/* Shared motion primitives. Paired with motion.js — the JS sets the custom
   properties, this file decides what they look like. Everything degrades to a
   plain, fully visible page when JS is off or reduced-motion is on. */

/* ---------- Film grain + vignette ------------------------------------- */
.film::after{
  content:"";position:fixed;inset:0;z-index:60;pointer-events:none;opacity:.05;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette::before{
  content:"";position:absolute;inset:0;z-index:2;pointer-events:none;
  background:radial-gradient(120% 90% at 50% 40%,transparent 40%,rgba(0,0,0,.75) 100%);
}

/* ---------- Preloader -------------------------------------------------- */
#pre{position:fixed;inset:0;z-index:100;display:grid;place-items:center;background:var(--pre-bg,#08090C);
  transition:opacity .7s ease,visibility .7s}
#pre.done{opacity:0;visibility:hidden}
#pre .bar{position:absolute;bottom:0;left:0;height:2px;width:var(--load,0%);background:var(--pre-accent,#fff);
  transition:width .25s ease}

/* ---------- Line masks -------------------------------------------------
   motion.js wraps each visual line in .ln > .ln-i so the inner span can slide
   out from behind the clipped outer one. */
/* Vertical slack on both sides: the mask clips descenders at the bottom and
   umlaut dots at the top (DÄCHER, ÖFFNUNG, ÜBER) without it. */
.ln{display:block;overflow:hidden;padding:.14em 0 .08em;margin:-.14em 0 -.08em}
.ln-i{display:block;transform:translateY(105%);
  transition:transform 1s cubic-bezier(.16,1,.3,1);transition-delay:var(--d,0ms)}
.is-in .ln-i{transform:none}

/* ---------- Generic reveal --------------------------------------------- */
[data-reveal]{opacity:0;transform:translateY(var(--ry,32px)) scale(var(--rs,1));
  transition:opacity .9s cubic-bezier(.16,1,.3,1),transform .9s cubic-bezier(.16,1,.3,1);
  transition-delay:var(--d,0ms)}
[data-reveal].is-in{opacity:1;transform:none}

/* ---------- Curtain wipe ----------------------------------------------- */
[data-wipe]{clip-path:inset(0 100% 0 0);transition:clip-path 1.2s cubic-bezier(.16,1,.3,1);
  transition-delay:var(--d,0ms)}
[data-wipe].is-in{clip-path:inset(0 0 0 0)}

/* ---------- Pinned sections --------------------------------------------
   [data-pin] gets --p (0..1) written every frame while it is on screen. */
[data-pin]{position:relative}
[data-pin] .pin-stage{position:sticky;top:0;height:100svh;overflow:hidden}

/* ---------- Scroll-driven media ---------------------------------------- */
/* :where() keeps specificity at 0 so a Tailwind position class on the same
   element still wins — motion.css loads after the Tailwind sheet. */
