/* Fonts, self-hosted (latin subset from Google Fonts, SIL Open Font License) */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 700 800; font-display: swap; src: url(../fonts/bricolage-grotesque-latin.woff2) format("woff2"); }
@font-face { font-family: "DM Sans"; font-style: normal; font-weight: 400 500; font-display: swap; src: url(../fonts/dm-sans-latin.woff2) format("woff2"); }
@font-face { font-family: "DM Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/dm-mono-500-latin.woff2) format("woff2"); }

/* Layout concept: a blockout. Cool grey surfaces like an untextured level,
   a faint metric grid behind everything, and "guide yellow" used only where a
   level designer would paint it: on the things you should go to next. */
:root {
  --bg: #e7e8e4;
  --surface: #f3f4f1;
  --fg: #1a1c1e;
  --muted: #565b60;
  --line: #c9ccc6;
  --guide: #f0bf2a;      /* fills, markers, highlights (dark text on top) */
  --guide-ink: #7a5a00;  /* yellow-family colour that passes contrast as text */
  --grid: rgb(26 28 30 / 0.045);

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  --step-4: clamp(2.6rem, 1.6rem + 4.6vw, 4.75rem);

  --measure: 65ch;
  --wrap: 1056px;       /* text column width: a whole number of grid squares (44 × 24px) */
  --unit: 24px;         /* one background grid square = one line of body text */
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --space: calc(3 * var(--unit));   /* section spacing, always whole rows */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181a; --surface: #1f2225; --fg: #e5e6e2; --muted: #9ba0a4;
    --line: #34383c; --guide: #f0bf2a; --guide-ink: #f0bf2a;
    --grid: rgb(229 230 226 / 0.035); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16181a; --surface: #1f2225; --fg: #e5e6e2; --muted: #9ba0a4;
  --line: #34383c; --guide: #f0bf2a; --guide-ink: #f0bf2a;
  --grid: rgb(229 230 226 / 0.035); color-scheme: dark;
}

@media (min-width: 48rem) { :root { --space: calc(4 * var(--unit)); } }

/* Vertical rhythm: every line of text is one grid square tall (headings two),
   and every gap, padding and media height is a whole number of squares, so
   text always sits between two grid lines. Borders are drawn with box-shadow
   or outline, which take up no space and so never push the text off the rhythm.
   (The visible background grid was removed on 2026-11-14; the 24px rhythm stays.) */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background-color: var(--bg);
  /* A soft wash of the accent colour in the top-right corner (scrolls away with the page) */
  background-image: radial-gradient(60rem 36rem at 85% -6rem, color-mix(in srgb, var(--guide) 22%, transparent), transparent 70%);
  background-repeat: no-repeat;
  color: var(--fg);
  font: 400 var(--step-0)/var(--unit) var(--font-body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--guide); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--guide-ink); }
:focus-visible { outline: 3px solid var(--guide); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); line-height: var(--unit); text-wrap: balance; margin: 0; }
p { margin: 0; }

.wrap {
  margin-inline: auto;
  width: min(var(--wrap), 100% - 2 * var(--gutter));
  /* Snap the column to whole pairs of squares; browsers without round() keep the line above. */
  width: min(var(--wrap), round(down, 100% - 2 * var(--gutter), calc(2 * var(--unit))));
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--gutter); top: 0.5rem; background: var(--guide); color: #1a1c1e; padding: 0.5rem 1rem; z-index: 10; }

/* Media: every image, video and embed is shown at one ratio, 16:9 (object-fit crops the rest),
   with the height rounded to the nearest whole square so the grid rhythm holds. */
.figure, .hero figure, .project__media { container-type: inline-size; }
.figure > img, .figure > video, .figure > .yt, .hero figure img, .project__media img {
  display: block; width: 100%; object-fit: cover; aspect-ratio: auto;
  height: round(nearest, 100cqi * 9 / 16, var(--unit));
}

