/* taktcode.de — Tokens und Layout. Vertrag: DESIGN.md */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-wdth.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --paper: #f3f2ee;
  --paper-2: #e9e7e1;
  --ink: #15171c;
  --muted: #50555e;
  --rule: #cfcbc2;
  --signal: #d2401e;       /* nur Grafik/UI, nie Fließtext (4,17:1) */
  --signal-deep: #a8321a;  /* Text, Links, Button-Fläche (5,98:1) */
  --on-signal: #fff8f2;

  --font-sans: "Archivo", ui-sans-serif, sans-serif;
  --font-mono: "Plex Mono", ui-monospace, monospace;

  /* Skala ×1.333 ab 17px */
  --step-0: 1.0625rem;
  --step-1: 1.4167rem;
  --step-2: 1.8883rem;
  --step-3: clamp(2rem, 1.3rem + 2.6vw, 2.5171rem);
  --step-4: clamp(2.5rem, 1.4rem + 4.6vw, 4.4726rem);
  --mono-size: 0.8125rem;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-6: 3rem;
  --space-8: 4rem;
  --space-11: 5.5rem;
  --space-16: 8rem;

  --measure: 68ch;
  --max: 75rem;
  --radius: 4px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --press-scale: 0.98;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  font-stretch: 100%;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-stretch: 85%;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}
p { margin: 0; text-wrap: pretty; max-width: var(--measure); }

a { color: var(--signal-deep); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--signal-deep); outline-offset: 3px; border-radius: 2px; }

.skip-link {
  position: absolute; left: var(--space-2); top: -3rem;
  background: var(--ink); color: var(--paper); padding: var(--space-1) var(--space-2);
  border-radius: var(--radius); z-index: 10;
}
.skip-link:focus { top: var(--space-2); }

.mono {
  font-family: var(--font-mono);
  font-size: var(--mono-size);
  letter-spacing: 0.02em;
}

.wrap { width: min(100% - 2 * var(--space-3), var(--max)); margin-inline: auto; }

/* Kopf */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3);
  padding-block: var(--space-3);
}
.wordmark {
  font-stretch: 85%; font-weight: 700; font-size: var(--step-1); letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.wordmark:hover { text-decoration: none; }
.site-head .who { color: var(--muted); }
.site-head nav a { font-family: var(--font-mono); font-size: var(--mono-size); color: var(--ink); }

/* Hero */
.hero { padding-block: var(--space-11) var(--space-16); }
.hero .wrap {
  display: grid; column-gap: var(--space-8); row-gap: var(--space-8);
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: end;
}
.hero .diagram { grid-column: 1 / -1; justify-self: end; width: 100%; max-width: 52rem; }
.hero h1 { font-size: var(--step-4); }
.hero .lede { font-size: var(--step-1); line-height: 1.45; color: var(--ink); max-width: 30ch; }
.hero .actions { margin-top: var(--space-6); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; }
.hero .actions .mono { color: var(--muted); }

.button {
  display: inline-flex; align-items: center; gap: 0.5em;
  min-height: 3rem; padding: 0.75rem 1.25rem;
  background: var(--signal-deep); color: var(--on-signal);
  font-family: var(--font-sans); font-weight: 600; font-size: var(--step-0);
  border-radius: var(--radius); text-decoration: none;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}
.button:hover { text-decoration: none; }
.button:active { transform: scale(var(--press-scale)); }
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: #8f2914; }
}
.button[aria-disabled="true"] { background: var(--muted); pointer-events: none; }

/* Diagramm */
.diagram { margin: 0; }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram .d-mobile { display: none; }
.diagram figcaption { margin-top: var(--space-2); color: var(--muted); }
.d-mobile .dg-label, .d-mobile .dg-ist text, .d-mobile .dg-takt text, .d-mobile .dg-free text { font-size: 12px; }
.d-mobile .dg-axis { font-size: 11px; }

.dg-grid { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 4; }
.dg-clock { fill: none; stroke: var(--signal); stroke-width: 2; stroke-linejoin: miter; }
.dg-label { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); letter-spacing: 0.04em; }
.dg-axis { font-family: var(--font-mono); font-size: 10px; fill: var(--muted); }
.dg-ist rect { fill: var(--paper-2); stroke: var(--ink); stroke-width: 1; }
.dg-ist text, .dg-takt text { font-family: var(--font-mono); font-size: 11px; }
.dg-ist text { fill: var(--ink); }
.dg-wait { stroke: var(--signal); stroke-width: 1.5; stroke-dasharray: 3 3; }
.dg-wait-label { font-family: var(--font-mono); font-size: 10px; fill: var(--signal-deep); }
.dg-takt rect { fill: var(--ink); }
.dg-takt text { fill: var(--paper); }
.dg-free rect { fill: none; stroke: var(--rule); stroke-width: 1; stroke-dasharray: 4 3; }
.dg-free text { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }

