/* ==========================================================================
   Our story (round 2026-11-20l, PRD Docs/rounds/2026-11-20l-our-story.md).
   "The invention, drawn": five chapters of a side-view line drawing, played on their own while in view; a tap on a
   year jumps there; one pause button; reduced motion shows one still per year.
   Sources: our first patent drawing (assets/img/v7/dev-2020-patent-drawing.webp: black line work, the dotted cone, the
   floor ellipse, dashed leader lines); apple-05 (make the invisible visible); dyson-b02 / dyson-b04 (show the part);
   people as warm dots (the plan story's ps-heat, playbook trust-privacy, Stanley's pitch "just red dots"); the alert
   card, year pill and caption from css/switch-story.css and css/plan-story.css; the rail with progress lines and pause
   from Apple "Get the highlights" (Design-Gallery shots/apple-airpods-pro d-02) and the DS v3 carousel rule.
   js/invention.js sets data-step 1 to 5. Every element's resting style is its end state, and each chapter's motion is a
   "from" keyframe, so reduced motion (animations off) lands straight on the still.
   ========================================================================== */
.iv { padding-inline: var(--hs-edge); }
.iv-stage { position: relative; container-type: inline-size; margin: 0 auto; aspect-ratio: 1000 / 620; overflow: hidden;
  width: min(100%, 1000px, calc((100svh - 300px) * 1000 / 620)); }

