/* =========================================================
   Steffen Klug — site styles
   Modern, minimal, himatt-inspired. Light/dark with toggle.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --c-bg: #f7f5f1;
  --c-bg-alt: #efece6;
  --c-surface: #ffffff;
  --c-text: #1b1b1a;
  --c-ink: #0b0c0e;
  --c-text-muted: #6b6a66;
  --c-line: #e3dfd6;
  --c-accent: #c8553d;
  --c-accent-soft: #e8b4a7;
  --c-blueprint: #2d4a6b;
  --c-blueprint-soft: #c9d6e4;
  --c-success: #3f7d58;
  --c-grid-line: rgba(43, 74, 107, 0.08);
  --c-link: #1b1b1a;

  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.03);
  --shadow-md: 0 6px 24px rgba(0,0,0,.06);
  --maxw: 1120px;
  --maxw-narrow: 760px;

  --f-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system,
            "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-serif: ui-serif, Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "JetBrains Mono",
            Menlo, monospace;

  --t-fast: 160ms cubic-bezier(.4,.0,.2,1);
  --t-med:  280ms cubic-bezier(.4,.0,.2,1);
  --t-slow: 600ms cubic-bezier(.2,.7,.2,1);
}

html[data-resolved="dark"],
html[data-theme="dark"] {
  --c-bg: #0f1115;
  --c-bg-alt: #14171d;
  --c-surface: #181c23;
  --c-text: #ececea;
  --c-ink: #ffffff;
  --c-text-muted: #9a9b97;
  --c-line: #262a31;
  --c-accent: #e89180;
  --c-accent-soft: #3a2620;
  --c-blueprint: #7fa6cf;
  --c-blueprint-soft: #1d2a3a;
  --c-success: #7cb693;
  --c-grid-line: rgba(127, 166, 207, 0.10);
  --c-link: #ececea;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 32px rgba(0,0,0,.5);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --c-bg: #0f1115;
    --c-bg-alt: #14171d;
    --c-surface: #181c23;
    --c-text: #ececea;
    --c-ink: #ffffff;
    --c-text-muted: #9a9b97;
    --c-line: #262a31;
    --c-accent: #e89180;
    --c-accent-soft: #3a2620;
    --c-blueprint: #7fa6cf;
    --c-blueprint-soft: #1d2a3a;
    --c-success: #7cb693;
    --c-grid-line: rgba(127, 166, 207, 0.10);
    --c-link: #ececea;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 8px 32px rgba(0,0,0,.5);
  }
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--f-sans);
  font-size: 17px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11", "kern";
  transition: background var(--t-med), color var(--t-med);
}
.tabular { font-variant-numeric: tabular-nums; letter-spacing: 0; }
img, svg { max-width: 100%; display: block; }
a { color: var(--c-link); text-decoration: none; }
a:hover { color: var(--c-accent); }
button { font: inherit; color: inherit; cursor: pointer; }

h1, h2, h3, h4 {
  font-family: var(--f-sans);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 .4em;
  color: var(--c-text);
}
h1 { font-size: clamp(2.2rem, 4.6vw, 3.6rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1em; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.container.narrow, .narrow { max-width: var(--maxw-narrow); }

.muted { color: var(--c-text-muted); }
.eyebrow {
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  margin: 0 0 .6em;
  font-weight: 600;
}
.lede { font-size: 1.15rem; color: var(--c-text-muted); max-width: 60ch; }
.accent { color: var(--c-accent); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--c-text); color: var(--c-bg);
  padding: 10px 14px; border-radius: 0 0 8px 0; z-index: 1000;
}
.skip-link:focus { left: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--c-bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.site-header.is-scrolled { border-bottom-color: var(--c-line); }
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; letter-spacing: -.01em;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--c-surface); border: 1px solid var(--c-line);
  color: var(--c-text);
}
.site-nav { display: flex; align-items: center; }
.nav-menu {
  display: flex; align-items: center; gap: 6px;
  list-style: none; margin: 0; padding: 0;
}
.nav-menu a {
  display: inline-block; padding: 8px 12px; border-radius: 999px;
  color: var(--c-text-muted); font-size: .95rem; font-weight: 500;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-menu a:hover { color: var(--c-text); background: var(--c-bg-alt); }
.nav-menu a[aria-current="page"] { color: var(--c-text); background: var(--c-bg-alt); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-left: 4px;
  border: 1px solid var(--c-line); background: var(--c-surface);
  border-radius: 999px; color: var(--c-text);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.theme-toggle:hover { background: var(--c-bg-alt); }
.theme-toggle:active { transform: scale(.96); }
.theme-toggle .i-sun  { display: none; }
.theme-toggle .i-moon { display: block; }
html[data-resolved="dark"] .theme-toggle .i-sun  { display: block; }
html[data-resolved="dark"] .theme-toggle .i-moon { display: none; }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border: 1px solid var(--c-line);
    background: var(--c-surface); border-radius: 10px; gap: 4px; flex-direction: column;
  }
  .nav-toggle .bar { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; }
  .nav-menu {
    position: absolute; top: 64px; right: 16px; left: 16px;
    background: var(--c-surface); border: 1px solid var(--c-line);
    border-radius: var(--radius); padding: 10px; gap: 4px;
    flex-direction: column; align-items: stretch;
    box-shadow: var(--shadow-md);
    transform-origin: top right;
    transform: scale(.96); opacity: 0; pointer-events: none;
    transition: transform var(--t-fast), opacity var(--t-fast);
  }
  .nav-menu a { padding: 12px 14px; }
  .site-nav.is-open .nav-menu { transform: scale(1); opacity: 1; pointer-events: auto; }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(72px, 12vw, 160px) 0 clamp(56px, 9vw, 120px);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: -10% -10% auto auto;
  width: 60vw; height: 60vw; max-width: 720px; max-height: 720px;
  background: radial-gradient(closest-side, var(--c-accent-soft), transparent 70%);
  filter: blur(20px); opacity: .6; pointer-events: none; z-index: 0;
}
.hero > .container { position: relative; z-index: 1; }
.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 1.05; letter-spacing: -.025em;
  margin-bottom: .4em; max-width: 18ch;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font-weight: 600; font-size: .96rem;
  border: 1px solid transparent; transition: all var(--t-fast);
  white-space: nowrap;
}
.btn.primary { background: var(--c-text); color: var(--c-bg); }
.btn.primary:hover { background: var(--c-accent); color: #fff; }
.btn.ghost { border-color: var(--c-line); background: transparent; color: var(--c-text); }
.btn.ghost:hover { background: var(--c-bg-alt); }

/* ---------- Sections / cards ---------- */
.section { padding: clamp(64px, 9vw, 120px) 0; }
.section-alt { background: var(--c-bg-alt); border-block: 1px solid var(--c-line); }
.section-head { margin-bottom: 48px; max-width: 60ch; }

