/* MODULWERK — „Website in Aufbau": Montage-Bühne auf warmem Graphit.
   Tokens aus src/index.css, Handschrift aus Intro/Kicker/RasterFeld.
   Das Entrée läuft rein in CSS (animation-delay + fill-mode both); JS
   übernimmt nur Decode, Canvas, Magnet, Glow und Modul-Zeile. */

/* ---- Schriften (self-hosted, Namen werden vom Build gehasht) ---------- */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/space-grotesk-latin-700-normal-35f8aec5.woff2) format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/space-grotesk-latin-500-normal-1b1a8131.woff2) format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/inter-latin-400-normal-8909904a.woff2) format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/ibm-plex-mono-latin-400-normal-08949f72.woff2) format('woff2');
}

/* ---- Tokens ----------------------------------------------------------- */
:root {
  --bg: #14130f;
  --graphite-900: #1b1a16;
  --ink: #ece8df;
  --ink-300: #b8b2a5;
  --ink-500: #837e71;
  --brass-300: #dcbe7a;
  --brass-400: #cba85e;
  --brass-500: #b08d46;
  --steel-400: #7d9bb0;
  --haarlinie: rgba(236, 232, 223, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --rand: 20px;
  --klammer: 24px; /* Kantenlänge der Eck-Klammern */
  --klammer-rand: 16px; /* Abstand der Klammern zum Dokumentrand */
  --rand-y: 48px; /* hält den Inhalt oben frei von den Klammern (16 + 24 + 8 px) */
  --leiste: 44px;
  /* Unten: HUD-Leiste + Klammer-Rand + Klammer + Luft, damit auch auf dem
     Handy (Seite scrollt) kein Text je eine Klammer berührt */
  --fuss: calc(var(--leiste) + var(--klammer-rand) + var(--klammer) + 16px);
}
@media (min-width: 640px) {
  :root {
    --rand: 40px;
  }
}

/* ---- Grund ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  /* Reveal-Versätze dürfen nie horizontales Scrollen erzeugen */
  overflow-x: hidden;
  overflow-x: clip;
}
html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  /* Bezugsrahmen des Messrahmens: er spannt sich über das ganze Dokument,
     nicht über den Viewport — sonst scrollt Text auf dem Handy in die
     unteren Klammern hinein */
  position: relative;
  min-height: 100svh;
}
::selection {
  background: var(--brass-500);
  color: var(--bg);
}
:focus-visible {
  outline: 2px solid var(--brass-400);
  outline-offset: 3px;
  border-radius: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Hintergrund-Ebenen (alle fixed, hinter dem Inhalt) --------------- */
.raster,
.glow,
.korn,
.vignette {
  position: fixed;
  pointer-events: none;
}
.raster {
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.glow {
  left: 0;
  top: 0;
  width: 600px;
  height: 600px;
  margin: -300px 0 0 -300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(203, 168, 94, 0.14), transparent 60%);
  opacity: 0;
  transition: opacity 0.6s var(--ease);
  will-change: transform;
  z-index: 1;
}
.glow.an {
  opacity: 1;
}
/* Korn: statische feTurbulence-Textur als data:-URI (img-src data: erlaubt).
   Bewusst mix-blend-mode normal — overlay ist auf dem dunklen Graphit
   messbar wirkungslos. feComponentTransfer hebt den Kontrast des Rauschens
   und senkt seine Grundhelligkeit, damit die Bühne nicht grau wird. */
.korn {
  inset: 0;
  z-index: 2;
  opacity: 0.05;
  mix-blend-mode: normal;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='k'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncR type='linear' slope='1.6' intercept='-0.4'/%3E%3CfeFuncG type='linear' slope='1.6' intercept='-0.4'/%3E%3CfeFuncB type='linear' slope='1.6' intercept='-0.4'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23k)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
}
.vignette {
  inset: 0;
  z-index: 3;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
}

/* Messrahmen: vier Eck-Klammern, 24 px, Ink 20 % — absolut über das ganze
   Dokument (body ist der Bezug), die unteren am Dokumentende oberhalb der
   fixen HUD-Leiste. Der Build misst, dass keine Klammer Text schneidet. */