/* ---- The drawing ---- */
.iv-draw { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; transition: opacity 0.9s var(--ease-out); }
.iv-draw * { transform-box: view-box; }
.iv-ceil { stroke: var(--ink); stroke-width: 2; }
.iv-floor { fill: none; stroke: var(--ink); stroke-width: 2; }
.iv-cone line { stroke: var(--ink); stroke-width: 1.6; }
.iv-cone { transform-origin: 500px 108px; }
.iv-lamp rect { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.iv-lamp ellipse { fill: #fff; stroke: var(--ink); stroke-width: 1.6; }
.iv-eye { fill: var(--ink); opacity: 0; }
.iv-grid path { fill: none; stroke: var(--ember); stroke-width: 1; opacity: 0.45; }
.iv-grid { opacity: 0; }
.iv-cell { fill: rgba(198, 61, 23, 0.16); stroke: var(--ember); stroke-width: 2; opacity: 0; }
.iv-sensor { opacity: 0; }
.iv-sensor rect { fill: var(--ember); }
.iv-lead { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 6 5; }
.iv-sensor text, .iv-timer text { font: 600 17px "Montserrat", sans-serif; fill: var(--ink); }
.iv-pers { opacity: 0; transform: translate(470px, 530px) rotate(-90deg); }
.iv-pers circle { fill: url(#iv-heat); }
.iv-timer { opacity: 0; }
.iv-timer__bg { fill: var(--paper); stroke: var(--line, rgba(15, 17, 21, 0.14)); stroke-width: 4; }
.iv-timer__run { fill: none; stroke: var(--ember); stroke-width: 4; stroke-dasharray: 100; stroke-dashoffset: 0; transform: rotate(-90deg); transform-origin: 430px 440px; }
.iv-timer text { text-anchor: middle; font-size: 15px; }

/* Chapter 1: the light reaches the whole floor */
.iv[data-step="1"] .iv-cone { animation: iv-cone 2.4s var(--ease-out) 0.3s both; }
@keyframes iv-cone { from { transform: scaleX(0.12); opacity: 0; } }

/* Chapter 2 on: the light drawn open (a cutaway, as the patent drawing) and the sensor inside */
.iv:not([data-step="1"]) .iv-lamp rect { fill: none; stroke-dasharray: 7 5; }
.iv:not([data-step="1"]) .iv-lamp ellipse { fill: none; }
.iv:is([data-step="2"], [data-step="3"], [data-step="4"]) .iv-sensor,
.iv:is([data-step="2"], [data-step="3"], [data-step="4"]) .iv-eye { opacity: 1; }
.iv-eye { fill: var(--ember); }
.iv[data-step="2"] .iv-sensor rect { animation: iv-drop 1.3s cubic-bezier(0.3, 0, 0.2, 1) 0.6s both; }
@keyframes iv-drop { from { transform: translateY(-150px); opacity: 0; } 30% { opacity: 1; } }
.iv[data-step="2"] .iv-lead, .iv[data-step="2"] .iv-sensor text { animation: iv-fade 0.6s ease 2s both; }
.iv[data-step="2"] .iv-eye { animation: iv-fade 0.5s ease 1.9s both; }
@keyframes iv-fade { from { opacity: 0; } }
.iv:is([data-step="3"], [data-step="4"]) .iv-sensor text, .iv:is([data-step="3"], [data-step="4"]) .iv-lead { opacity: 0.35; }

/* Chapter 3: the floor read as warmth; someone walks in, only warm dots */
.iv:is([data-step="3"], [data-step="4"]) .iv-grid { opacity: 1; }
.iv[data-step="3"] .iv-grid { animation: iv-fade 1s ease 0.2s both; }
.iv:is([data-step="3"], [data-step="4"]) .iv-pers { opacity: 1; }
.iv[data-step="3"] .iv-pers { transform: translate(470px, 530px); animation: iv-walk 3.4s var(--ease-out) 0.8s both; }
@keyframes iv-walk { from { transform: translate(190px, 530px); opacity: 0; } 15% { opacity: 1; } }

/* Chapter 4: the dots fall and stay still; the light notices; 20 seconds; the alert */
.iv[data-step="4"] .iv-pers { animation: iv-fall 0.8s cubic-bezier(0.55, 0, 0.85, 0.35) 0.4s both; }
@keyframes iv-fall { from { transform: translate(470px, 530px) rotate(0deg); } }
.iv[data-step="4"] .iv-cell { opacity: 1; animation: iv-fade 0.6s ease 1.3s both; }
.iv[data-step="4"] .iv-timer { opacity: 1; animation: iv-fade 0.4s ease 1.6s both; }
.iv[data-step="4"] .iv-timer__run { animation: iv-run 2s linear 1.8s both; }
@keyframes iv-run { from { stroke-dashoffset: 100; } }

/* Chapter 5: the drawing gives way to SORVA */
.iv-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; pointer-events: none; }
.iv[data-step="5"] .iv-draw { opacity: 0; }
.iv[data-step="5"] .iv-photo { opacity: 1; animation: iv-photo 1.4s var(--ease-out) 0.3s both; }
@keyframes iv-photo { from { opacity: 0; transform: scale(0.96); } }

/* ---- Year pill, caption, alert card (switch story) ---- */
.iv-year { position: absolute; z-index: 3; left: 2.5%; top: 3%; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font: 600 clamp(12px, 1.6cqw, 15px)/1 "Montserrat", sans-serif; font-variant-numeric: tabular-nums; }
.iv-year::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ember); }
/* The caption sits under the drawing, not over it, so it never covers the floor (round 2026-11-20l touch-up) */
.iv-cap { margin: clamp(14px, 1.6vw, 22px) auto 0; max-width: 46ch; min-height: 2.7em; text-align: center; color: var(--ink);
  font: 500 clamp(16px, 1.4vw, 19px)/1.35 "Montserrat", sans-serif; letter-spacing: -0.01em; text-wrap: balance; opacity: 0; transform: translateY(6px); transition: opacity 0.3s, transform 0.4s var(--ease-out); }
.iv-cap.is-on { opacity: 1; transform: none; }
.iv-card { position: absolute; z-index: 3; right: 2.5%; top: 3%; width: 34cqw; display: grid; grid-template-columns: 4.4cqw 1fr; gap: 0.3cqw 1.4cqw; padding: 1.8cqw 2cqw;
  border-radius: 2.4cqw; background: rgba(28, 28, 32, 0.9); color: #fff; font: 400 clamp(12px, 1.6cqw, 15px)/1.3 "Montserrat", sans-serif; opacity: 0; visibility: hidden; }
.iv-card img { grid-row: span 3; width: 4.4cqw; height: 4.4cqw; min-width: 22px; min-height: 22px; border-radius: 1cqw; background: #fff; padding: 0.6cqw; }
.iv-card p { display: flex; justify-content: space-between; opacity: 0.75; }
.iv-card > b { font-weight: 600; }
.iv[data-step="4"] .iv-card { opacity: 1; visibility: visible; animation: iv-card 0.5s var(--ease-out) 3.9s both; }
@keyframes iv-card { from { opacity: 0; visibility: hidden; transform: translateY(-8px); } }

/* ---- The rail: the years as buttons, the current one fills (DS v3 carousel rule) ---- */
.iv-rail { width: min(100%, 1000px); margin: clamp(16px, 2vw, 28px) auto 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(10px, 1.6vw, 24px); }
.iv-rail button { width: 100%; padding: 0 0 4px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink-3); font: 500 13px/1.35 "Montserrat", sans-serif; transition: color 0.3s; }
.iv-rail button:focus-visible { outline: 2px solid var(--ember); outline-offset: 4px; }
.iv-rail i { display: block; position: relative; height: 2px; margin-bottom: 14px; background: var(--line, rgba(15, 17, 21, 0.12)); overflow: hidden; }
.iv-rail i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ember); }
.iv-rail b { display: block; font-weight: 600; letter-spacing: 0.05em; }
.iv-rail span { display: block; margin-top: 2px; }
.iv-rail li.is-done i::after { width: 100%; }
.iv-rail li.is-on button { color: var(--ink); }
.iv-rail li.is-on i::after { animation: v8-fill var(--seg-time, 4s) linear forwards; }
@media (hover: hover) { .iv-rail button:hover { color: var(--ink); } }
.iv.is-paused .iv-rail li.is-on i::after, .iv.is-paused * { animation-play-state: paused !important; }
.iv .dots-row { padding-top: 20px; }
.iv-foot { margin: 20px auto 0; padding-inline: var(--hs-edge); max-width: 60ch; text-align: center; font-size: 15px; line-height: 1.55; color: var(--ink-2); text-wrap: balance; }
.iv-foot a { color: var(--ink); text-underline-offset: 3px; }

