/* About page: scroll-driven scenes. Most motion is CSS driven by --p (scene
   progress 0..1) and --sp (step progress 0..1), both written by about.js. */

body.about {
  background: var(--bg);
  color: var(--text);
}

.about-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; font-size: 14px;
  background: linear-gradient(180deg, rgba(13, 18, 24, 0.9), rgba(13, 18, 24, 0));
}
.about-nav a { color: var(--muted); text-decoration: none; }
.about-nav a:hover { color: var(--text); }
.about-nav .spacer { flex: 1; }
.about-nav .nav-links { display: flex; gap: 18px; }

/* ---------- scenes ---------- */
.scene { position: relative; }
.scene .sticky {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  overflow: hidden; gap: 24px; padding: 72px 20px 40px;
}
.scene-title {
  position: absolute; top: 80px; left: 0; right: 0; text-align: center;
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
}
.scene-copy {
  max-width: 560px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.7;
}
.scene-copy strong { color: var(--text); font-weight: 500; }
/* steps fade in one after another as the scene scrolls */
[data-step] { opacity: calc(var(--sp, 0) * 1); transform: translateY(calc((1 - var(--sp, 0)) * 14px)); }

/* ---------- scene 1: the hero bus settles onto the road ---------- */
/* --pi: the first part of the scene (0 -> 1 over the first 40%), used to hand
   over from the still hero bus to the moving one. --pr: the road part after that. */
.intro-scene { height: 340vh; }
.intro-scene .sticky { justify-content: center; gap: 22px; }
.intro-scene .sticky > * {
  --pi: clamp(0, calc(var(--p, 0) / 0.4), 1);
  --pr: clamp(0, calc((var(--p, 0) - 0.3) / 0.35), 1);
}

.hero-about h1, .intro-copy h1 {
  margin: 0; font-size: clamp(34px, 6vw, 64px); font-weight: 500; letter-spacing: -0.02em;
}
.intro-copy .kicker {
  margin: 0 0 10px; font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
}
.intro-copy { text-align: center; }
p.sub { margin: 0; max-width: 540px; color: var(--muted); font-size: clamp(15px, 2vw, 18px); text-align: center; }

/* the title and the copy hand over to the road scene */
.intro-copy { opacity: calc(1 - var(--pi)); }
.scroll-hint { font-size: 12px; color: var(--muted); letter-spacing: 0.1em; }
.scroll-hint span { display: block; margin-top: 8px; animation: nudge 2.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(5px); opacity: 1; } }

.road-title { opacity: var(--pr); }

/* the street fades in under the bus */
.road { position: relative; width: min(760px, 94vw); }
.road svg { display: block; width: 100%; height: auto; overflow: visible; }
.street { opacity: var(--pr); }
.road .scenery { transform: translateX(calc(var(--pe, 0) * -1500px)); }
.road .scenery-far { transform: translateX(calc(var(--pe, 0) * -560px)); }
.road .wheel { transform-box: fill-box; transform-origin: center; transform: rotate(calc(var(--pe, 0) * 1560deg)); }

/* the one bus: large and centred at first, then settling onto the road */
.bus-holder {
  transform-box: fill-box; transform-origin: 50% 50%;
  transform: translateY(calc((1 - var(--pi)) * 34px)) scale(calc(1 + (1 - var(--pi)) * 0.34));
}
.bus-label { opacity: calc(1 - var(--pi)); }