.messrahmen {
  position: absolute;
  pointer-events: none;
  inset: var(--klammer-rand) var(--klammer-rand) calc(var(--leiste) + var(--klammer-rand)) var(--klammer-rand);
  z-index: 5;
  animation: rahmen 0.6s var(--ease) both;
}
.ecke {
  position: absolute;
  width: var(--klammer);
  height: var(--klammer);
  border: 0 solid rgba(236, 232, 223, 0.2);
}
.ecke-ol { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.ecke-or { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.ecke-ul { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.ecke-ur { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* ---- Layout ----------------------------------------------------------- */
main {
  position: relative;
  z-index: 10;
  min-height: 100svh;
  width: 100%;
  max-width: 88rem;
  margin-inline: auto;
  padding: var(--rand-y) var(--rand) var(--fuss);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 32px;
}

/* HUD-Kopf */
.hud-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 32px;
  min-height: 32px;
}
.marke {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.zeichen {
  width: 32px;
  height: 32px;
  overflow: visible;
  flex: none;
}
.zeichen .q1 {
  stroke: var(--brass-400);
}
.zeichen .q2 {
  stroke: var(--ink);
}
.zeichen rect {
  transform-box: fill-box;
  transform-origin: center;
}
.zeichen .q1 {
  animation: fuegen-links 0.65s var(--ease) 0.1s both;
}
.zeichen .q2 {
  animation: fuegen-rechts 0.65s var(--ease) 0.22s both;
}
.wortmarke-maske {
  display: inline-block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}
.wortmarke {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  text-transform: lowercase;
  color: var(--ink);
  animation: steigen 0.55s var(--ease) 0.55s both;
}

/* Kicker (Mono-HUD) */
.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: lowercase;
  color: var(--ink-500);
  animation: einblenden 0.4s var(--ease) 0.5s both;
}
.kicker-status {
  color: var(--ink-300);
}
/* Die animierte Spanne bleibt unsichtbar, bis das Modul html.js gesetzt hat
   (seine allererste Anweisung) — sonst blitzt bei spätem JS der Endtext auf,
   bevor der Decode ihn verschlüsselt. Ohne JS: <noscript> im Head. Der
   Endtext steht daneben immer als sr-only im Markup. */
.decode {
  visibility: hidden;
}
html.js .decode {
  visibility: visible;
}
.kicker .quadrat {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  background: var(--brass-400);
  transition: transform 0.4s var(--ease);
}
.kicker .quadrat.gedockt {
  transform: rotate(90deg);
}

/* Hauptblock */
.haupt {
  align-self: center;
}
h1 {
  margin-top: 28px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.75rem, 11vw, 9.5rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
  text-transform: lowercase;
  color: var(--ink);
}
h1 .zeile {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}
h1 .wort {
  display: inline-block;
  animation: steigen 0.9s var(--ease) 0.7s both;
}
h1 .zeile:nth-child(2) .wort {
  animation-delay: 0.9s;
}
h1 .akzent {
  color: var(--brass-400);
}
.absatz {
  margin-top: 32px;
  max-width: 36rem;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink-300);
  animation: fade-up 0.6s var(--ease) 1.3s both;
}
@media (min-width: 640px) {
  .absatz {
    font-size: 1.125rem;
  }
}

/* CTA mit vier Eck-Klammern und Messing-Füllung */
.cta-zeile {
  margin-top: 36px;
  animation: fade-up 0.6s var(--ease) 1.45s both;
}
.magnet {
  display: inline-block;
  will-change: transform;
}
.cta {
  position: relative;
  display: inline-block;
  padding: 16px 30px;
  border: 1px solid var(--brass-500);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease);
}
.cta-fuellung {
  position: absolute;
  inset: 0;
  background: var(--brass-400);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.45s var(--ease);
}
.cta-text {
  position: relative;
}
.cta-ecke {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 0 solid var(--brass-400);
  transition: transform 0.35s var(--ease);
}
.cta-ol { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.cta-or { top: -1px; right: -1px; border-top-width: 1px; border-right-width: 1px; }
.cta-ul { bottom: -1px; left: -1px; border-bottom-width: 1px; border-left-width: 1px; }
.cta-ur { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }
.cta:hover,
.cta:focus-visible {
  color: var(--bg);
  border-color: var(--brass-400);
}
.cta:hover .cta-fuellung,
.cta:focus-visible .cta-fuellung {
  transform: scaleY(1);
}
.cta:hover .cta-ol, .cta:focus-visible .cta-ol { transform: translate(-5px, -5px); }
.cta:hover .cta-or, .cta:focus-visible .cta-or { transform: translate(5px, -5px); }
.cta:hover .cta-ul, .cta:focus-visible .cta-ul { transform: translate(-5px, 5px); }
.cta:hover .cta-ur, .cta:focus-visible .cta-ur { transform: translate(5px, 5px); }

/* Mono-Zeile unter dem CTA */
.takt {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: var(--ink-500);
  animation: fade-up 0.6s var(--ease) 1.45s both;
}
.punkt {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--brass-500);
}
/* Schmale Handys: drei ruhige Zeilen statt Quadraten am Zeilenende */
@media (max-width: 479px) {
  .takt {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .takt .punkt {
    display: none;
  }
}

/* Modul-Zeile */
.module {
  margin-top: 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  animation: einblenden 0.5s var(--ease) 1.6s both;
}
.modul-reihe {
  display: inline-flex;
  gap: 6px;
}
.modul {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(236, 232, 223, 0.22);
  background: transparent;
  transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.modul.voll {
  background: var(--brass-400);
  border-color: var(--brass-400);
}
.modul-label,
.slogan {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: lowercase;
  color: var(--ink-500);
}
.slogan {
  margin-top: 14px;
  animation: einblenden 0.5s var(--ease) 1.8s both;
}

/* ---- HUD-Leiste (fixed unten) ---------------------------------------- */
.hud-leiste {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 20;
  height: var(--leiste);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-inline: var(--rand);
  border-top: 1px solid var(--haarlinie);
  background: rgba(20, 19, 15, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: leiste 0.5s var(--ease) 1.5s both;
}
.hud-leiste p {
  white-space: nowrap;
}
.hud-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
}
.hud-leistung {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.hud-quadrat {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--brass-400);
}
.hud-mitte,
.hud-rechts {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: lowercase;
  color: var(--ink-500);
}
.hud-mitte,
.hud-ort {
  display: none;
}
@media (max-width: 479px) {
  .hud-leistung {
    display: none;
  }
}
@media (max-width: 639px) {
  .hud-mitte,
  .hud-rechts {
    letter-spacing: 0.16em;
  }
}
@media (min-width: 640px) {
  .hud-mitte,
  .hud-ort {
    display: inline;
  }
}

/* Kurze Viewports (Laptop 1366×768): alles bleibt auf einem Schirm */
@media (max-height: 820px) and (min-width: 640px) {
  :root {
    --rand-y: 44px;
  }
  main {
    gap: 20px;
  }
  h1 {
    margin-top: 20px;
    font-size: clamp(3.75rem, 9vw, 8rem);
  }
  .absatz {
    margin-top: 22px;
    font-size: 1.0625rem;
    line-height: 1.55;
  }
  .cta-zeile {
    margin-top: 26px;
  }
  .takt {
    margin-top: 16px;
  }
  .module {
    margin-top: 24px;
  }
  .slogan {
    margin-top: 10px;
  }
}

/* ---- Keyframes -------------------------------------------------------- */
@keyframes rahmen {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}
@keyframes fuegen-links {
  from { opacity: 0; transform: translateX(-48px) rotate(-8deg); }
  to { opacity: 1; transform: none; }
}
@keyframes fuegen-rechts {
  from { opacity: 0; transform: translateX(48px) rotate(8deg); }
  to { opacity: 1; transform: none; }
}
@keyframes steigen {
  from { transform: translateY(108%); }
  to { transform: none; }
}
@keyframes einblenden {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes leiste {
  from { transform: translateY(100%); }
  to { transform: none; }
}

/* ---- Reduzierte Bewegung: Endzustände sofort, nichts läuft ----------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
  .glow {
    display: none;
  }
}
