/* kopf.css — S.A.S Automobile (Autohaus 17) · Kopf (Head) aller Nav-Seiten
   WEB-CREW Schritt 4 · @hero-engineer · 04.10.2026
   Quelle: bau-brief §5 Zeile 0/0b, §2.1 (themenfeste Tokens), §2.5 (Motion), §6 (Bühnenkopf)
   Regeln: GESETZ Kap. 5 (Video ganz oben, Text unten links, EIN CTA, keine Rufnummer im Kopf,
   kein poster, < 900 px eigenes Bildband, Kontaktleiste 0 px bündig) · Kap. 11 (themenfeste
   Bühne über die Tokens, Schatten nur als Verlauf an der Textecke — Video nie flächig abgedunkelt).

   Vertrag mit Schritt 6 (@web-designer):
   - Reihenfolge der Stylesheets: fonts.css → tokens.css → rahmen.css → kopf.css (alle mit ?v=).
   - Ab 900 px liegt die Kopfleiste (.nav.nav--ueber-video) TRANSPARENT über dem Video.
     Der Kopf beginnt bei top 0 — KEIN padding-top auf body/main.
     Video + Kontaktleiste füllen genau EINEN Bildschirm: (100svh − 64px) + 64px.
   - Unter 900 px: Kopfleiste deckend (Override unten), Kopf rückt um --kopf-h nach unten,
     Bildband 16:9, Text mittig darunter auf dem Seitengrund (folgt dem Thema).
   - Text-Reveal läuft per CSS (keine GSAP-Abhängigkeit), nur bei prefers-reduced-motion:
     no-preference. Das Video selbst wird nie animiert, nie pausiert (GESETZ Kap. 5). */

/* ── 1 · Bühne ─────────────────────────────────────────────────────────── */
:where(:root) {
  --kontaktleiste-h: 64px;
}

/* Ab 900 px liegt der Text ÜBER dem Video → themenfeste Bühne (GESETZ Kap. 11):
   die Text-Tokens werden auf *-fest umdefiniert — kein Hell/Dunkel-Schalter
   kann die Schrift über dem Video kippen. Unter 900 px steht der Text auf dem
   Seitengrund und folgt dem Thema (Abschnitt 7). */
@media (min-width: 900px) {
  .kopf {
    --text: var(--kalk-fest);
    --meta: var(--meta-fest);
    /* Über dem hellen Video trägt das rote Zettel-Band den Akzent, das Wort bleibt
       kalk-fest: rot-fest als Schrift erreichte auf dem Pflaster (Luma ~175, s 14)
       nur 1,2:1 — gemessen 04.10.2026, Abweichung zu bau-brief §5 Z. 0 notiert. */
    --kopf-akzent: var(--kalk-fest);
  }
}

.kopf {
  --kopf-ease: cubic-bezier(0.16, 1, 0.3, 1);

  position: relative;
  isolation: isolate;
  height: calc(100svh - var(--kontaktleiste-h));
  min-height: 560px;
  overflow: hidden;
  background: var(--dunkel-fest);
  color: var(--text);
}

/* Medienfläche: trägt selbst den dunklen Grundton (kein helles Loch bis Frame 1). */
.kopf__buehne {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--dunkel-fest);
}
.kopf__video,
.kopf__bild {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--kopf-fokus, 50% 50%);
  background: var(--dunkel-fest);
}

/* Kopfleiste über dem Kopf (≥ 900 px): KEIN dunkler Verlauf oben. Himmel und Bühnenbilder
   sind oben hell — die Leisten-Schrift folgt ihrem echten Untergrund (GESETZ Kap. 11) und ist
   darum dunkel und themenfest. Dahinter eine helle Glas-Leiste (Glas-Karte hinter dem Text,
   Kap. 11): sie hält die Schrift auch über dunklen Bildteilen (Hebebühnen-Säulen, Türrahmen)
   lesbar und dunkelt das Video nie ab. (Überschreibt rahmen.css .nav--ueber-video.) */
