/* ==========================================================================
   David Supernak — Version 2: One-Screen Landing
   Dark & cinematic, monochrom. Alle Farben/Abstände als Tokens.
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0a0a0a;
  --surface: rgba(18, 18, 18, 0.92);
  --fg: #f4f4f2;
  --muted: #a3a3a3;
  --soft: rgba(244, 244, 242, 0.72);
  --line: rgba(244, 244, 242, 0.14);
  --line-strong: rgba(244, 244, 242, 0.32);

  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 180ms;
  --dur: 320ms;

  --gutter: clamp(1.25rem, 4.5vw, 4rem);
  --max: 80rem;
  --node: 48px;

  --z-bg: -2;
  --z-shade: -1;
  --z-pop: 20;
  --z-skip: 100;
}

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 380ms; animation-timing-function: var(--ease-in-out); }

/* --- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; touch-action: manipulation; }
h1, h2, h3, p, figure, ol, ul, dl, dd { margin: 0; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: fixed; left: 1rem; top: 1rem; z-index: var(--z-skip);
  padding: 0.75rem 1rem; background: var(--fg); color: var(--bg); font-weight: 500; border-radius: 6px;
  transform: translateY(-200%); transition: transform var(--dur-fast) var(--ease-out);
}
.skip:focus { transform: none; }

.eyebrow {
  font-family: var(--font-display); font-weight: 500; font-size: 0.9375rem;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--soft);
}
.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* --- Stage: alles auf einem Screen ---------------------------------------- */
.stage {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100dvh;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
}

/* Hintergrund-Slideshow */
.bg { position: absolute; inset: 0; z-index: var(--z-bg); background: var(--bg); }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1800ms var(--ease-in-out); }
.slide.is-active { opacity: 1; }
.slide img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); transform: scale(1.08); }
.slide.is-active img { animation: kenburns 7500ms var(--ease-out) both; }
.bg.is-paused .slide img { animation-play-state: paused; }
/* Querformat-Screens: Foto oben ausrichten und nur leicht vergrößern, damit der
   komplette Oberkörper über dem Zeitstrahl sichtbar ist; Person leicht rechts der Mitte. */
@media (min-aspect-ratio: 5/4) {
  .slide--subject-right img {
    position: absolute; top: -12%; left: -6%;
    width: 116%; max-width: none; height: auto; min-height: 112%; /* 112 % gleicht den Versatz nach oben aus */
    object-fit: cover; object-position: 50% 0;
    transform-origin: 50% 20%; /* Ken-Burns-Zoom um das Gesicht, damit es nicht wandert */
  }
}
/* Hochformat (Handy/Tablet): Gesicht in der Lücke rechts neben „DAVID"
   (unter der Eyebrow, über „SUPERNAK"). Ober- und Unterkante blenden ins Schwarz über. */
@media (max-aspect-ratio: 5/4) {
  .slide--subject-right img {
    position: absolute; top: 10vh; top: 10dvh;
    height: 84vh; height: 84dvh;
    width: 126vh; width: 126dvh; max-width: none;
    left: calc(68% - 63vh); left: calc(68% - 63dvh); /* Gesicht (Bildmitte) bei 68 % der Breite */
    object-fit: cover; object-position: 50% 0;
    transform-origin: 50% 22%;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 80%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 80%, transparent 100%);
  }
}
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.08); } }

.shade {
  position: absolute; inset: 0; z-index: var(--z-shade);
  background:
    linear-gradient(180deg, rgba(10,10,10,0.6) 0%, rgba(10,10,10,0.15) 22%, rgba(10,10,10,0.35) 50%, rgba(10,10,10,0.88) 78%, rgba(10,10,10,0.96) 100%),
    linear-gradient(90deg, rgba(10,10,10,0.5) 0%, transparent 65%);
}

/* --- Top-Bar -------------------------------------------------------------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding-block: 0.75rem; }
.brand {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.375rem; letter-spacing: 0.06em;
}
.menu { display: flex; gap: 0.25rem; }
.menu a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.75rem;
  font-family: var(--font-display); font-weight: 500; font-size: 1rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--soft); transition: color var(--dur-fast) ease;
}
.menu a:hover, .menu a[aria-current="page"] { color: var(--fg); }
.menu a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px; }

/* --- Hero ----------------------------------------------------------------- */
.hero { align-self: center; padding-block: clamp(1rem, 3vh, 2.5rem); }
.hero .eyebrow { text-shadow: 0 1px 12px rgba(0,0,0,0.7); }
.name {
  margin: 0.6rem 0 0.9rem;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(3.75rem, min(17vw, 15vh), 10.5rem);
  line-height: 0.84; text-transform: uppercase; text-shadow: 0 2px 24px rgba(0,0,0,0.35);
}
.name .line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.name .line > span { display: block; }
.slogan {
  font-family: var(--font-display); font-weight: 500;
  font-size: clamp(1.25rem, 2.2vw, 1.75rem); letter-spacing: 0.24em; text-transform: uppercase;
  margin-bottom: clamp(1.25rem, 3vh, 2rem);
}

