/* ─────────────────────────────────────────────────────────────────────────────
   tokens.css, magic places
   Shared design tokens: @font-face, :root variables, reset/base styles
   ───────────────────────────────────────────────────────────────────────────── */

/* ─── @FONT-FACE: Urbanist (self-hosted, variable 300-700) ───
   Primaerschrift laut Brand Manual 2026. Ersetzt Cormorant Garamond
   (Headings) und Space Grotesk (Body) ab 06/2026. Variable woff2 von
   Google Fonts (OFL), latin + latin-ext, identische unicode-ranges. */
@font-face {
  font-family: 'Urbanist';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/urbanist-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Urbanist';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/urbanist-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ─── :ROOT, Design Tokens ─── */
:root {
  /* -- Colors: Base Palette -- */
  --c-dark: #060D08;
  --c-dark-elevated: #0B1A0F;
  --c-gold: #B8944F;
  --c-gold-light: #D4C48A;
  --c-green: #6B8F72;
  --c-green-muted: #4A6B50;
  --c-green-pale: #A8C4AD;
  --c-canopy: #36463A;
  --c-marigold: #FD9623;
  --c-amber: #C8963C;
  --c-white: #FFFFFF;
  --c-cream: #F1EDE3;
  --c-text-dark: #111A14;

  /* -- Colors: Functional Tokens --
     --c-accent bewusst auf gold-light gesetzt, damit akzentuierte
     Texte/Labels site-weit konsistent hell erscheinen.
     --c-gold bleibt als Basis-Token erhalten (fuer Borders/Focus). */
  --c-accent: var(--c-gold-light);
  --c-accent-light: var(--c-gold-light);
  --c-accent-on-light: #6B5630;
  --c-text-primary: var(--c-white);
  --c-text-muted: rgba(168, 196, 173, 0.78);
  --c-text-muted-low: rgba(168, 196, 173, 0.85);
  --c-text-sub-light: rgba(17, 26, 20, 0.75);
  --c-border: rgba(156, 126, 81, 0.12);
  --c-border-subtle: rgba(156, 126, 81, 0.06);
  --c-surface: rgba(156, 126, 81, 0.06);
  --c-surface-hover: rgba(156, 126, 81, 0.12);

  /* -- Typography: Font Families --
     Urbanist (Brand Manual 2026) als einzige Primaerschrift: Headings + Body.
     Differenzierung ueber Gewicht/Groesse, nicht ueber zwei Schriftfamilien. */
  --font-heading: 'Urbanist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Urbanist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Headline-Gewicht (Brand Manual 2026: markante Headlines in Bold).
     Zentral steuerbar: hier aendern wirkt auf alle Ueberschriften, die
     var(--weight-heading) nutzen. 700 = Bold, 600 = SemiBold (ruhiger). */
  --weight-heading: 700;

  /* -- Scale-Unit: 1% der relevanten Bezugsbreite. Default = 1vw (Mobile/Fullscreen),
        gekappt bei 5.19px (= 1% der maximalen Phone-Frame-Breite 519px).
        Verhindert dass Typo/Spacing auf breiten Viewports OHNE aktivem Phone-Frame
        (z.B. 1100×500) überproportional wachsen.
        Wird im Phone-Frame-Breakpoint auf 1% von --phone-current-width umgestellt,
        damit Type/Space mit der Phone-Breite skalieren statt mit dem Desktop-Viewport. -- */
  --vw1: min(1vw, 4.7px);

  /* -- Typography: Fluid Scale (t-shirt). v5 — gekoppelt an --vw1, damit der
        Phone-Frame eine eigene Skalierungsbasis hat. -- */
  --text-xxs: clamp(0.62rem, calc(0.52rem + 0.32 * var(--vw1)), 0.78rem);  /* 9.9  -> 12.5 px */
  --text-xs:  clamp(0.72rem, calc(0.60rem + 0.42 * var(--vw1)), 0.88rem);  /* 11.5 -> 14.1 px */
  --text-sm:  clamp(0.88rem, calc(0.74rem + 0.50 * var(--vw1)), 1.02rem);  /* 14.1 -> 16.3 px */
  --text-md:  clamp(1.05rem, calc(0.94rem + 0.40 * var(--vw1)), 1.22rem);  /* 16.8 -> 19.5 px */
  --text-lg:  clamp(1.40rem, calc(1.20rem + 0.70 * var(--vw1)), 1.65rem);  /* 22.4 -> 26.4 px */
  --text-xl:  clamp(2.00rem, calc(1.60rem + 1.50 * var(--vw1)), 2.65rem);  /* 32.0 -> 42.4 px */
  --text-2xl: clamp(1.85rem, calc(1.45rem + 1.55 * var(--vw1)), 2.85rem);  /* 29.6 -> 45.6 px */
  --text-3xl: clamp(2.65rem, calc(1.85rem + 3.20 * var(--vw1)), 4.50rem);  /* 42.4 -> 72.0 px */

  /* -- Spacing: Fluid Scale (t-shirt). -- */
  --space-xs: clamp(0.375rem, calc(0.30rem + 0.30 * var(--vw1)), 0.60rem);
  --space-sm: clamp(0.625rem, calc(0.50rem + 0.50 * var(--vw1)), 1.00rem);
  --space-md: clamp(1.125rem, calc(0.95rem + 0.70 * var(--vw1)), 1.625rem);
  --space-lg: clamp(1.625rem, calc(1.32rem + 1.20 * var(--vw1)), 2.50rem);
  --space-xl: clamp(2.25rem, calc(1.80rem + 1.80 * var(--vw1)), 3.50rem);

  /* -- Header-Clearance: Abstand vom oberen Phone-Frame-Rand bis Hero-Content. -- */
  --header-clearance: clamp(6rem, calc(4.5rem + 3 * var(--vw1)), 8rem); /* 96 -> 128 px */

  /* -- Phone-Frame Breite — Quelle der Wahrheit fuer Overlays/Sheets.
        Default = mobile (volle Viewport-Breite). Wird in Media-Queries unten
        ueberschrieben, um die Phone-Frame-Logik zu spiegeln. -- */
  --phone-current-width: 100vw;
}

/* Desktop ab 1280px: Phone-Frame skaliert ratio-treu (440/932), max 519px breit
   (= 1100/932 * 440), Höhe gedeckelt auf 100dvh - 40px Padding.
   Darunter (Mobile + Tablet inkl. Landscape) bleibt das Fullscreen-Layout aktiv. */
@media (min-width: 900px) and (min-height: 600px) and (hover: hover), (min-width: 1280px) and (min-height: 600px) and (hover: none) {
  :root {
    --phone-current-width: min(519px, calc((100dvh - 40px) * 440 / 932));
    /* Type/Space skalieren mit der Phone-Breite, nicht dem Desktop-Viewport. */
    --vw1: calc(var(--phone-current-width) / 100);
  }
}

/* Bei begrenzter Viewport-Hoehe (bis 800px) wird der Phone-Frame leicht breiter
   im Verhaeltnis zur Hoehe — Ratio 440/820 statt 440/932 (siehe home.css). */
@media (min-width: 900px) and (min-height: 600px) and (max-height: 800px) and (hover: hover), (min-width: 1280px) and (min-height: 600px) and (max-height: 800px) and (hover: none) {
  :root {
    --phone-current-width: min(519px, calc((100dvh - 40px) * 440 / 820));
    --vw1: calc(var(--phone-current-width) / 100);
  }
}

/* Easing + Legacy Aliases — gehoeren wieder ins globale :root,
   waren versehentlich in eine Media-Query gerutscht. */
:root {
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-cine: cubic-bezier(0.16, 1, 0.3, 1);

  --d: var(--c-dark);
  --d2: var(--c-dark-elevated);
  --gold: var(--c-gold);
  --gold-l: var(--c-gold-light);
  --moss: var(--c-green-muted);
  --sage: var(--c-green);
  --mist: var(--c-green-pale);
  --canopy: var(--c-canopy);
  --marigold: var(--c-marigold);
  --w: var(--c-white);
  --l: var(--c-cream);
  --l-text: var(--c-text-dark);
  --l-sub: var(--c-text-sub-light);
  --e: var(--ease);
  --e-cine: var(--ease-cine);
}

/* ─── Reset / Base ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: var(--gold); color: var(--w); }

/* ─── Anti-Clipping / Anti-Overlap (site-weit) ─────────────────────────────
   Schützt lange deutsche Komposita ("Zellregeneration") vor Overflow,
   gibt kursiven Headlines Descender-Puffer und erlaubt Flex-/Grid-
   Kindern mit Text zu schrumpfen statt das Layout zu sprengen. */
html { -webkit-text-size-adjust: 100%; }

body {
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  hyphenate-limit-chars: 8 4 4;
}

:where(h1, h2, h3, h4, .hero-title, .sheet__title, .hero-proof, .le-statement__main) {
  overflow-wrap: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-wrap: balance;
  padding-block: 0.05em;
  font-weight: var(--weight-heading);
}

:where(p, li) { text-wrap: pretty; }

/* Flex-/Grid-Kinder mit Text dürfen schrumpfen, sonst zwingen sie Overflow. */
:where(.row, .stack, .flex, [class*="__row"], .email-signup, .cta-primary, .icon-btn) > * {
  min-width: 0;
}

/* ─── Fokus-Indikator (WCAG 2.4.7) ─── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--c-gold);
  outline-offset: 3px;
  border-radius: 2px;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  background: #020504;
  color: var(--w);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  font-weight: 300;
}

/* ─── LANGUAGE SWITCH ─── */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 3px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(6, 13, 8, 0.6);
  z-index: 100;
}
.lang-switch__item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 28px;
  padding: 2px 8px;
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--c-text-muted);
  border-radius: 999px;
  text-decoration: none;
  transition: all 0.3s var(--ease);
  cursor: pointer;
  line-height: 1;
}
.lang-switch__item.is-active {
  color: var(--c-gold-light);
  background: var(--c-surface);
  cursor: default;
}
.lang-switch__item:not(.is-active):hover {
  color: var(--c-white);
}
/* Position inside phone frame (subpages) */
.phone .lang-switch {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 150;
}
/* Position for non-phone pages (book, confirm) */
body > .lang-switch,
main > .lang-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 300;
}

/* ═══════════════════════════════════════════════════════
   GLOBAL prefers-reduced-motion, site-weit aktiv (WCAG 2.3.3)
   Greift auf Pages, die nur pages.css/christian.css/leistungen.css laden
   (z.B. /book, /confirm), wo kein eigener RM-Block existiert.
   ═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
