/* Kontent – BASE-Tokens + Blöcke
   Layout: Positionen 1:1 aus Figma (Frame 1440 × 1024), proportional skaliert – kein Spaltenraster.
   Layer: reset → tokens → base → blocks → project (Projekt-Overrides) */
@layer reset, tokens, base, blocks, project;

/* ---------- Fonts: IvyPresto via Adobe-Kit, lokaler Fallback (DSGVO) ---------- */
@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond-latin-300-normal.woff2") format("woff2"); font-weight: 100 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("../fonts/cormorant-garamond-latin-300-italic.woff2") format("woff2"); font-weight: 100 300; font-style: italic; font-display: swap; }

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { margin: 0; }
  h1, h2, h3, p, figure, blockquote, ul { margin: 0; padding: 0; }
  ul[role="list"] { list-style: none; }
  img, picture, video, svg { display: block; max-width: 100%; }
  button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
}

@layer tokens {
  :root {
    /* BASE */
    --size: 1;
    --font-a: "ivypresto-display", "Cormorant Garamond", Georgia, serif;
    --font-b: "ivypresto-text", "Cormorant Garamond", Georgia, serif;
    --color-a: #000;
    --color-b: #fff;
    --color-c: #ece9e5;
    --background: var(--color-a);
    --radius: 12.5rem;
    --border-size: 1px;
    --border-color: var(--color-b);
    --line: 0.5px;                 /* Unterstreichungen + Linien: fein */
    --fx-blur: 2.2vw;
    --fx-multiply: 0.38;           /* Schwarz-Overlay über dem Video */
    --fx-multiply-chapter: 0.55;   /* … auf den Kapitelseiten */
    --opac: 0.85;

    /* Figma-Einheiten: 1 Figma-Pixel horizontal / vertikal / für Größen */
    /* ab --max-w / --max-h wachsen Abstände + Größen nicht mehr; Ausrichtung zu den Rändern bleibt */
    --max-w: 1920px; --max-h: 1200px;
    --ux: calc(min(100vw, var(--max-w)) / 1440);
    --uy: calc(min(100vh, var(--max-h)) / 1024);
    --us: min(var(--ux), var(--uy) * 1.1);

    /* Motion: lang und ruhig */
    --dur: 1.2s;
    --dur-long: 1.6s;
    --ease: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@layer base {
  html { background: var(--background); color: var(--color-b); color-scheme: dark; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
  body {
    font-family: var(--font-b); font-weight: 100; font-size: 1.125rem; line-height: 1.75;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
    font-synthesis: none; font-kerning: normal; font-optical-sizing: auto;
    font-size-adjust: from-font;
  }
  em { font-style: italic; }
  em.u, .jump em { text-decoration: underline; text-decoration-thickness: var(--line); text-underline-offset: 0.14em; }
  a { color: inherit; }
  .jump { text-decoration: none; }
  .jump em { text-decoration-color: currentColor; transition: text-decoration-color var(--dur) var(--ease); }
  .jump:hover em { text-decoration-color: transparent; }
  :focus-visible { outline: var(--line) solid currentColor; outline-offset: 0.35rem; }
  .sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .skip { position: fixed; left: 1rem; top: 1rem; z-index: 100; padding: .5rem 1rem; background: var(--color-b); color: var(--color-a); translate: 0 -200%; }
  .skip:focus { translate: 0 0; }

  .display { font-family: var(--font-a); font-weight: 100; line-height: 1; letter-spacing: -0.005em; }
}

@layer blocks {
  /* =========== Globaler Hintergrund: Start-Video / Slider-Medien =========== */
  .bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--color-a); }
  .hero-slide, .bg-shade { position: absolute; inset: 0; }
  .hero-slide { opacity: 0; transition: opacity var(--dur-long) var(--ease); }
  .hero-slide.is-active { opacity: 1; }
  .hero-blur, .hero-sharp, .hero-sharp img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .hero-blur { filter: blur(var(--fx-blur)); scale: 1.15; opacity: var(--opac); }
  .hero-sharp { opacity: 0; transition: opacity var(--dur-long) var(--ease), filter var(--dur-long) var(--ease), scale var(--dur-long) var(--ease); }
  .bg-shade { background: rgb(0 0 0 / var(--fx-multiply)); transition: background-color var(--dur-long) var(--ease); }

  /* Video-Slides: das laufende Video ist selbst der unscharfe Hintergrund */
  .hero-slide.is-video .hero-sharp { opacity: var(--opac); filter: blur(var(--fx-blur)); scale: 1.15; }

  /* Bild scharf: Slider ab Bild 2 – oder Bild 1 nach Tippen */
  :root[data-zone="slider"]:not([data-slide="0"]) .hero-slide.is-active .hero-sharp,
  :root[data-zone="slider"][data-focus="media"] .hero-slide.is-active .hero-sharp { opacity: 1; filter: none; scale: 1; }
  :root[data-zone="slider"]:not([data-slide="0"]) .bg-shade,
  :root[data-zone="slider"][data-focus="media"] .bg-shade { background-color: rgb(0 0 0 / 0.08); }
  :root[data-zone="chapters"] .bg-shade { background-color: rgb(0 0 0 / var(--fx-multiply-chapter)); }

  /* =========== Komma / Menü-Button =========== */
  .topbar { position: fixed; z-index: 20; inset: 0 0 auto; pointer-events: none; }
  .menu-btn, .menu-close {
    position: fixed; z-index: 2; pointer-events: auto;
    right: calc(50 * var(--ux) - 0.75rem); top: calc(50 * var(--uy) - 0.75rem);
    padding: 0.75rem; display: grid; place-items: center;
  }
  .comma { width: max(1.25rem, calc(26 * var(--us)), 1.4vw); height: auto; transition: rotate var(--dur) var(--ease-out); }
  .menu-btn:hover .comma, .menu-close:hover .comma { rotate: -12deg; }
  .menu-btn { transition: opacity var(--dur) var(--ease); }
  .brand { display: none; }
  .is-preloading .menu-btn, .is-preloading .lang { opacity: 0; }
  /* Sprachumschalter: klein, links oben auf der Linie des Kommas */
  .lang {
    position: fixed; z-index: 2; pointer-events: auto; left: calc(50 * var(--ux) - 0.75rem); top: calc(50 * var(--uy) - 0.75rem);
    padding: 0.75rem; font-family: var(--font-a); font-weight: 100; font-size: max(1rem, calc(22 * var(--us))); line-height: 1;
    letter-spacing: 0.02em; transition: opacity var(--dur) var(--ease);
  }
  .lang:hover { font-style: italic; }
  /* Sprachwechsel: Texte blenden aus, tauschen, blenden ein – die Seite bleibt */
  [data-i18n] { transition: opacity .5s var(--ease); }
  .is-switching [data-i18n] { opacity: 0; }
  .i18n-pending [data-i18n] { visibility: hidden; }

  /* =========== Menü: wächst als Kreis aus dem Komma, Linien zeichnen, Wörter steigen auf =========== */
  .menu {
    --cx: calc(100% - 3.5vw); --cy: 5vh;
    position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
    background: var(--color-c); color: var(--color-a); overflow: hidden;
    clip-path: circle(0 at var(--cx) var(--cy));
    transition: clip-path 1.3s var(--ease), display 1.3s allow-discrete, overlay 1.3s allow-discrete;
  }
  .menu[open] { clip-path: circle(150vmax at var(--cx) var(--cy)); }
  @starting-style { .menu[open] { clip-path: circle(0 at var(--cx) var(--cy)); } }
  .menu:modal { overscroll-behavior: contain; }
  .menu::backdrop { background: transparent; overflow: hidden; overscroll-behavior: contain; }
  .menu-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .15; filter: blur(var(--fx-blur)); scale: 1.15; }
  .menu nav { position: absolute; left: calc(122 * var(--ux)); right: calc(102 * var(--ux)); top: calc(32 * var(--uy)); bottom: calc(32 * var(--uy)); }
  .menu ul { height: 100%; display: flex; flex-direction: column; }
  .menu li { flex: 1; position: relative; display: flex; align-items: center; overflow: hidden; }
  .menu li + li::before {
    content: ""; position: absolute; left: 0; right: 0; top: 0; height: var(--line); background: currentColor;
    transform-origin: left; scale: 0 1;
    transition-delay: calc(0.45s + var(--i) * 0.12s), 0s, 0s;
  }
  .menu a {
    display: block; width: 100%; text-decoration: none;
    font-family: var(--font-a); font-weight: 100; line-height: 1.15;
    font-size: max(2.75rem, calc(96 * var(--us)));
    translate: -2.5rem 0; opacity: 0;
    transition: translate 1.2s var(--ease-out), opacity 1.2s var(--ease), filter .9s var(--ease);
    transition-delay: calc(0.6s + var(--i) * 0.12s), calc(0.6s + var(--i) * 0.12s), 0s;
  }
  .menu[open] li + li::before { scale: 1 1; }
  .menu[open] a { translate: 0 0; opacity: 1; }
  /* Normal → kursiv: echtes Morphen geht mit getrennten Schnitten nicht – daher Überblendung beider Schnitte */
  .menu a { display: grid; }
  .menu a > span { grid-area: 1 / 1; transition: opacity .9s var(--ease), filter .9s var(--ease); }
  .menu a .it { font-style: italic; opacity: 0; filter: blur(4px); }
  .menu a:is(:hover, :focus-visible, [aria-current="true"]) .rm { opacity: 0; filter: blur(4px); }
  .menu a:is(:hover, :focus-visible, [aria-current="true"]) .it { opacity: 1; filter: none; }
  /* Hover: der Punkt kommt leicht nach vorne, die anderen treten zurück */
  .menu a { transform-origin: left center; }
  .menu[open] a { transition: translate 1.2s var(--ease-out), opacity 1.2s var(--ease), filter .9s var(--ease), scale .9s var(--ease-out); transition-delay: calc(0.6s + var(--i) * 0.12s), calc(0.6s + var(--i) * 0.12s), 0s, 0s; }
  .menu ul:has(a:hover) a:hover { scale: 1.035; }
  .menu ul:has(a:hover) a:not(:hover) { filter: blur(3px); opacity: .45; scale: 0.965; transition-delay: 0s; }
  .menu ul:has(a:hover) li::before { filter: blur(2px); opacity: .45; }
  .menu li::before { transition: scale 1.1s var(--ease-out), filter .9s var(--ease), opacity .9s var(--ease); }
  /* Schließen: Punkte bleiben stehen, nur der Kreis zieht sich ins Komma zurück */
  .menu.is-closing a { opacity: 1; translate: 0 0; transition: none; }
  .menu.is-closing li + li::before { scale: 1 1; transition: none; }

  /* =========== Spur =========== */
  .track { display: block; }
  .chapter { display: block; }
  .panel { position: relative; width: 100%; min-height: 100svh; }

  /* =========== Desktop: Figma-Positionen, horizontal =========== */
  @media (min-width: 64rem) and (hover: hover) and (pointer: fine) {
    /* Paging wie am iPhone: natives Scrollen, rastet auf jeder Station ein */
    .is-horizontal { scroll-snap-type: y mandatory; scrollbar-width: none; }
    .is-horizontal::-webkit-scrollbar { display: none; }
    .snap-rail { position: relative; z-index: -2; pointer-events: none; }
    .snap-rail > div { height: 100vh; scroll-snap-align: start; scroll-snap-stop: always; }
    .is-horizontal .stage { position: fixed; inset: 0; overflow: clip; }
    .is-horizontal .track { display: flex; height: 100vh; }
    .is-horizontal.is-moving .track { will-change: transform; } /* Ebene nur während der Fahrt – sonst gestochen scharfer Text */
    .is-horizontal .chapter { display: flex; }
    .panel { flex: 0 0 100vw; width: 100vw; height: 100vh; min-height: 0; }
    .panel > *, .panel figure { position: absolute; top: calc(50% + (var(--y, 512) - 512) * var(--us)); }

    /* Typo nach Figma, proportional */
    .t-96 { font-size: calc(96 * var(--us)); }
    .t-90 { font-size: calc(90 * var(--us)); }
    .t-50 { font-size: calc(50 * var(--us)); line-height: 1.25; }
    .t-30 { font-size: calc(30 * var(--us)); }
    .t-20 { font-size: max(1rem, calc(20 * var(--us))); line-height: 1.75; }
    .t-20.lh2 { line-height: 2; }
    .t-15 { font-size: max(0.875rem, calc(15 * var(--us))); line-height: 2; }
    .t-10 { font-size: max(0.6875rem, calc(10 * var(--us))); line-height: 2; }

    /* Start */
    .hero-title { --y: 382; left: calc(122 * var(--ux)); width: calc(800 * var(--ux)); }

    /* Intro „Sicher nicht für jeden …“ */
    .p-intro .display { --y: 383; left: calc(122 * var(--ux)); width: calc(766 * var(--ux)); }
    .p-intro p { --y: 486; left: calc(609 * var(--ux)); width: calc(587 * var(--ux)); }

    /* Medien: Bildunterschrift hängt immer direkt am Medium (unten rechts daneben) */
    .p-media figure { left: calc(122 * var(--ux)); display: flex; align-items: flex-end; gap: calc(23 * var(--ux)); }
    .p-media .media { overflow: hidden; background: rgb(255 255 255 / .04); flex: none; }
    .p-media .media :is(img, video) { width: 100%; height: 100%; object-fit: cover; }
    .p-media figcaption { width: calc(102 * var(--ux)); min-width: 6.5rem; translate: 0 0.5em; }
    .p-media figure { top: 50%; transform: translateY(-50%); }
    .p-media.is-landscape .media { width: min(calc(950 * var(--ux)), calc(634 * var(--uy) * 950 / 634)); aspect-ratio: 950 / 634; }
    .p-media.is-portrait .media { height: calc(882 * var(--uy)); aspect-ratio: 588 / 882; }

    /* Wege / Preise */
    .p-prices .display { --y: 101; left: calc(122 * var(--ux)); }
    .p-prices .lead { --y: 101; left: calc(487 * var(--ux)); width: calc(710 * var(--ux)); }
    .p-prices .prices { --y: 551; left: 0; width: 100%; height: 0; }
    .prices li { position: absolute; top: 0; width: calc(243 * var(--ux)); }
    .prices li:nth-child(1) { left: calc(122 * var(--ux)); }
    .prices li:nth-child(2) { left: calc(487 * var(--ux)); }
    .prices li:nth-child(3) { left: calc(852 * var(--ux)); }
    .prices .label { margin-top: calc(15 * var(--us)); }
    .prices .t-15 { margin-top: calc(33 * var(--us)); width: calc(221 * var(--ux)); }

    /* Menschen */
    .p-quote figure { left: 50%; margin-left: calc(954 * var(--ux) / -2); width: calc(954 * var(--ux)); --y: 383; text-align: center; }
    .p-quote blockquote { width: calc(710 * var(--ux)); margin-inline: auto; text-wrap: balance; hyphens: manual; }
    .p-quote figcaption { margin-top: calc(60 * var(--us)); }

    /* Kontakt */
    .p-contact > * { left: 50%; margin-left: calc(var(--w) / -2); width: var(--w); text-align: center; }
    .p-contact .display { --w: calc(710 * var(--ux)); --y: 317; }
    .p-contact p { --w: calc(954 * var(--ux)); --y: 488; }
    .p-contact .btn { --w: calc(345 * var(--ux)); --y: 680; height: calc(58 * var(--us)); min-height: 2.75rem; padding: 0; }
  }

  /* =========== Mobile / Touch: gestapelt, jede Seite füllt den Screen =========== */
  @media (max-width: 63.99rem), (hover: none) {
    html { scroll-snap-type: y proximity; }
    .panel { display: flex; flex-direction: column; justify-content: center; gap: 1.75rem; padding: 6rem 8vw; scroll-snap-align: start; }
    .t-96, .t-90 { font-size: clamp(2.75rem, 11vw, 4rem); }
    .t-50 { font-size: clamp(1.25rem, 5.3vw, 2rem); line-height: 1.25; }
    .p-quote blockquote { max-width: none; }
    .t-30 { font-size: 1.375rem; }
    .t-20 { font-size: 1.0625rem; line-height: 1.75; }
    .t-15 { font-size: 0.9375rem; line-height: 1.9; }
    .t-10 { font-size: 0.75rem; line-height: 1.9; }
    .p-media figure { display: flex; flex-direction: column; gap: .75rem; }
    .p-media .media { width: 100%; aspect-ratio: 950 / 634; overflow: hidden; }
    .p-media .media :is(img, video, picture) { width: 100%; height: 100%; object-fit: cover; }
    .p-media.is-portrait .media { width: 72%; aspect-ratio: 588 / 882; }
    .prices { display: grid; gap: 2.5rem; }
    .p-quote, .p-contact { text-align: center; align-items: center; }
    .menu-btn, .menu-close { left: auto; right: calc(8vw - 0.75rem); top: 1.25rem; }
    .lang { left: calc(8vw - 0.75rem); top: 1.25rem; }
    .menu nav { left: 8vw; right: 8vw; }
  }

  /* =========== Elemente =========== */
  .price { font-family: var(--font-a); font-weight: 100; line-height: 1; }
  .prices li, .p-media figure { transition: filter .9s var(--ease), opacity .9s var(--ease); }
  .prices:has(li:hover) li:not(:hover) { filter: blur(2px); opacity: .5; }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; padding: .7rem 2.5rem;
    border: var(--border-size) solid var(--border-color); border-radius: var(--radius);
    font-family: var(--font-a); font-weight: 100; line-height: 1; text-decoration: none;
    text-box: trim-both ex alphabetic; /* optisch mittig auf der x-Höhe (Kleinbuchstaben) */
    padding-bottom: 0.08em;
    box-shadow: 0 .25rem .25rem rgb(0 0 0 / .25);
    transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
  }
  .btn:hover, .btn:focus-visible { background: var(--color-b); color: var(--color-a); font-style: italic; }

  /* =========== Start: Text ⇄ Bild (Tippen auf Slide 1) =========== */
  .hero { cursor: default; }
  :root[data-zone="slider"][data-slide="0"] .hero { cursor: pointer; }
  .hero-title {
    transition: opacity var(--dur-long) var(--ease), filter var(--dur-long) var(--ease), translate var(--dur-long) var(--ease);
  }
  :root[data-focus="media"] .hero-title { opacity: .3; filter: blur(0.3rem); }
  :root:not([data-slide="0"]) .hero-title { opacity: 0; filter: blur(0.3rem); translate: -6vw 0; pointer-events: none; }

  /* =========== Sanftes Einblenden der Inhalte =========== */
  .js .panel:not(.hero) > *, .js .p-media figure > * {
    @media (prefers-reduced-motion: no-preference) {
      transition: opacity var(--dur-long) var(--ease), translate var(--dur-long) var(--ease-out), filter .9s var(--ease);
    }
  }
  .js .panel.is-out:not(.hero) > * { opacity: 0; }
  .js .panel.is-out:not(.hero) > * { @media (prefers-reduced-motion: no-preference) { translate: 4vw 0; } }

  /* =========== Preloader: ruhig, schwarz-weiß =========== */
  .preloader { display: none; }
  .is-preloading .preloader { display: grid; place-items: center; position: fixed; inset: 0; z-index: 50; background: var(--color-a); }
  .is-preloading .preloader { animation: pl-failsafe .8s 9s forwards; } /* Failsafe ohne JS */
  @keyframes pl-failsafe { to { opacity: 0; visibility: hidden; } }
  .pl-logo { grid-area: 1 / 1; width: clamp(14rem, 49.3vw, 44.5rem); height: auto; }
  .pl-light { color: var(--color-b); opacity: 0; }
  .pl-wipe { grid-area: 1 / 1; position: absolute; inset: 0; display: grid; place-items: center; background: var(--color-b); clip-path: inset(0 100% 0 0); }
  .pl-images, .pl-images img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .pl-images img { opacity: 0; filter: grayscale(1) contrast(.9) brightness(1.15); transition: opacity 1.4s var(--ease); }
  .pl-images img.is-on { opacity: 1; }
  .pl-images::after { content: ""; position: absolute; inset: 0; background: rgb(255 255 255 / .45); }
  .pl-dark { color: var(--color-a); position: relative; }
}