.socials { display: flex; flex-wrap: wrap; gap: 0.625rem; list-style: none; padding: 0; }
.socials a {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--fg); background: rgba(10,10,10,0.25);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease, transform var(--dur) var(--ease-spring);
}
.socials a:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); transform: translateY(-2px); }
.socials a:active { transform: scale(0.95); }

/* --- Zeitstrahl (horizontal) ---------------------------------------------- */
.timeline { padding-bottom: clamp(0.75rem, 2.5vh, 1.75rem); }
.timeline__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }

.tl {
  --n: 4; --done: 3;
  position: relative; list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr));
}
/* Linie: durchgezogen für Erreichtes, gestrichelt bis zur nächsten Challenge */
.tl::before, .tl::after {
  content: ""; position: absolute; top: calc(var(--node) / 2); height: 1px; transform-origin: left;
  z-index: 0; pointer-events: none;
  animation: draw 1200ms var(--ease-out) both; animation-delay: 700ms;
}
.tl::before {
  left: calc(50% / var(--n));
  width: calc(100% * (var(--done) - 1) / var(--n));
  background: rgba(244, 244, 242, 0.55);
}
.tl::after {
  left: calc(100% * (var(--done) - 0.5) / var(--n));
  width: calc(100% * (var(--n) - var(--done)) / var(--n));
  background-image: linear-gradient(90deg, rgba(244, 244, 242, 0.55) 50%, transparent 0);
  background-size: 8px 1px;
  animation-delay: 1500ms;
}
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.tl-item { position: relative; display: flex; justify-content: center; }
.tl-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
  width: 100%; padding: 0 0.25rem 0.25rem; text-align: center; border-radius: 12px;
}
.tl-node {
  position: relative; z-index: 1; display: grid; place-items: center;
  width: var(--node); height: var(--node); border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line-strong); color: var(--fg);
  transition: background-color 600ms var(--ease-out), color 600ms var(--ease-out), border-color 600ms var(--ease-out), transform 700ms var(--ease-out);
}
/* Zustand wird per JS (.is-open, mit kurzer Hover-Verzögerung) gesteuert → kein Flackern beim Drüberziehen */
.tl-item.is-open .tl-node { background: var(--fg); color: var(--bg); border-color: var(--fg); transform: scale(1.06); }
.tl-btn:active .tl-node { transform: scale(0.97); }
.tl-item.is-next .tl-node::after {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  animation: pulse 2.6s var(--ease-out) infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(244,244,242,0.4); }
  100% { box-shadow: 0 0 0 14px rgba(244,244,242,0); }
}
.tl-label { display: flex; flex-direction: column; gap: 0.2rem; }
.tl-title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(0.9375rem, 1.3vw, 1.125rem); line-height: 1.1; letter-spacing: 0.05em; text-transform: uppercase;
}
.tl-date { font-size: 0.8125rem; color: var(--muted); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }

/* Hover-Animation (ruhig): Ring breitet sich sanft aus, Icon + Label heben sich leicht */
.tl-node::before {
  content: ""; position: absolute; inset: -1px; border-radius: 50%;
  border: 1px solid var(--fg); opacity: 0; pointer-events: none;
}
.tl-item.is-open .tl-node::before { animation: ring 1400ms var(--ease-out); }
@keyframes ring {
  0% { opacity: 0.35; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.45); }
}
.tl-node .icon { transition: transform 700ms var(--ease-out); }
.tl-item.is-open .tl-node .icon { transform: translateY(-1px); }
.tl-label { transition: transform 700ms var(--ease-out); }
.tl-date, .tl-title { transition: color 600ms var(--ease-out); }
.tl-item.is-open .tl-label { transform: translateY(-2px); }
.tl-item.is-open .tl-date { color: var(--fg); }

/* Entrance: Punkte nacheinander */
/* fill-mode "backwards": nach der Animation bleibt kein transform hängen,
   sonst würde das Item zum Bezugsrahmen der Info-Karte (Handy-Layout) */