/* ---- Reduced motion: one still per year ---- */
.iv.is-still *, .iv.is-still { animation: none !important; transition: none !important; }
.iv.is-still .dots-row { display: none; }
.iv.is-still .iv-rail li.is-on i::after { width: 100%; }
.iv.is-still .iv-cap { opacity: 1; transform: none; }

/* ---- Section 2's quote, centred under the two columns (playbook about-story row 5) ---- */
.os-quote { width: var(--lc-wide); margin: clamp(40px, 4vw, 64px) auto 0; text-align: center; }
.os-quote p { margin: 0 auto; max-width: 26ch; font-size: clamp(24px, 2.4vw, 34px); line-height: 1.2; letter-spacing: -0.03em; color: var(--ink); text-wrap: balance; }
.os-quote figcaption { margin-top: 14px; font-size: 14px; color: var(--ink-3); }

/* ---- Section 4, three equal cards (Cartier d-07, as Contact's ct-need) ---- */
.os-make { list-style: none; padding: 0; margin: 0 auto; width: min(1240px, calc(100% - 2 * var(--hs-edge))); display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.os-make a { display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--ink); text-decoration: none; }
.os-make__pic { width: 100%; aspect-ratio: 4 / 5; overflow: hidden; }
.os-make__pic img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease-out); }
@media (hover: hover) { .os-make a:hover .os-make__pic img { transform: scale(1.03); } }
.os-make h3 { margin-top: 20px; font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.os-make p { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--ink-2); max-width: 28ch; }
.os-make__go { margin-top: 12px; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--ember); }

/* ---- Phone ---- */
@media (max-width: 600px) {
  .iv-rail { gap: 8px; }
  .iv-sensor text { font-size: 30px; }
  .iv-rail span { display: none; }
  .iv-rail b { font-size: 11px; letter-spacing: 0.02em; }
  .iv-rail i { margin-bottom: 10px; }
  .iv-year { padding: 6px 10px; font-size: 11px; }
  .iv-cap { font-size: 15px; }
  .iv-card { width: 52cqw; grid-template-columns: 6cqw 1fr; padding: 2.4cqw 3cqw; font-size: 10px; }
  .iv-card img { width: 6cqw; height: 6cqw; }
  .os-make { grid-template-columns: 1fr; gap: 40px; }
  .os-make__pic { aspect-ratio: 4 / 3; }
}