/* Mono labels: the "metrics" voice of the site */
.label {
  font: 500 var(--step--1)/var(--unit) var(--font-mono);
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.label--marker::before {
  content: ""; display: inline-block; width: 0.6em; height: 0.6em;
  background: var(--guide); margin-right: 0.6em; transform: rotate(45deg) translateY(-1px);
}

/* Header: exactly two squares tall (one more row per wrapped nav line on phones) */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--line);
}
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1.5rem; padding-block: calc(var(--unit) / 2); }
.brand { font: 700 var(--step-0)/var(--unit) var(--font-display); font-stretch: 112%; text-decoration: none; letter-spacing: 0.02em; text-transform: uppercase; }
/* Narrow screens: brand and theme toggle share the first row, links wrap below. Wide: one row. */
.brand { flex: 1 1 auto; }
.theme-toggle { order: 1; }
.nav { order: 2; }
@media (min-width: 40rem) {
  .brand { flex: 0 1 auto; }
  .nav { order: 1; margin-left: auto; }
  .theme-toggle { order: 2; }
}
/* Theme toggle: a quiet icon button; shows the moon in light mode and the sun in dark mode */
.theme-toggle { display: grid; place-items: center; width: var(--unit); height: var(--unit); padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { color: var(--fg); }
.theme-toggle:focus-visible { outline: 2px solid var(--guide); outline-offset: 2px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
.nav { display: flex; flex-wrap: wrap; gap: 0 1.25rem; font: 500 var(--step--1)/var(--unit) var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; text-decoration-color: var(--guide); }

/* Hero */
.hero { padding-block: calc(2 * var(--unit)) 0; }
.hero + .section { padding-top: calc(2 * var(--unit)); }
@media (min-width: 48rem) { .hero { padding-top: calc(3 * var(--unit)); } .hero + .section { padding-top: calc(3 * var(--unit)); } }
.hero__grid { display: grid; gap: calc(2 * var(--unit)) 3rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 60rem) { .hero__grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: center; } }
.hero h1, .cs-hero h1 {
  font-size: var(--step-4); font-weight: 800; font-stretch: 75%; text-transform: uppercase; letter-spacing: -0.01em;
  line-height: calc(2 * var(--unit));
  line-height: max(calc(2 * var(--unit)), round(nearest, 1em, var(--unit)));
}
.hero h1 { margin-block: var(--unit); }
.hero h1 mark { background: none; color: inherit; box-shadow: inset 0 -0.18em 0 var(--guide); }
.hero__lede { font-size: var(--step-1); max-width: 34ch; color: var(--muted); }
.hero__lede + .actions { margin-top: var(--unit); }
.hero__lede strong { color: var(--fg); font-weight: 500; }
.hero figure { margin: 0; }

.facts { display: grid; gap: var(--unit); grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); margin: calc(2 * var(--unit)) 0 0; }
.facts-h { margin-top: calc(2 * var(--unit)); }
.facts-h + .facts { margin-top: 0; }
.facts > div { background: var(--surface); padding: var(--unit) 1.1rem; display: grid; align-content: start; box-shadow: inset 0 0 0 1px var(--line); }
.facts dd { margin: 0; font-weight: 500; }
.facts dt { margin: 0; }

/* Sections */
.section { padding-block: var(--space) 0; }
.section__head { display: grid; gap: var(--unit); max-width: var(--measure); margin-bottom: calc(2 * var(--unit)); }
.section__head h2, .h-section, .cs-section h2 { font-size: var(--step-3); font-weight: 800; font-stretch: 80%; text-transform: uppercase; line-height: calc(2 * var(--unit)); }
.section__head p { color: var(--muted); font-size: var(--step-1); }

/* Featured work: one panel per project. The type chip and the coloured top
   edge tell the projects apart at a glance; yellow is kept for shipped work. */
.projects { display: grid; gap: calc(2 * var(--unit)); }
.project { --edge: var(--muted); display: grid; grid-template-columns: minmax(0, 1fr); background: var(--surface); position: relative; }
.project::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 4px 0 var(--edge), inset 0 0 0 1px var(--line); }
.project--shipped { --edge: var(--guide); }
.project--solo { --edge: var(--fg); }
/* Side by side only once the text column is wide enough; below that the image
   stacks on top at full card width instead of shrinking next to a tall column of text. */