.js .tl-item { animation: fade 700ms var(--ease-out) backwards; animation-delay: calc(900ms + var(--i, 0) * 90ms); }

/* Info-Karte */
.tl-pop {
  --tx: -50%;
  position: absolute; left: 50%; bottom: calc(100% + 14px); z-index: var(--z-pop);
  width: min(290px, calc(100vw - 2 * var(--gutter)));
  padding: 1.1rem 1.25rem 1.2rem; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px -24px rgba(0,0,0,0.9);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(var(--tx), 10px) scale(0.98); transform-origin: 50% 100%;
  transition: opacity 280ms ease, transform 320ms var(--ease-out), visibility 0s linear 320ms;
}
.tl-pop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 16px; } /* Hover-Brücke */
.tl-item.is-open .tl-pop {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translate(var(--tx), 0) scale(1);
  transition: opacity 500ms var(--ease-out), transform 650ms var(--ease-out), visibility 0s;
}
.tl-item:first-child .tl-pop { --tx: 0%; left: 0; transform-origin: 0 100%; }
.tl-item:last-child .tl-pop { --tx: 0%; left: auto; right: 0; transform-origin: 100% 100%; }

/* Karten-Inhalt gleitet gestaffelt ein */
.tl-item.is-open .tl-pop > * { animation: pop-in 700ms var(--ease-out) backwards; animation-delay: 80ms; }
.tl-item.is-open .tl-pop > :nth-child(2) { animation-delay: 160ms; }
.tl-item.is-open .tl-pop > :nth-child(3) { animation-delay: 240ms; }
.tl-item.is-open .tl-pop > :nth-child(4) { animation-delay: 320ms; }
@keyframes pop-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.pop-date { font-family: var(--font-display); font-size: 0.875rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.pop-title { margin-top: 0.3rem; font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1.05; text-transform: uppercase; }
.pop-text { margin-top: 0.6rem; font-size: 0.9375rem; line-height: 1.55; color: var(--soft); }
.pop-tag {
  display: inline-block; margin-left: 0.5rem; padding: 0.05rem 0.55rem; vertical-align: 0.1em;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-size: 0.75rem; letter-spacing: 0.14em; color: var(--fg);
}
.pop-stats { display: flex; gap: 1.25rem; margin-top: 0.9rem; padding: 0.8rem 0 0; list-style: none; border-top: 1px solid var(--line); }
.pop-stats li { display: flex; align-items: baseline; gap: 0.25rem; font-size: 0.8125rem; color: var(--muted); }
.pop-stats strong { font-family: var(--font-display); font-weight: 600; font-size: 1.5rem; line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; }

/* Handy: Karte über die volle Breite des Zeitstrahls */
@media (max-width: 699px) {
  :root { --node: 44px; }
  .tl-item { position: static; }
  .tl-pop, .tl-item:first-child .tl-pop, .tl-item:last-child .tl-pop {
    --tx: 0%; left: 0; right: 0; width: auto; transform-origin: 50% 100%;
  }
  .tl-title { font-size: 0.875rem; letter-spacing: 0.03em; }
  .tl-date { font-size: 0.75rem; }
}

/* --- Meta-Leiste unten ---------------------------------------------------- */
.meta {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem;
  padding-block: 0.25rem 0.5rem; border-top: 1px solid var(--line);
  font-size: 0.8125rem; color: var(--muted);
}
.meta__legal { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.25rem; }
.meta__legal a { display: inline-flex; align-items: center; min-height: 44px; transition: color var(--dur-fast) ease; }
.meta__legal a:hover { color: var(--fg); }
.meta__slides { display: flex; align-items: center; gap: 0.75rem; }
.caption { font-family: var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; }
.toggle {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-strong); color: var(--fg);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.toggle:hover { background: var(--fg); color: var(--bg); }
.toggle .icon { width: 16px; height: 16px; }
.toggle .icon-play { display: none; }
.toggle.is-paused .icon-play { display: block; }
.toggle.is-paused .icon-pause { display: none; }
@media (max-width: 599px) { .caption, .meta__copy { display: none; } }

/* --- Über mich (Split-Screen) --------------------------------------------- */
.stage--about { background: var(--bg); }
.about { display: grid; gap: clamp(2rem, 5vw, 4.5rem); align-items: center; padding-block: clamp(1rem, 3vh, 2rem); }
.about__photo { overflow: hidden; border-radius: 6px; aspect-ratio: 4 / 5; background: #121212; }
.about__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.about__text h1 {
  margin-top: 0.5rem; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(3rem, min(8vw, 10vh), 6rem); line-height: 0.88; text-transform: uppercase;
}
.about__text .lead { margin-top: 1.5rem; max-width: 34rem; font-size: clamp(1.125rem, 1.8vw, 1.375rem); line-height: 1.45; }
.about__text p:not(.lead):not(.eyebrow):not(.motto__text) { margin-top: 1rem; max-width: 34rem; color: var(--muted); }
.motto { margin: 2rem 0; padding-top: 1.5rem; border-top: 1px solid var(--line); max-width: 34rem; }
.motto .eyebrow { font-size: 0.8125rem; color: var(--muted); }
.about__text .motto__text {
  margin-top: 0.35rem; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.375rem, 1.8vw, 1.625rem); line-height: 1; letter-spacing: 0.12em; text-transform: uppercase;
}
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 2rem; margin: 2rem 0; padding-top: 1.5rem; border-top: 1px solid var(--line); max-width: 34rem; }
.facts dt { font-family: var(--font-display); font-size: 0.8125rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin-top: 0.2rem; font-family: var(--font-display); font-weight: 600; font-size: 1.25rem; line-height: 1.15; text-transform: uppercase; }
/* Große Screens: alles auf einen Blick. Reicht die Höhe nicht, darf die Seite
   scrollen (nichts wird abgeschnitten) und das Foto bleibt stehen. */