.cards {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius-lg); transition: transform var(--t-med), border-color var(--t-fast), box-shadow var(--t-med);
}
.card a {
  display: block; padding: 26px 24px 24px; height: 100%;
  color: var(--c-text);
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in oklab, var(--c-accent) 50%, var(--c-line)); box-shadow: var(--shadow-md); }
.card h3 { margin: 12px 0 8px; font-size: 1.2rem; }
.card p  { color: var(--c-text-muted); margin-bottom: 14px; }
.card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--c-bg-alt); color: var(--c-text);
}
.card-link { color: var(--c-accent); font-weight: 600; font-size: .95rem; }

/* ---------- Page header ---------- */
.page { padding: clamp(56px, 8vw, 96px) 0 clamp(72px, 9vw, 120px); }
.page-header { margin-bottom: 40px; }
.prose { font-size: 1.05rem; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose blockquote {
  margin: 1.4em 0; padding: 8px 18px; border-left: 3px solid var(--c-accent);
  color: var(--c-text-muted); font-style: italic;
}
.prose code {
  font-family: var(--f-mono); font-size: .92em;
  background: var(--c-bg-alt); padding: 2px 6px; border-radius: 6px;
}
.prose pre {
  background: var(--c-bg-alt); padding: 16px 18px; border-radius: var(--radius);
  overflow: auto; border: 1px solid var(--c-line);
}
.prose pre code { background: transparent; padding: 0; }
.prose img { border-radius: var(--radius); }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose hr { border: 0; border-top: 1px solid var(--c-line); margin: 2em 0; }

.tags { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li {
  font-size: .8rem; color: var(--c-text-muted);
  border: 1px solid var(--c-line); padding: 3px 10px; border-radius: 999px;
  background: var(--c-surface);
}
.tags.small li { font-size: .72rem; padding: 2px 8px; }

.links { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 14px; }
.links a { color: var(--c-accent); font-weight: 600; }

.back { margin-top: 40px; }
.back a { color: var(--c-text-muted); }
.back a:hover { color: var(--c-accent); }

.hero-figure { margin: 0 0 32px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--c-line); }

/* ---------- Blog list ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li + li { border-top: 1px solid var(--c-line); }
.post-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 18px;
  align-items: baseline; padding: 22px 0; color: var(--c-text);
}
.post-row time { color: var(--c-text-muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.post-row .post-title { font-size: 1.15rem; font-weight: 600; }
.post-row .post-sub { display: block; margin-top: 4px; font-size: .95rem; }
.post-row:hover .post-title { color: var(--c-accent); }
@media (max-width: 600px) {
  .post-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Grids (projects / architectures / books) ---------- */
.grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.grid-card {
  background: var(--c-surface); border: 1px solid var(--c-line);
  border-radius: var(--radius-lg); overflow: hidden;
  transition: transform var(--t-med), border-color var(--t-fast), box-shadow var(--t-med);
}
.grid-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in oklab, var(--c-accent) 50%, var(--c-line)); }
.grid-card a { display: block; height: 100%; color: var(--c-text); }
.grid-thumb { aspect-ratio: 16 / 10; background: var(--c-bg-alt); overflow: hidden; }
.grid-thumb.cover { aspect-ratio: 3 / 4; }
.grid-thumb img { width: 100%; height: 100%; object-fit: cover; }
.grid-body { padding: 18px 20px 20px; }
.grid-body h3 { margin: 6px 0 6px; font-size: 1.1rem; }
.grid-body .muted { font-size: .95rem; }