@media (min-width: 64rem) {
  .project { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .project:nth-child(even) { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .project:nth-child(even) .project__media { order: 2; }
  /* 16:9 media is centred vertically in the card, however tall the text makes it */
  .project__media { align-self: center; }
}
.project__media { min-width: 0; }
.project__body { display: grid; gap: var(--unit); align-content: start; min-width: 0; padding: var(--unit) clamp(1.25rem, 1rem + 1.5vw, 2.25rem); }
@media (min-width: 64rem) { .project__body { padding-block: calc(2 * var(--unit)); } }
.project__body > p { max-width: 48ch; }
.project__head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.9rem; }
.project__no { font: 800 var(--step-2)/calc(2 * var(--unit)) var(--font-display); font-stretch: 75%; color: var(--muted); }
.project h3 { font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem); font-weight: 800; font-stretch: 85%; text-transform: uppercase; line-height: calc(2 * var(--unit)); }
.chip, .tag { font: 500 0.6875rem/calc(var(--unit) - 2px) var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; padding: 0 0.5rem; border: 1px solid var(--line); color: var(--muted); }
.project--shipped .chip { background: var(--guide); border-color: var(--guide); color: #1a1c1e; }
.project--solo .chip { border-color: var(--fg); color: var(--fg); }
.spec { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 1rem; margin: 0; font-size: var(--step--1); font-family: var(--font-mono); }
.spec dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.spec dd { margin: 0; }
.cta { font: 500 var(--step--1)/var(--unit) var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; padding: calc(var(--unit) / 2) 1rem; background: var(--guide); color: #1a1c1e; justify-self: start; }
.cta:hover { color: #1a1c1e; background: color-mix(in srgb, var(--guide) 85%, var(--fg)); }
.cta::after { content: "→"; font-family: var(--font-body); }
.cta--quiet { background: none; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.cta--quiet:hover { background: var(--surface); color: var(--fg); }
.actions { display: flex; flex-wrap: wrap; gap: var(--unit) 0.75rem; }


/* Leadership */
.lead-grid { display: grid; align-items: start; gap: calc(2 * var(--unit)) 3rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 56rem) { .lead-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); } }
.role-card, .contact, .quote { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); padding: var(--unit) 1.5rem; display: grid; gap: var(--unit); align-content: start; }
.role-card h3, .technique h3 { font-size: var(--step-2); font-weight: 700; font-stretch: 90%; }
.principles { display: grid; gap: var(--unit); align-content: start; margin: 0; padding: 0; list-style: none; }
.principles li { display: grid; align-content: start; padding-left: 1.25rem; border-left: 2px solid var(--line); max-width: var(--measure); }
.principles p { font-size: var(--step-1); font-weight: 500; }

/* Recommendations */
.quotes { display: grid; gap: var(--unit); grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); } /* 2 × 2 on wide screens */
.quote { margin: 0; gap: 0; grid-row: span 2; grid-template-rows: subgrid; }
.quote blockquote { margin: 0; display: grid; gap: var(--unit); align-content: start; }
.quote blockquote p:first-child { font-size: var(--step-1); }
.quote blockquote p:first-child::before { content: "“"; font: 800 2.5em/0 var(--font-display); color: var(--guide-ink); vertical-align: -0.35em; margin-right: 0.1em; }
.quote blockquote p + p { color: var(--muted); }
.quote figcaption { display: grid; align-content: start; margin-top: calc(var(--unit) / 2); padding-top: calc(var(--unit) / 2); box-shadow: 0 -1px 0 var(--line); }

/* About + contact */
.about { display: grid; align-items: start; gap: calc(2 * var(--unit)) 3rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 56rem) { .about { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } .about .contact { align-self: end; } }
.prose { display: grid; gap: var(--unit); max-width: var(--measure); }
.contact address { font-style: normal; display: grid; }
.about .prose { display: flow-root; }
.about .prose > * { margin: 0; }
.about .prose > * + * { margin-top: var(--unit); }
.about .prose > .portrait { float: left; width: calc(4 * var(--unit)); height: calc(4 * var(--unit)); margin: var(--unit) 1.25rem calc(var(--unit) / 2) 0; object-fit: cover; border-radius: var(--media-radius); box-shadow: var(--media-shadow); }
@media (min-width: 40rem) { .about .prose > .portrait { width: calc(6 * var(--unit)); height: calc(6 * var(--unit)); margin-right: 1.5rem; } }
.contact .email { font: 500 var(--step-1)/var(--unit) var(--font-mono); word-break: break-all; user-select: all; }

.site-footer { margin-top: var(--space); box-shadow: inset 0 1px 0 var(--line); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 2rem; padding-block: var(--unit) calc(2 * var(--unit)); }

