:root {
  color-scheme: light;
  font: 16px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --fg: #292b26; --bg: #f5f3ed; --muted: #5c5f57; --line: #c9c6bc; --accent: #476345;
  --surface: #ebe8e0; --flash: #cfd8cd; --media: #292b26;
  color: var(--fg);
  background: var(--bg);
}
/* Follow the system dark mode setting. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fg: #e7e4db; --bg: #1c1d1a; --muted: #a5a398; --line: #45463f; --accent: #9fc49a;
    --surface: #2a2b27; --flash: #3b5239; --media: #111210;
  }
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
a { color: inherit; text-underline-offset: 5px; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.landing main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 100vh; min-height: 100svh; padding: 24px; }
.landing h1 { font: 600 clamp(28px, 5vw, 40px)/1.2 system-ui, sans-serif; letter-spacing: -1px; margin: 0 0 12px; }
.landing .statement { max-width: 32em; margin: 0 0 20px; text-align: center; font-size: 15px; color: var(--muted); }
.landing nav { display: flex; justify-content: center; }
.landing nav a { font-size: 14px; padding-block: 6px; text-decoration: underline; }
.page main { width: 100%; max-width: 44em; margin: 0 auto; padding: 48px 24px 64px; }
.page h1 { font: 600 clamp(28px, 5vw, 40px)/1.2 system-ui, sans-serif; letter-spacing: -1px; margin: 0 0 8px; }
.page h2 { font-size: 18px; margin: 40px 0 8px; }
.page .meta { margin: 0; color: var(--muted); }
.page ul { padding-left: 1.2em; }
.page li + li { margin-top: 6px; }
.page figure { margin: 32px 0; }
.page figcaption { margin-top: 6px; font-size: 14px; color: var(--muted); }
.page figure img, .page figure video { display: block; width: 100%; height: auto; }
.page figure video { aspect-ratio: 16 / 9; background: var(--media); }
.page iframe { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; background: var(--media); }
.page .back { display: inline-block; margin-bottom: 32px; font-size: 14px; }
.page footer { margin-top: 48px; font-size: 14px; color: var(--muted); }
.page .card { margin: 16px 0; padding: 20px 24px; border: 1px solid var(--line); border-radius: 0; }
.page .card h3 { font-size: 20px; margin: 0 0 2px; }
.page .card p { margin: 8px 0 0; }
.page .card .meta { margin: 0; font-size: 14px; }
.page .tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 14px 0 0; padding: 0; }
.page .tags li { margin: 0; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; color: var(--muted); }
.home main { max-width: 88em; }
.home .projects > h2 { margin-top: 0; }
.home .intro > p:last-child { margin-bottom: 0; }
@media (min-width: 900px) {
  .home main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); column-gap: 64px; align-items: start; }
  /* The about column is always open here, so its toggle is hidden. */
  .home details.about > summary { display: none; }
}
/* On phones the about column folds into a toggle above the projects. */
@media (max-width: 899px) {
  .home details.about { margin-top: 20px; padding: 12px 16px; border: 1px solid var(--line); }
  .home details.about > summary { cursor: pointer; font-weight: 600; }
  .home details.about[open] > summary { margin-bottom: 8px; }
  .home details.about .intro > h2:first-child { margin-top: 16px; }
  .home .projects > h2 { margin-top: 32px; }
}
.page .shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 16px; }
.page .shots a { display: block; }
.page .shots img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.page details.aside { margin-top: 16px; font-size: 14px; color: var(--muted); }
.page details.aside summary { cursor: pointer; width: fit-content; }
.page details.aside p { margin: 8px 0 0; }
/* Spoilers stay folded until the reader asks for them. */
/* Skill filter above the project cards (built by filter.js). */
.home .filter { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.home .filter summary { cursor: pointer; width: fit-content; font-weight: 600; color: var(--fg); }
.home .filter .hint { margin: 6px 0 0; }
.home .filter .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.home .filter .chips button { font: inherit; font-size: 13px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.home .filter .status { margin: 10px 0 0; }
.home .filter .status:empty { display: none; }
.home .filter .clear { font: inherit; padding: 0; border: 0; background: none; color: var(--fg); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.home .tags li[role="button"] { cursor: pointer; }
.home .filter .chips button:hover, .home .tags li[role="button"]:hover { border-color: var(--accent); color: var(--accent); }
.home .filter .chips button[aria-pressed="true"], .home .tags li.selected { border-color: var(--accent); background: var(--accent); color: var(--bg); }
.home .filter button:focus-visible, .home .tags li[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.page details.spoilers { margin: 40px 0 0; padding: 14px 20px; border: 1px solid var(--line); }
.page details.spoilers summary { cursor: pointer; font-weight: 600; }
.page details.spoilers + details.spoilers { margin-top: 16px; }
.page details.spoilers[open] summary { margin-bottom: 8px; }
.page details.spoilers figure:last-child { margin-bottom: 8px; }
.page h3 { font-size: 16px; margin: 28px 0 4px; }
.page h2 + h3 { margin-top: 12px; }
.page code { font-size: 0.9em; }
.page > main > .tags { margin-top: 20px; }
.page .tracks { display: grid; gap: 12px; margin-top: 12px; }
.page .track { margin: 0; }
.page .track figcaption { margin: 0 0 4px; font-size: 14px; color: inherit; }
.page .track .year { color: var(--muted); }
.page .track audio { display: block; width: 100%; color-scheme: light; }
.page h1.detail { margin: 56px 0 0; padding-top: 32px; border-top: 1px solid var(--line); font-size: clamp(22px, 4vw, 30px); }
.page .track .hw { margin: 0 0 6px; font-size: 13px; color: var(--muted); line-height: 1.5; }
@keyframes flash { 0%, 40% { background: var(--track-flash); } 100% { background: var(--track-bg); } }
/* Match the browser's audio player: Chromium draws #f1f3f4; Firefox draws rgba(26, 26, 26, 0.8), which only blends with a #1a1a1a box. */
.page .track { --track-bg: #f1f3f4; --track-flash: #cfd8cd; padding: 12px 16px 8px; border-radius: 20px; background: var(--track-bg); }
@supports (-moz-appearance: none) {
  .page .track { --track-bg: #1a1a1a; --track-flash: #3b5239; color: #ececec; }
  .page .track .year, .page .track .hw { color: #b8b8b8; }
  .page .track a:hover { color: #a9c7a5; }
}
.page .track.flash { animation: flash 1.6s ease-out; }
.home footer.note { margin-top: 48px; font-size: 13px; color: var(--muted); }
.home footer.note p { margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.page > main > .track { margin: 24px 0; }
/* Custom player (player.js). Same look in every browser; overrides the native-player box colours above. */
.page .track.custom { --track-bg: var(--surface); --track-flash: var(--flash); padding-bottom: 12px; color: var(--fg); }
.page .track.custom .year, .page .track.custom .hw { color: var(--muted); }
.page .track.custom a:hover { color: var(--accent); }
.player { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.player button { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: var(--fg); cursor: pointer; }
.player button:hover { background: var(--accent); }
.player button:focus-visible, .player input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.player button::before { content: ""; width: 10px; height: 12px; margin-left: 2px; background: var(--bg); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.player.playing button::before { box-sizing: border-box; margin-left: 0; background: none; border: solid var(--bg); border-width: 0 3px; clip-path: none; }
/* A 24px-tall hit area with a 6px track drawn as a centred background stripe. */
.player input { flex: 1; min-width: 0; height: 24px; margin: 0; appearance: none; cursor: pointer; background: linear-gradient(to right, var(--fg) var(--fill, 0%), var(--line) var(--fill, 0%)) center / 100% 6px no-repeat; border-radius: 3px; }
.player input::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--fg); }
.player input::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: var(--fg); }
.player input::-moz-range-track { background: transparent; }
.player .time { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.player .speaker { flex: none; width: 18px; height: 18px; margin-left: 4px; color: var(--muted); fill: currentColor; }
.player input.volume { flex: 0 0 80px; }
@media (max-width: 499px) { .player { gap: 8px; } .player input.volume { flex-basis: 56px; } }
/* Pixel-art images keep hard pixel edges when scaled up. */
.page img.pixel { image-rendering: pixelated; }
.page figure img.pixel { width: 100%; height: auto; }
.page .gallery { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); margin-top: 0; }
.page .caption { margin: 6px 0 32px; font-size: 14px; color: var(--muted); }
.page figure + .gallery { margin-top: -16px; }
/* Education as a small timeline. */
.page .edu { list-style: none; margin: 16px 0 0; padding: 0 0 0 22px; border-left: 2px solid var(--line); }
.page .edu li { position: relative; margin: 0; }
.page .edu li + li { margin-top: 22px; }
.page .edu li::before { content: ""; position: absolute; left: -29px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
.page .edu p { margin: 0; }
.page .edu .degree { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.page .edu .grade { padding: 1px 10px; border-radius: 999px; font-size: 13px; color: var(--bg); background: var(--accent); }
.page .edu .where { font-size: 14px; color: var(--muted); }
.page .edu .where + p { margin-top: 4px; }
.page figure img.natural { width: auto; max-width: 100%; }
/* Project pages: media spreads past the text column on wide screens, like Ghost's wide images. */
.page:not(.home) main > figure:not(.track):not(:has(img.natural)),
.page:not(.home) main > .gallery,
.page:not(.home) main > .gallery + .caption {
  --wide: max(100%, min(100vw - 64px, 72rem));
  width: var(--wide);
  margin-left: calc((100% - var(--wide)) / 2);
}
.page:not(.home) main > .gallery { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.page figure:has(img.natural) img { margin: 0 auto; }
/* Show the map drawing at four pixels per tile, not stretched to the column. */
.page figure img.map { width: 248px; max-width: 100%; }