.section-divider { margin: 56px 0 20px; font-size: 1.1rem; letter-spacing: -.01em; }
.section-divider::before {
  content: ""; display: inline-block; width: 28px; height: 2px;
  background: var(--c-accent); margin-right: 12px; vertical-align: middle;
}

/* ---------- CV / scrollorama ---------- */
.cv { padding: clamp(56px, 8vw, 96px) 0 clamp(72px, 9vw, 120px); }
.cv-intro h1 .muted { font-weight: 400; }

/* Three-track grid:
   [ left rail dates ] [ center stage ] [ right rail icons ]
   The phasing background canvas sits absolutely behind the center column. */
.cv-scroll {
  position: relative;
  display: grid;
  grid-template-columns: 180px 1fr 120px;
  gap: clamp(24px, 4vw, 56px);
  margin-top: 32px;
  align-items: start;
  /* Continuous progress (0..1) — written per scroll frame by main.js */
  --cv-rail-fill: 0;
  --cv-active-index: 0;
  --cv-active-progress: 0;
  --cv-bg-opacity: 0;
}

/* --- Phasing background canvas (two layers cross-fade) --- */
.cv-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: var(--radius-lg);
}
.cv-bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  filter: blur(6px) saturate(60%);
  transition: opacity var(--t-slow) ease;
  will-change: opacity;
}
/* Scrubbed: opacity is the active scene's progress curve (sin(πp), 0..1). */
.cv-bg-layer.is-active { opacity: calc(var(--cv-bg-opacity, 0) * 0.15); }
html[data-resolved="dark"] .cv-bg-layer.is-active {
  opacity: calc(var(--cv-bg-opacity, 0) * 0.28);
}
.cv-bg-vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 60% at 50% 40%, transparent, var(--c-bg) 100%);
  mix-blend-mode: normal;
}

/* --- Left rail: dates + active dot timeline --- */
.cv-rail { position: relative; z-index: 1; }
.cv-sticky {
  position: sticky;
  top: 100px;
  padding: 8px 0;
}
.cv-sticky .eyebrow { margin-bottom: 16px; }

.cv-timeline {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
  position: relative;
}
.cv-timeline::before {
  content: ""; position: absolute;
  left: 6px; top: 6px; bottom: 6px; width: 2px;
  background: var(--c-line); border-radius: 2px;
}
/* Filled progress rail — full-height gradient, revealed top-down via inset. */
.cv-timeline::after {
  content: ""; position: absolute;
  left: 6px; top: 6px; bottom: 6px; width: 2px;
  background: linear-gradient(to bottom,
              var(--c-accent) 0%, var(--c-blueprint) 100%);
  border-radius: 2px;
  /* clip from the bottom up; (1 - fill) of the rail height is hidden */
  clip-path: inset(0 0 calc((1 - var(--cv-rail-fill, 0)) * 100%) 0);
  transition: clip-path 120ms linear;
  will-change: clip-path;
}
.cv-timeline li {
  --p: 0; /* per-item progress 0..1 — written by main.js */
  position: relative;
  padding: 10px 8px 10px 28px;
  border-radius: 10px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  background: color-mix(in oklab, var(--c-bg-alt) calc(var(--p) * 100%), transparent);
  transition: background 120ms linear;
}
.cv-timeline li:hover {
  background: color-mix(in oklab, var(--c-bg-alt)
                        calc(max(var(--p), 0.6) * 100%), transparent);
}