/* Draft notes: things only Vilhelm can fill in. Delete before launch. */
.todo { background: color-mix(in srgb, var(--guide) 22%, transparent); outline: 1px dashed var(--guide-ink); padding: 0 0.3em; font-style: normal; }
.todo::before { content: "TODO "; font: 500 0.75em var(--font-mono); color: var(--guide-ink); }

/* Case study page */
.cs-hero { padding-block: calc(2 * var(--unit)) 0; display: grid; gap: var(--unit); }
@media (min-width: 48rem) { .cs-hero { padding-top: calc(3 * var(--unit)); } }
.cs-hero .lede { font-size: var(--step-1); color: var(--muted); max-width: 48ch; }
.figure { margin: 0; }
.cs-body { display: grid; gap: var(--space); padding-block: var(--space) 0; }
.cs-section { display: grid; gap: var(--unit); }
.split { display: grid; gap: var(--unit) 3rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 52rem) { .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

.beats { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--unit); grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); counter-reset: beat; }
.beats li { background: var(--surface); padding: var(--unit) 1.1rem; display: grid; align-content: start; counter-increment: beat; box-shadow: inset 0 0 0 1px var(--line); }
.beats li::before { content: counter(beat); font: 500 var(--step--1)/var(--unit) var(--font-mono); color: var(--guide-ink); }
.beats h3 { font-size: var(--step-0); font-weight: 700; font-stretch: 90%; }
.tag { justify-self: start; }

.technique { display: grid; gap: var(--unit); padding-top: var(--unit); box-shadow: inset 0 1px 0 var(--line); }
.technique .principle { font-size: var(--step--1); color: var(--muted); }
.technique .principle b { font-family: var(--font-mono); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg); }