@media (min-width: 900px) {
  .nav--ueber-video:not(.ist-gescrollt) {
    color: var(--dunkel-fest);
    background: rgb(247 248 251 / 0.62);
    border-bottom-color: rgb(247 248 251 / 0.5);
    -webkit-backdrop-filter: blur(14px) saturate(1.25);
    backdrop-filter: blur(14px) saturate(1.25);
  }
  .nav--ueber-video:not(.ist-gescrollt) .marke b {
    color: var(--rot);
  }
  .nav--ueber-video:not(.ist-gescrollt) .nav__merk,
  .nav--ueber-video:not(.ist-gescrollt) .nav__schalter,
  .nav--ueber-video:not(.ist-gescrollt) .nav__burger {
    border-color: rgb(14 20 40 / 0.32);
  }
  .nav--ueber-video:not(.ist-gescrollt) .nav__cta {
    background: var(--navy-fest);
    border-color: var(--navy-fest);
    color: var(--kalk-fest);
  }
  .nav--ueber-video:not(.ist-gescrollt) :focus-visible {
    outline-color: var(--dunkel-fest);
  }
}

/* Verlauf NUR an der Textecke unten links (GESETZ Kap. 11, Hamada 29.09.2026).
   Das Pflaster im Video ist hell (Luma ~150–175) — darum trägt die Ecke selbst
   genug Deckung für Fließtext, und läuft zur Bildmitte hin auf 0 aus. */
.kopf__schatten {
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(72%, 1060px);
  height: 76%;
  z-index: -1;
  pointer-events: none;
  /* Deckung je Kopf einstellbar (helle Bühnen brauchen mehr), Form bleibt gleich. */
  background: radial-gradient(
    118% 100% at 0% 100%,
    rgb(14 20 40 / var(--s0, 0.82)) 0%,
    rgb(14 20 40 / var(--s1, 0.74)) 34%,
    rgb(14 20 40 / var(--s2, 0.44)) 58%,
    rgb(14 20 40 / 0) 80%
  );
}

/* ── 2 · Textblock unten links ─────────────────────────────────────────── */
.kopf__text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 88rem;
  margin-inline: auto;
  padding: 0 var(--rand) clamp(2.25rem, 6.5vh, 4.75rem);
  text-shadow: 0 1px 2px rgb(14 20 40 / 0.4);
}
.kopf__text > * {
  max-width: 44rem;
}