/* Continuous dot ramp: empty → filled as --p goes 0 → 1 */
.cv-timeline .dot {
  position: absolute; left: 0; top: 16px;
  width: 14px; height: 14px; border-radius: 50%;
  background: color-mix(in oklab, var(--c-accent) calc(var(--p) * 100%), var(--c-bg));
  border: 2px solid color-mix(in oklab, var(--c-accent) calc(var(--p) * 100%), var(--c-line));
  transform: scale(calc(1 + var(--p) * 0.18));
  box-shadow: 0 0 0 calc(var(--p) * 4px)
              color-mix(in oklab, var(--c-accent) 25%, transparent);
  transition: background 120ms linear, border-color 120ms linear,
              transform 120ms linear, box-shadow 120ms linear;
}
.cv-timeline .period {
  font-family: var(--f-mono);
  font-size: .76rem; letter-spacing: .04em;
  color: color-mix(in oklab, var(--c-accent) calc(var(--p) * 100%), var(--c-text-muted));
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: color 120ms linear;
}
.cv-timeline .role-mini {
  font-size: .92rem; font-weight: 600; color: var(--c-text);
  letter-spacing: -.01em;
}

/* --- Center stage --- */
.cv-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(64px, 10vw, 120px);
}
.cv-scene {
  scroll-margin-top: 120px;
  background: color-mix(in oklab, var(--c-surface) 92%, transparent);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 4vw, 44px);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px) saturate(140%);
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  opacity: 0; transform: translateY(28px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(.2,.7,.2,1);
}
.cv-scene.is-visible { opacity: 1; transform: none; }
.cv-scene h2 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  margin-bottom: 4px;
  color: var(--c-ink);
}
.cv-scene .eyebrow {
  font-family: var(--f-mono);
  letter-spacing: .04em;
  text-transform: none;
  font-size: .8rem;
}
.cv-scene .lede { margin-top: 12px; font-size: 1.05rem; color: var(--c-text); }
.cv-scene .bullets {
  list-style: none; padding: 0; margin: 18px 0 0;
  display: flex; flex-direction: column; gap: 10px;
}
.cv-scene .bullets li {
  position: relative; padding-left: 22px; color: var(--c-text);
}
.cv-scene .bullets li::before {
  content: ""; position: absolute; left: 0; top: 11px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-accent);
}

/* --- Right rail: per-scene icon / monogram cues --- */
.cv-rail-right { position: relative; z-index: 1; }
.cv-cues {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: clamp(64px, 10vw, 120px);
}
.cv-cue {
  --p: 0; /* per-item progress 0..1 — written by main.js */
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  padding-top: clamp(28px, 4vw, 44px); /* align with scene padding */
  text-align: center;
  opacity: calc(0.55 + var(--p) * 0.45);
  transition: opacity 120ms linear;
}
.cv-cue-frame {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--c-surface);
  border: 1px solid color-mix(in oklab,
                              var(--c-accent) calc(var(--p) * 60%),
                              var(--c-line));
  display: inline-flex; align-items: center; justify-content: center;
  overflow: hidden;
  transform: scale(calc(1 + var(--p) * 0.05));
  box-shadow:
    0 0 0 calc(var(--p) * 4px) color-mix(in oklab, var(--c-accent) 18%, transparent),
    var(--shadow-sm);
  transition: transform 120ms linear, border-color 120ms linear,
              box-shadow 120ms linear;
}
.cv-cue-frame img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.cv-cue-monogram {
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: .02em;
  color: var(--c-blueprint);
}
html[data-resolved="dark"] .cv-cue-monogram { color: var(--c-blueprint); }
.cv-cue-org {
  font-size: .72rem;
  font-family: var(--f-mono);
  letter-spacing: .02em;
  color: var(--c-text-muted);
  max-width: 100px;
  line-height: 1.25;
}

.cv-extra { margin-top: clamp(64px, 9vw, 96px); }
.skill-groups {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.skill-groups h3 {
  font-size: .82rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--c-text-muted); margin-bottom: 10px;
}
.cert-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.cert-list li {
  background: var(--c-surface); border: 1px solid var(--c-line);
  padding: 14px 18px; border-radius: var(--radius);
}
.cert-list li::before {
  content: "✓"; color: var(--c-accent); font-weight: 700; margin-right: 10px;
}

