/* Shared Geometry as a Rosetta Stone.
   In the style of MCML: Work Sans throughout, bold headlines, the dark navy and the particle colours of the annual
   report in dark mode, the white of mcml.ai in light mode. The point cloud fills the screen like a map; the
   chapters sit in a panel beside it (a bottom sheet on phones). Take-aways are the report's blue boxes. */

@font-face { font-family: "Work Sans"; src: url(../fonts/work-sans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  /* dark: the annual report. One navy for the page, one for the panels, and one blue for everything that stands
     out. The report's green stays in the decoration (the stone, the blob) and the data. */
  --bg: #001c32;
  --bg-2: #001c32;                    /* insets: the page colour */
  --surface: rgba(7, 43, 71, 0.95);   /* the chapter panel */
  --raised: #072b47;                  /* cards, dialogs: the panel colour */
  --card: rgba(7, 43, 71, 0.97);
  --fg: #ffffff;
  --fg-body: #e2e6ea;
  --fg-2: #b4bcc4;
  --fg-3: #87909a;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.28);
  --blue: #007fff;                    /* the one blue: take-aways, subheads, buttons, the data's blue */
  --accent: var(--blue); --key: var(--blue);
  --btn-bg: var(--blue); --btn-fg: #ffffff;
  --take-bg: var(--blue); --take-fg: #ffffff;
  --badge-bg: var(--blue); --badge-fg: #ffffff;
  --shadow: 0 14px 40px rgba(0, 8, 20, 0.45);
  /* data colours: the MCML palette, brightened for the navy; the blue is the one blue */
  --d-green: #00ebb5; --d-pink: #ff5a6e; --d-orange: #ffa24c; --d-blue: var(--blue);
  --d-purple: #a08cff; --d-yellow: #ceff58; --d-sand: #d9b38c; --d-red: #ff7d57;
  /* names the scripts use */
  --ink: var(--fg); --ink-2: var(--fg-2); --ink-3: var(--fg-3);
  --chalk: var(--fg); --chalk-2: var(--fg-2); --chalk-3: var(--fg-3);
  --stone: var(--bg); --paper: var(--bg); --paper-2: var(--bg-2); --paper-3: var(--raised); --stone-hi: var(--d-green);
  --stone-ink: #ffffff;               /* the words on the title stone, which is navy in both modes */
  --ochre: var(--blue);               /* "ours" in charts */
  --lapis: var(--blue);
  --band: var(--bg-2);
  --sans: "Work Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --gutter: max(clamp(16px, 4vw, 56px), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --top: 52px;
  --panel-w: clamp(300px, 31vw, 440px);
  --radius: 10px;
  color-scheme: dark;
}
/* light: mcml.ai. White, near-black, black buttons, and one blue for everything that stands out. */
:root[data-theme="light"] {
  --bg: #ffffff; --bg-2: #f2f2f2; --surface: rgba(255, 255, 255, 0.95); --raised: #ffffff; --card: rgba(255, 255, 255, 0.98);
  --fg: #141414; --fg-body: #262626; --fg-2: #5f5f5f; --fg-3: #8f8f8f;
  --line: #e4e4e4; --line-strong: #b4b4b4;
  --blue: #0070e0;                    /* the one blue: MCML's, deep enough to read as text on white */
  --accent: var(--blue); --key: var(--blue);
  --btn-bg: #141414; --btn-fg: #ffffff;
  --badge-bg: var(--blue); --badge-fg: #ffffff;
  --shadow: 0 12px 34px rgba(20, 20, 20, 0.12);
  --d-green: #00a37e; --d-pink: #e2405a; --d-orange: #e07b12; --d-blue: var(--blue);
  --d-purple: #7a62f0; --d-yellow: #8aa800; --d-sand: #a0703c; --d-red: #cc4a2a;
  --ochre: var(--blue);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ffffff; --bg-2: #f2f2f2; --surface: rgba(255, 255, 255, 0.95); --raised: #ffffff; --card: rgba(255, 255, 255, 0.98);
    --fg: #141414; --fg-body: #262626; --fg-2: #5f5f5f; --fg-3: #8f8f8f;
    --line: #e4e4e4; --line-strong: #b4b4b4;
    --blue: #0070e0;                    /* the one blue: MCML's, deep enough to read as text on white */
    --accent: var(--blue); --key: var(--blue);
    --btn-bg: #141414; --btn-fg: #ffffff;
    --badge-bg: var(--blue); --badge-fg: #ffffff;
    --shadow: 0 12px 34px rgba(20, 20, 20, 0.12);
    --d-green: #00a37e; --d-pink: #e2405a; --d-orange: #e07b12; --d-blue: var(--blue);
    --d-purple: #7a62f0; --d-yellow: #8aa800; --d-sand: #a0703c; --d-red: #cc4a2a;
    --ochre: var(--blue);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
/* the page never scrolls: the cloud is moved and zoomed, and only the chapter text scrolls inside its panel */
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { position: fixed; inset: 0; margin: 0; color: var(--fg-body); background: var(--bg); font: 400 16px/1.6 var(--sans); }
a, button, select, input, label, [data-open] { cursor: pointer; }
a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: currentColor; }
sup { font-size: 0.62em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
svg, img, canvas { max-width: 100%; }
b, strong { color: var(--fg); font-weight: 600; }
button { font: inherit; color: inherit; }
/* the one orthogonal map, wherever it is named */
.key { font-weight: 700; color: var(--key); }

/* headlines: Work Sans bold; titles are revealed letter by letter, with a few particles flying off */
.carve, .title, dialog h3 { font-family: var(--sans); font-weight: 700; color: var(--fg); }
.carve .ch { display: inline-block; clip-path: inset(0 100% 0 0); }
.carve.carved .ch { animation: chisel .34s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(var(--i) * 18ms); }
@keyframes chisel { 0% { clip-path: inset(0 100% 0 0); transform: translateY(2px); } 100% { clip-path: inset(0 -2px 0 0); transform: none; } }
.dust { position: fixed; z-index: 30; pointer-events: none; width: var(--s, 3px); height: var(--s, 3px); border-radius: 50%; background: var(--c, var(--fg-3)); animation: dust var(--t, .9s) cubic-bezier(.2, .6, .4, 1) forwards; }
@keyframes dust { 0% { opacity: .9; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 0; } }

/* ---------------------------------------------------------------- the stage: canvases, figure, labels */
#stage, #overlay { position: fixed; left: 0; top: 0; pointer-events: none; }
#stage { z-index: 4; }
#overlay { z-index: 5; }
#plot-hit { position: fixed; z-index: 5; display: none; cursor: grab; touch-action: none; }
#plot-hit.on { display: block; }
#plot-hit.grabbing { cursor: grabbing; }
#callouts { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.stage-figure { position: fixed; z-index: 5; opacity: 0; visibility: hidden; transition: opacity .5s ease .25s, visibility 0s linear .75s; }
.stage-figure.show { opacity: 1; visibility: visible; transition: opacity .6s ease .35s, visibility 0s; }
body[data-chapter="benchmarks"] #domain-plot.show { opacity: .3; }
.stage-figure svg { display: block; }
.stage-figure text, .chart text, .bench text { font-family: var(--sans); fill: var(--fg-2); }

/* the row above the plot: the setting and the FOSCTTM, then the legend */
.hud-stage { position: fixed; z-index: 7; left: var(--plot-x); top: calc(var(--row-y) + 2px); max-width: calc(var(--plot-w) - 170px);
  font: 500 14.5px/1.3 var(--sans); color: var(--fg-2); pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .3s; }
.hud-stage.on { opacity: 1; }
/* a halo of background keeps the labels legible over a zoomed cloud */
.hud-stage, .legend, .metric { text-shadow: 0 0 3px var(--bg), 0 0 6px var(--bg), 0 0 10px var(--bg); }
.legend { position: fixed; z-index: 7; left: var(--plot-x); top: var(--legend-y); max-width: var(--plot-w); display: flex; flex-wrap: wrap; gap: 2px 14px;
  font: 500 13.5px/1.3 var(--sans); color: var(--fg-2); pointer-events: none; opacity: 0; transition: opacity .4s; }
.legend.on { opacity: 1; }
.legend.measure { left: 0; top: 0; visibility: hidden; opacity: 0; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend svg { width: 11px; height: 11px; }
.legend svg.wide { width: 26px; }
.metric { position: fixed; z-index: 7; left: calc(var(--plot-x) + var(--plot-w)); top: calc(var(--row-y) - 2px); transform: translateX(-100%);
  display: flex; align-items: baseline; gap: 8px; padding: 3px 0 3px 10px; border: 0; background: transparent; color: var(--fg-2); font: 600 13px/1 var(--sans);
  letter-spacing: .04em; text-align: left; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s linear .3s; }
.metric.on { opacity: 1; visibility: visible; transition: opacity .3s; }
.metric span { text-decoration: underline dotted; text-underline-offset: 3px; }
.metric b { font: 700 25px/1 var(--sans); color: var(--fg); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.metric small { font-size: 12.5px; font-weight: 500; letter-spacing: 0; color: var(--fg-3); }
.fit-view { position: fixed; z-index: 7; left: calc(var(--plot-x) + var(--plot-w)); top: calc(var(--plot-y) + var(--plot-h)); transform: translate(-100%, -100%);
  padding: 8px 14px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--fg); font: 600 13.5px/1 var(--sans); }
.fit-view[hidden] { display: none; }
body[data-chapter="title"] .hud-stage, body[data-chapter="title"] .legend, body[data-chapter="title"] .metric { opacity: 0 !important; }

/* ---------------------------------------------------------------- the top bar */
#topbar { position: fixed; z-index: 12; left: 0; right: 0; top: 0; height: var(--top); display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: env(safe-area-inset-top, 0px) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  background: linear-gradient(var(--bg) 60%, transparent); pointer-events: none; }
#topbar > * { pointer-events: auto; }
.brand { min-width: 0; padding: 4px 0; border: 0; background: none; font: 700 16.5px/1.2 var(--sans); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .4s; }
.top-links { display: flex; align-items: center; gap: 22px; flex: none; }
.top-links a, .top-links button { border: 0; background: none; padding: 6px 0; font: 600 15px/1 var(--sans); color: var(--fg-2); text-decoration: none; transition: opacity .4s, color .2s; }
.top-links a:hover, .top-links button:hover { color: var(--fg); }
.theme-btn { display: inline-flex; }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.theme-btn .fill { fill: currentColor; stroke: none; }
/* on the title the hero carries the links and the name */
body[data-chapter="title"] #topbar { background: none; }
body[data-chapter="title"] .brand, body[data-chapter="title"] .top-links > :not(.theme-btn) { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- title: the stone */
#hero { position: fixed; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
#hero .hero-text, #hero .stone-wrap { pointer-events: auto; }
#hero.away, #hero.away * { pointer-events: none !important; }
.hero-grid { height: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: clamp(20px, 4vw, 64px);
  padding: var(--top) var(--gutter) 24px; max-width: 1440px; margin: 0 auto; }
.hero-text { position: relative; z-index: 5; }
.title { font-size: clamp(34px, 4.7vw, 66px); line-height: 1.07; letter-spacing: -0.015em; margin: 0; }
.subtitle { font: 400 clamp(18px, 1.75vw, 25px)/1.35 var(--sans); color: var(--fg); margin: 18px 0 24px; }
.authors { list-style: none; padding: 0; margin: 0 0 4px; display: flex; flex-wrap: wrap; gap: 2px 20px; font: 500 17px/1.6 var(--sans); }
.authors a { text-decoration-color: var(--line-strong); }
.affiliations { color: var(--fg-2); font-size: 14px; margin: 0 0 24px; }
.affiliations sup { margin-left: 8px; }
.affiliations sup:first-child { margin-left: 0; }
.affiliations .equal { margin-left: 14px; white-space: nowrap; }
/* the affiliations' logos: each a mask filled with the text colour; heights set by eye, since the marks differ */
.logos { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 28px; margin: -6px 0 26px; padding: 0; }
.logo { display: block; height: var(--h); aspect-ratio: var(--r); background: var(--fg); opacity: .82; transition: opacity .2s;
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.logo:hover { opacity: 1; }
.logo.tum { --m: url(../img/logos/tum.svg); --r: 73 / 38; --h: 25px; }
.logo.mcml { --m: url(../img/logos/mcml.svg); --r: 206.73 / 30.63; --h: 17px; }
.logo.ulm { --m: url(../img/logos/ulm.png); --r: 159 / 160; --h: 42px; }
.logo.eth { --m: url(../img/logos/eth.png); --r: 476 / 80; --h: 20px; }
.logo.mit { --m: url(../img/logos/mit.png); --r: 181 / 96; --h: 24px; }
.links { display: flex; flex-wrap: wrap; gap: 10px; }
/* the main action, as on mcml.ai: a square with an arrow, and its label */
.enter, .continue { display: inline-flex; align-items: center; gap: 14px; border: 0; background: none; color: var(--fg); text-align: left; }
.enter::before, .continue::before { content: ""; flex: none; width: 48px; height: 48px; border-radius: 9px; background: var(--btn-bg) center / 22px no-repeat
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 12h15M13 5.5 19.5 12 13 18.5' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.enter:hover::before, .continue:hover::before { transform: translateX(4px); }
.enter { margin-top: 30px; font: 600 20px/1.2 var(--sans); }
/* a grainy blob of the MCML colours behind the stone */
.blob { position: absolute; z-index: -1; inset: -16% -34% -20% -30%; pointer-events: none; opacity: calc(1 * var(--fade, 1));
  background:
    radial-gradient(26% 30% at 31% 68%, rgba(140, 120, 255, .95), rgba(140, 120, 255, 0) 100%),
    radial-gradient(30% 32% at 42% 34%, color-mix(in srgb, var(--blue) 85%, transparent), transparent 100%),
    radial-gradient(34% 36% at 64% 74%, color-mix(in srgb, var(--blue) 70%, transparent), transparent 100%),
    radial-gradient(32% 38% at 80% 38%, rgba(0, 235, 181, .9), rgba(0, 235, 181, 0) 100%);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='1' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 3 -0.5'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='1' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 3 -0.5'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .blob { opacity: calc(.75 * var(--fade, 1)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .blob { opacity: calc(.75 * var(--fade, 1)); } }
/* the stone: a slab of the report's navy, standing out from the page in both modes */
.stone-wrap { position: relative; isolation: isolate; height: min(76vh, 640px); aspect-ratio: 400 / 516; justify-self: center; max-width: 100%; touch-action: none; cursor: crosshair; }
.stone { width: 100%; height: 100%; display: block; filter: drop-shadow(0 24px 38px rgba(0, 10, 25, .45)); }
.stone-body { fill: url(#stoneShade); }
#stoneShade stop:first-child { stop-color: #072b47; }
#stoneShade stop:last-child { stop-color: #001c32; }
.stone-edge { stroke: rgba(0, 235, 181, .45); stroke-width: 2; }
.stone-split { stroke: rgba(255, 255, 255, .14); stroke-width: 1.2; stroke-dasharray: 3 5; }
/* each register is named at its left end, as a line of the stone */
.stone-labels { position: absolute; inset: 0; pointer-events: none; font: 500 13px/1 var(--sans); color: var(--stone-ink); opacity: .6; }
.stone-labels span { position: absolute; left: 9%; }
.stone-labels .lab-text { top: 52%; }
.stone-labels .lab-images { bottom: 7%; }

/* ---------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; min-height: 42px; padding: 0 18px; border: 1.5px solid var(--fg); border-radius: 9px;
  font: 600 15.5px/1 var(--sans); color: var(--fg); background: transparent; text-decoration: none; transition: background .2s, color .2s;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn.is-muted, .btn.is-muted:hover { color: var(--fg-3); border-color: var(--line-strong); background: transparent; cursor: default; }
select {
  font: 500 15px/1.2 var(--sans); color: var(--fg); background-color: var(--bg); border: 1.5px solid var(--line-strong); border-radius: 8px; padding: 8px 30px 8px 10px; width: 100%; min-width: 0; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-2) 50%), linear-gradient(135deg, var(--fg-2) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
select:hover { border-color: var(--fg-2); }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--btn-bg); box-shadow: 0 0 0 3px var(--bg); }
input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--btn-bg); box-shadow: 0 0 0 3px var(--bg); }
.inline-term { font: inherit; font-weight: 600; color: var(--fg); background: none; border: 0; padding: 0; text-decoration: underline dotted; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- the panel: chapters, their text and controls */
#panel { position: fixed; z-index: 10; left: 16px; top: calc(var(--top) + 4px); max-height: calc(100% - var(--top) - 20px); width: var(--panel-w); display: flex; flex-direction: column;
  background: var(--surface); color: var(--fg-body); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .55s cubic-bezier(.2, .8, .2, 1), opacity .4s; }
body[data-chapter="title"] #panel { transform: translateX(calc(-100% - 24px)); opacity: 0; pointer-events: none; }
.grab { flex: none; padding: 14px 20px 10px; border-bottom: 1px solid var(--line); }
.handle { display: none; }
.chips { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.chips button { padding: 4px 0; border: 0; background: none; font: 600 14px/1.3 var(--sans); color: var(--fg-3); white-space: nowrap; transition: color .2s; }
.chips button:hover { color: var(--fg); }
.chips button[aria-current] { color: var(--fg); box-shadow: inset 0 -2.5px 0 var(--accent); }
.panel-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 20px 24px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
article[data-chapter] { display: none; }
article[data-chapter].active { display: block; animation: rise .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
/* chapter titles as the report sets them: bold capitals */
.ch-head h2 { font-size: clamp(21px, 1.9vw, 26px); line-height: 1.12; letter-spacing: .01em; text-transform: uppercase; margin: 0 0 8px; }
.subhead { font: 600 15.5px/1.4 var(--sans); color: var(--accent); margin: 0 0 16px; }
article p { margin: 0 0 13px; font-size: 15.5px; line-height: 1.62; }
article p.note { font-size: 14.5px; line-height: 1.6; color: var(--fg-2); padding-left: 14px; border-left: 3px solid var(--line-strong); }
article h3 { font: 700 16.5px/1.3 var(--sans); color: var(--fg); margin: 0 0 6px; }
article ul.findings { margin: 0 0 14px; padding-left: 20px; }
article ul.findings li { margin: 0 0 9px; font-size: 15px; line-height: 1.55; }
article ul.findings li::marker { color: var(--accent); }
article p.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 14px 0; padding: 10px 0 0; font-size: 14px; color: var(--fg-2); border-top: 1px solid var(--line); }
article p.stat b { font: 700 22px/1 var(--sans); color: var(--fg); font-variant-numeric: tabular-nums; }
/* a take-away is one of the report's blue boxes */
article p.inscription { position: relative; margin: 18px 0; padding: 16px 18px 16px 50px; border-radius: var(--radius); background: var(--take-bg); color: var(--take-fg);
  font: 600 16.5px/1.45 var(--sans); box-shadow: 0 8px 22px color-mix(in srgb, var(--take-bg) 28%, transparent); }
/* the take-away's mark: a lightbulb, the main finding of the chapter */
article p.inscription::before { content: ""; position: absolute; left: 14px; top: 14px; width: 25px; height: 25px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 18h5M10.5 21h3'/%3E%3Cpath d='M12 2.8a6.2 6.2 0 0 0-3.7 11.2c.7.5 1.1 1.3 1.1 2.1V16h5.2v-.1c0-.8.4-1.6 1.1-2.1A6.2 6.2 0 0 0 12 2.8z'/%3E%3Cpath d='M12 6.4a2.9 2.9 0 0 0-2.9 2.9' /%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 18h5M10.5 21h3'/%3E%3Cpath d='M12 2.8a6.2 6.2 0 0 0-3.7 11.2c.7.5 1.1 1.3 1.1 2.1V16h5.2v-.1c0-.8.4-1.6 1.1-2.1A6.2 6.2 0 0 0 12 2.8z'/%3E%3Cpath d='M12 6.4a2.9 2.9 0 0 0-2.9 2.9' /%3E%3C/svg%3E") center / contain no-repeat; }
article p.inscription .key { color: inherit; }

/* tools: the steps of the method, play and replay */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; margin: 0 0 16px; }
.seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; margin-bottom: 4px; padding: 3px; gap: 3px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.seg button { min-height: 38px; padding: 4px 4px; border: 0; border-radius: 7px; background: none; font: 600 13.5px/1.15 var(--sans); color: var(--fg-2); transition: background .2s, color .2s; }
.seg button:hover { color: var(--fg); }
.seg button[aria-selected="true"] { background: var(--btn-bg); color: var(--btn-fg); }
.tool { display: inline-flex; align-items: center; gap: 7px; padding: 6px 0; border: 0; background: none; font: 600 14.5px/1 var(--sans); color: var(--fg-2); transition: color .2s; }
.tool:hover { color: var(--fg); }
.tool::before { content: ""; width: 14px; height: 14px; background: currentColor; flex: none;
  /* an arrow turning back on itself */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M13.5 8A5.5 5.5 0 1 1 11.9 4.1' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M15 1v6H9z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M13.5 8A5.5 5.5 0 1 1 11.9 4.1' fill='none' stroke='black' stroke-width='2'/%3E%3Cpath d='M15 1v6H9z'/%3E%3C/svg%3E") center / contain no-repeat; }
.tool.play { color: var(--fg); }
.tool.play::before { -webkit-mask: none; mask: none; width: 11px; height: 13px; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.step-text { display: none; }
.step-text.active { display: block; animation: rise .4s cubic-bezier(.2, .8, .2, 1); }

/* controls of a chapter */
.controls { display: flex; flex-direction: column; gap: 10px; margin: 0 0 18px; }
.controls > label:not(.slider) { display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 10px; font: 600 14px/1.2 var(--sans); color: var(--fg-2); }
.slider { display: flex; flex-direction: column; gap: 2px; font: 600 14px/1.3 var(--sans); color: var(--fg-2); }
.slider span { display: flex; justify-content: space-between; align-items: baseline; }
.slider b { font: 700 19px/1 var(--sans); color: var(--fg); font-variant-numeric: tabular-nums; }
article p.combo-name { margin: 0; font-size: 14px; color: var(--fg-2); }
.stepper { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.stepper button { height: 40px; border: 1.5px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--fg); font: 500 22px/1 var(--sans); transition: border-color .2s; }
.stepper button:hover { border-color: var(--fg); }
.stepper span { font: 500 15px/1.35 var(--sans); text-align: center; color: var(--fg); }
.chart { height: 150px; margin: 0 0 18px; }
.chart.tall { height: 230px; }
.chart svg { display: block; }
#hist { height: 120px; }
.continue { width: 100%; margin: 24px 0 4px; padding: 0; font: 600 16px/1.3 var(--sans); }
.continue::before { width: 44px; height: 44px; }
.end-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.end-links > * { flex: 1 1 auto; justify-content: center; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1.5px solid var(--fg); border-radius: 9px; background: none;
  font: 600 14.5px/1 var(--sans); color: var(--fg); text-decoration: none; transition: background .2s, color .2s; }
.end-links > *:hover { background: var(--fg); color: var(--bg); }

/* ---------------------------------------------------------------- hover cards and callouts */
.hc-col { display: flex; flex-direction: column; gap: 6px; max-width: 260px; pointer-events: none; }
.hc-img { width: 132px; height: 132px; object-fit: cover; display: block; border-radius: 8px; box-shadow: 0 0 0 1px var(--line-strong), var(--shadow); }
.hc-img.small { width: 78px; height: 78px; border-radius: 6px; }
.hc-img-wrap { position: relative; }
.hc-img-wrap:has(.badge) { margin-bottom: 10px; }
.hc-img-wrap .badge { position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); margin: 0; white-space: nowrap; }
.hc-cap { background: var(--card); padding: 8px 11px; border-radius: 8px; font-size: 14.5px; line-height: 1.4; color: var(--fg); border: 1px solid var(--line); box-shadow: var(--shadow); }
.hc-cap.main { font-size: 15.5px; }
.hc-cap small, .hc-lab { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 3px; }
.badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 4px; font: 700 11px/1.6 var(--sans); letter-spacing: .03em; text-transform: uppercase; color: var(--badge-fg); background: var(--badge-bg); vertical-align: 1px; }
.callout { position: absolute; transition: opacity .4s; }
.callout img { width: 96px; height: 96px; object-fit: cover; display: block; border-radius: 8px; box-shadow: 0 0 0 1px var(--line-strong), var(--shadow); }
.callout .hc-cap { max-width: 220px; }
.callout figure.gen { margin: 0; }
.callout figure.gen img { border-radius: 10px; }
.callout figure.gen figcaption { margin-top: 5px; font: 600 12.5px/1.2 var(--sans); color: var(--fg-2); text-align: center; }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--card); color: var(--fg); font-size: 13.5px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); box-shadow: var(--shadow); }

/* the tapped point (phones): shown in the sheet in place of the chapter, as a place in a map app */
#inspector { display: none; }
#inspector .close { position: absolute; top: -6px; right: -8px; width: 44px; height: 44px; border: 0; background: none; color: var(--fg-2); font: 400 28px/1 var(--sans); }
.ins-head { display: flex; align-items: center; gap: 8px; margin: 0 44px 12px 0; font: 700 15px/1.2 var(--sans); color: var(--fg); }
.ins-head svg { width: 13px; height: 13px; flex: none; }
.ins-head .cat { color: var(--fg-3); font-weight: 500; }
.ins-image { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 12px; align-items: start; }
.ins-image.alone { grid-template-columns: 1fr; justify-items: start; }
.ins-image > img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.ins-image.alone > img { width: min(100%, 240px); }
.ins-caption { font-size: 15.5px; line-height: 1.45; color: var(--fg); margin: 0 0 12px; }
.ins-list { display: flex; flex-direction: column; gap: 8px; }
.ins-list .item { font-size: 14px; line-height: 1.4; color: var(--fg); }
.ins-list small, .ins-grid small { display: block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-3); margin-bottom: 2px; min-height: 18px; }
.ins-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 520px; }
.ins-grid figure { margin: 0; }
.ins-grid img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; display: block; border-radius: 6px; }
.ins-grid .match img { outline: 2.5px solid var(--badge-bg); outline-offset: 2px; }
.ins-grid small .badge { display: table; margin: 2px 0 0; }
.ins-note { margin: 12px 0 0; padding-top: 10px; font-size: 13.5px; color: var(--fg-2); border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- the benchmark table */
.bench { margin: 4px 0 16px; }
.bench-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.bench-table th, .bench-table td { padding: 8px 6px; text-align: left; font-weight: 400; vertical-align: middle; }
.bench-table thead th { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-3); border-bottom: 1.5px solid var(--line-strong); }
.bench-table tbody { border-bottom: 1px solid var(--line-strong); }
.bench-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bench-table td.num { font: 600 17px/1.2 var(--sans); color: var(--fg-2); font-variant-numeric: tabular-nums; }
.bench-table td.num b { color: var(--fg); font-weight: 700; }
.bench-table .std { display: block; font: 500 12.5px var(--sans); color: var(--fg-3); margin: 1px 0 0; }
.bench-table tr.ours td { color: var(--fg); font-weight: 600; }
.bench-table tr.ours td:first-of-type { color: var(--accent); }
.bench-name { display: block; font: 700 16.5px/1.2 var(--sans); color: var(--fg); }
.bench-task { display: block; font-size: 12.5px; line-height: 1.3; color: var(--fg-3); max-width: 9em; }
/* the table as the main figure on wide screens */
.bench-stage { display: flex; align-items: center; justify-content: center; padding: 0 2vw; }
.bench-stage .bench-table { max-width: 820px; font-size: 17px; }
.bench-stage .bench-table th, .bench-stage .bench-table td { padding: 13px 16px; }
.bench-stage .bench-table thead th { font-size: 13px; }
.bench-stage .bench-table td.num { font-size: 25px; }
.bench-stage .bench-table .std { display: inline; margin-left: 8px; font-size: 14px; }
.bench-stage .bench-name { font-size: 22px; }
.bench-stage .bench-task { font-size: 14.5px; max-width: none; }
#panel:not(.sheet) #bench-plot { display: none; }

/* ---------------------------------------------------------------- dialogs */
dialog.tablet { border: 1px solid var(--line); border-radius: 16px; padding: 28px 30px; max-width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--raised); color: var(--fg-body); box-shadow: 0 30px 80px rgba(0, 10, 25, .45); }
dialog.tablet.wide { max-width: min(760px, calc(100vw - 32px)); }
dialog.tablet::backdrop { background: rgba(0, 14, 28, .6); }
dialog h3 { font-size: 22px; text-transform: uppercase; letter-spacing: .01em; margin: 0 0 14px; }
dialog p { margin: 0 0 12px; }
dialog .row { display: flex; flex-wrap: wrap; gap: 10px; }
dialog .links { margin: 0 0 16px; }
dialog pre { margin: 0 0 16px; background: var(--bg-2); padding: 16px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--fg-body); border: 1px solid var(--line); }

/* ================================================================ phones and upright tablets: the bottom sheet */
@media (max-width: 600px), (orientation: portrait) and (max-width: 1000px) {
  body { font-size: 15.5px; }
  :root { --top: 48px; }
  .top-links { gap: 16px; }
  .top-links a, .top-links button { font-size: 14.5px; }
  .brand { font-size: 15px; }
  #panel.sheet { left: 0; right: 0; top: auto; bottom: 0; width: auto; max-width: none; max-height: none; height: 46%; border-radius: 18px 18px 0 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -12px 34px rgba(0, 10, 25, .3); }
  body[data-chapter="title"] #panel.sheet { transform: translateY(105%); }
  #panel.sheet .grab { padding: 7px 0 0; touch-action: none; cursor: grab; }
  #panel.sheet .handle { display: block; width: 40px; height: 5px; margin: 0 auto 6px; border-radius: 3px; background: var(--line-strong); }
  #panel.sheet .chips { flex-wrap: nowrap; overflow-x: auto; gap: 20px; padding: 2px 16px 8px; scrollbar-width: none; touch-action: pan-x; }
  #panel.sheet .chips::-webkit-scrollbar { display: none; }
  #panel.sheet .chips button { font-size: 14.5px; padding: 6px 0; }
  #panel.sheet .ch-head { touch-action: none; }
  .panel-body { padding: 16px 16px 22px; }
  .ch-head h2 { font-size: 20px; }
  .subhead { font-size: 14.5px; margin-bottom: 12px; }
  article p { font-size: 15px; }
  article p.note { font-size: 14px; }
  article p.inscription { font-size: 15.5px; }
  .seg button { font-size: 13px; }
  #panel.sheet #inspector:not([hidden]) { display: block; position: relative; }
  body.inspecting #panel.sheet article { display: none; }
  .hc-col { display: none !important; }
  .callout .hc-cap { font-size: 12.5px; padding: 6px 8px; }
  /* the hero: name and links above the stone */
  .hero-grid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(14px, 3vh, 40px); padding: calc(var(--top) + 4px) var(--gutter) max(28px, env(safe-area-inset-bottom)); text-align: center; }
  .hero-text { width: 100%; max-width: 760px; }
  .title { font-size: clamp(28px, 6.6vw, 56px); }
  .subtitle { font-size: clamp(16px, 2.6vw, 22px); margin: 10px 0 12px; }
  .authors { justify-content: center; font-size: clamp(14.5px, 2.1vw, 17px); gap: 2px 14px; }
  .affiliations { font-size: clamp(12px, 1.6vw, 14px); margin-bottom: 14px; }
  .logos { justify-content: center; gap: 10px 14px; margin-bottom: 4px; }
  .logo { height: calc(var(--h) * .78); }
  /* when the title does not fit, it starts below the top bar instead of centring up under it */
  .hero-grid { justify-content: flex-start; }
  .hero-grid > :first-child { margin-top: auto; }
  .hero-grid > :last-child { margin-bottom: auto; }
  .links { justify-content: center; }
  .enter { margin-top: 14px; font-size: 17.5px; }
  .enter::before { width: 44px; height: 44px; }
  /* the links move to the top bar, which keeps them on the title too */
  .hero-text .links { display: none; }
  body[data-chapter="title"] .top-links > :not(.theme-btn) { opacity: 1; pointer-events: auto; }
  .stone-wrap { flex: 1 1 auto; min-height: 150px; height: auto; max-height: min(46vh, 540px); width: auto; margin: 0 0 22px; }
  .hud-stage { display: none; }
  .legend { font-size: 12px; gap: 1px 10px; }
  .metric { top: calc(var(--plot-y) + var(--plot-h)); transform: translate(-100%, -100%); gap: 6px; padding: 2px 0 2px 8px; }
  .metric b { font-size: 19px; }
  .metric small { display: none; }
  .fit-view { left: var(--plot-x); transform: translateY(-100%); }
  .bench-stage { display: none !important; }
}
@media (max-width: 380px) {
  .top-links { gap: 12px; }
  .top-links a, .top-links button { font-size: 13.5px; }
  .seg button { font-size: 12px; }
  .authors { font-size: 14px; }
  .links .btn { min-height: 38px; padding: 0 12px; font-size: 14px; }
  .enter { gap: 10px; font-size: 16px; }
  .logos { gap: 8px 10px; }
  .logo { height: calc(var(--h) * .64); }
  .stone-wrap { min-height: 120px; }
}
/* very short screens (phones held sideways): a narrower panel, smaller type */
@media (max-height: 560px) and (orientation: landscape) {
  :root { --top: 42px; --panel-w: clamp(280px, 38vw, 380px); }
  #panel { left: max(10px, env(safe-area-inset-left)); top: calc(var(--top) + 2px); max-height: calc(100% - var(--top) - 10px); }
  .grab { padding: 8px 14px 6px; }
  .chips { gap: 2px 12px; }
  .chips button { font-size: 13px; }
  .panel-body { padding: 12px 14px 16px; }
  .ch-head h2 { font-size: 18px; }
  .subhead { font-size: 14px; }
  article p { font-size: 14px; }
  .hero-grid { gap: 16px; padding-bottom: 10px; }
  .title { font-size: clamp(24px, 4.2vw, 40px); }
  .subtitle { margin: 6px 0 8px; font-size: 16px; }
  .authors { font-size: 14px; }
  .affiliations { margin-bottom: 8px; font-size: 12px; }
  .logos { gap: 8px 18px; margin: -2px 0 6px; }
  .logo { height: calc(var(--h) * .7); }
  /* the links move to the top bar here too, as on upright phones */
  .hero-text .links { display: none; }
  body[data-chapter="title"] .top-links > :not(.theme-btn) { opacity: 1; pointer-events: auto; }
  .btn { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
  .enter { margin-top: 12px; font-size: 16px; }
  .enter::before { width: 38px; height: 38px; }
  .stone-wrap { height: 78vh; height: 78svh; }
  .legend { font-size: 11.5px; gap: 1px 9px; }
  .hud-stage { font-size: 12.5px; }
  .metric b { font-size: 19px; }
  .metric small { display: none; }
}

/* ---------------------------------------------------------------- touch screens */
@media (pointer: coarse) {
  select { font-size: 16px; min-height: 44px; }
  button, a, select, input, label { touch-action: manipulation; }
  .btn { min-height: 44px; }
  .seg button { min-height: 42px; }
  .tool { padding: 12px 0; }
  .stepper { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .stepper button { height: 44px; }
  input[type=range] { height: 38px; }
  input[type=range]::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -10px; }
  .inline-term { padding: 6px 0; }
  .top-links a, .top-links button { padding: 12px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .carve .ch { clip-path: none; }
}
/* explained terms inside a take-away box or a highlighted sentence keep that text's colour */
article p.inscription .inline-term, .key .inline-term { color: inherit; }
