:root {
  --bg: #06070c;
  --bg-2: #0c0f18;
  --ink: #f4efe6;
  --muted: #8b8fa3;
  --line: rgba(255, 255, 255, 0.08);
  --glass: rgba(14, 16, 26, 0.72);
  --c0: #fff1a8;
  --c1: #ffb000;
  --c2: #ff6a2b;
  --c3: #ff2e7e;
  --teal: #3de0d0;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--c1); text-decoration: none; }
a:hover { text-decoration: underline; }
b { font-weight: 600; color: #fff; }
em { font-style: italic; }

#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--c1), var(--c2), var(--c3));
  z-index: 100; box-shadow: 0 0 12px var(--c2);
}

.kicker, .step-kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c1);
}

/* ---------------- HERO ---------------- */
#hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 600px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: radial-gradient(ellipse 80% 60% at 70% 50%, #1a1006 0%, var(--bg) 70%);
}
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, var(--bg) 0%, rgba(6,7,12,0.85) 30%, rgba(6,7,12,0) 65%);
  pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 2;
  padding: 0 6vw;
  max-width: 760px;
}
.hero-inner h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(4rem, 11vw, 10rem);
  line-height: 0.88;
  letter-spacing: -0.02em;
  margin: 1.2rem 0 1.6rem;
}
.hero-inner h1 em {
  background: linear-gradient(100deg, var(--c0) 0%, var(--c1) 35%, var(--c2) 70%, var(--c3) 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  padding-right: 0.08em;
}
.lede { font-size: clamp(1.05rem, 1.5vw, 1.3rem); color: #cfcbc3; max-width: 34em; font-weight: 300; }
.lede .num { font-family: var(--mono); color: var(--c1); font-weight: 500; }
.hero-stats { display: flex; gap: 2.8rem; margin-top: 2.6rem; flex-wrap: wrap; }
.hero-stats > div { display: flex; flex-direction: column; border-left: 1px solid var(--line); padding-left: 1rem; }
.hero-stats .big { font-family: var(--serif); font-size: 3rem; line-height: 1; }
.hero-stats .unit { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 0.4rem; }

.scroll-hint {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem; z-index: 2;
  font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.25em; text-transform: uppercase; color: var(--muted);
}
.scroll-hint i { width: 1px; height: 48px; background: linear-gradient(var(--c1), transparent); animation: drip 2s ease-in-out infinite; transform-origin: top; }
@keyframes drip { 0% { transform: scaleY(0); opacity: 1; } 70% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------------- SCROLLY ---------------- */
#scrolly { position: relative; }
#graphic {
  position: sticky; top: 0;
  height: 100vh; height: 100lvh; width: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse 70% 70% at 68% 50%, #0f0b07 0%, var(--bg) 75%);
}
#particles, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
#overlay { pointer-events: none; }
#overlay .interactive { pointer-events: all; }

#year-badge {
  position: absolute; right: 3vw; bottom: 4vh;
  font-family: var(--serif); font-size: clamp(4rem, 8vw, 7.5rem); line-height: 1;
  color: rgba(255, 176, 0, 0.9);
  text-shadow: 0 0 40px rgba(255, 120, 0, 0.45);
  opacity: 0; transition: opacity 0.5s;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
#year-badge small { display: block; font-family: var(--mono); font-size: 0.85rem; color: var(--muted); letter-spacing: 0.15em; text-align: right; text-shadow: none; }
#year-badge.on { opacity: 1; }

#legend {
  position: absolute; right: 3vw; top: 4vh;
  display: flex; gap: 1.1rem; flex-wrap: wrap; justify-content: flex-end;
  font-family: var(--mono); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.05em;
  opacity: 0; transition: opacity 0.5s;
}
#legend.on { opacity: 1; }
#legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
#legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
#legend b { font-weight: 400; }
#legend .short { display: none; }

#steps {
  position: relative;
  z-index: 3;
  margin-top: -100vh;
  margin-top: -100lvh;
  padding: 0 0 40vh 5vw;
  pointer-events: none;
}
.step {
  pointer-events: all;
  width: min(420px, 88vw);
  margin: 0 0 85vh;
  padding: 1.8rem 1.9rem;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  opacity: 0.35;
  transform: translateY(20px);
  transition: opacity 0.6s, transform 0.6s, border-color 0.6s;
}
.step:first-child { margin-top: 50vh; }
.sticky-wrap { height: 260vh; margin-bottom: 40vh; pointer-events: none; }
.step[data-progress] { position: sticky; top: 30vh; margin-bottom: 0; }
.step.active { opacity: 1; transform: none; border-color: rgba(255, 176, 0, 0.25); }
.step h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 2.1rem; line-height: 1.08;
  margin: 0.6rem 0 1rem;
}
.step p { font-size: 0.97rem; color: #cfcbc3; margin-bottom: 0.8rem; }
.step p:last-child { margin-bottom: 0; }
.step .muted { color: var(--muted); font-size: 0.85rem; }
.hl { color: var(--c2); font-style: italic; }

.chip { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 0.5rem; white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.c0 { color: var(--c0); } .c1 { color: var(--c1); } .c2 { color: var(--c2); } .c3 { color: var(--c3); }

#bez-list { margin: 0.4rem 0 0.8rem; display: grid; gap: 1px; }
.bez-row { display: grid; grid-template-columns: 9.5rem 1fr 3rem; align-items: center; gap: 0.6rem; font-size: 0.74rem; line-height: 1.45; cursor: default; }
.bez-row .bn { color: #cfcbc3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bez-row .bar { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--c1), var(--c2)); }
.bez-row .bv { font-family: var(--mono); color: var(--muted); text-align: right; font-size: 0.72rem; }
.bez-row.hover .bn, .bez-row.hover .bv { color: #fff; }
.bez-row .code { display: none; font-style: normal; font-family: var(--mono); color: var(--c1); margin-right: 0.45rem; }
.bez-row:focus-visible { outline: 1px solid var(--c1); outline-offset: 2px; border-radius: 3px; }

/* SVG */
.axis text { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.axis line, .axis path { stroke: rgba(255, 255, 255, 0.12); }
.grid line { stroke: rgba(255, 255, 255, 0.05); }
.solid .seg { stroke: var(--bg); stroke-width: 0.6; }
.bar-total { fill: #cfcbc3; font-family: var(--mono); font-size: 11px; }
.chart-note { fill: var(--muted); font-family: var(--mono); font-size: 11px; }
.anno-text { fill: #e6e2da; font-family: var(--mono); font-size: 11px; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
.anno text { fill: #cfcbc3; font-family: var(--mono); font-size: 11px; }
.anno line { stroke: rgba(255, 255, 255, 0.35); stroke-dasharray: 2 3; }
.bez-path { fill-opacity: 0.55; stroke: rgba(255, 255, 255, 0.18); stroke-width: 0.8; transition: fill-opacity 0.3s, stroke 0.3s; }
.bez-path.hover { fill-opacity: 0.85; stroke: #fff; stroke-width: 1.5; }
.bez-outline { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 0.7; }
.bez-label { fill: #fff; font-family: var(--sans); font-size: 11px; font-weight: 600; text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,0.7); stroke-width: 3px; pointer-events: none; }
.bez-label tspan.v { font-family: var(--mono); font-weight: 400; font-size: 10px; fill: var(--c0); }
.big-circle { stroke: rgba(255, 255, 255, 0.5); stroke-width: 0.6; cursor: pointer; transition: stroke 0.2s, stroke-width 0.2s; }
.big-circle.sel { stroke: #fff; stroke-width: 2.5; }
.big-circle:focus { outline: none; }
.big-circle:focus-visible { stroke: var(--c1); stroke-width: 3; }
.big-circle.dim { opacity: 0.25; }
.chart-title { fill: #fff; font-family: var(--serif); font-size: 22px; }
.chart-sub { fill: var(--muted); font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.chart-sub.nocaps { text-transform: none; letter-spacing: 0.03em; }

/* Recent panel */
#recent {
  position: fixed; right: 2vw; bottom: 3vh; transform: translateX(120%);
  width: 270px; max-height: 58vh; overflow: auto;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 16px; padding: 1.1rem 1.2rem;
  z-index: 20; transition: transform 0.6s cubic-bezier(.2,.8,.2,1);
}
#recent.on { transform: none; }
.recent-title {
  display: flex; align-items: center; gap: 0.4rem; width: 100%;
  background: none; border: 0; padding: 0; color: var(--ink); text-align: left; cursor: default;
  font-family: var(--serif); font-size: 1.3rem;
}
.recent-title i { display: none; }
.recent-hint { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); margin-bottom: 0.8rem; letter-spacing: 0.05em; }
.recent-empty { font-size: 0.8rem; color: var(--muted); font-style: italic; }
.recent-item {
  border-top: 1px solid var(--line); padding: 0.75rem 0; cursor: pointer;
  animation: slidein 0.4s ease-out;
}
.recent-item:hover .ri-name { color: var(--c1); }
.ri-name { font-weight: 600; font-size: 0.88rem; line-height: 1.3; transition: color 0.2s; }
.ri-op { font-size: 0.75rem; color: var(--muted); margin: 0.15rem 0 0.4rem; }
.ri-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem 0.8rem; font-family: var(--mono); font-size: 0.68rem; color: #cfcbc3; }
.ri-facts span { color: var(--muted); }
@keyframes pulse { 0% { color: var(--c1); } 100% { color: var(--ink); } }
.nocaps { text-transform: none; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* Tooltip */
#tooltip {
  position: fixed; pointer-events: none; z-index: 50;
  background: rgba(10, 11, 18, 0.95); border: 1px solid rgba(255, 176, 0, 0.3);
  border-radius: 10px; padding: 0.6rem 0.8rem; font-size: 0.8rem;
  max-width: 260px; opacity: 0; transition: opacity 0.15s;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
#tooltip.on { opacity: 1; }
#tooltip .tt-t { font-weight: 600; margin-bottom: 0.2rem; }
#tooltip .tt-s { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }

/* ---------------- OUTRO ---------------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 6vw; }
.section-title { font-family: var(--serif); font-weight: 400; font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.05; margin: 0.8rem 0 2.5rem; }
.section-title em { color: var(--c1); }

#levers { padding: 18vh 0 12vh; position: relative; background: linear-gradient(var(--bg), var(--bg-2)); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.card {
  position: relative; padding: 2rem 1.6rem 1.8rem;
  border: 1px solid var(--line); border-radius: 18px;
  background: linear-gradient(160deg, rgba(255,176,0,0.06), rgba(255,255,255,0.01) 50%);
  transition: transform 0.4s, border-color 0.4s;
}
.card:hover { transform: translateY(-6px); border-color: rgba(255,176,0,0.35); }
.card-num { font-family: var(--mono); font-size: 0.75rem; color: var(--c1); }
.card-stat { display: block; font-family: var(--serif); font-size: 3.4rem; line-height: 1; margin-top: 1rem;
  background: linear-gradient(100deg, var(--c0), var(--c1) 50%, var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card-stat-label { display: block; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 0.3rem; }
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.15; margin: 0.8rem 0 0.8rem; }
.card p { color: #bfbbb3; font-size: 0.93rem; }
.card-source { margin-top: 1.4rem; font-size: 0.75rem; color: var(--muted); }


#method { padding: 8vh 0 6vh; border-top: 1px solid var(--line); background: var(--bg); }
#method h3 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; margin-bottom: 1rem; }
#method ul { list-style: none; display: grid; gap: 0.6rem; }
#method li { font-size: 0.8rem; color: var(--muted); max-width: 70em; }
#method li b { color: #cfcbc3; font-weight: 500; }
.fine { margin-top: 2rem; font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }

/* Barrierefreiheit */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; z-index: 200; background: var(--c1); color: #111; padding: 0.5rem 0.9rem; border-radius: 8px; font-size: 0.85rem; }
.skip:focus { top: 1rem; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--c1); outline-offset: 3px; border-radius: 4px; }

/* Hinweise je nach Eingabegerät */
.hint-touch { display: none; }
@media (hover: none) {
  .hint-mouse { display: none; }
  .hint-touch { display: inline; }
}

/* niedrige Viewports: Scroll-Hinweis kollidiert sonst mit den Kennzahlen */
@media (max-height: 760px) { .scroll-hint { display: none; } }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 860px) {
  #hero::after { background: linear-gradient(180deg, rgba(6,7,12,0) 0%, rgba(6,7,12,0.6) 28%, rgba(6,7,12,0.96) 46%); }
  .hero-inner .kicker { display: inline-block; background: rgba(6, 7, 12, 0.7); padding: 0.2em 0.45em; border-radius: 4px; }
  #step-big, #step-big-map { margin-bottom: calc(85vh + 1rem); padding-bottom: 1.6rem; }
  .hero-inner { align-self: flex-end; padding-bottom: 9vh; }
  .hero-stats { gap: 1.4rem; }
  .hero-stats .big { font-size: 2.2rem; }
  #steps { padding-left: 0; display: flex; flex-direction: column; align-items: center; }
  .step { width: 92vw; padding: 1.1rem 1.2rem; background: rgba(12, 14, 22, 0.9); }
  .step:first-child { margin-top: 70vh; }
  .step h2 { font-size: 1.5rem; margin: 0.4rem 0 0.6rem; }
  .step p { font-size: 0.88rem; margin-bottom: 0.6rem; }
  .step[data-progress] { top: 58vh; }
  .sticky-wrap { margin-bottom: 85vh; }
  .scroll-hint { display: none; }
  .bez-row .code { display: inline-block; width: 1.4rem; }
  #legend { left: 4vw; right: 4vw; top: 2.2vh; justify-content: flex-start; gap: 0.7rem; font-size: 0.68rem; }
  #legend .full { display: none; }
  #legend .short { display: inline; }
  /* Bottom-Sheet: standardmäßig nur als Leiste, aufklappbar */
  #recent {
    top: auto; bottom: 0; right: 0; left: 0; width: auto; max-height: 46vh;
    border-radius: 16px 16px 0 0; padding: 0.7rem 1.1rem 1rem;
    background: rgba(12, 14, 22, 0.96);
    transform: translateY(110%);
  }
  #recent.on { transform: translateY(calc(100% - 3rem)); }
  #recent.on.open { transform: none; }
  #recent:not(.open) #recent-list, #recent:not(.open) .recent-hint { visibility: hidden; }
  #recent.pulse .recent-title { animation: pulse 0.9s ease-out; }
  .recent-title { cursor: pointer; font-size: 1.1rem; min-height: 1.8rem; }
  .recent-title i { display: inline-block; margin-left: auto; width: 0.6rem; height: 0.6rem; border-left: 1.5px solid var(--muted); border-top: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform 0.3s; }
  #recent.open .recent-title i { transform: rotate(225deg); }
  #year-badge { bottom: auto; top: 6vh; font-size: 3.6rem; }
  .cards { grid-template-columns: 1fr; }
    }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint i { animation: none; }
}
