/* Die neue Typographie - Modern CSS Implementation */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');

:root {
  /* Tschichold's color palette */
  --ink-black: #000000;
  --paper-white: #FAFAF8;
  --revolutionary-red: #E30613;
  --industrial-gray: #4A4A4A;
  
  /* Typography scale based on geometric progression */
  --type-scale-ratio: 1.414;
  --type-base: clamp(1rem, 1vw + 0.875rem, 1.125rem);
  --type-small: calc(var(--type-base) / var(--type-scale-ratio));
  --type-large: calc(var(--type-base) * var(--type-scale-ratio));
  --type-xlarge: calc(var(--type-large) * var(--type-scale-ratio));
  --type-xxlarge: calc(var(--type-xlarge) * var(--type-scale-ratio));
  --type-display: clamp(3rem, 8vw + 1rem, 8rem);
  
  /* Grid system */
  --grid-unit: 8px;
  --column-width: calc(var(--grid-unit) * 12);
  --gutter: calc(var(--grid-unit) * 3);
  
  /* Dynamic spacing */
  --space-xs: calc(var(--grid-unit) * 1);
  --space-s: calc(var(--grid-unit) * 2);
  --space-m: calc(var(--grid-unit) * 4);
  --space-l: calc(var(--grid-unit) * 8);
  --space-xl: calc(var(--grid-unit) * 16);
}

/* Reset with intentionality */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', 'Helvetica Neue', sans-serif;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ink-black);
  background-color: var(--paper-white);
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

/* Grid system container */
.grid-system {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0;
}

/* Header - Asymmetric composition */
.manifesto {
  position: relative;
  padding: var(--space-xl) var(--space-l);
  min-height: 100vh;
  display: grid;
  align-content: center;
  background: linear-gradient(90deg, var(--paper-white) 0%, var(--paper-white) 75%, var(--revolutionary-red) 75%);
}

.red-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--space-m);
  height: 100%;
  background: var(--revolutionary-red);
}

.primary-statement {
  font-size: var(--type-display);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-m);
}

.neue {
  display: block;
  font-weight: 300;
  font-size: 0.4em;
  letter-spacing: 0.2em;
  margin-bottom: var(--space-xs);
}

.typographie {
  display: block;
  text-transform: uppercase;
}

.subtitle {
  font-size: var(--type-large);
  font-weight: 300;
  max-width: 40ch;
  color: var(--industrial-gray);
}

/* Principles section */
.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gutter);
  padding: var(--space-xl) var(--space-l);
  background: var(--ink-black);
}

.principle-card {
  position: relative;
  padding: var(--space-l);
  background: var(--paper-white);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.principle-card:hover {
  transform: translateX(var(--space-s));
}

.principle-card .number {
  position: absolute;
  top: var(--space-m);
  right: var(--space-m);
  font-size: var(--type-xxlarge);
  font-weight: 900;
  color: var(--revolutionary-red);
  opacity: 0.2;
}

.principle-card h2 {
  font-size: var(--type-xlarge);
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-m);
}

.principle-card p {
  font-size: var(--type-base);
  line-height: 1.6;
}

/* Typography specimens */
.typography-specimens {
  padding: var(--space-xl) var(--space-l);
  background: var(--paper-white);
}

.specimen-header {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  margin-bottom: var(--space-xl);
}

.specimen-header h2 {
  font-size: var(--type-xlarge);
  font-weight: 900;
  letter-spacing: 0.2em;
}

.rule {
  flex: 1;
  height: 4px;
  background: var(--ink-black);
}

.specimen {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-l);
  margin-bottom: var(--space-xl);
  padding: var(--space-l);
  border: 2px solid var(--ink-black);
}

.type-sample {
  font-size: 120px;
  line-height: 1;
  font-weight: 400;
}

.grotesque .type-sample {
  font-family: 'Helvetica Neue', sans-serif;
}

.futura .type-sample {
  font-family: 'Futura', 'Century Gothic', sans-serif;
  font-weight: 500;
}

.type-info h3 {
  font-size: var(--type-large);
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-s);
}

.type-info p {
  font-size: var(--type-base);
  color: var(--industrial-gray);
  margin-bottom: var(--space-m);
}