/* Case study image rows */
.sequence { display: grid; gap: var(--unit); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 52rem) {
  .sequence { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .sequence > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.gallery { display: grid; gap: var(--unit); grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.figure video { display: block; background: var(--surface); }

/* YouTube: a thumbnail inside the iframe until clicked, so no player scripts load with the page */
.yt { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; background: #000; }
.table-group + .table-group { margin-top: calc(2 * var(--unit)); }
.sub-h { font-size: var(--step-1); font-weight: 700; font-stretch: 90%; margin-bottom: var(--unit); }

/* Maps are shown whole at their own square ratio, never cropped to 16:9 */
.figure--map { max-width: calc(30 * var(--unit)); width: 100%; margin-inline: auto; }
.figure--map > img { height: round(nearest, 100cqi, var(--unit)); object-fit: contain; background: #000; }

/* Blockout grid behind the opening of each page only, fading out before the content */
.hero, .cs-hero { position: relative; isolation: isolate; }
.hero::before, .cs-hero::before {
  content: ""; position: absolute; inset: calc(-2 * var(--unit)) 0 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(color-mix(in srgb, var(--fg) 6%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--fg) 6%, transparent) 1px, transparent 1px);
  background-size: calc(2 * var(--unit)) calc(2 * var(--unit));
  background-position: calc(50% + var(--unit)) 0;
  -webkit-mask-image: linear-gradient(#000 30%, transparent);
  mask-image: linear-gradient(#000 30%, transparent);
}

/* A second group heading inside the work section (Professional, then Featured) */
.projects + .section__head { margin-top: var(--space); }

/* Image frame: rounded corners and a soft drop shadow on every image, video and embed */
:root { --media-radius: 12px; --media-shadow: 0 12px 32px -12px rgb(0 0 0 / 0.35); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --media-shadow: 0 12px 32px -12px rgb(0 0 0 / 0.8); } }
:root[data-theme="dark"] { --media-shadow: 0 12px 32px -12px rgb(0 0 0 / 0.8); }
.figure > img, .figure > video, .figure > .yt, .hero figure img, .project__media img {
  border-radius: var(--media-radius); box-shadow: var(--media-shadow);
}
/* Inset card images from the card edge so the rounded corners and shadow read as a frame */
.project__media { padding: var(--unit); }
@media (min-width: 64rem) { .project:nth-child(odd) .project__media { padding-right: 0; } .project:nth-child(even) .project__media { padding-left: 0; } }
@media (max-width: 63.99rem) { .project__media { padding-bottom: 0; } }


/* Anchor jumps land below the sticky header */
[id] { scroll-margin-top: calc(4 * var(--unit)); }

/* Floating buttons, bottom right: "back to top" on every page, plus a section menu on case studies */
.to-top, .toc-btn {
  position: fixed; z-index: 6; bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  height: calc(2 * var(--unit)); display: grid; grid-auto-flow: column; place-items: center; gap: 0.5rem;
  border: 0; border-radius: 999px; background: var(--surface); color: var(--fg); text-decoration: none; cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 24px -8px rgb(0 0 0 / 0.4);
}
.to-top { right: var(--gutter); width: calc(2 * var(--unit)); }
.toc-btn { right: calc(var(--gutter) + 2 * var(--unit) + 0.75rem); padding: 0 1rem 0 0.875rem; font: 500 var(--step--1)/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; }
.to-top:hover, .toc-btn:hover, body:has(.toc:popover-open) .toc-btn { background: var(--guide); color: #1a1c1e; }
/* The arrow fades in once the visitor has scrolled most of a screen (where scroll-driven animation is supported; elsewhere it is always shown) */
@supports (animation-timeline: scroll()) {
  .to-top { animation: to-top-in linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
  @keyframes to-top-in { 0%, 60% { opacity: 0; visibility: hidden; transform: translateY(0.5rem); } 100% { opacity: 1; visibility: visible; transform: none; } }
}
/* Section menu: a native popover (opens and closes without script; one inline handler closes it after a link is picked) */
.toc {
  position: fixed; inset: auto var(--gutter) calc(1rem + 2 * var(--unit) + 0.75rem + env(safe-area-inset-bottom, 0px)) auto; margin: 0;
  min-width: 15rem; max-width: calc(100vw - 2 * var(--gutter)); padding: calc(var(--unit) / 2) 0; border: 0; border-radius: var(--media-radius);
  background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line), var(--media-shadow);
}
.toc .label { padding: 0 1.25rem calc(var(--unit) / 2); }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: calc(var(--unit) / 2) 1.25rem; font: 500 var(--step-0)/var(--unit) var(--font-body); text-decoration: none; }
.toc a:hover, .toc a:focus-visible { background: color-mix(in srgb, var(--guide) 30%, transparent); color: var(--fg); outline-offset: -3px; }
/* Guard against sub-pixel sideways scroll on the narrowest phones (long one-word headings at 360px) */
body { overflow-x: clip; }

/* Label above the leadership principles */
.principles-wrap { display: grid; gap: var(--unit); align-content: start; }

/* Student projects: one card per row, image beside the text from 40rem up, stacked on top below that */
.students { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--unit); }
.student { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--unit) 1.5rem; padding: var(--unit); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); align-items: center; }
@media (min-width: 40rem) { .student { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.student__media img, .student__media--empty { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--media-radius); box-shadow: var(--media-shadow); }
.student__media--empty { display: grid; place-items: center; background-color: var(--bg); background-image: linear-gradient(color-mix(in srgb, var(--fg) 7%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--fg) 7%, transparent) 1px, transparent 1px); background-size: var(--unit) var(--unit); box-shadow: inset 0 0 0 1px var(--line); }
.student__media--empty span { font: 800 var(--step-1)/var(--unit) var(--font-display); text-transform: uppercase; color: var(--muted); }
.student__body { display: grid; gap: calc(var(--unit) / 2) 0; align-content: start; justify-items: start; min-width: 0; }
.student h4 { margin: 0; font: 700 var(--step-1)/var(--unit) var(--font-display); }
.student h4 a { text-decoration: none; }
.student h4 a:hover { text-decoration: underline; text-decoration-color: var(--guide); }
.student .chip { display: inline-block; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.student__link { text-decoration: none; color: var(--fg); }
.student__link:hover { color: var(--guide-ink); }

/* Mount Liberation top-down: transparent PNG shown whole at its own ratio. Its light legend
   needs a dark backdrop, so it sits on a dark panel in both themes. */
.figure--topdown .map-wrap { position: relative; padding: var(--unit); background: #1f2225; border-radius: var(--media-radius); box-shadow: var(--media-shadow); }
.figure--topdown .map-wrap > img { display: block; width: 100%; height: auto; }

/* Level flow beats: a compact key under the top-down map, same width as the map */
.beats { max-width: calc(30 * var(--unit)); width: 100%; margin-inline: auto; gap: calc(var(--unit) / 2); grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); }
.beats li { grid-template-columns: 1.5rem minmax(0, 1fr) auto; align-items: center; gap: 0 0.5rem; padding: calc(var(--unit) / 4) 0.75rem; }
.beats li::before { grid-row: 1; }
.beats h3 { font-size: var(--step--1); line-height: var(--unit); }
.beats .tag { justify-self: end; font-size: 0.625rem; padding: 0 0.375rem; }
.cs-section { grid-template-columns: minmax(0, 1fr); } /* keep wide children from stretching the column on phones */

/* Hovering a beat lights up its number on the map (CSS only, via :has) */
.map-hit { position: absolute; left: calc(var(--unit) + (100% - 2 * var(--unit)) * var(--x)); top: calc(var(--unit) + (100% - 2 * var(--unit)) * var(--y)); width: 6%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%) scale(0.6); opacity: 0; pointer-events: none; background: color-mix(in srgb, var(--guide) 35%, transparent); box-shadow: 0 0 0 3px var(--guide), 0 0 24px 6px color-mix(in srgb, var(--guide) 70%, transparent); transition: opacity 0.2s, transform 0.2s; }
.cs-section:has(.beats li:nth-child(1):hover) .map-hit:nth-of-type(1),
.cs-section:has(.beats li:nth-child(2):hover) .map-hit:nth-of-type(2),
.cs-section:has(.beats li:nth-child(3):hover) .map-hit:nth-of-type(3),
.cs-section:has(.beats li:nth-child(4):hover) .map-hit:nth-of-type(4),
.cs-section:has(.beats li:nth-child(5):hover) .map-hit:nth-of-type(5),
.cs-section:has(.beats li:nth-child(6):hover) .map-hit:nth-of-type(6),
.cs-section:has(.beats li:nth-child(7):hover) .map-hit:nth-of-type(7),
.cs-section:has(.beats li:nth-child(8):hover) .map-hit:nth-of-type(8) { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.beats li { transition: background 0.2s; }
.beats li:hover { background: color-mix(in srgb, var(--guide) 25%, var(--surface)); }
@media (prefers-reduced-motion: reduce) { .map-hit, .beats li { transition: none; } }

/* Level flow: the beat list sits inside the map panel. From 48rem it is overlaid on the empty
   bottom-left of the top-down (measured: free below 50% height, left of 38% width), so each
   beat and its number light up together. Narrower, it follows the map inside the panel. */
.figure--topdown { max-width: 35rem; }
.figure--topdown .map-wrap { container-type: inline-size; }
.figure--topdown .beats { margin-top: var(--unit); max-width: none; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; font-size: 0.875rem; }
@media (min-width: 48rem) {
  .figure--topdown { max-width: 52.5rem; }
  .figure--topdown .beats {
    position: absolute; margin: 0; left: calc(var(--unit) + (100% - 2 * var(--unit)) * 0.015); bottom: calc(var(--unit) + (100% - 2 * var(--unit)) * 0.028); /* list bottom = island bottom (97.2% of the image) */
    width: calc((100% - 2 * var(--unit)) * 0.36); gap: 0.6cqi; font-size: clamp(0.625rem, 1.55cqi, 0.8125rem);
  }
}
/* Beat list on the dark map panel, at every width */
.figure--topdown .beats li { grid-template-columns: 1.6em minmax(0, 1fr); grid-template-rows: auto auto; padding: 0.35em 0.6em; background: rgb(255 255 255 / 0.06); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14); border-radius: 6px; color: #e5e6e2; }
.figure--topdown .beats li::before { grid-row: 1 / span 2; font-size: 1em; line-height: 1.3; color: #f0bf2a; }
.figure--topdown .beats h3 { font-size: 1em; line-height: 1.3; }
.figure--topdown .beats .tag { grid-column: 2; justify-self: start; font-size: 0.75em; line-height: 1.5; padding: 0 0.4em; color: #9ba0a4; border-color: rgb(255 255 255 / 0.2); }
.figure--topdown .beats li:hover { background: rgb(240 191 42 / 0.28); }

/* Small image beside the text (Mount Liberation "What I learned"), shown whole at its own ratio */
@media (min-width: 52rem) { .split--aside { grid-template-columns: minmax(0, var(--measure)) 16rem; justify-content: start; } }
.figure--small { max-width: 16rem; }
.figure--small > img { height: auto; object-fit: initial; }
