/* Fonts, self-hosted from fonts/ (variable, weights 400-600; SIL OFL, see fonts/OFL-*.txt).
   Newsreader is the weight-only cut, without the optical-size axis: 58 KB instead of 132 KB.
   Latin covers the page; latin-ext only downloads if a character needs it (e.g. ō).
   Newsreader's true italic (weight-only cut, from Fontsource) loads only on pages that set italic serif text. */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/newsreader-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/newsreader-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 400 600; font-display: swap; src: url("fonts/newsreader-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 400 600; font-display: swap; src: url("fonts/newsreader-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/inter-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/inter-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #272624;
  --muted: #5d5c58;
  --faint: #706e69;
  --line: #e4e3de;
  --accent: #2f5d8a;
  --accent-soft: #e7eef6;
  --warm: #9c5636;
  --warm-soft: #f5ece7;
  --been: #4f8a5b;
  --page: #efe9dd;  /* book page edges */
  --page-line: #ddd5c4;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131414;
    --surface: #1b1c1c;
    --text: #e6e5e0;
    --muted: #a6a59f;
    --faint: #8d8b85;
    --line: #2c2c2b;
    --accent: #8db6dd;
    --accent-soft: #1f2a35;
    --warm: #d9a07f;
    --warm-soft: #2b2320;
    --been: #8cc79a;
    --page: #3a3631;
    --page-line: #2a2724;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .wrap { padding: 0 32px; } }

/* Header */
/* Reading progress: a thin warm line along the header's bottom edge that fills as the page scrolls,
   where browsers support scroll-driven animations (nothing shows elsewhere) */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--warm); transform-origin: left; transform: scaleX(0); animation: read-progress linear both; animation-timeline: scroll(root); }
  }
}
@keyframes read-progress { to { transform: scaleX(1); } }
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; }
.nav-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--text); }
.nav-links { display: flex; gap: 1.25rem; font-size: 0.92rem; }
.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--text); }
/* The page you're on (or, for Travel, Thinking and Values, the page they belong to) */
.nav-links a[aria-current] { color: var(--text); text-decoration: underline; text-decoration-color: var(--warm); text-decoration-thickness: 1px; text-underline-offset: 0.4em; }