.kopf__h1 {
  margin: 0;
  font-family: var(--disp);
  color: var(--text);
}
.kopf__z1 {
  display: block;
  font-stretch: 112%;
  font-weight: 700;
  font-size: clamp(1.05rem, 0.9rem + 0.5vw, 1.4rem);
  line-height: 1.25;
  letter-spacing: 0;
  color: var(--text);
}
.kopf__pointe {
  display: block;
  margin-top: 0.45rem;
  font-stretch: 112%;
  font-weight: 800;
  font-size: clamp(2.2rem, 1.1rem + 3vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.kopf__akzent {
  position: relative;
  color: var(--kopf-akzent);
}
/* Das Zettel-Band (Device A „Der Scheibenzettel"): 6-px-Streifen in Kennzeichen-Rot
   unter dem Akzentwort — im Reveal fährt es von links ein. */
.kopf__akzent::after {
  content: "";
  position: absolute;
  left: 0.04em;
  right: 0.04em;
  bottom: 0.04em;
  height: max(4px, 0.1em); /* 6 px bei 3,4rem — skaliert, damit das Band am Handy die Glyphen nicht berührt */
  border-radius: 1px;
  background: var(--rot);
  transform-origin: 0 50%;
}

.kopf__beweis {
  margin: clamp(0.9rem, 2vh, 1.3rem) 0 0;
  font-family: var(--body);
  font-weight: 400;
  font-size: clamp(1.06rem, 0.98rem + 0.3vw, 1.25rem);
  line-height: 1.55;
  color: var(--text);
  max-width: 40rem;
}

/* Der EINE CTA im Kopf (bau-brief §5 Z. 0): Fläche kalk-fest, Schrift navy-fest 12,1:1 */
.kopf__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 52px;
  margin-top: clamp(1.25rem, 3vh, 2rem);
  padding: 0.85rem 1.45rem;
  border: 1px solid var(--kalk-fest);
  border-radius: var(--radius);
  background: var(--kalk-fest);
  color: var(--navy-fest);
  font-family: var(--body);
  font-weight: 700;
  font-size: 1.02rem;
  line-height: 1.2;
  text-decoration: none;
  text-shadow: none;
  transition:
    background 180ms var(--ease),
    color 180ms var(--ease),
    border-color 180ms var(--ease);
}
.kopf__cta svg {
  width: 18px;
  height: 18px;
  flex: none;
  transition: transform 180ms var(--ease);
}
.kopf__cta:hover {
  background: var(--navy-fest);
  border-color: var(--navy-fest);
  color: var(--kalk-fest);
}
.kopf__cta:hover svg {
  transform: translateX(3px);
}
.kopf__cta:focus-visible {
  outline: 2px solid var(--kalk-fest);
  outline-offset: 3px;
}

/* Wort-Masken für den Reveal: jedes Wort hat seine eigene Maske — sicher bei
   jedem Zeilenumbruch. Luft unten für Unterlängen und das Zettel-Band. */
.kopf .m {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding: 0.04em 0.02em 0.16em;
  margin: -0.04em -0.02em -0.16em;
}
.kopf .w {
  display: inline-block;
}

/* ── 3 · Kontaktleiste — bündig an der Video-Unterkante, 0 px Lücke ───── */
.kontaktleiste {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  justify-content: start;
  align-items: stretch;
  height: var(--kontaktleiste-h, 64px);
  margin: 0;
  padding: 0 22rem 0 var(--rand); /* rechts frei für die feste Ecke Anrufen/WhatsApp */
  background: var(--navy-fest);
  color: var(--kalk-fest);
  font-family: var(--body);
  font-size: 0.97rem;
  line-height: 1.2;
}
.kontaktleiste__punkt {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  padding: 0 1.35rem;
  color: var(--kalk-fest);
  text-decoration: none;
  white-space: nowrap;
  border-left: 1px solid rgb(247 248 251 / 0.16);
}
.kontaktleiste__punkt:first-child {
  border-left: 0;
  padding-left: 0;
}
.kontaktleiste__punkt b {
  font-weight: 700;
}
.kontaktleiste__punkt span {
  color: var(--meta-fest);
}
.kontaktleiste__punkt .immer::before {
  content: "· ";
}
a.kontaktleiste__punkt:hover b {
  text-decoration: underline;
  text-underline-offset: 3px;
}
a.kontaktleiste__punkt:focus-visible {
  outline: 2px solid var(--kalk-fest);
  outline-offset: -6px;
}
.kontaktleiste svg {
  flex: none;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (max-width: 1180px) {
  /* Unter 1181 px wird die Leiste nicht mehr rechts freigehalten — die feste Ecke
     hebt sich stattdessen über die Leiste, solange sie im Bild ist (§6). */
  .kontaktleiste { padding-right: var(--rand); }
  .kontaktleiste__punkt { padding: 0 0.95rem; }
  .kontaktleiste__punkt span:not(.immer) { display: none; }
}

/* ── 4 · Unterseiten-Köpfe (Video 10 s / Bühnenbild) ───────────────────── */
/* Gleiche Bühne, gleiche Höhe, ohne Kontaktleiste; der Sektions-Rhythmus
   beginnt direkt darunter. Bühnenbild: volles Bild, KEIN Zoom/Ken-Burns. */
.kopf--sub .kopf__pointe {
  font-size: clamp(2rem, 1.05rem + 2.6vw, 3.1rem);
}
.kopf--sub .kopf__beweis {
  max-width: 38rem;
}

/* Bildausschnitt je Bühnenkopf (Motiv bleibt neben dem Textblock) */
.kopf[data-kopf="ankauf"] { --kopf-fokus: 70% 55%; }
.kopf[data-kopf="service"] { --kopf-fokus: 62% 40%; }
.kopf[data-kopf="finanzierung"] { --kopf-fokus: 70% 50%; }
.kopf[data-kopf="ueber-uns"] { --kopf-fokus: 55% 45%; }
.kopf[data-kopf="kontakt"] { --kopf-fokus: 60% 50%; }
.kopf[data-kopf="fahrzeuge"] { --kopf-fokus: 62% 55%; }
.kopf[data-kopf="start"] { --kopf-fokus: 55% 55%; }
/* Helle Innenraum-Bühnen (weißer Boden / Fensterfront) brauchen mehr Deckung an der Textecke */
.kopf[data-kopf="service"],
.kopf[data-kopf="finanzierung"] { --s0: 0.94; --s1: 0.9; --s2: 0.72; }
/* Schritt 7 (04.10.): Eyebrow/„Rate." lagen live bei 2,45–2,6:1 über weißen Autos/hellen Fliesen —
   Deckung an der Textecke dichter und etwas höher hinauf, Bildmitte bleibt frei (Kap. 11). */
.kopf[data-kopf="service"] .kopf__schatten,
.kopf[data-kopf="finanzierung"] .kopf__schatten { height: 86%; width: min(78%, 1140px); }
.kopf[data-kopf="service"] { --s0: 0.96; --s1: 0.93; --s2: 0.8; }
.kopf[data-kopf="service"] .kopf__schatten { height: 96%; width: min(84%, 1220px); }
/* Augen-Tor 05.10.: Kontakt-Kopf neu (Startbild 520) — Zeile 1 liegt über hellen Autos */
.kopf[data-kopf="kontakt"] { --s0: 0.94; --s1: 0.9; --s2: 0.72; }
.kopf[data-kopf="kontakt"] .kopf__schatten { height: 90%; width: min(80%, 1180px); }
.kopf[data-kopf="start"] { --s1: 0.8; --s2: 0.55; }
.kopf[data-kopf="start"] .kopf__schatten { height: 84%; }

/* ── 5 · Eingangs-Choreografie 0–3 s (nur wenn Bewegung erwünscht) ────── */
/* EINE Bewegung in überlappenden Phasen: Z1 → Pointe Wort für Wort (Stagger 90 ms)
   → Zettel-Band unter „sofort." → Beweis-Satz → CTA. Video läuft ab Sekunde 0
   unangetastet (LCP = erstes Video-Frame). Endzustand = normaler, paintender Text
   (fill-mode both; ohne Animation steht alles sofort). */
@media (prefers-reduced-motion: no-preference) {
  .kopf__schatten {
    animation: kopf-ein 700ms var(--kopf-ease) both;
  }
  .kopf__z1 .w {
    animation: kopf-hoch 800ms var(--kopf-ease) 120ms both;
  }
  .kopf__pointe .w {
    animation: kopf-hoch 900ms var(--kopf-ease) both;
    animation-delay: calc(300ms + var(--i, 0) * 90ms);
  }
  .kopf__pointe .m:nth-child(2) .w { --i: 1; }
  .kopf__pointe .m:nth-child(3) .w { --i: 2; }
  .kopf__pointe .m:nth-child(4) .w { --i: 3; }
  .kopf__pointe .m:nth-child(5) .w { --i: 4; }
  .kopf__pointe .m:nth-child(6) .w { --i: 5; }
  .kopf__pointe .m:nth-child(7) .w { --i: 6; }
  .kopf__akzent::after {
    animation: kopf-band 650ms var(--kopf-ease) 1150ms both;
  }
  .kopf__beweis {
    animation: kopf-auf 800ms var(--kopf-ease) 820ms both;
  }
  .kopf__cta {
    animation: kopf-auf 750ms var(--kopf-ease) 1020ms both;
  }
}
@keyframes kopf-hoch {
  from {
    transform: translateY(108%);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes kopf-auf {
  from {
    transform: translateY(18px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes kopf-band {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes kopf-ein {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ── 6 · Feste Ecke zwischen 761 und 1180 px über die Leiste heben ─────── */
/* (≥ 1181: Leiste hält rechts 22rem frei · ≤ 760: Ecke ist die Handy-Leiste.)
   Klasse setzt kopf.js per IntersectionObserver. */
@media (min-width: 761px) and (max-width: 1180px) {
  html.kontaktleiste-im-bild .ecke {
    bottom: calc(var(--kontaktleiste-h, 64px) + 1.1rem);
    transition: bottom 0.25s ease;
  }
}
@media (min-width: 761px) and (max-width: 899px) {
  html.kontaktleiste-im-bild .ecke {
    bottom: calc(120px + 1.1rem); /* Leiste zweizeilig: 2 × 60 px */
  }
}

/* ── 7 · Unter 900 px: eigenes Bildband, Text mittig darunter ──────────── */
@media (max-width: 899px) {
  /* Kopfleiste deckend: über dem Band läge sie sonst auf hellem Himmel. */
  .nav--ueber-video:not(.ist-gescrollt) {
    background: var(--grund);
    border-bottom-color: var(--kante);
    color: var(--text);
  }
  .nav--ueber-video:not(.ist-gescrollt) .marke b {
    color: var(--rot-text);
  }

  .kopf {
    height: auto;
    min-height: 0;
    margin-top: var(--kopf-h);
    overflow: visible;
    background: var(--grund);
    /* Text liegt hier NICHT über dem Video → --text/--meta kommen unverändert aus
       dem Thema (die *-fest-Umdefinition gilt nur ab 900 px, Abschnitt 1). */
    --kopf-akzent: var(--rot-text);
    color: var(--text);
  }
  .kopf__buehne {
    position: relative;
    inset: auto;
    z-index: auto;
    aspect-ratio: 16 / 9;
  }
  .kopf__schatten {
    display: none;
  }
  .kopf__text {
    position: relative;
    max-width: 36rem;
    padding: 1.6rem var(--rand) 1.9rem;
    text-align: center;
    text-shadow: none;
  }
  .kopf__text > * {
    margin-left: auto;
    margin-right: auto;
  }
  .kopf__pointe {
    font-size: clamp(1.8rem, 1.2rem + 2.6vw, 2.3rem);
  }
  .kopf--sub .kopf__pointe {
    font-size: clamp(1.7rem, 1.15rem + 2.4vw, 2.15rem);
  }
  .kopf__z1 {
    font-size: 1rem;
  }
  .kopf__beweis {
    font-size: 1.04rem;
  }
  .kopf__cta {
    background: var(--navy);
    border-color: var(--navy);
    color: var(--auf-navy);
  }
  .kopf__cta:hover {
    background: var(--navy-hover);
    border-color: var(--navy-hover);
    color: var(--auf-navy);
  }
  .kopf__cta:focus-visible {
    outline-color: var(--navy);
  }

  .kontaktleiste {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 60px;
    height: auto;
    padding: 0;
    font-size: 0.9rem;
  }
  .kontaktleiste__punkt,
  .kontaktleiste__punkt:first-child {
    justify-content: center;
    padding: 0 0.6rem;
    border-left: 0;
    white-space: normal;
    text-align: center;
  }
  .kontaktleiste__punkt {
    flex-wrap: wrap;
    align-content: center;
    column-gap: 0.45rem;
    row-gap: 0.1rem;
  }
  .kontaktleiste__punkt span,
  .kontaktleiste__punkt span:not(.immer) {
    display: block;
    flex-basis: 100%;
    font-size: 0.82rem;
  }
  .kontaktleiste__punkt .immer::before {
    content: none;
  }
  .kontaktleiste__punkt:nth-child(even) {
    border-left: 1px solid rgb(247 248 251 / 0.16);
  }
  .kontaktleiste__punkt:nth-child(n + 3) {
    border-top: 1px solid rgb(247 248 251 / 0.16);
  }
}