.alphabet {
  font-size: var(--type-small);
  line-height: 1.8;
  letter-spacing: 0.05em;
  font-family: inherit;
}

/* Tschichold Quote */
.tschichold-quote {
  padding: var(--space-xl) var(--space-l);
  background: var(--revolutionary-red);
  color: var(--paper-white);
  text-align: center;
}

.tschichold-quote blockquote {
  max-width: 60ch;
  margin: 0 auto;
}

.tschichold-quote p {
  font-size: var(--type-xxlarge);
  font-weight: 300;
  line-height: 1.2;
  margin-bottom: var(--space-m);
}

.tschichold-quote cite {
  font-size: var(--type-base);
  font-style: normal;
  opacity: 0.8;
}

/* Modern Application */
.modern-application {
  padding: var(--space-xl) var(--space-l);
  background: var(--paper-white);
}

.section-title {
  font-size: var(--type-xlarge);
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-l);
  position: relative;
  padding-left: var(--space-l);
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: var(--space-m);
  height: 100%;
  background: var(--revolutionary-red);
}

.technique-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gutter);
}

.technique {
  padding: var(--space-l);
  background: var(--ink-black);
  color: var(--paper-white);
}

.technique h3 {
  font-size: var(--type-large);
  font-weight: 700;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-m);
}

.technique p {
  font-size: var(--type-base);
  margin-bottom: var(--space-m);
}

.technique code {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: var(--type-small);
  background: rgba(255, 255, 255, 0.1);
  padding: var(--space-s);
  border-left: 3px solid var(--revolutionary-red);
}

/* Variable font demonstration */
.variable-demo {
  font-variation-settings: "wght" 400;
  transition: font-variation-settings 0.3s ease;
}

.technique:hover .variable-demo {
  font-variation-settings: "wght" 700;
}

/* Interactive Laboratory */
.interactive-lab {
  padding: var(--space-xl) var(--space-l);
  background: var(--industrial-gray);
  color: var(--paper-white);
}

.interactive-lab h2 {
  font-size: var(--type-xlarge);
  font-weight: 900;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-l);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-m);
  margin-bottom: var(--space-xl);
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
}

.controls span {
  font-size: var(--type-small);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

.controls input[type="range"] {
  -webkit-appearance: none;
  height: 4px;
  background: var(--paper-white);
  outline: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.controls input[type="range"]:hover {
  opacity: 1;
}

.controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--revolutionary-red);
  cursor: pointer;
  border-radius: 0;
}

.controls input[type="range"]::-moz-range-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--revolutionary-red);
  cursor: pointer;
  border-radius: 0;
  border: none;
}

.specimen-text {
  font-size: 48px;
  line-height: 1.2;
  text-align: center;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
  transition: all 0.2s ease;
}

/* Manifesto text columns */
.manifesto-text {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gutter);
  padding: var(--space-xl) var(--space-l);
  background: var(--paper-white);
}

.manifesto-text h3 {
  font-size: var(--type-large);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-m);
  color: var(--revolutionary-red);
}

.manifesto-text p {
  font-size: var(--type-base);
  line-height: 1.7;
  text-align: justify;
  hyphens: auto;
}

/* Colophon */
.colophon {
  position: relative;
  padding: var(--space-l);
  background: var(--ink-black);
  color: var(--paper-white);
  text-align: center;
}

.colophon p {
  font-size: var(--type-small);
  opacity: 0.8;
  margin-bottom: var(--space-xs);
}

.colophon .red-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--space-xs);
  background: var(--revolutionary-red);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .manifesto {
    background: var(--paper-white);
    min-height: auto;
    padding: var(--space-l) var(--space-m);
  }
  
  .primary-statement {
    font-size: clamp(2.5rem, 10vw, 4rem);
  }
  
  .principles {
    grid-template-columns: 1fr;
  }
  
  .specimen {
    grid-template-columns: 1fr;
  }
  
  .type-sample {
    font-size: 80px;
    text-align: center;
  }
  
  .manifesto-text {
    grid-template-columns: 1fr;
  }
}

/* Print styles */
@media print {
  .interactive-lab,
  .controls {
    display: none;
  }
  
  body {
    color: var(--ink-black);
    background: white;
  }
  
  .red-bar,
  .revolutionary-red {
    color: black !important;
    background: black !important;
  }
}