/* line-art drawing style, shared by every diagram */
.draw { width: min(560px, 88vw); height: auto; }
.draw path, .draw line, .draw circle, .draw rect, .draw polyline {
  fill: none; stroke: var(--text); stroke-width: 1.2;
  stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.draw .faint { stroke: var(--muted); opacity: 0.55; }
.draw .accent { stroke: var(--c-on_time); }
.draw .fill-panel { fill: rgba(255, 255, 255, 0.05); stroke: none; }
.draw .label { fill: var(--muted); stroke: none; font-size: 9px; letter-spacing: 0.08em; }
.draw .label-strong { fill: var(--text); stroke: none; font-size: 10px; }
.draw text { stroke: none; fill: var(--muted); }
.draw path, .draw line, .draw polyline, .draw rect, .draw circle {
  stroke-dasharray: 3000; stroke-dashoffset: 3000;
  transition: stroke-dashoffset 1.8s ease-out;
}
.draw.drawn path, .draw.drawn line, .draw.drawn polyline,
.draw.drawn rect, .draw.drawn circle { stroke-dashoffset: 0; }
/* ---------- scene 2: data flow ---------- */
.flow-scene { height: 300vh; }
.flow { width: min(820px, 94vw); }
.flow svg { display: block; width: 100%; height: auto; }
.flow .packet { opacity: 0; }
.flow .packet.on { opacity: 1; }
/* three packets travel along the path at slightly different times */
.flow .p1 { offset-path: path("M 120 120 L 330 120"); offset-distance: calc(var(--sp, 0) * 100%); }
.flow .p2 { offset-path: path("M 470 120 L 660 120"); offset-distance: calc(var(--sp, 0) * 100%); }
.flow .p3 { offset-path: path("M 690 160 L 690 250"); offset-distance: calc(var(--sp, 0) * 100%); }

/* ---------- scene 3: inside the bus ---------- */
.inside-scene { height: 300vh; }
.inside { position: relative; width: min(860px, 94vw); }
.inside svg { display: block; width: 100%; height: auto; }
/* the view pushes in towards the screen on the dashboard */
.inside .zoomer {
  transform: scale(calc(1 + var(--p, 0) * 1.35)) translateY(calc(var(--p, 0) * -6%));
  transform-origin: 50% 46%;
}
.inside .cabin { opacity: calc(1 - var(--p, 0) * 1.1); }
.inside .screen-content { opacity: calc(var(--p, 0) * 1.6 - 0.3); }

/* ---------- plain content sections ---------- */
.about-section { max-width: 860px; margin: 0 auto; padding: 88px 24px; }
.about-section h2 {
  margin: 0 0 8px; font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted);
}
.about-section h3 { margin: 0 0 20px; font-size: clamp(22px, 3.4vw, 30px); font-weight: 500; }
.about-section p { color: var(--muted); line-height: 1.75; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); margin-top: 26px; }
.card {
  padding: 16px 18px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border);
}
.card h4 { margin: 0 0 6px; font-size: 14px; font-weight: 500; }
.card p { margin: 0; font-size: 13px; line-height: 1.6; }
.card .tag {
  display: inline-block; margin-bottom: 10px; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; letter-spacing: 0.06em; color: var(--bg); background: var(--c-on_time);
}
.card .tag.js { background: var(--c-late); }
.card .tag.sql { background: var(--c-early); }
.card .tag.ops { background: var(--c-unknown); }

.steps-list { list-style: none; margin: 24px 0 0; padding: 0; }
.steps-list li {
  display: grid; grid-template-columns: 88px 1fr; gap: 16px; align-items: baseline;
  padding: 12px 0; border-top: 1px solid var(--border); font-size: 14px;
}
.steps-list .when { color: var(--c-on_time); font-size: 12px; letter-spacing: 0.06em; }
.steps-list .what { color: var(--muted); line-height: 1.6; }
.steps-list .what b { color: var(--text); font-weight: 500; }

.endnote {
  max-width: 640px; margin: 0 auto; padding: 60px 24px 110px; text-align: center; color: var(--muted);
  font-size: 14px; line-height: 1.8;
}
.endnote .btn-row { display: flex; gap: 12px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .scene .sticky { padding-top: 88px; gap: 16px; }
  .scene-copy { font-size: 14px; }
  .intro-scene { height: 300vh; }
  .flow-scene, .inside-scene { height: 220vh; }
  .steps-list li { grid-template-columns: 1fr; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hint span { animation: none; }
  .draw path, .draw line, .draw polyline, .draw rect, .draw circle {
    stroke-dasharray: none; stroke-dashoffset: 0; transition: none;
  }
  .road .scenery, .road .scenery-far, .road .wheel, .inside .zoomer, .bus-holder { transform: none; }
  .intro-copy, .street, .road-title, .bus-label { opacity: 1; }
  .inside .cabin, .inside .screen-content, [data-step] { opacity: 1; transform: none; }
}