/* Tablet: drop right rail, keep dates on left */
@media (max-width: 1024px) {
  .cv-scroll { grid-template-columns: 160px 1fr; }
  .cv-rail-right { display: none; }
}

/* Mobile: collapse all rails into single column */
@media (max-width: 720px) {
  .cv-scroll { grid-template-columns: 1fr; gap: 28px; }
  .cv-sticky { position: static; padding-bottom: 0; }
  .cv-timeline { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .cv-timeline::before { display: none; }
  .cv-timeline li {
    padding: 6px 12px;
    border: 1px solid var(--c-line);
    border-radius: 999px;
  }
  .cv-timeline .dot { display: none; }
  .cv-timeline .role-mini { display: none; }
  .cv-bg { display: none; }
  .cv-scene { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--c-line);
  padding: 40px 0 56px;
  margin-top: clamp(64px, 9vw, 120px);
  background: var(--c-bg);
}
.footer-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 18px;
}
.footer-inner p { margin: 0; font-size: .92rem; }
.social { list-style: none; padding: 0; margin: 0; display: flex; gap: 18px; }
.social a { color: var(--c-text-muted); font-size: .92rem; }
.social a:hover { color: var(--c-accent); }

/* ---------- Reveal-on-scroll ---------- */
.reveal,
.reveal-children > * {
  opacity: 0; transform: translateY(14px);
  transition: opacity 600ms ease, transform 600ms cubic-bezier(.2,.7,.2,1);
  will-change: opacity, transform;
}
.reveal.is-visible,
.reveal-children > .is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .reveal-children > *, .cv-scene { opacity: 1 !important; transform: none !important; }
  .cv-bg-layer { transition: none !important; }
  .cv-cue { opacity: 1 !important; }
  .cv-timeline::after,
  .cv-timeline li,
  .cv-timeline li .dot,
  .cv-timeline li .period,
  .cv-cue-frame { transition: none !important; }
}

/* ---------- Scroll-driven enhancement (Chromium) ----------
   When the browser supports CSS Scroll-Driven Animations, scenes get a
   smoother view-timeline reveal. Falls back silently to IntersectionObserver. */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .cv-scene {
      /* Override IO-driven defaults so animation is fully scroll-linked. */
      opacity: 0;
      transform: translateY(28px);
      animation: cv-scene-reveal both;
      animation-timeline: view();
      animation-range: entry 5% cover 25%;
    }
  }
}
@keyframes cv-scene-reveal {
  to { opacity: 1; transform: none; }
}

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Legal pages (Impressum, Datenschutz) ---------- */
.page.legal { padding-bottom: clamp(56px, 7vw, 96px); }
.page.legal .small { font-size: .85rem; }

.legal-prose h2 {
  margin-top: 2.4em;
  padding-bottom: .35em;
  border-bottom: 1px solid var(--c-line);
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
  letter-spacing: -.015em;
}
.legal-prose h2:first-child { margin-top: 0; }
.legal-prose h3 {
  margin-top: 1.8em;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-muted);
  font-weight: 600;
}
.legal-prose h4 {
  margin-top: 1.4em;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--c-text);
}
.legal-prose address {
  font-style: normal;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-accent);
  padding: 14px 18px;
  border-radius: var(--radius);
  margin: 0 0 1.2em;
  line-height: 1.7;
  font-variant-numeric: tabular-nums;
}
.legal-prose .legal-contact {
  list-style: none; padding: 0; margin: 0 0 1.4em;
  display: flex; flex-direction: column; gap: 6px;
}
.legal-prose .legal-contact strong {
  display: inline-block; min-width: 5.5em; color: var(--c-text-muted);
  font-weight: 600;
}
.legal-prose hr {
  margin: 3em 0;
  border: 0;
  border-top: 1px dashed var(--c-line);
}
.legal-prose .legal-lang { scroll-margin-top: 100px; }
.legal-prose section[lang] { margin-top: 0; }
.legal-prose .back { margin-top: 3em; padding-top: 1.4em; border-top: 1px solid var(--c-line); }

/* ---------- Footer legal nav ---------- */
.footer-links { flex: 1 1 auto; min-width: 0; }
.legal-nav {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 14px;
  justify-content: center;
}
.legal-nav a {
  color: var(--c-text-muted); font-size: .92rem;
  border-bottom: 1px dotted transparent;
  padding-bottom: 1px;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.legal-nav a:hover { color: var(--c-accent); border-bottom-color: currentColor; }

@media (max-width: 720px) {
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 14px; }
  .legal-nav { justify-content: flex-start; }
}