/* Einrasten: die Takt-Blöcke kommen von ihrer Ist-Position ins Raster */
.dg-takt g { transform-box: view-box; }
@media (prefers-reduced-motion: no-preference) {
  .js .dg-takt g {
    animation: snap 900ms var(--ease-out) both;
    animation-delay: calc(300ms + var(--i) * 60ms);
  }
  .js .dg-free g {
    animation: fade 600ms var(--ease-out) both;
    animation-delay: 900ms;
  }
}
@keyframes snap {
  from { transform: translate(var(--dx), -46px); opacity: 0.25; }
  to   { transform: translate(0, 0); opacity: 1; }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Spuren (Leistungen) */
.section { padding-block: var(--space-11); border-top: 1px solid var(--rule); }
.section-head { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: var(--space-4); align-items: baseline; }
.section-head h2 { font-size: var(--step-3); grid-column: 2; }
.section-head .mono { color: var(--muted); }

.lanes { list-style: none; margin: var(--space-8) 0 0; padding: 0; }
.lane {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 4fr);
  gap: var(--space-4);
  padding-block: var(--space-6);
  border-top: 1px solid var(--rule);
  position: relative;
}
.lane:last-child { border-bottom: 1px solid var(--rule); }
.lane h3 { font-size: var(--step-2); }
.lane .tag { display: block; margin-bottom: var(--space-1); color: var(--muted); }
.lane p { color: var(--ink); }
.lane .out { margin: 0; padding: 0; list-style: none; }
.lane .out li { font-family: var(--font-mono); font-size: var(--mono-size); padding-block: 0.35rem; border-bottom: 1px dashed var(--rule); }
.lane .out li:last-child { border-bottom: 0; }
.lane .out-label { color: var(--muted); margin-bottom: var(--space-1); }

@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); transition-delay: calc(var(--i, 0) * 60ms); }
  .js .reveal.is-in { opacity: 1; transform: none; }
}

/* Taktleiste (Zusammenarbeit) */
.beats { list-style: none; margin: var(--space-8) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.beat { padding: var(--space-3) var(--space-3) 0 0; border-left: 1px solid var(--ink); padding-left: var(--space-3); position: relative; }
.beat:first-child { border-left-color: var(--signal); border-left-width: 2px; }
.beat .mono { color: var(--muted); display: block; }
.beat h3 { font-size: var(--step-1); margin-top: var(--space-1); }
.beat p { margin-top: var(--space-2); font-size: 1rem; color: var(--ink); }

/* Kontakt */
.contact { padding-block: var(--space-16); border-top: 1px solid var(--rule); }
.contact h2 { font-size: var(--step-4); max-width: 16ch; }
.contact p { margin-top: var(--space-3); font-size: var(--step-1); line-height: 1.45; max-width: 40ch; }
.contact .mail {
  display: inline-block; margin-top: var(--space-6);
  font-stretch: 85%; font-weight: 700; font-size: var(--step-3); letter-spacing: -0.01em;
  word-break: break-word;
}
.contact .fine { margin-top: var(--space-3); color: var(--muted); font-size: var(--mono-size); }

/* Fuß */
.site-foot { border-top: 1px solid var(--rule); padding-block: var(--space-4) var(--space-6); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); justify-content: space-between; color: var(--muted); }
.site-foot nav { display: flex; gap: var(--space-3); }
.site-foot a { color: var(--ink); font-family: var(--font-mono); font-size: var(--mono-size); }

/* Rechtstexte */
.legal { padding-block: var(--space-8) var(--space-16); }
.legal h1 { font-size: var(--step-3); }
.legal h2 { font-size: var(--step-1); margin-top: var(--space-6); }
.legal p, .legal ul { margin-top: var(--space-2); max-width: var(--measure); }
.legal address { font-style: normal; margin-top: var(--space-2); }
.placeholder { background: #fbe3dc; color: var(--signal-deep); padding: 0 0.25em; border-radius: 2px; }

/* Responsiv */
@media (max-width: 960px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero .lede { max-width: 36ch; }
  .lane { grid-template-columns: 1fr; gap: var(--space-2); }
  .section-head { grid-template-columns: 1fr; gap: var(--space-1); }
  .section-head h2 { grid-column: 1; }
  .beats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-6); }
}
@media (max-width: 640px) {
  .hero { padding-block: var(--space-8) var(--space-11); }
  .diagram .d-desktop { display: none; }
  .diagram .d-mobile { display: block; }
  .beats { grid-template-columns: 1fr; }
  .site-head .who { display: none; }
  .contact { padding-block: var(--space-11); }
}

/* Staffel- und Versatzwerte ohne Inline-Styles (CSP style-src 'self') */
.dg-takt g:nth-child(1) { --i: 0; }
.dg-takt g:nth-child(2) { --i: 1; }
.dg-takt g:nth-child(3) { --i: 2; }
.dg-takt g:nth-child(4) { --i: 3; }
.d-desktop .dg-takt g:nth-child(1) { --dx: -2px; }
.d-desktop .dg-takt g:nth-child(2) { --dx: 26px; }
.d-desktop .dg-takt g:nth-child(3) { --dx: 150px; }
.d-desktop .dg-takt g:nth-child(4) { --dx: 266px; }
.d-mobile .dg-takt g:nth-child(1) { --dx: -2px; }
.d-mobile .dg-takt g:nth-child(2) { --dx: 2px; }
.d-mobile .dg-takt g:nth-child(3) { --dx: 70px; }
.reveal:nth-child(2) { --i: 1; }
.reveal:nth-child(3) { --i: 2; }
.reveal:nth-child(4) { --i: 3; }

.noscript-hero { padding: var(--space-16) var(--space-3); color: #f3f2ee; font-size: var(--step-2); max-width: 30ch; margin: 0 auto; }
.wordmark img { display: block; height: 28px; width: auto; }