.stage--about { overflow: visible; }
.about__text p:not(.lead):not(.eyebrow):not(.motto__text) { font-size: 1rem; }
@media (min-width: 900px) {
  .about { grid-template-columns: 5fr 6fr; align-items: start; }
  .about__photo { position: sticky; top: 1.5rem; aspect-ratio: 4 / 5; max-height: calc(100dvh - 7rem); width: 100%; }
}

/* --- 404 ------------------------------------------------------------------ */
.stage--error { background: var(--bg); }
.error { align-self: center; padding-block: clamp(2rem, 6vh, 4rem); }
.error__code {
  margin: 0.4rem 0 1rem;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(7rem, min(30vw, 32vh), 16rem); line-height: 0.82; letter-spacing: -0.01em;
}
.error__code .line { display: block; overflow: hidden; padding-bottom: 0.03em; }
.error__code .line > span { display: block; }
.js .error__code .line > span { transform: translateY(105%); animation: rise 1100ms var(--ease-out) forwards; animation-delay: var(--delay, 200ms); }
.error__text { max-width: 28rem; color: var(--muted); margin-bottom: 2rem; }
.error__btn {
  display: inline-flex; align-items: center; gap: 0.6rem; min-height: 48px; padding: 0 1.4rem 0 1.1rem;
  border: 1px solid var(--line-strong); border-radius: 999px;
  font-family: var(--font-display); font-weight: 500; font-size: 1.0625rem; letter-spacing: 0.12em; text-transform: uppercase;
  transition: background-color 400ms var(--ease-out), color 400ms var(--ease-out), border-color 400ms var(--ease-out);
}
.error__btn .icon { width: 18px; height: 18px; transition: transform 500ms var(--ease-out); }
.error__btn:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.error__btn:hover .icon { transform: translateX(-3px); }

/* --- Rechtliches ---------------------------------------------------------- */
.legal { padding-block: clamp(3rem, 8vw, 6rem); }
.legal h1 { margin-top: 0.5rem; font-family: var(--font-display); font-weight: 700; font-size: clamp(3rem, 8vw, 5rem); line-height: 0.9; text-transform: uppercase; }
.legal h2 { margin: 2.25rem 0 0.6rem; font-family: var(--font-display); font-weight: 600; font-size: 1.375rem; text-transform: uppercase; }
.legal p { max-width: 40rem; color: var(--muted); }
.legal p + p { margin-top: 0.75rem; }

/* --- Intro-Animationen (nur mit JS) --------------------------------------- */
.js .name .line > span { transform: translateY(105%); animation: rise 1100ms var(--ease-out) forwards; animation-delay: var(--delay, 200ms); }
.js [data-intro] { opacity: 0; animation: fade 900ms var(--ease-out) forwards; animation-delay: var(--delay, 600ms); }
@keyframes rise { to { transform: none; } }
@keyframes fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .slide img, .slide.is-active img { animation: none !important; transform: none; }
  @view-transition { navigation: none; }
}
