:root {
  color-scheme: dark;
  --ink: #10161d;
  --paper: #eef3f6;
  --muted: #a9b7c2;
  --accent: #6fe0e8;
  --line: #ffffff32;
  --edge: clamp(1.25rem, 3.5vw, 9rem);
  --mast: 4.5rem;
  --rail: 4rem;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font: 100%/1.55 system-ui, sans-serif;
  background: var(--ink);
  color: var(--paper);
}
*, *::before, *::after { box-sizing: border-box; }
body, figure, h1, h2, h3, p { margin: 0; }
a { color: inherit; text-underline-offset: .2em; }
a:hover { color: var(--accent); }
a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
img { display: block; width: 100%; height: auto; }
picture { display: block; }
.skip { position: fixed; z-index: 10; top: .5rem; left: 1rem; padding: .65rem 1rem; background: var(--ink); }
.skip:not(:focus) { clip-path: inset(50%); }
.mast {
  position: relative; z-index: 3; min-height: var(--mast); padding: .55rem var(--edge);
  display: flex; align-items: center; gap: clamp(.75rem, 2vw, 2.5rem);
  background: #10161d; border-bottom: 1px solid var(--line);
}
.mast nav { margin-inline-start: auto; display: flex; align-items: center; gap: clamp(.6rem, 2vw, 2.25rem); }
.mast a { text-decoration: none; padding-block: .6rem; }
.brand { display: inline-flex; gap: .6em; align-items: center; font-weight: 750; letter-spacing: -.025em; }
.aperture { display: inline-block; width: 1.55rem; height: .8rem; border: 1px solid var(--accent); }
.aperture::after { content: ''; display: block; width: 52%; height: 100%; margin: auto; border-inline: 1px solid var(--accent); }
.mast-sub, .platform, .hero-label, .scroll-hint, figcaption, .kicker {
  font-family: var(--mono); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase;
}
.mast-sub, .platform, .hero-label, figcaption, .scroll-hint { color: var(--muted); }
.mast-install { color: var(--accent); font-weight: 700; }
.kicker { color: var(--accent); margin-bottom: .95rem; font-weight: 700; }
h1, h2 { font: 400 clamp(2.7rem, 5.1vw, 10rem)/.96 Georgia, serif; letter-spacing: -.055em; }
h1 { font-size: clamp(4rem, 10vw, 20rem); }
h3 { font-size: clamp(1.02rem, 1.3vw, 1.55rem); line-height: 1.25; }
.lead { color: #dde6ec; max-width: 43ch; font-size: clamp(1.04rem, 1.16vw, 1.5rem); line-height: 1.52; margin-top: 1.2rem; }
.button { display: inline-flex; align-items: center; gap: 1.5rem; min-height: 3rem; padding: .65rem 1rem; color: #0b1a1e; background: var(--accent); font-weight: 750; text-decoration: none; }
.button:hover { color: #0b1a1e; background: #b6f3f7; }
.actions { display: flex; align-items: center; gap: .7rem 1.4rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-next { font-weight: 650; }
.hero { position: relative; isolation: isolate; }
.hero picture { width: 100%; }
.hero-copy { background: var(--ink); padding: 2.25rem var(--edge) 3rem; }
.hero-copy .platform { margin-top: 1.15rem; }
.hero-label { display: none; }
.plate, .text-panel { padding: clamp(2.5rem, 8vw, 8rem) var(--edge); border-top: 1px solid var(--line); }
.plate { background: #131b24; }
.battle { background: #111c28; }
.bevelle { background: #151d2b; }
.features { background: #121a22; }
.authors { background: #101a24; }
.costs { background: #131c26; }
.install { background: #0f1820; }
.plate-media { margin-top: 1.7rem; min-width: 0; }
.plate-media img { background: #0b1016; }
.plate-media figcaption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; border-bottom: 1px solid var(--line); padding: .65rem 0; }
.text-link { display: inline-block; margin-top: 1.4rem; color: var(--accent); }
.install .button { margin-top: 1.45rem; }
.feature-list, .steps { margin: 2rem 0 0; padding: 0; list-style: none; }
.feature-list li, .steps li { border-top: 1px solid var(--line); padding: .9rem 0 1.1rem; }
.feature-list p, .steps p { margin-top: .35rem; max-width: 64ch; color: var(--muted); }
.steps { counter-reset: step; padding-left: 0; }
.steps li { position: relative; padding-left: 2.75rem; counter-increment: step; }
.steps li::before { content: '0' counter(step); position: absolute; left: 0; color: var(--accent); font: 700 .8rem/1.6 var(--mono); }
code { color: var(--paper); overflow-wrap: anywhere; }
.footer { border-top: 1px solid var(--line); padding-top: 1rem; color: var(--muted); font-size: .86rem; }
.footer nav { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin-bottom: .35rem; }
.chapter-rail { display: none; }

@media (min-width: 720px) {
  .hero { min-height: min(72vh, 64vw); display: grid; align-items: end; }
  .hero picture { position: absolute; z-index: -2; inset: 0; }
  .hero img { width: 100%; height: 100%; object-fit: cover; }
  .hero::after { content: ''; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, #060a0eec 0%, #060a0ea8 29%, transparent 73%), linear-gradient(0deg, #060a0ede, transparent 60%); }
  .hero-copy { background: none; }
  .text-panel { display: grid; align-items: center; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem 4vw; }
  .footer { grid-column: 1 / -1; }
  .feature-list, .steps { margin: 0; }
}
@media (max-width: 719px) {
  .mast { --mast: 3.5rem; }
  .mast-sub, .mast .jump { display: none; }
  .hero picture { margin-bottom: -1px; }
  .hero-copy { border-top: 1px solid var(--line); }
}

/* Enabled only when JS can keep fragment navigation and focus in sync with the sticky stage. The coloured stage is
   never narrower than 21:9: when the window is less wide, the black bars above and below grow, and the mast and the
   chapter rail live in them. --sh is the stage height, --u one percent of it. */
@media (prefers-reduced-motion: no-preference) {
  [data-journey] {
    --bar-min: 4.5rem; --sh: min(calc(100vh - 2 * var(--bar-min)), 42.857vw); --u: calc(var(--sh) / 100);
    --bar: calc((100vh - var(--sh)) / 2); --copy-w: clamp(19rem, 25vw, 44rem);
  }
  [data-journey] .mast { position: fixed; inset: 0 0 auto; height: var(--bar); min-height: 0; background: #000; border-bottom: 0; }
  [data-journey] .journey { height: calc(100vh + var(--travel)); }
  [data-journey] .stage { position: sticky; top: 0; display: flow-root; height: 100vh; overflow: clip; background: #000; }
  [data-journey] .track { display: flex; width: max-content; translate: var(--shift, 0px) 0; margin-top: var(--bar); height: var(--sh); background: var(--ink); }
  [data-journey] .panel {
    flex: 0 0 var(--panel-width); width: var(--panel-width); height: var(--sh); min-height: 0;
    padding: calc(4 * var(--u)) var(--edge); border: 0; isolation: isolate; overflow: clip;
  }
  [data-journey] .hero { align-items: end; }
  [data-journey] .hero picture { overflow: clip; }
  [data-journey] .hero img { translate: var(--drift, 0px) 0; }
  [data-journey] .hero-copy { padding: 0 0 clamp(.75rem, calc(2 * var(--u)), 4rem); }
  [data-journey] .hero-label { display: block; position: absolute; bottom: calc(4 * var(--u)); right: var(--edge); }
  [data-journey] .plate {
    display: grid; grid-template-columns: var(--copy-w) minmax(0, 1fr); align-content: center; align-items: center;
    column-gap: clamp(1.5rem, 3vw, 6rem);
  }
  [data-journey] .plate-copy { display: block; }
  [data-journey] .plate-copy .kicker { margin-bottom: .9rem; }
  [data-journey] .plate-copy h2 { font-size: clamp(2.4rem, min(4.4vw, calc(8 * var(--u))), 9rem); }
  [data-journey] .plate-copy .lead { margin-top: 1.1rem; }
  [data-journey] .plate-media { --ar: 2.3889; margin: 0; justify-self: center; min-width: 0; width: min(100%, calc((var(--sh) - 8 * var(--u) - 3.2rem) * var(--ar))); }
  [data-journey] .plate-media img { width: 100%; height: 100%; object-fit: contain; }
  [data-journey] .plate-media picture { aspect-ratio: var(--ar); }
  [data-journey] .plate-media figcaption { font-size: .68rem; }
  [data-journey] .scene .plate-media { --ar: 1.7778; width: min(100%, calc((var(--sh) - 8 * var(--u) - 2.4rem) * var(--ar))); }
  [data-journey] .scene .carousel { margin: 0; }
  [data-journey] .authors .author-body { display: grid; gap: calc(2 * var(--u)); }
  [data-journey] .authors .code-pair { margin-top: 0; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  [data-journey] .authors .links li { padding-block: .35rem; }
  [data-journey] .authors .links span { font-size: .8rem; }
  [data-journey] .authors .table-wrap { margin-top: 0; }
  [data-journey] .authors th, [data-journey] .authors td { padding-block: .3rem; }
  [data-journey] .text-panel { grid-template-columns: minmax(0, .8fr) minmax(0, 1.8fr); column-gap: clamp(2rem, 5vw, 10rem); row-gap: calc(2 * var(--u)); align-content: center; }
  [data-journey] .features .feature-list, [data-journey] .authors .code-pair { margin: 0; }
  [data-journey] .features .feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(1rem, 1.8vw, 3.5rem); align-content: center; }
  [data-journey] .features .feature-list p { font-size: clamp(.82rem, .85vw, 1.1rem); }
  [data-journey] .install .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(1rem, 2.4vw, 4rem); align-content: center; }
  [data-journey] .install .footer { grid-column: 1 / -1; }
  [data-journey] .feature-list p, [data-journey] .steps p { font-size: clamp(.94rem, 1.05vw, 1.3rem); }
  [data-journey] .chapter-rail { display: flex; position: absolute; inset: auto 0 0; height: var(--bar); padding: 0 var(--edge); align-items: center; justify-content: space-between; gap: 1rem; background: #000; }
  .chapter-rail ol { display: flex; flex-wrap: wrap; gap: .1rem clamp(.85rem, 2vw, 3rem); list-style: none; margin: 0; padding: 0; }
  .chapter-rail a { display: inline-flex; align-items: center; gap: .55em; min-height: 2.75rem; text-decoration: none; font-size: .9rem; }
  .chapter-rail small { font: .66rem var(--mono); color: var(--muted); }
  .chapter-rail a[aria-current] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; }
  .progress { position: absolute; inset: 0 0 auto; height: 2px; background: var(--line); }
  .progress span { display: block; height: 100%; background: var(--accent); transform: scaleX(var(--progress, 0)); transform-origin: left; }
  [data-journey='js'] .plate-copy, [data-journey='js'] .panel-copy { translate: var(--entry-offset, 0px) 0; opacity: var(--entry-opacity, 1); }
  [data-journey='css'] .track { animation: track linear both; animation-timeline: scroll(root block); }
  [data-journey='css'] .hero img { animation: drift linear both; animation-timeline: scroll(root block); animation-range: 0% 25%; }
  [data-journey='css'] .progress span { animation: progress linear both; animation-timeline: scroll(root block); }
  [data-journey='css'] :is(.plate-copy, .panel-copy) { animation: arrive linear both; animation-timeline: scroll(root block); animation-range: var(--entry) var(--arrive); }
  @keyframes track { to { translate: calc(-1 * var(--travel)) 0; } }
  @keyframes drift { to { translate: 9vw 0; } }
  @keyframes progress { to { transform: scaleX(1); } }
  @keyframes arrive { from { translate: 2.25rem 0; opacity: .78; } to { translate: 0 0; opacity: 1; } }
}

/* Screenshot carousel in the scene panel. */
.carousel { position: relative; width: 100%; margin: 1.7rem 0 0; background: #000; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; margin: 0; }
.slide picture, .slide img { aspect-ratio: 16 / 9; }
.slide img { object-fit: contain; background: #0b1016; }
.slide figcaption { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0 0; border: 0; }
.car-btn { position: absolute; top: calc(50% - 1.5rem); z-index: 4; width: 3rem; height: 3.5rem; display: grid; place-items: center; border: 1px solid var(--line); background: #000b; color: var(--paper); font: 1.9rem/1 var(--mono); cursor: pointer; }
.car-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.car-btn:disabled { opacity: .3; cursor: default; }
.car-prev { left: .5rem; } .car-next { right: .5rem; }

/* Screenshots open full screen on click (zoom.js). */
picture[data-zoom] { position: relative; cursor: zoom-in; }
picture[data-zoom]::after {
  content: 'Expand \2922'; position: absolute; z-index: 3; top: .6rem; right: .6rem; padding: .3rem .55rem;
  font: .68rem var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--paper); background: #000a; opacity: .75;
}
picture[data-zoom]:hover::after, picture[data-zoom]:focus-visible::after { opacity: 1; color: var(--accent); }
button.hero-label { border: 0; background: none; cursor: zoom-in; color: var(--muted); }
button.hero-label:hover { color: var(--accent); }
.lightbox { position: fixed; z-index: 100; inset: 0; background: #000; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.lightbox.dragging { cursor: grabbing; }
.lightbox picture, .lightbox img { display: block; position: absolute; top: 0; left: 0; width: auto; height: auto; max-width: none; transform-origin: 0 0; }
.lightbox .lb-hint { position: absolute; left: 50%; bottom: 1rem; translate: -50% 0; margin: 0; padding: .35rem .8rem; background: #000b; color: var(--muted); pointer-events: none;
  font: .72rem var(--mono); letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.lightbox .lb-close { position: absolute; top: .8rem; right: .8rem; min-width: 2.75rem; min-height: 2.75rem; border: 1px solid var(--line); background: #000b; color: var(--paper); font: 1.2rem var(--mono); cursor: pointer; }
@media print {
  :root { color-scheme: light; }
  .mast, .chapter-rail, .skip { display: none !important; }
  .panel { break-inside: avoid; }
}

/* draw3d panels: the API example, its links and the measured costs. */
.code-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem clamp(1.5rem, 3vw, 4rem); align-items: start; margin-top: 1.6rem; }
.code { margin: 0; padding: clamp(1rem, 1.6vw, 1.75rem); background: #0b1016; border-left: 3px solid var(--accent); overflow-x: auto; font: clamp(.78rem, .4vw + .5rem, 1.05rem)/1.55 var(--mono); }
.code .c { color: var(--muted); }
.links { list-style: none; margin: 0; padding: 0; }
.links li { display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-block: .6rem; }
.links li:last-child { border-bottom: 1px solid var(--line); }
.links a { font-weight: 650; }
.links span { color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; margin-top: 1.2rem; }
table { width: 100%; border-collapse: collapse; font-size: clamp(.85rem, .9vw, 1.1rem); }
caption { text-align: left; color: var(--muted); font-size: .85rem; padding-bottom: .6rem; }
th, td { text-align: left; padding: .55rem .9rem .55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { color: var(--accent); font: 700 .72rem/1.5 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
tbody th { font-weight: 600; }
td { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 719px) { .code { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; } }