/* Hero */
.hero { position: relative; display: flex; flex-direction: column; gap: 1.5rem; padding: 4.5rem 16px 2.5rem; }
@media (min-width: 640px) { .hero { padding: 7rem 32px 3.3rem; } }
.hero h1 {
  position: relative; width: fit-content;
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4.2rem); line-height: 1.05; letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}
.portrait { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; background: #fff;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--accent), 0 0 0 9px var(--bg), 0 0 0 11px color-mix(in srgb, var(--warm) 70%, transparent); }
@media (min-width: 820px) {
  .hero { flex-direction: row-reverse; justify-content: space-between; align-items: center; gap: 3rem; }
  .portrait { width: 220px; height: 220px; flex-shrink: 0; }
}
.lede { font-family: var(--serif); font-size: clamp(1.25rem, 2.6vw, 1.6rem); line-height: 1.4; max-width: 38ch; margin: 0 0 1rem; }
.hero-sub { color: var(--muted); max-width: 52ch; margin: 0 0 1.75rem; }
.hello { margin: 0 0 0.6rem; font-weight: 500; }
.hello a { white-space: nowrap; padding: 0.15rem 0.8rem; border-radius: 999px; background: var(--accent-soft); transition: background-color 0.2s; }
.hello a:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 16%, var(--accent-soft)); }
.contact { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; font-size: 0.95rem; }
.copy-email { margin-left: 0.45rem; padding: 0.1rem 0.55rem; font: 600 0.72rem/1.4 var(--sans); color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; vertical-align: 0.1em; }
/* On touch screens the button keeps its size but gets a fingertip-sized tap area (about 45 px tall). */
@media (pointer: coarse) { .copy-email { position: relative; } .copy-email::after { content: ""; position: absolute; inset: -12px -8px; } }
.copy-email:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* Sections */
.section { padding-top: 4.5rem; padding-bottom: 2.2rem; }
.section-title {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--warm);
  display: flex; align-items: center; gap: 0.6rem; position: relative;
  margin: 0 0 2rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line);
}
/* A short warm underline on the rule, drawn in as the title scrolls into view where browsers can */
.section-title::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 3.5rem; height: 2px; background: var(--warm); transform-origin: left; }
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .section-title::after { animation: title-draw linear both; animation-timeline: view(); animation-range: entry 10% cover 25%; }
  }
}
@keyframes title-draw { from { transform: scaleX(0); } }
/* Outside work: an elevation profile of five passes instead of the plain rule, drawn in on load */
#outside .section-title { border-bottom: 0; padding-bottom: 0.2rem; margin-bottom: 0.3rem; }
#outside .section-title::after { display: none; }
.ridge { display: block; width: 100%; height: 56px; margin: 0 0 1.8rem; overflow: visible; }
.ridge path { fill: none; stroke: color-mix(in srgb, var(--warm) 55%, var(--line)); stroke-width: 1.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: ride-draw 2.4s ease-out 0.2s forwards; }
@media (prefers-reduced-motion: reduce) { .ridge path { animation: none; stroke-dashoffset: 0; } }
@media (max-width: 600px) { .ridge { height: 36px; margin-bottom: 1.3rem; } }
/* A trail map's contour lines, faint, behind Outside work and the Endurance tile */
.outside, .tile-grit { position: relative; isolation: isolate; }
.outside::before, .tile-grit::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: url("images/contours.svg") right top / 480px repeat; opacity: 0.16; }
.outside::before { inset: 3.5rem -16px 0; -webkit-mask-image: linear-gradient(to left, #000, transparent 75%); mask-image: linear-gradient(to left, #000, transparent 75%); }
.tile-grit { overflow: hidden; }
h3 { font-family: var(--serif); font-weight: 600; font-size: 1.55rem; line-height: 1.25; margin: 0 0 0.6rem; }

/* Projects */
.project { display: grid; gap: 1rem; margin-bottom: 3.25rem; }
@media (min-width: 820px) {
  .project { grid-template-columns: 0.85fr 1fr; gap: 2rem; align-items: center; }
}
/* North star: two guiding lines under the intro, human and technical, side by side on wide screens */
.north-star { padding-top: 2.5rem; padding-bottom: 0; }
.ns-lines { display: grid; gap: 1rem; }
@media (min-width: 820px) { .ns-lines { grid-template-columns: 1fr 1fr; gap: 1.5rem; } }
.ns-line { padding: 1.2rem 1.4rem 1.3rem; border: 1px solid var(--line); border-left: 3px solid var(--warm); border-radius: 14px; background: var(--surface); }
.ns-line + .ns-line { border-left-color: var(--accent); }
.ns-kind { margin: 0 0 0.35rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ns-text { margin: 0; font-family: var(--serif); font-size: clamp(1.15rem, 2vw, 1.35rem); line-height: 1.4; color: var(--text); }
/* Featured: the top four projects, two by two on wide screens, each a large image above
   a one-sentence hook, its stack and links to the live demo and the source. */
.featured { display: grid; gap: 2.75rem 2rem; }
@media (min-width: 820px) { .featured { grid-template-columns: 1fr 1fr; } }
.featured .project { grid-template-columns: 1fr; gap: 1rem; align-items: start; align-content: start; margin-bottom: 0; }
.featured .project-text h3 { font-size: 1.45rem; }
.featured .project-text h3 + p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.5; }
.featured .links { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; }
.featured + .more { margin-top: 2.5rem; }
/* A Featured card's year and status, and Rewarding's pre-registered results */
.card-when { margin: 0 0 0.2rem !important; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.card-results { font-size: 0.9rem; color: var(--muted); }
/* The honest miss on each Featured card, and the current bet under each thought */
.card-miss, .bet { font-size: 0.9rem; color: var(--muted); }
.card-miss span, .bet span { display: block; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--warm); }
/* The image opens the live demo too; the text link is the one for keyboards and screen readers. */
.shot-link { display: contents; }
/* "Try it live" on cards whose demo runs in the browser */
.shot.has-badge { position: relative; }
.try-badge { display: inline-flex; align-items: center; gap: 0.35rem; font: 600 0.74rem/1 var(--sans); letter-spacing: 0.02em; padding: 0.42rem 0.7rem; border-radius: 999px; color: #fff; background: color-mix(in srgb, var(--warm) 92%, #000); text-decoration: none; box-shadow: 0 4px 12px -4px rgb(0 0 0 / 0.35); }
.try-badge::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: #9be3a8; box-shadow: 0 0 0 3px rgb(155 227 168 / 0.3); }
.shot .try-badge { position: absolute; top: 0.7rem; right: 0.7rem; }  /* the card's own links carry it for keyboards and screen readers */
.try-badge:hover { text-decoration: none; background: var(--warm); }
.try-badge.inline { vertical-align: 0.2em; margin-left: 0.4rem; font-size: 0.68rem; padding: 0.32rem 0.6rem; }
@media (prefers-color-scheme: dark) { .try-badge { color: #1b1410; background: var(--warm); } .try-badge:hover { background: color-mix(in srgb, var(--warm) 85%, #fff); } }
.shot:has(.shot-link) img { cursor: pointer; }
/* More projects: one compact line each, two columns on wide screens, no pictures. */
.minis { list-style: none; padding: 0; margin: 0; display: grid; column-gap: 2rem; }
@media (min-width: 720px) { .minis { grid-template-columns: 1fr 1fr; } }
.mini { padding: 0.9rem 0 1rem; border-top: 1px solid var(--line); }
.mini h3 { font-size: 1.12rem; margin: 0 0 0.2rem; }
.mini p { margin: 0; font-size: 0.92rem; line-height: 1.55; color: var(--muted); }
.mini .links { display: flex; flex-wrap: wrap; gap: 0 1rem; margin-top: 0.35rem; font-size: 0.88rem; }
.mini .links.private { display: block; font-size: 0.82rem; color: var(--faint); }
/* Apps you can use: an icon, a line, and a Buy button that goes to the Lemon Squeezy checkout */
.apps-intro { color: var(--muted); margin: 0 0 1.25rem; }
.apps { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
@media (min-width: 720px) { .apps { grid-template-columns: 1fr 1fr; } }
.app { display: grid; grid-template-columns: 64px 1fr; gap: 1rem; align-items: start; align-content: start; padding: 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.app-icon { width: 64px; height: 64px; }
.app .app-shot { grid-column: 1 / -1; margin: 0 0 0.2rem; }  /* a screenshot across the top of the card */
.app h3 { font-size: 1.15rem; margin: 0.1rem 0 0.25rem; }
.app p { margin: 0; font-size: 0.92rem; line-height: 1.55; color: var(--muted); }
.app .app-meta { margin-top: 0.35rem; font-size: 0.82rem; color: var(--faint); }
.app .links { margin-top: 0.75rem; }
.soon { display: inline-block; padding: 0.4rem 0.95rem; border-radius: 999px; font-weight: 600; font-size: 0.85rem; color: var(--warm); background: var(--warm-soft); }
.download { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.42rem 0.95rem; border-radius: 999px; font-weight: 600; font-size: 0.9rem; color: #fff; background: var(--accent); transition: background-color 0.2s; }
.download::before { content: "↓"; font-weight: 700; }
.download:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 85%, #000); }
@media (prefers-color-scheme: dark) { .download { color: #0f1a24; } .download:hover { background: color-mix(in srgb, var(--accent) 85%, #fff); } }
.app .links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; }
.app .app-note { margin-top: 0.45rem; font-size: 0.8rem; color: var(--faint); }
.buy { display: inline-block; padding: 0.4rem 0.95rem; border-radius: 999px; font-weight: 600; font-size: 0.9rem; background: var(--accent-soft); transition: background-color 0.2s; }
.buy:hover { text-decoration: none; background: color-mix(in srgb, var(--accent) 16%, var(--accent-soft)); }
.buy { white-space: nowrap; }
@media (max-width: 480px) { .app { grid-template-columns: 48px 1fr; gap: 0.8rem; padding: 1rem 0.9rem; } .app-icon { width: 48px; height: 48px; } }
@media (pointer: coarse) { .buy { padding-block: 0.65rem; } }
/* Built for fun: the rest of More projects, closed until clicked (anchors.js opens it for a link to one of them) */
.fun { margin-top: 1.25rem; }
.fun > summary { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; padding: 0.5rem 0; border-top: 1px solid var(--line); cursor: pointer; list-style: none;
  font: 600 0.8rem/1.4 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.fun > summary::-webkit-details-marker { display: none; }
.fun > summary::before { content: ""; width: 0.4rem; height: 0.4rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform 0.2s; }
.fun[open] > summary::before { transform: rotate(45deg); }
.fun > summary:hover { color: var(--text); }
.fun-count { font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: var(--faint); }
.shot { margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); aspect-ratio: 16 / 10; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
/* The card's <picture> (AVIF with a WebP fallback) lays out as if it were just the image. */
.shot picture { display: contents; }
.shot img, .shot video { width: 100%; height: 100%; object-fit: cover; object-position: top left; display: block; }
.shot video { cursor: pointer; }
.shot.contain img, .shot.contain video { object-fit: contain; object-position: center; background: #fcfcfa; }
/* For a wide screenshot whose useful part is on the right */
.shot.crop-right img, .shot.crop-right video { object-position: top right; }
.project-text p { margin: 0 0 0.6rem; }
.project-text h3 { font-size: 1.35rem; margin-bottom: 0.35rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.85rem; color: var(--faint); }
.links { font-size: 0.95rem; font-weight: 500; }
.links.private { font-size: 0.85rem; font-weight: 400; color: var(--faint); }

/* Research */
.role { display: grid; gap: 0.25rem; padding: 1.75rem 0; border-top: 1px solid var(--line); max-width: 860px; }
.role:first-of-type { border-top: 0; padding-top: 0; }
@media (min-width: 720px) { .role { grid-template-columns: 9rem 1fr; gap: 2rem; } }
.role h3 { font-size: 1.3rem; margin-bottom: 0.15rem; }
.when { margin: 0.3rem 0 0; font-size: 0.9rem; font-weight: 500; color: var(--accent); font-variant-numeric: tabular-nums; }
.where { margin: 0 0 0.7rem; font-size: 0.92rem; color: var(--muted); }
.role p { margin-top: 0; }
.role .tags { margin-bottom: 0; }
/* Research & work: a thin rail with a dot per role, between the years and the entry */
@media (min-width: 720px) {
  #research .role { position: relative; border-top: 0; }
  #research .role::before { content: ""; position: absolute; left: 10rem; top: 0; bottom: 0; width: 1px; background: var(--line); }
  #research .role:first-of-type::before { top: 0.75rem; }
  #research .role:last-of-type::before { bottom: auto; height: 2.5rem; }
  #research .role::after { content: ""; position: absolute; left: calc(10rem - 4.5px); top: calc(1.75rem + 0.55rem); width: 10px; height: 10px; box-sizing: border-box; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
  #research .role:first-of-type::after { top: 0.55rem; }
}
.more { color: var(--muted); margin-top: 1.5rem; }

/* Skills: one row per group, the group name on the left on wide screens */
.page-updated { margin: -0.4rem 0 0; font-size: 0.85rem; color: var(--faint); }
.skills-updated { margin: -1.25rem 0 1.5rem; font-size: 0.85rem; color: var(--faint); }
.skill-row { display: grid; gap: 0.4rem; padding: 0.9rem 0; border-top: 1px solid var(--line); max-width: 860px; }
.skill-row:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 720px) { .skill-row { grid-template-columns: 9rem 1fr; gap: 2rem; align-items: baseline; } }
.skill-row h3 { font-family: var(--sans); font-size: 0.92rem; font-weight: 600; margin: 0; }
.skill-row .tags { margin: 0; }

/* Touch screens: links in rows and lines of text get at least a 24 px tall tap area */
@media (pointer: coarse) {
  .contact a, .hello a, .links a, .footer a, .page-link a, .more a, .outside a { display: inline-block; padding-block: 0.25rem; }
}

/* Hidden replay: "soccer tournaments" in Outside work opens it (messi.js); it looks like plain text */
.messi-egg { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.messi-egg:hover { color: var(--accent); }
.messi { width: min(720px, calc(100vw - 32px)); }
.pong.messi canvas { cursor: default; aspect-ratio: 672 / 576; width: auto; max-width: 100%; max-height: 70vh; margin-inline: auto; }  /* its own shape, not Pong's 16:10, and short enough to fit */
.messi-foot { display: flex; gap: 1rem; align-items: center; justify-content: space-between; margin-top: 0.6rem; }
.messi-foot .pong-help { margin: 0; }
.messi-again { flex-shrink: 0; font: 600 0.85rem var(--sans); color: var(--accent); background: var(--accent-soft); border: 0; border-radius: 999px; padding: 0.4rem 0.9rem; cursor: pointer; }
/* Hidden tree: the first-principles line on What I try to live by opens it (tree.js); it looks like plain text */
.tree-egg, .maze-egg, .world-egg, .swarm-egg { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.tree-egg:hover, .maze-egg:hover, .world-egg:hover, .swarm-egg:hover { color: var(--accent); }
.pong.tree canvas { cursor: default; aspect-ratio: 4 / 3; }
.maze { width: min(900px, calc(100vw - 32px)); }
.pong.maze canvas { cursor: default; aspect-ratio: 864 / 356; }
.pong.world canvas { cursor: default; aspect-ratio: 640 / 440; }
.pong.swarm canvas { cursor: crosshair; aspect-ratio: 640 / 420; }

/* The "#" link beside each entry's heading (anchors.js): faint until the entry is hovered or focused */
.anchor { margin-left: 0.15rem; font: 500 0.8em var(--sans); color: var(--faint); text-decoration: none; opacity: 0; transition: opacity 0.15s; }
.project:hover .anchor, .role:hover .anchor, .mini:hover .anchor, .thought:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); text-decoration: none; }
/* Phones have no hover: keep the "#" on Thinking, where linking one thought matters, and drop it on the profile. */
@media (hover: none) { .anchor { opacity: 0.6; } .project .anchor, .role .anchor, .mini .anchor { display: none; } }

/* Footer */
.footer { position: relative; padding-top: 2.4rem; padding-bottom: 3rem; margin-top: 2rem; font-size: 0.9rem; color: var(--faint); }
/* The five-pass ridge, small and faint, as the footer's top edge */
.footer::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; height: 20px; background: color-mix(in srgb, var(--warm) 35%, var(--line)); -webkit-mask: url("images/ridge.svg") center / 100% 100% no-repeat; mask: url("images/ridge.svg") center / 100% 100% no-repeat; }
.footer p { margin: 0; }

/* Colour accents */
.hero::before {
  content: ""; position: absolute; inset: 0 -20vw; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40rem 22rem at 85% 35%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    radial-gradient(40rem 24rem at 14% 22%, color-mix(in srgb, var(--warm) 14%, transparent), transparent 70%);
}
/* A soft paper grain over the intro's wash, fading out at the bottom so it never meets a hard edge */
.hero::after {
  content: ""; position: absolute; inset: 0 -20vw; z-index: -1; pointer-events: none;
  background: url("images/grain.svg") repeat; opacity: 0.13;
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to bottom, #000 55%, transparent);
}
main { overflow-x: clip; }
.section-title::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--warm); }
.tags.pubs { display: block; }
.chip { font-size: 0.78rem; line-height: 1.5; padding: 0.1rem 0.55rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.project .chip { background: var(--warm-soft); color: var(--warm); }
.credit { font-size: 0.75rem; color: var(--faint); }
.project:hover .shot { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.28); transform: translateY(-2px); }
/* Featured cards: the image eases in a touch and the title takes the accent on hover */
.featured .shot img { transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.featured .project:hover .shot img { transform: scale(1.035); }
.featured .project-text h3 { transition: color 0.2s; }
.featured .project:hover .project-text h3 { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .featured .shot img { transition: none; } .featured .project:hover .shot img { transform: none; } }
.nav-name::before { content: ""; display: inline-block; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--warm); margin-right: 0.5rem; vertical-align: middle; }
.outside { color: var(--text); font-size: 1rem; line-height: 1.7; }
.outside p { max-width: 68ch; margin: 0 0 0.9rem; }
.outside p:first-of-type { min-height: 2.6em; }
.outside strong { color: var(--text); font-weight: 600; }

/* Media slots: looping clips with a poster fallback (see media.js) */
.role .shot { aspect-ratio: 16 / 9; max-width: 460px; margin: 0.2rem 0 0.9rem; }
.role .shot img, .role .shot video { object-position: center; }

/* Accessibility */
picture { display: contents; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.shot:has(video:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: 16px; top: -3rem; z-index: 20; padding: 0.4rem 0.8rem; border-radius: 6px; background: var(--surface); color: var(--accent); border: 1px solid var(--line); font-size: 0.92rem; }
.skip:focus { top: 0.6rem; }
/* Links inside sentences are underlined, not told apart by colour alone. */
.more a, .footer a, .credit a, .outside a, .page-head p a, .role p:not(.links):not(.tags) a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.nav-links .file { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; color: var(--faint); }

/* Musings: short notes in three groups, side by side on wide screens */
.musings { display: grid; gap: 1.25rem; }
@media (min-width: 820px) { .musings { grid-template-columns: repeat(3, 1fr); } }
.musing-group { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.25rem 1.25rem 0.4rem; }
.musing-group h3 { font-size: 1.3rem; margin: 0 0 0.15rem; }
.musing-blurb { margin: 0 0 0.9rem; font-size: 0.9rem; color: var(--muted); }
.musing { border-top: 1px solid var(--line); padding: 0.9rem 0; }
.musing .when { margin: 0; font-size: 0.82rem; }
.musing h4 { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; line-height: 1.3; margin: 0.2rem 0 0.35rem; }
.musing p:last-child { margin: 0; font-size: 0.95rem; }
.musing-empty { border-top: 1px dashed var(--line); padding: 0.9rem 0; margin: 0; font-size: 0.92rem; font-style: italic; color: var(--muted); }
.nav-name, .nav-links a { white-space: nowrap; }
/* Narrow screens: there's room for three links. On the profile, Featured projects start right below
   the intro while Research is screens further down, so Projects gives way; on the other pages Profile
   already leads to the projects. */
@media (max-width: 600px) {
  .nav-links { gap: 0.8rem; }
  .nav-links a[href$="#featured"], .nav-links .file { display: none; }
}
@media (max-width: 380px) { .nav-links { gap: 0.6rem; } }
@media (max-width: 360px) { .nav-name { font-size: 1.02rem; } .nav-links { gap: 0.5rem; font-size: 0.86rem; } }  /* 320 px phones */

/* Things I'm thinking about: its own page (thinking.html) */
.page { padding-top: 3.5rem; padding-bottom: 2rem; max-width: 760px; }
.page-head { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.page-head h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(2.2rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 0.75rem; }
.page-head p { color: var(--muted); margin: 0; }
.thoughts { list-style: none; padding: 0; margin: 0; counter-reset: thought; }
.thought { counter-increment: thought; position: relative; padding: 0 0 1.75rem 2.75rem; margin-bottom: 1.75rem; border-bottom: 1px solid var(--line); }
.thought::before { content: counter(thought, decimal-leading-zero); position: absolute; left: 0; top: 0.2rem; font-family: var(--serif); font-size: 1.1rem; color: var(--warm); }
.thought h2 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; line-height: 1.3; margin: 0 0 0.4rem; }
.thought p { margin: 0 0 0.5rem; }
/* A serif drop cap opens Outside work on the profile */
.outside p:first-of-type::first-letter { float: left; font-family: var(--serif); font-weight: 600; font-size: 3.1em; line-height: 0.85; margin: 0.08em 0.1em 0 0; color: var(--warm); }
.thought .when { margin: 0; font-size: 0.85rem; }
.role .tags + .tags { margin-top: 0.6rem; }

/* Photos: its own page (photos.html), a grid of captioned photos */
.photos-page { max-width: 1040px; }
.photos { display: grid; gap: 1.5rem; }
@media (min-width: 640px) { .photos { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .photos { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .photos.pair { grid-template-columns: repeat(2, 1fr); } }  /* two items: fill the row */
.photo { margin: 0; }
/* Inspiration drawings tilt toward the cursor (tilt.js sets the angles) */
.inspo-card .photo { perspective: 900px; }
.inspo-card .photo img { transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)); transition: transform 0.25s ease-out, box-shadow 0.25s; will-change: transform; }
.inspo-card .photo:hover img { box-shadow: 0 18px 36px -20px rgb(0 0 0 / 0.45); }
@media (prefers-reduced-motion: reduce) { .inspo-card .photo img { transform: none; transition: none; } }
.photo img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; display: block; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); }
.photo figcaption { margin-top: 0.55rem; font-size: 0.92rem; color: var(--muted); line-height: 1.45; }
.photo figcaption strong { display: block; color: var(--text); font-weight: 600; }
.photos-empty { grid-column: 1 / -1; margin: 0; padding: 1rem 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); color: var(--muted); font-style: italic; }
.photo-log { margin-top: 3.5rem; }
.wishlist-note { margin: -1.25rem 0 1.5rem; color: var(--muted); font-size: 0.92rem; }
.wishlist.going { margin-bottom: 3rem; }
/* Interests: Now, a few lines on what I'm doing this month */
.now { margin-bottom: 3rem; }
.now-list { margin: 0; padding-left: 1.2rem; }
.now-list li { margin-bottom: 0.4rem; }
.now-list a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.now-sub { font-family: var(--sans); font-size: 0.92rem; font-weight: 600; margin: 1.6rem 0 0.6rem; }
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.events strong { font-weight: 600; }
.events .event-where { color: var(--muted); }
.events time { margin-left: auto; font-size: 0.9rem; color: var(--warm); font-variant-numeric: tabular-nums; }
/* Profile: a short through-line above the Research & work timeline */
.section-intro { max-width: 68ch; margin: 0 0 2rem; font-family: var(--sans); font-size: 1.06rem; line-height: 1.75; color: var(--text); }  /* the body sans reads easier than the serif at this length */
@media (min-width: 720px) { #research .section-intro { margin-left: 11rem; max-width: calc(860px - 11rem); } #writeups .thanks { margin-left: 11rem; max-width: calc(860px - 11rem); } }  /* starts where the role titles do: years column plus gap */
/* Travel map (built by tools/make-map.py): countries I've been to tinted, a pin per place, coloured by kind */
.travel-map { margin: 0 0 3rem; }
.travel-map svg { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.map-ocean { fill: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.map-grid { fill: none; stroke: color-mix(in srgb, var(--accent) 16%, var(--surface)); stroke-width: 0.8; }
.map-land { fill: color-mix(in srgb, var(--text) 13%, var(--surface)); stroke: var(--surface); stroke-width: 0.7; }
@media (prefers-color-scheme: dark) { .map-land { fill: color-mix(in srgb, var(--text) 22%, var(--surface)); } .map-ocean { fill: color-mix(in srgb, var(--accent) 7%, var(--bg)); } }
.map-been { fill: color-mix(in srgb, var(--been) 38%, var(--surface)); }
.pin-going { --pin: var(--warm); }
.pin-want { --pin: var(--accent); }
.pin-been { --pin: var(--been); }
.pin-dot { fill: var(--pin); stroke: var(--surface); stroke-width: 3; }
.pin-halo { fill: var(--pin); opacity: 0.18; transition: opacity 0.2s; }
.travel-map a:hover .pin-halo { opacity: 0.45; }
/* Keyboard focus: a solid ring round the pin in its own colour (the browser's outline would box the whole map) */
.travel-map a:focus-visible { outline: none; }
.travel-map a:focus-visible .pin-halo { opacity: 1; fill-opacity: 0.25; stroke: var(--pin); stroke-width: 4; animation: none; }
.travel-map a:focus-visible .pin-dot { stroke: var(--text); }
.pin-going .pin-halo { transform-box: fill-box; transform-origin: center; animation: pin-pulse 2.4s ease-out infinite; }
@keyframes pin-pulse { 0% { transform: scale(0.6); opacity: 0.5; } 100% { transform: scale(1.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pin-going .pin-halo { animation: none; } }
/* Long trips (the Seattle-to-DC ride, the road across Pakistan): a line that draws itself in once, revealed by an animated mask */
.map-route-line { fill: none; stroke: var(--warm); stroke-width: 3; stroke-dasharray: 7 6; stroke-linecap: round; }
.map-road .map-route-line { stroke-dasharray: 0.1 5.5; stroke-width: 3.5; }  /* dotted, so it reads apart from the bike */
.map-route-reveal { fill: none; stroke: #fff; stroke-width: 12; stroke-dasharray: 1; stroke-dashoffset: 1; animation: ride-draw 2.6s ease-in-out 0.4s forwards; }
.map-route-end { fill: var(--warm); stroke: var(--surface); stroke-width: 2; }
@keyframes ride-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .map-route-reveal { animation: none; stroke-dashoffset: 0; } }
.map-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-top: 0.7rem; font-size: 0.88rem; color: var(--muted); }
.key::before { content: ""; display: inline-block; width: 0.65rem; height: 0.65rem; margin-right: 0.4rem; border-radius: 50%; background: var(--pin); vertical-align: 0.02em; }
.key-ride::before { width: 18px; height: 0; border-radius: 0; background: none; border-top: 3px dashed var(--warm); }
.key-road::before { width: 18px; height: 0; border-radius: 0; background: none; border-top: 3px dotted var(--warm); }
.key-going { --pin: var(--warm); } .key-want { --pin: var(--accent); } .key-been { --pin: var(--been); }
.key-count { color: var(--faint); font-variant-numeric: tabular-nums; }
.map-been-list { margin: 0.45rem 0 0; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
.map-been-list .key { color: var(--text); font-weight: 500; margin-right: 0.3rem; }
/* A pin's link lands on its card below the sticky header */
.photo[id^="place-"] { scroll-margin-top: 5rem; }
.trip-dates { display: block; margin-top: 0.2rem; color: var(--accent); font-weight: 500; }

/* Writings: its own page (writings.html), unlinked until the first piece is in */
.writings { margin: 0; }
.writing { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.writing:first-child { padding-top: 0; }
.writing h2 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; line-height: 1.3; margin: 0 0 0.4rem; }
.writing p { margin: 0 0 0.6rem; }
.writing .when { margin: 0; font-size: 0.85rem; }
.writings-empty { margin: 0; padding: 0 0 1rem; border-bottom: 1px dashed var(--line); color: var(--muted); font-style: italic; }

/* Values & inspiration: its own page (values.html), linked from the footer */
.values { list-style: none; padding: 0; margin: 0 0 3rem; counter-reset: value; }
.value { counter-increment: value; position: relative; padding: 0 0 1.25rem 2.75rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.value::before { content: counter(value, decimal-leading-zero); position: absolute; left: 0; top: 0.15rem; font-family: var(--serif); font-size: 1.05rem; color: var(--warm); }
.value h3 { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; margin: 0 0 0.3rem; }
.value p { margin: 0; color: var(--muted); }
.inspo { list-style: none; padding: 0; margin: 0; }
.inspo-item { padding: 0.75rem 0; border-bottom: 1px solid var(--line); color: var(--muted); }
.inspo-item strong { color: var(--text); font-weight: 600; margin-right: 0.4rem; }
.inspo-group { margin-top: 3rem; }
/* Inspiration: a card per person or thing, with a drawing, in a grid like the photos */
.inspo:has(.inspo-card) { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.inspo-link { display: block; margin-top: 0.3rem; font-weight: 500; }
.media { margin-top: 3rem; }
.media-kind { display: inline-block; margin-right: 0.4rem; padding: 0 0.5rem; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.03em; border-radius: 999px; background: var(--warm-soft); color: var(--warm); vertical-align: 0.1em; }
/* Beliefs: tabs (beliefs.js), What I believe currently, My predictions and Outdated */
.beliefs { margin-top: 3rem; }
.belief-tabs { display: inline-flex; gap: 0.25rem; padding: 0.25rem; margin: 0 0 1.25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.belief-tabs [role="tab"] { font: 600 0.88rem/1.2 var(--sans); padding: 0.5rem 0.95rem; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.belief-tabs [role="tab"]:hover { color: var(--text); }
.belief-tabs [role="tab"][aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.belief-tabs[hidden] { display: none; }
/* Small phones: the three tabs share the full width, sized to their labels; on the narrowest
   screens a long label wraps onto two lines rather than running off the edge. */
@media (max-width: 420px) {
  .belief-tabs { display: flex; width: 100%; border-radius: 1.4rem; }
  .belief-tabs [role="tab"] { flex: 1 1 auto; min-width: 0; padding: 0.5rem 0.35rem; font-size: 0.76rem; line-height: 1.15; border-radius: 1.2rem; }
}
.belief-heading { font-family: var(--sans); font-size: 0.92rem; font-weight: 600; margin: 0 0 0.6rem; }
/* Beliefs and Ways I want to lead my life read as quotes: italic serif with a thin bar on the left, no dividers */
.beliefs .inspo-item, #how-i-want-to-live .inspo-item, #how-i-lead .inspo-item { border-bottom: 0; padding: 0.15rem 0 0.15rem 1rem; margin: 0 0 1rem; border-left: 2px solid color-mix(in srgb, var(--warm) 45%, var(--surface)); }
.beliefs .inspo-item strong, #how-i-want-to-live .inspo-item strong, #how-i-lead .inspo-item strong { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 1.15rem; line-height: 1.45; color: var(--text); margin: 0; }
.belief-panel + .belief-panel { margin-top: 2rem; }
/* Current beliefs as pull quotes: larger, with a hanging quote mark instead of the rule */
#beliefs-current .inspo-item { position: relative; border-left: 0; padding: 0.2rem 0 0.2rem 2.2rem; margin-bottom: 1.6rem; }
#beliefs-current .inspo-item::before { content: "“"; position: absolute; left: 0; top: -0.55rem; font-family: var(--serif); font-size: 3.4rem; line-height: 1; color: var(--warm); opacity: 0.85; }
#beliefs-current .inspo-item strong { font-size: 1.45rem; line-height: 1.35; margin-bottom: 0.25rem; }
.beliefs .inspo-item strong, #how-i-want-to-live .inspo-item strong, #how-i-lead .inspo-item strong { display: block; }  /* the belief on its own line, the reason under it */
.beliefs.tabbed .belief-heading, .beliefs.single .belief-heading { display: none; }
.beliefs.tabbed .belief-panel + .belief-panel { margin-top: 0; }
.belief-note { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.92rem; }
/* Outdated: the old belief struck through, and what changed my mind on its own line below */
#beliefs-outdated .inspo-item strong { display: block; color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
#beliefs-outdated .changed { display: block; margin-top: 0.35rem; font-size: 0.95rem; }
/* Predictions: upright serif at a calmer size, so a list of longer claims scans easily */
#beliefs-predictions .inspo-item strong { font-style: normal; font-weight: 400; font-size: 1.1rem; line-height: 1.5; }
.inspo-empty { padding: 1rem 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); color: var(--muted); font-style: italic; }
.inspo + .section-title, .tiles + .section-title, .books + .section-title { margin-top: 3rem; }
.tiles + .books, .photos + .books { margin-top: 3rem; }
/* Books (built from books.json by tools/make-books.py): Reading now, Read and Want to read,
   a card per book with a drawn cover, and stars and a short review once read */
.book-group { margin: 1.75rem 0 0.75rem; font: 600 0.8rem/1.4 var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.book-group:first-of-type { margin-top: 0; }
.book-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.book { display: grid; grid-template-columns: 84px 1fr; gap: 1rem; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.book:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.28); transform: translateY(-2px); }
.book-cover { aspect-ratio: 2 / 3; border-radius: 4px 7px 7px 4px; padding: 0.5rem 0.35rem 0.5rem 0.55rem; display: flex; align-items: flex-end;
  background: linear-gradient(160deg, hsl(var(--hue, 210) 45% 46%), hsl(calc(var(--hue, 210) + 25) 50% 30%));
  box-shadow: inset 5px 0 0 rgb(0 0 0 / 0.18), inset 6px 0 0 rgb(255 255 255 / 0.12), inset 9px 0 3px -2px rgb(0 0 0 / 0.12), 0 2px 6px rgb(0 0 0 / 0.15), 3px 3px 0 -1px var(--page), 3px 3px 0 0 rgb(0 0 0 / 0.08);
  position: relative; }
/* A book, not a card: a sheen across the cover and page edges along the right */
.book-cover::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 0.1) 45%, transparent 60%); }
.book-cover::after { content: ""; position: absolute; top: 3px; bottom: 3px; right: -3px; width: 3px; border-radius: 0 2px 2px 0; pointer-events: none; background: repeating-linear-gradient(to bottom, var(--page) 0 1px, var(--page-line) 1px 2px); }
/* Cover colours, picked per book by tools/make-books.py (inline styles are blocked by the content security policy) */
.cover-0 { --hue: 210; }
.cover-1 { --hue: 25; }
.cover-2 { --hue: 150; }
.cover-3 { --hue: 340; }
.cover-4 { --hue: 265; }
.cover-5 { --hue: 95; }
.cover-6 { --hue: 190; }
.cover-7 { --hue: 0; }
.book-cover span { font: 600 0.72rem/1.2 var(--serif); color: #fff; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.book-body h4 { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; line-height: 1.3; margin: 0.1rem 0 0.1rem; }
.book-status { margin: 0; font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.book-by { margin: 0 0 0.35rem; font-size: 0.88rem; color: var(--muted); }
.book-review { margin: 0.35rem 0 0; font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
/* Stars: five glyphs, filled to --stars (0–5, halves allowed) with a gradient clipped to the text */
.stars { margin: 0; font-size: 1rem; letter-spacing: 0.08em; line-height: 1; width: max-content;
  background: linear-gradient(90deg, var(--warm) calc(var(--stars, 0) / 5 * 100%), var(--line) 0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stars[data-stars="0"] { --stars: 0; } .stars[data-stars="0.5"] { --stars: 0.5; } .stars[data-stars="1"] { --stars: 1; } .stars[data-stars="1.5"] { --stars: 1.5; } .stars[data-stars="2"] { --stars: 2; } .stars[data-stars="2.5"] { --stars: 2.5; } .stars[data-stars="3"] { --stars: 3; } .stars[data-stars="3.5"] { --stars: 3.5; } .stars[data-stars="4"] { --stars: 4; } .stars[data-stars="4.5"] { --stars: 4.5; } .stars[data-stars="5"] { --stars: 5; }
@media (prefers-reduced-motion: reduce) { .book { transition: none; } .book:hover { transform: none; } }
/* Live interests: hobbies as tiles */
.tiles { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
/* Three across on desktop, two on tablets, one on phones; a pair sits two across */
.tiles.pair { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tile-icon .think { transform-origin: 12px 12px; }
.tile-icon .antenna { transform-origin: 12px 6.5px; }
.tile-icon .eyes { transform-origin: 12px 11.5px; }
.tile:hover .think, .tile.is-live .think { animation: tile-pulse 1.4s ease-in-out infinite; }
.tile:hover .antenna, .tile.is-live .antenna { animation: tile-swing 1s ease-in-out infinite; }
.tile:hover .eyes, .tile.is-live .eyes { animation: tile-blink 2.2s ease-in-out infinite; }
@keyframes tile-blink { 0%, 44%, 52%, 100% { transform: scaleY(1); } 48% { transform: scaleY(0.1); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem 1.1rem; transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s; }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.28); transform: translateY(-2px); }
.tile-icon { display: block; width: 36px; height: 36px; padding: 7px; margin-bottom: 0.75rem; border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile:nth-child(even) .tile-icon { background: var(--warm-soft); color: var(--warm); }
/* Icons: a soft fill under the line drawing, and a small motion of their own on hover */
.tile-icon .fill { fill: currentColor; stroke: none; opacity: 0.2; }
.tile-icon .solid { fill: currentColor; stroke: none; }
.tile-icon * { transform-box: view-box; }
.tile-icon .orbit { transform-origin: 12px 12px; }
.tile-icon .play { transform-origin: 12.5px 14px; }
.tile-icon .swing { transform-origin: 4.5px 18.5px; }
.tile-icon .write { stroke-dasharray: 11; stroke-dashoffset: 0; }
.tile-icon .page { transform-origin: 12px 12px; }
.tile-icon .trail { stroke-dasharray: 1.4 2.4; }
.joys { margin-top: 3rem; }
.tile-icon .wheel-a { transform-origin: 6px 16px; }
.tile-icon .wheel-b { transform-origin: 18px 16px; }
.tile-icon .roll { transform-origin: 12px 12px; }
.tile-icon .sway { transform-origin: 13px 20.5px; }
.tile-icon .reach { transform-origin: 7px 13.5px; }
.tile-icon .twinkle { transform-origin: 19.5px 4px; }
.tile:hover .wheel-a, .tile.is-live .wheel-a, .tile:hover .wheel-b, .tile.is-live .wheel-b { animation: tile-orbit 0.9s linear infinite; }
.tile:hover .roll, .tile.is-live .roll { animation: tile-roll 1.6s ease-in-out infinite; }
.tile:hover .sway, .tile.is-live .sway { animation: tile-sway 1.2s ease-in-out infinite; }
.tile:hover .reach, .tile.is-live .reach { animation: tile-reach 1.4s ease-in-out infinite; }
.tile:hover .twinkle, .tile.is-live .twinkle { animation: tile-pulse 1.2s ease-in-out infinite; }
@keyframes tile-roll { 0%, 100% { transform: translateX(-1px) rotate(-30deg); } 50% { transform: translateX(1px) rotate(30deg); } }
@keyframes tile-sway { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@keyframes tile-reach { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-14deg); } }
.tile-icon { transition: transform 0.25s; }
.tile:hover .tile-icon, .tile.is-live .tile-icon { transform: translateY(-1px) scale(1.06); }
.tile:hover .orbit, .tile.is-live .orbit { animation: tile-orbit 2.4s linear infinite; }
.tile:hover .play, .tile.is-live .play { animation: tile-pulse 0.9s ease-in-out infinite; }
.tile:hover .swing, .tile.is-live .swing { animation: tile-swing 0.7s ease-in-out infinite; }
.tile:hover .write, .tile.is-live .write { animation: tile-write 1.4s ease-in-out infinite; }
.tile:hover .page, .tile.is-live .page { animation: tile-page 1.6s ease-in-out infinite; }
.tile:hover .steam, .tile.is-live .steam { animation: tile-steam 1.4s ease-in-out infinite; }
.tile:hover .bounce, .tile.is-live .bounce { animation: tile-bounce 0.9s ease-in-out infinite; }
.tile:hover .trail, .tile.is-live .trail { animation: tile-trail 1s linear infinite; }
@keyframes tile-orbit { to { transform: rotate(360deg); } }
@keyframes tile-pulse { 50% { transform: scale(1.18); } }
@keyframes tile-swing { 0%, 100% { transform: rotate(0); } 45% { transform: rotate(-18deg); } 70% { transform: rotate(4deg); } }
@keyframes tile-write { 0% { stroke-dashoffset: 11; } 60%, 100% { stroke-dashoffset: 0; } }
@keyframes tile-page { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(0.82); } }
@keyframes tile-steam { 0% { transform: translateY(1px); opacity: 0.2; } 50% { opacity: 1; } 100% { transform: translateY(-2px); opacity: 0; } }
@keyframes tile-bounce { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-2.5px); } 60% { transform: translateY(0.5px); } }
@keyframes tile-trail { to { stroke-dashoffset: -3.8; } }
/* The tiles arrive one after another when the page opens */
.tile { animation: tile-in 0.5s ease both; }
.tile:nth-child(2) { animation-delay: 0.05s; } .tile:nth-child(3) { animation-delay: 0.1s; } .tile:nth-child(4) { animation-delay: 0.15s; }
.tile:nth-child(5) { animation-delay: 0.2s; } .tile:nth-child(6) { animation-delay: 0.25s; } .tile:nth-child(7) { animation-delay: 0.3s; } .tile:nth-child(8) { animation-delay: 0.35s; } .tile:nth-child(9) { animation-delay: 0.4s; }
@keyframes tile-in { from { opacity: 0; transform: translateY(8px); } }
.tile h3 { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; line-height: 1.3; margin: 0 0 0.3rem; }
/* A tile with somewhere to go: its title is the link, and the whole tile is clickable */
.tile { position: relative; }
.tile-link { color: inherit; }
.tile-link::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }
.tile-link:hover { text-decoration: none; }
.tile:has(.tile-link) h3::after { content: " →"; color: var(--accent); transition: margin 0.2s; }
.tile:has(.tile-link):hover h3::after { margin-left: 0.2rem; }
.tile-link:focus-visible { outline: none; }
.tile:has(.tile-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.tile p { margin: 0; font-size: 0.92rem; line-height: 1.5; color: var(--muted); }

.page-link { margin: 0; }
.page-link + .section-title, .art + .section-title { margin-top: 3rem; }
.inspo + .art { margin-top: 3rem; }

/* Hidden game: a skier on the Hokkaido drawing opens Pong (pong.js) */
.slope { position: relative; }
.skier {
  position: absolute; left: 41%; top: 38.5%; width: clamp(20px, 6%, 30px); aspect-ratio: 1;
  padding: 0; border: 0; background: none; cursor: pointer;
  transform: translate(-50%, -90%) rotate(-30deg);
  animation: ski 16s linear infinite;
}
.skier::before { content: ""; position: absolute; inset: -10px; }  /* a bigger target than the drawing */
.skier svg { display: block; width: 100%; height: 100%; }
.skier:hover, .skier:focus-visible { animation-play-state: paused; }
@keyframes ski {
  0% { left: 47.5%; top: 31.5%; opacity: 0; }
  6%, 90% { opacity: 1; }
  100% { left: 35%; top: 45.5%; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .skier { animation: none; } }
.pong { width: min(680px, calc(100vw - 32px)); padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); }
.pong::backdrop { background: rgb(0 0 0 / 0.55); }
.pong-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.pong-score { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.pong-close { border: 0; background: none; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; padding: 0 0.25rem; }
.pong canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: 8px; touch-action: none; cursor: none; }
.pong-help { margin: 0.6rem 0 0; font-size: 0.85rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .tile, .tile-icon, .tile-icon * { animation: none !important; transition: none !important; }
  .tile:hover, .tile:hover .tile-icon, .tile.is-live .tile-icon { transform: none; }
}
/* Reduced motion everywhere else: links jump instead of gliding, and hovered cards don't lift. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shot, .hello a { transition: none; }
  .project:hover .shot { transform: none; }
}
/* Dark mode: bright drawings and screenshots are dimmed a touch so they don't glare, and brighten on hover. */
@media (prefers-color-scheme: dark) {
  .shot img, .photo img { filter: brightness(0.86); transition: filter 0.2s; }
  .project:hover .shot img, .role:hover .shot img, .photo:hover img { filter: none; }
  .portrait { filter: brightness(0.88); transition: filter 0.2s; }
  .portrait:hover { filter: none; }
}

/* Print: a few tidy pages instead of a long screen layout. Hide the chrome and the
   pictures, use print-sized type, keep dates beside each entry, and don't split an
   entry or card across pages. */
@media print {
  @page { margin: 14mm 15mm; }
  html { font-size: 10pt; }
  body { font-size: 10pt; line-height: 1.45; background: #fff; color: #000; }
  .belief-tabs { display: none !important; }
  .belief-panel[hidden] { display: block !important; }
  .beliefs.tabbed .belief-heading { display: block; }
  .site-header, .skip, .hero::before, .shot, .portrait, picture, dialog, .pong, .hello, .copy-email, .anchor { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .hero { display: block; padding: 0 0 0.6rem; }
  .hero h1 { font-size: 22pt; margin: 0 0 0.3rem; }
  .lede { font-size: 11.5pt; max-width: none; margin-bottom: 0.3rem; }
  .hero-sub { max-width: none; margin-bottom: 0.4rem; }
  .contact { gap: 0.2rem 1.2rem; font-size: 9pt; }
  .section { padding-top: 0.9rem; padding-bottom: 0.2rem; }
  .section-title { margin-bottom: 0.6rem; padding-bottom: 0.3rem; font-size: 8pt; }
  .role { grid-template-columns: 6.5rem 1fr; gap: 0 1.2rem; padding: 0.55rem 0; break-inside: avoid; }
  .role h3, .project-text h3 { font-size: 11pt; margin-bottom: 0.1rem; }
  .project, .mini { display: block; margin-bottom: 0.7rem; break-inside: avoid; }
  .minis { display: block; }
  .mini { padding: 0.3rem 0; border: 0; }
  .skill-row { grid-template-columns: 6.5rem 1fr; gap: 0 1.2rem; padding: 0.3rem 0; break-inside: avoid; }
  .chip { padding: 0; background: none !important; color: #333 !important; font-size: 8.5pt; }
  .chip + .chip::before { content: "· "; color: #999; }
  .tags { gap: 0 0.35rem; }
  .links, .more { font-size: 9pt; }
  a { color: #000; text-decoration: none; }
  .outside { padding-top: 0.4rem; font-size: 9.5pt; break-inside: avoid; }
  .footer { margin-top: 0.6rem; padding: 0.4rem 0 0; }
  h2, h3 { break-after: avoid; }
  /* The tiles fade in on screen; on paper they'd be caught invisible, so no motion */
  .tile, .tile-icon, .tile-icon * { animation: none !important; transition: none !important; }
  .tiles { gap: 0.5rem; }
  .tile { padding: 0.6rem 0.7rem; break-inside: avoid; }
  .wishlist-note { margin: 0 0 0.6rem; }
  .photo { break-inside: avoid; }
  /* Links are dead ends on paper, so print where they go */
  .links a[href^="http"]::after, .contact a[href^="http"]::after, .page-link a[href^="http"]::after { content: " — " attr(href); }
  .links a[href^="papers/"]::after, .contact a[href^="resume/"]::after { content: " — amalmehta.com/" attr(href); }
  .links, .contact { overflow-wrap: anywhere; }
}


/* Warm notes: chat offer under the hello, a line after More projects, advisor thanks, footer sign-off */
.hello-more { max-width: 60ch; margin: 0 0 0.9rem; color: var(--muted); font-size: 0.95rem; }
.minis-note, .thanks { max-width: 68ch; margin: 1.4rem 0 0; color: var(--muted); }
.thanks { font-family: var(--serif); font-style: italic; font-size: 1.05rem; }
.minis-note a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.footer .signoff { margin-top: 1.4rem; font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--text); }
.footer .secrets { display: block; margin-top: 0.2rem; font-family: var(--sans); font-style: normal; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }

/* ---- Finishing touches ---- */

/* Page transitions: pages cross-fade into each other and the header stays put (browsers that support it) */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Sections ease up into place as they scroll into view, where scroll-driven animations exist */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    main > .section:not(.hero), main > section.inspo-group, main > .thoughts > .thought, main > section.now, main > .tiles, main > .books {
      animation: rise linear both; animation-timeline: view(); animation-range: entry 0% entry 35%;
    }
  }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }

/* Card links: the underline grows from the left on hover */
.links a, .page-link a, .nav-links a { background: linear-gradient(currentColor, currentColor) left calc(100% - 0.15em) / 0 1px no-repeat; transition: background-size 0.3s ease, color 0.2s; }
.links a:hover, .page-link a:hover, .nav-links a:hover { text-decoration: none; background-size: 100% 1px; }
.links a.buy, .links a.download, .try-badge { background-image: none; }
.links a.download { background-color: var(--accent); }  /* the underline rule above would clear it */
.links a.download:hover { background-color: color-mix(in srgb, var(--accent) 85%, #000); }
@media (prefers-color-scheme: dark) { .links a.download:hover { background-color: color-mix(in srgb, var(--accent) 85%, #fff); } }
@media (prefers-reduced-motion: reduce) { .links a, .page-link a, .nav-links a { transition: none; } }

/* Featured cards: a soft blue-to-terracotta glow around the image on hover */
.featured .project:hover .shot { border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: -10px 14px 34px -20px color-mix(in srgb, var(--accent) 70%, transparent), 10px 14px 34px -20px color-mix(in srgb, var(--warm) 70%, transparent), 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }

/* Profile section titles: a small line icon instead of the dot */
#north-star .section-title::before, #featured .section-title::before, #apps .section-title::before, #research .section-title::before,
#more-projects .section-title::before, #writeups .section-title::before, #skills .section-title::before, #outside .section-title::before, #musings .section-title::before {
  width: 0.95rem; height: 0.95rem; border-radius: 0; background: var(--warm);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
#north-star { --icon: url("images/icons/north-star.svg"); }
#featured { --icon: url("images/icons/featured.svg"); }
#apps { --icon: url("images/icons/apps.svg"); }
#research { --icon: url("images/icons/research.svg"); }
#more-projects { --icon: url("images/icons/more-projects.svg"); }
#writeups { --icon: url("images/icons/writeups.svg"); }
#skills { --icon: url("images/icons/skills.svg"); }
#outside { --icon: url("images/icons/outside.svg"); }
#musings { --icon: url("images/icons/musings.svg"); }

/* The name in the hero: ink that deepens towards terracotta, and a brush stroke drawn in under it */
.hero h1 { background: linear-gradient(100deg, var(--text) 35%, color-mix(in srgb, var(--text) 72%, var(--warm))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero h1::after { content: ""; position: absolute; left: 0.02em; right: -0.1em; bottom: -0.12em; height: 0.16em; background: color-mix(in srgb, var(--warm) 75%, transparent);
  -webkit-mask: url("images/brush.svg") center / 100% 100% no-repeat; mask: url("images/brush.svg") center / 100% 100% no-repeat;
  clip-path: inset(0 100% 0 0); animation: brush 1.1s cubic-bezier(0.3, 0.6, 0.2, 1) 0.35s forwards; }
@keyframes brush { to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) { .hero h1::after { animation: none; clip-path: none; } }
@media print { .hero h1 { color: #000; background: none; } .hero h1::after, .footer::before { display: none; } }

/* ---- Nicer: typography, warmth, the status chip, the portrait, Skills as a map, the 404 ---- */
::selection { background: color-mix(in srgb, var(--warm) 30%, transparent); }
h1, h2, h3 { text-wrap: balance; }  /* not the intro: its secret button would let the full stop wrap alone */
p, li, figcaption { text-wrap: pretty; }
body { hanging-punctuation: first last; }
.when, .card-when, .events time, .skills-updated { font-variant-numeric: tabular-nums lining-nums; }
:focus-visible { box-shadow: 0 0 0 5px var(--accent-soft); }
/* Each page's title gets the intro's soft wash */
.page-head { position: relative; }
.page-head::before { content: ""; position: absolute; inset: -4.5rem 0 -1.5rem; z-index: -1; pointer-events: none;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent); mask-image: radial-gradient(closest-side, #000 55%, transparent);  /* the page column clips it, so fade every edge */
  background: radial-gradient(34rem 16rem at 12% 30%, color-mix(in srgb, var(--warm) 12%, transparent), transparent 70%), radial-gradient(34rem 18rem at 88% 10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%); }

/* Now chip above the name */
.status-chip { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0 0 1.1rem; padding: 0.32rem 0.8rem 0.32rem 0.65rem; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); font-size: 0.82rem; font-weight: 500; color: var(--muted); text-decoration: none; backdrop-filter: blur(4px); }
.status-chip:hover { text-decoration: none; color: var(--text); border-color: color-mix(in srgb, var(--warm) 40%, var(--line)); }
.status-dot { position: relative; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: #3fa364; }
.status-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #3fa364; animation: status-ping 2s ease-out infinite; }
@keyframes status-ping { from { transform: scale(1); opacity: 0.6; } to { transform: scale(2.8); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .status-dot::after { animation: none; } }
@media print { .status-chip { display: none; } }

/* Portrait: on hover the sketch warms and the rings swap colours */
.portrait { transition: filter 0.6s ease, transform 0.6s ease, box-shadow 0.6s ease; }
.portrait:hover { filter: sepia(0.35) saturate(1.3); transform: rotate(-2deg) scale(1.03);
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--warm), 0 0 0 9px var(--bg), 0 0 0 11px color-mix(in srgb, var(--accent) 70%, transparent); }
@media (prefers-reduced-motion: reduce) { .portrait { transition: none; } .portrait:hover { transform: none; } }

/* Skills as a map: a card per group, each with its own icon */
@media screen {
  .skills { display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); max-width: none; }
  .skill-row, .skill-row:first-child { display: block; padding: 1rem 1.1rem 1.1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); max-width: none; transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s; }
  .skill-row:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 10px 24px -14px rgb(0 0 0 / 0.28); transform: translateY(-2px); }
  .skill-row h3 { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.75rem; font-size: 0.95rem; }
  /* Each group's icon: a hand-drawn sketch (tools/draw-skill-icons.py), inline so it draws in every browser */
  .skill-icon { flex: none; width: 1.9rem; height: 1.9rem; padding: 0.38rem; border-radius: 10px; background: var(--accent-soft); color: var(--accent);
    fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.25s; }
  .skill-icon .again { stroke-width: 0.9; opacity: 0.55; }  /* the second pass of the pen */
  .skill-row:nth-child(even) .skill-icon { background: var(--warm-soft); color: var(--warm); }
  .skill-row:hover .skill-icon { transform: rotate(-6deg) scale(1.08); }
  @media (prefers-reduced-motion: reduce) { .skill-row, .skill-icon { transition: none; } .skill-row:hover, .skill-row:hover .skill-icon { transform: none; } }
}

/* 404: the lost hiker */
.lost { display: block; width: 100%; max-width: 900px; height: auto; margin: 0 0 1.5rem; border-radius: 16px; }

/* Keeps a hidden extra's button and the punctuation after it on one line */
.nowrap { white-space: nowrap; }

/* The living hero: a faint ridge along the bottom of the intro, with dots learning to cross it (hero.js) */
.hero { padding-bottom: 7.5rem; }
.hero-ridge { position: absolute; left: 16px; right: 16px; bottom: 0.5rem; width: calc(100% - 32px); height: 110px; z-index: -1; pointer-events: none; }
@media (max-width: 600px) { .hero { padding-bottom: 6rem; } .hero-ridge { height: 80px; } }
@media print { .hero-ridge { display: none; } .hero { padding-bottom: 0; } }

/* Deep-dive pages (project-*.html, tools/make-case-studies.py) */
.case .page-head .card-when { margin: 0 0 0.4rem; }
.case .page-head .case-hook { font-family: var(--serif); font-size: 1.2rem; line-height: 1.5; color: var(--text); max-width: 62ch; margin: 0 0 0.9rem; }
.case .page-head .links { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; margin: 0; }
.case-part { margin: 0 0 2.75rem; }
.case-part p { max-width: 68ch; margin: 0 0 0.9rem; }
.flow { list-style: none; counter-reset: flow; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; padding: 0; margin: 0 0 0.9rem; }
.flow li { counter-increment: flow; position: relative; padding: 0.8rem 0.9rem 0.85rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); font-size: 0.92rem; line-height: 1.45; }
.flow li::before { content: counter(flow); display: grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-bottom: 0.45rem; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 0.78rem; font-weight: 600; }
.flow li:nth-child(even)::before { background: var(--warm-soft); color: var(--warm); }
.flow-note { font-size: 0.92rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin: 0 0 1.4rem; }
.stat { padding: 0.9rem 1rem; border-radius: 14px; background: var(--accent-soft); }
.stat:nth-child(even) { background: var(--warm-soft); }
.stat strong { display: block; font-family: var(--serif); font-size: 1.7rem; font-weight: 600; line-height: 1.1; color: var(--text); font-variant-numeric: lining-nums; }
.stat span { display: block; margin-top: 0.3rem; font-size: 0.85rem; line-height: 1.4; color: var(--muted); }
.case-notes { margin: 0 0 1.2rem; padding-left: 1.1rem; max-width: 68ch; }
.case-notes li { margin-bottom: 0.5rem; color: var(--muted); }
.case-notes strong { color: var(--text); }
.case-figure { margin: 1.5rem 0 0; }
.case-figure img { display: block; width: 100%; height: auto; max-height: 720px; object-fit: contain; border-radius: 14px; border: 1px solid var(--line); background: #fcfcfa; }
.case-figure figcaption { margin-top: 0.5rem; font-size: 0.85rem; color: var(--muted); }
.case-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.6rem 1rem; padding-top: 1.5rem; border-top: 1px solid var(--line); font-weight: 500; }
.links a.deep { font-weight: 600; }
@media (min-width: 640px) { .flow { grid-template-columns: repeat(3, 1fr); } }  /* 5 or 6 steps sit as 3 + 2 or 3 + 3 */

/* Hidden supernova: the star by North star is a button once eggs.js shows it (nova.js) */
.nova-egg { width: 0.95rem; height: 0.95rem; padding: 0; border: 0; cursor: pointer; background: var(--warm);
  -webkit-mask: url("images/icons/north-star.svg") center / contain no-repeat; mask: url("images/icons/north-star.svg") center / contain no-repeat; transition: transform 0.4s; }
.nova-egg:hover { transform: rotate(45deg) scale(1.25); }
#north-star .section-title:has(.nova-egg:not([hidden]))::before { display: none; }
.nova { width: min(800px, calc(100vw - 32px)); }
.pong.nova canvas { cursor: default; aspect-ratio: 760 / 500; background: #04050c; }
@media (prefers-reduced-motion: reduce) { .nova-egg { transition: none; } }

/* Hidden dragon: the ring on The Lord of the Rings tile is a button once eggs.js shows it (dragon.js) */
.dragon-egg { display: block; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 12px; }
.dragon-egg .tile-icon { margin-bottom: 0.75rem; transition: transform 0.3s; }
.dragon-egg:hover .tile-icon { transform: rotate(-12deg) scale(1.12); }
.dragon { width: min(800px, calc(100vw - 32px)); }
.pong.dragon canvas { cursor: default; aspect-ratio: 760 / 500; background: #090b1f; }
@media (prefers-reduced-motion: reduce) { .dragon-egg .tile-icon { transition: none; } }

/* Tiles with some colour: a soft wash in the corner that matches the icon, a bigger, brighter icon,
   brighter text in dark mode, and a warmer glow on hover */
.tile { background: radial-gradient(14rem 9rem at 0% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--surface); }
.tile:nth-child(even) { background: radial-gradient(14rem 9rem at 0% 0%, color-mix(in srgb, var(--warm) 10%, transparent), transparent 70%), var(--surface); }
.tile-icon { width: 42px; height: 42px; padding: 8px; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.tile:nth-child(even) .tile-icon { background: color-mix(in srgb, var(--warm) 18%, var(--surface)); }
.tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--accent) 55%, transparent); }
.tile:nth-child(even):hover { border-color: color-mix(in srgb, var(--warm) 45%, var(--line)); box-shadow: 0 14px 30px -18px color-mix(in srgb, var(--warm) 55%, transparent); }
@media (prefers-color-scheme: dark) {
  .tile { border-color: #34342f; }
  .tile h3 { color: #f1efe9; }
  .tile p { color: #bcbab3; }
  .tile-icon { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
  .tile:nth-child(even) .tile-icon { background: color-mix(in srgb, var(--warm) 24%, var(--surface)); }
}
/* …and the quote closes after the belief, in the same warm serif */
#beliefs-current .inspo-item strong::after { content: "”"; font-family: var(--serif); font-style: normal; font-size: 2em; line-height: 0; vertical-align: -0.38em; margin-left: 0.08em; color: var(--warm); opacity: 0.85; }
/* A way of living that links to an example of it: the line reads as text, with only a faint underline that warms on hover */
.quiet-link, #how-i-want-to-live .tree-egg { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--warm) 30%, transparent); text-decoration-thickness: 1px; text-underline-offset: 0.22em; transition: text-decoration-color 0.2s, color 0.2s; }
.quiet-link:hover, .quiet-link:focus-visible, #how-i-want-to-live .tree-egg:hover, #how-i-want-to-live .tree-egg:focus-visible { color: var(--warm); text-decoration-color: currentColor; }