@layer blocks {
  /* =========== Cursor: weißer Punkt mit „Differenz“ – über Hellem wird er dunkel =========== */
  .cursor { display: none; }
  @media (hover: hover) and (pointer: fine) {
    .has-cursor, .has-cursor * { cursor: none !important; }
    .has-cursor .cursor:popover-open {
      display: grid; place-items: center; position: fixed; inset: 0 auto auto 0; margin: 0; padding: 0; border: 0; overflow: visible;
      width: 7rem; height: 7rem; background: transparent; pointer-events: none;
      mix-blend-mode: difference; color: #000;
      translate: var(--x, -100px) var(--y, -100px);
    }
    .cursor::before {
      content: ""; position: absolute; inset: 0; margin: auto; width: .75rem; height: .75rem; border-radius: 50%; background: #fff;
      transition: width .7s var(--ease-out), height .7s var(--ease-out);
    }
    .cur-arrow { position: absolute; width: 1.4rem; opacity: 0; transition: opacity .5s var(--ease), rotate .5s var(--ease-out); }
    .cursor[data-state="link"]::before { width: 3.5rem; height: 3.5rem; }
    .cursor:is([data-state="next"], [data-state="prev"])::before { width: 3.5rem; height: 3.5rem; }
    .cursor:is([data-state="next"], [data-state="prev"]) .cur-arrow { opacity: 1; }
    .cursor[data-state="prev"] .cur-arrow { rotate: 180deg; }
    .cursor[data-state="tap"]::before { width: 7rem; height: 7rem; }
    .cur-label { position: relative; font-family: var(--font-a); font-style: italic; font-size: 1.25rem; line-height: 1; opacity: 0; transition: opacity .5s var(--ease); }
    .cursor[data-state="tap"] .cur-label { opacity: 1; }
    .cursor[data-state="tap"] .cur-arrow { display: none; }
    .cursor.is-hidden::before { width: 0; height: 0; }
  }
}

@layer project {
  /* Platz für projektspezifische Overrides */
}