:where(.media){position:relative}
.media{overflow:hidden;background:var(--ph,#111)}
.media img,.media canvas{width:100%;height:100%;object-fit:cover;display:block}
.media img{will-change:transform}
[data-parallax]{transform:translate3d(0,var(--py,0px),0)}
/* Media stays overscaled so the parallax offset never exposes an edge. */
.media img[data-parallax]{transform:translate3d(0,var(--py,0px),0) scale(1.16)}
/* Images fade in once decoded so a slow connection never shows a half-drawn frame. */
.media img{opacity:0;transition:opacity .8s ease}
.media img.ready{opacity:1}

/* ---------- Responsive hero video -----------------------------------
   Every hero keeps its still frame as the first paint. The shared engine
   reveals the matching video only after the first decoded frame exists. */
.hero-media{isolation:isolate}
.hero-media img[data-hero]{position:absolute;inset:0;z-index:0;opacity:1}
.hero-motion{position:absolute;inset:0;z-index:1;width:100%;height:100%;display:block;object-fit:cover;object-position:center;opacity:0;pointer-events:none;transition:opacity .8s ease}
.hero-motion.is-ready{opacity:1}
@media (max-width:639px){.hero-motion{object-position:var(--hero-mobile-focus,center)}}
@media (prefers-reduced-motion:reduce){.hero-motion{display:none!important;opacity:0!important}}

/* ---------- Portfolio card films --------------------------------------
   Cards stay still until a pointer or keyboard focus asks for motion. This
   keeps the landing page cinematic without starting five video decoders at
   once; the poster remains the first paint and the mobile layout stays light. */
.work-card__media{isolation:isolate}
.work-card__media img{position:relative;z-index:0}
.work-card__media video[data-card-motion-video]{position:absolute;inset:0;z-index:1;width:100%;height:100%;display:block;object-fit:cover;opacity:0;pointer-events:none;transform:scale(1.02);transition:opacity .45s ease,transform 1.1s cubic-bezier(.16,1,.3,1)}
.work-card.card-motion-playing .work-card__media video[data-card-motion-video]{opacity:1;transform:scale(1.05)}
.work-card.card-motion-playing .work-card__media img{filter:saturate(.8) brightness(.72)}
@media (hover:none){.work-card__media video[data-card-motion-video]{display:none}}
@media (prefers-reduced-motion:reduce){.work-card__media video[data-card-motion-video]{display:none!important;opacity:0!important}.work-card.card-motion-playing .work-card__media img{filter:none}}
.hero-stack__card{isolation:isolate}
.hero-stack__card video[data-stack-motion-video]{position:absolute;inset:0;z-index:0;width:100%;height:100%;display:block;object-fit:cover;opacity:0;pointer-events:none;transform:scale(1.02);transition:opacity .45s ease,transform 1.1s cubic-bezier(.16,1,.3,1)}
.hero-stack__card.card-motion-playing video[data-stack-motion-video]{opacity:1;transform:scale(1.05)}
.hero-stack__card.card-motion-playing img{filter:saturate(.8) brightness(.72)}
@media (hover:none){.hero-stack__card:not(.hero-stack__card--2) video[data-stack-motion-video]{display:none}}
@media (prefers-reduced-motion:reduce){.hero-stack__card video[data-stack-motion-video]{display:none!important;opacity:0!important}.hero-stack__card.card-motion-playing img{filter:none}}

/* ---------- Neigung und Lesefortschritt --------------------------------- */
/* Beides setzt motion.js nur, wenn es laufen darf. Ohne Skript, ohne GSAP,
   auf Touch oder bei reduzierter Bewegung bleibt hier schlicht nichts übrig —
   kein halber Effekt, keine schiefe Karte. */
/* Erst ab .is-in, und bewusst nach den [data-reveal]-Regeln notiert: bis das
   Einblenden durch ist, gehört transform der Reveal-Regel, danach der Neigung.
   Beide schreiben dieselbe Eigenschaft, also entscheidet die Reihenfolge. */
.tilt{will-change:transform}
.tilt.is-in{transform:perspective(900px) rotateX(var(--tx,0deg)) rotateY(var(--ty,0deg))
  scale(var(--ts,1))}

/* Die Engine schreibt --sp (0..1). Wie daraus eine Anzeige wird, entscheidet
   die Seite; das hier ist die Vorgabe. currentColor, damit die Farbe aus der
   Palette der jeweiligen Seite kommt statt aus der Engine. */
/* z über dem Header (65), unter dem Sprunglink (70) — der Header hat einen
   Verlauf aus der Seitenfarbe und würde die Linie sonst verdecken. */
.fortschritt{position:fixed;top:0;left:0;right:0;height:2px;z-index:66;
  pointer-events:none;background:currentColor;opacity:.5;
  transform:scaleX(var(--sp,0));transform-origin:0 50%}

/* ---------- Active section navigation ---------------------------------- */
[data-section-nav] a{position:relative;transition:color .25s ease,opacity .25s ease}
[data-section-nav] a[aria-current="location"]{opacity:1}
[data-section-nav] a[aria-current="location"]::after{content:"";position:absolute;
  right:0;bottom:-.45rem;left:0;height:2px;background:currentColor;
  transform:scaleX(1);transform-origin:left center}
section[id]{scroll-margin-top:6rem}

/* ---------- Page-specific journey bridges ----------------------------- */
/* Each demo supplies its own accent/background variables. The structure stays
   shared for performance and accessibility, while the copy and rhythm remain
   deliberately different per brand. */
.journey-bridge{position:relative;isolation:isolate;width:calc(100% - 3rem);max-width:1600px;margin:clamp(4rem,9vw,9rem) auto;padding:1.2rem clamp(1.5rem,4vw,4rem) clamp(1.5rem,4vw,3.5rem);overflow:hidden;border:1px solid var(--bridge-accent);background:var(--bridge-bg);color:var(--bridge-accent)}
.journey-bridge:before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(115deg,rgba(255,255,255,.07),transparent 38%,rgba(0,0,0,.18))}
.journey-bridge:after{content:"";position:absolute;top:0;right:clamp(1.5rem,4vw,4rem);width:1px;height:100%;background:var(--bridge-accent);opacity:.3;transform:rotate(18deg);transform-origin:top}
.journey-bridge__meta{display:flex;justify-content:space-between;gap:1rem;padding-bottom:1.1rem;border-bottom:1px solid currentColor;font-size:.62rem;letter-spacing:.24em;text-transform:uppercase;opacity:.72}
.journey-bridge__body{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(14rem,.8fr);gap:clamp(2rem,7vw,8rem);align-items:end;padding-top:clamp(2rem,4vw,4rem)}
.journey-bridge__kicker{font-size:.72rem;letter-spacing:.2em;text-transform:uppercase;opacity:.76}
.journey-bridge__title{max-width:12ch;margin-top:1rem;font-size:clamp(2.3rem,5.5vw,5.5rem);line-height:.9;color:inherit}
.journey-bridge__action{max-width:20rem;color:rgba(255,255,255,.72);font-size:.95rem;line-height:1.6}
.journey-bridge__action a,.journey-bridge__wide-link{display:inline-flex;align-items:center;justify-content:space-between;gap:1rem;min-height:44px;margin-top:1.5rem;padding:.85rem 1rem;border:1px solid currentColor;color:var(--bridge-accent);font-size:.7rem;font-weight:700;letter-spacing:.18em;text-transform:uppercase;transition:background-color .25s ease,color .25s ease,transform .25s ease}
.journey-bridge__action a:hover,.journey-bridge__wide-link:hover{background:var(--bridge-accent);color:#0b0c0e;transform:translateY(-2px)}
.journey-bridge__action a:focus-visible,.journey-bridge__wide-link:focus-visible{outline:2px solid currentColor;outline-offset:4px}
.journey-bridge__steps{display:grid;gap:.75rem;margin:0;padding:0;list-style:none;color:rgba(255,255,255,.78);font-size:.78rem;letter-spacing:.12em;text-transform:uppercase}
.journey-bridge__steps li{display:flex;align-items:center;gap:.9rem;min-height:44px;border-bottom:1px solid rgba(255,255,255,.16)}
.journey-bridge__steps b{color:var(--bridge-accent);font-size:.65rem;letter-spacing:.12em}
.journey-bridge__wide-link{width:100%;margin-top:2.5rem}
@media (max-width:639px){
  .journey-bridge{margin:4rem 1.5rem 5rem;padding:1rem 1rem 1.25rem}
  .journey-bridge:after{right:1.5rem}
  .journey-bridge__meta{font-size:.52rem;letter-spacing:.16em}
  .journey-bridge__body{display:block;padding-top:2.5rem}
  .journey-bridge__title{font-size:clamp(2.3rem,12vw,3.8rem)}
  .journey-bridge__action,.journey-bridge__steps{margin-top:2.5rem}
  .journey-bridge__action a{width:100%}
}
@media (prefers-reduced-motion:reduce){
  .journey-bridge__action a,.journey-bridge__wide-link{transition:none}
}

/* ---------- Marquee ----------------------------------------------------- */
.marquee{display:flex;width:max-content;will-change:transform}

/* ---------- Magnetic buttons -------------------------------------------- */
.mag{will-change:transform;transition:transform .4s cubic-bezier(.16,1,.3,1)}
/* Übernimmt GSAP, muss die Transition weg — sonst interpolieren zwei Systeme
   dieselbe Eigenschaft gegeneinander und der Knopf zittert. */
.mag-gsap{transition:none}

/* ---------- Lenis ---------------------------------------------------------
   Aus lenis.css übernommen statt als zweite Datei geladen; dazu die eine
   Regel, die dort fehlt: mit aktivem Lenis darf CSS nicht auch noch weich
   scrollen, sonst laufen zwei Animationen gegen dieselbe Position. */
html.lenis,html.lenis body{height:auto}
html.lenis{scroll-behavior:auto}
.lenis:not(.lenis-autoToggle).lenis-stopped{overflow:clip}
.lenis [data-lenis-prevent],.lenis [data-lenis-prevent-wheel],
.lenis [data-lenis-prevent-touch]{overscroll-behavior:contain}
.lenis.lenis-smooth iframe{pointer-events:none}

/* ---------- Horizontal rail --------------------------------------------- */
.rail{display:flex;will-change:transform}

/* ---------- Mobile menu -------------------------------------------------- */
/* The panel is a fixed overlay; each page supplies its own background and type
   colour through Tailwind classes on it. Styled by class, not by #menu — an id
   would outrank every Tailwind utility on the same element. */
.menu-panel{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;
  opacity:0;visibility:hidden;overscroll-behavior:contain;
  transition:opacity .32s ease,visibility .32s}
.menu-open .menu-panel{opacity:1;visibility:visible}
/* Freezing the document keeps the page behind from scrolling under the overlay.
   overflow:hidden on <html> — not <body> — so the sticky pin stages survive. */
.menu-open{overflow:hidden}
.menu-panel a{opacity:0;transform:translateY(14px);
  transition:opacity .4s ease,transform .5s cubic-bezier(.16,1,.3,1)}
.menu-open .menu-panel a{opacity:1;transform:none}
.menu-open .menu-panel a:nth-child(1){transition-delay:.06s}
.menu-open .menu-panel a:nth-child(2){transition-delay:.11s}
.menu-open .menu-panel a:nth-child(3){transition-delay:.16s}
.menu-open .menu-panel a:nth-child(4){transition-delay:.21s}
.menu-open .menu-panel a:nth-child(5){transition-delay:.26s}
/* Hamburger → X, drawn from two bars so there is no icon swap to preload. */
/* place-content, not place-items: with the default stretch the two implicit
   rows grow to fill the 44px button, the bars end up 24px apart, and the close
   state folds into a chevron instead of a cross. */
.burger{display:grid;place-content:center;justify-items:center;gap:5px}
.burger span{display:block;width:22px;height:2px;background:currentColor;
  transition:transform .3s cubic-bezier(.16,1,.3,1),opacity .2s ease}
.menu-open .burger span:nth-child(1){transform:translateY(3.5px) rotate(45deg)}
.menu-open .burger span:nth-child(2){transform:translateY(-3.5px) rotate(-45deg)}
/* Both only exist below the breakpoint where the inline nav appears. Last in
   the block on purpose — .burger sets display above and would otherwise win. */
@media (min-width:768px){.menu-panel,.burger{display:none}}

/* ---------- Notbremse -----------------------------------------------------
   Gegenstück zum Inline-Skript im <head>. Greift, wenn motion.js nach sechs
   Sekunden nicht gestartet ist. Eine Seite, die ihren Inhalt versteckt und
   auf JavaScript wartet, muss einen Weg zurück haben. */
.notfall [data-reveal],.notfall [data-split]{opacity:1!important;transform:none!important}
.notfall [data-wipe]{clip-path:none!important}
.notfall .ln-i{transform:none!important;transition:none!important}
.notfall .media img{opacity:1!important}
.notfall #pre{display:none!important}

/* Keep the visually hidden skip link inside the layout box on narrow
   viewports; focus styles still move it into view through the page utilities. */
.sr-only{left:0;top:0;margin:0}
.eyebrow{overflow-wrap:anywhere}
@media (max-width:400px){header nav{padding-left:1rem!important;padding-right:1rem!important}}

/* ---------- Kill switches ----------------------------------------------- */
@media (prefers-reduced-motion:reduce){
  .ln-i{transform:none!important;transition:none!important}
  [data-reveal]{opacity:1!important;transform:none!important;transition:none!important}
  [data-wipe]{clip-path:none!important;transition:none!important}
  [data-parallax]{transform:none!important}
  .media img[data-parallax]{transform:none!important}
  .marquee{transform:none!important}
  .media img{opacity:1!important;transition:none!important}
  .menu-panel a{opacity:1!important;transform:none!important;transition:none!important}
  #pre{display:none}
  *{animation-duration:.001ms!important;animation-iteration-count:1!important}
}

/* Hub process stages: the central engine toggles one active stage while the
   pin progresses. Keeping this after the generic reveal rules prevents an
   already-observed stage from forcing every stage visible at once. */
.process[data-process-pin] .process-step:not(.is-active){opacity:0;transform:translateY(1rem)}
.process[data-process-pin] .process-step.is-active{opacity:1;transform:none}
@media (prefers-reduced-motion:reduce){
  .process[data-process-pin] .process-step{opacity:1!important;transform:none!important}
}

/* The hub turns the process into a normal document on small screens. This
   override must live after the shared sticky rule above; otherwise its
   one-screen clipping hides the lower part of step 03. */
@media (max-width:640px){
  .process[data-process-pin] .pin-stage{position:relative;top:auto;height:auto;min-height:100svh;overflow:visible}
}
