/* =====================================================================
   Theme tokens — tweak these to restyle the whole site.
   (The accent can also be set from data/site.js → meta.accent)
   ===================================================================== */
:root {
  --paper:   #f3efe6;
  --paper-2: #ebe5d7;
  --paper-3: #e2dac9;
  --ink:     #191713;
  --ink-2:   #4a463d;
  --ink-3:   #857f70;
  --line:    #d5cdbb;
  --accent:  #e0482b;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans:  "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --maxw: 1200px;
  --gutter: clamp(20px, 5vw, 48px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
[data-theme="dark"] {
  --paper:   #121110;
  --paper-2: #1b1a17;
  --paper-3: #26241f;
  --ink:     #ede7d9;
  --ink-2:   #b4ad9d;
  --ink-3:   #7a7465;
  --line:    #2e2b26;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .4s var(--ease);
  /* faint engineering grid */
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  background-attachment: fixed;
}
.main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1[tabindex="-1"]:focus { outline: none; }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: .02em; }
kbd {
  font: 500 11px var(--mono);
  padding: 1px 5px; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 4px; background: var(--paper-2); color: var(--ink-2);
}
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); width: 100%; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: var(--paper); padding: 8px 12px; }
.skip:focus { left: 8px; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: .07; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: .05; }

/* page-enter animation (re-runs on every route change) */
.view.animate .reveal { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid transparent;
  transition: background-color .3s, border-color .3s;
}
.scrolled .topbar {
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom-color: var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; font-size: 13px; white-space: nowrap; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.topnav { display: flex; gap: 2px; margin-left: auto; }
.topnav a {
  font-size: 14px; text-decoration: none; color: var(--ink-2); white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; transition: color .2s, background-color .2s;
}
.topnav a:hover { color: var(--ink); background: var(--paper-2); }
.topnav a[aria-current] { color: var(--paper); background: var(--ink); }
.topbar-actions { display: flex; gap: 6px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  background: transparent; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-3); }
.btn-ghost kbd { padding: 0 4px; font-size: 10px; }
.i-moon, [data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: block; }
@media (max-width: 900px) {
  .topbar { background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom-color: var(--line); }
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 12px; gap: 10px 16px; }
  .topbar-actions { margin-left: auto; }
  .topnav { order: 3; flex: 0 0 100%; margin: 0; padding-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .kbd-hint { display: none; }
}

/* ---------- buttons, chips, tags ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 15px;
  font: 500 14px var(--sans); text-decoration: none; color: var(--ink);
  border: 1px solid var(--ink); border-radius: 999px; background: transparent;
  transition: background-color .2s, color .2s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--solid:hover { background: var(--ink); border-color: var(--ink); }
.arrow { transition: transform .3s var(--ease); flex: none; }
a:hover > .arrow, .card:hover .arrow { transform: translate(2px, -2px); }

.chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--ink-2); cursor: pointer; text-transform: uppercase; text-decoration: none;
  transition: color .2s, border-color .2s, background-color .2s;
}
.chip sup { font-size: 9px; margin-left: 3px; color: var(--ink-3); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip[aria-pressed="true"] sup { color: inherit; opacity: .6; }

.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; color: var(--ink-3); }
.tags li { padding: 2px 8px; background: var(--paper-2); border-radius: 4px; }

.prose { color: var(--ink-2); }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a, .edu-summary a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.prose h4 { font: 500 12px var(--mono); text-transform: uppercase; letter-spacing: .04em; color: var(--ink); margin: 1.8em 0 .6em; }
.prose ul { padding-left: 1.1em; margin: 0 0 1em; }
.prose li::marker { color: var(--accent); }

/* =====================================================================
   HOME — intro + bio on the left, highlights + page index on the right
   ===================================================================== */
.home {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px); padding-block: clamp(28px, 4vw, 52px);
}
.home-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--ink-3); text-transform: uppercase; margin-bottom: 20px; }
.home-meta > span::before { content: "◦ "; color: var(--accent); }
.id { display: flex; align-items: center; gap: 20px; }
.avatar { flex: none; width: 84px; height: 84px; object-fit: cover; border: 1px solid var(--ink); filter: grayscale(.2); }
.monogram {
  display: grid; place-items: center; background: var(--paper-2);
  font: italic 400 38px/1 var(--serif); color: var(--accent);
  background-image: repeating-linear-gradient(-45deg, transparent 0 7px, color-mix(in srgb, var(--line) 70%, transparent) 7px 8px);
}
.name { margin: 0; font: 400 clamp(40px, 4.6vw, 60px)/1 var(--serif); letter-spacing: -.02em; }
.name em { color: var(--accent); }
.name .nick { color: var(--ink-3); font-style: italic; }
.role { margin: 8px 0 0; text-transform: uppercase; }
.role span { color: var(--ink-3); }
.tagline { margin: 26px 0 0; max-width: 32ch; font: 400 clamp(22px, 2.2vw, 28px)/1.25 var(--serif); }
.tagline em { color: var(--accent); }
.status { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--ink-2); min-height: 1.6em; }
#status { transition: opacity .3s, transform .3s var(--ease); }
#status.swap { opacity: 0; transform: translateY(-6px); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #2fbf71; position: relative; flex: none; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid #2fbf71; animation: ping 2s var(--ease) infinite; }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.8); opacity: 0; } }
/* cut-out portrait with the name overlapping it */
.stage {
  position: relative; display: grid; grid-template-rows: 1fr auto;
  min-height: clamp(260px, 22vw, 300px); margin-top: 4px;
}
.portrait { position: absolute; right: 0; bottom: 0; height: 100%; aspect-ratio: 830 / 1100; margin: 0; pointer-events: none; }
.portrait img {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  object-fit: contain; object-position: bottom;
  -webkit-mask-image: linear-gradient(to bottom, #000 64%, transparent 97%);
          mask-image: linear-gradient(to bottom, #000 64%, transparent 97%);
}
.portrait::before { /* soft accent glow behind the shoulders */
  content: ""; position: absolute; z-index: 0; left: -10%; right: -10%; top: 25%; bottom: 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent);
}
.portrait-rings { position: absolute; z-index: 0; left: -15%; top: 2%; width: 130%; fill: none; stroke: var(--line); stroke-width: .6; }
.portrait figcaption {
  position: absolute; right: -22px; top: 12%; writing-mode: vertical-rl;
  color: var(--ink-3); font-size: 10px; text-transform: uppercase; letter-spacing: .12em;
}
.view.animate .portrait img { animation: lift 1s var(--ease) .15s both; }
@keyframes lift { from { opacity: 0; transform: translateY(24px); } }

.stage-top, .stage-name { position: relative; z-index: 2; }
.stage-top { max-width: 52%; }
.stage .tagline { margin-top: 0; font-size: clamp(21px, 2vw, 25px); }
.stage .status { align-items: flex-start; }
.stage .status .pulse { margin-top: 5px; }
.stage-name { padding-top: 16px; }
.stage .name {
  font-size: clamp(44px, 5vw, 66px);
  text-shadow: 0 1px 0 var(--paper), 0 0 22px var(--paper), 0 0 42px color-mix(in srgb, var(--paper) 70%, transparent);
}
.stage .role { margin-top: 10px; text-shadow: 0 0 8px var(--paper), 0 0 16px var(--paper); }

@media (max-width: 520px) {
  .stage { min-height: 300px; }
  .stage-top { max-width: 56%; }
  .stage .tagline { font-size: 20px; }
  .portrait { right: -12px; }
  .portrait figcaption { display: none; }
}

.home-bio { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); }
.mini-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin: 22px 0 0; }
.mini-facts dt { color: var(--ink-3); text-transform: uppercase; font-size: 11px; }
.mini-facts dd { margin: 2px 0 0; font-size: 14px; }
.interests { margin-top: 18px; }
.home-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

.side-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  text-transform: uppercase; color: var(--ink-3);
  padding-bottom: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--ink);
}
.side-head a { color: var(--ink-2); text-decoration: none; text-transform: none; }
.side-head a:hover { color: var(--accent); }
.digests { display: grid; gap: 12px; margin-bottom: 36px; }

.explore { display: grid; }
.explore-row {
  display: grid; grid-template-columns: 28px auto minmax(0, 1fr) 14px; align-items: baseline; gap: 14px;
  padding: 12px 8px; margin-inline: -8px; border-bottom: 1px solid var(--line); border-radius: 4px;
  text-decoration: none; transition: background-color .2s;
}
.explore-num { color: var(--ink-3); }
.explore-title { font: 400 24px/1.1 var(--serif); transition: color .2s; }
.explore-digest { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.explore-row .arrow { align-self: center; color: var(--ink-3); }
.explore-row:hover { background: var(--paper-2); }
.explore-row:hover .explore-title, .explore-row:hover .arrow { color: var(--accent); }

@media (max-width: 900px) { .home { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  .explore-row { grid-template-columns: 24px minmax(0, 1fr) 14px; }
  .explore-digest { display: none; }
}

/* =====================================================================
   INNER PAGES — breadcrumb, title, content, prev/next pager
   ===================================================================== */
.page { padding-block: clamp(24px, 3vw, 40px) clamp(48px, 6vw, 80px); }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; color: var(--ink-3); margin-bottom: 18px; }
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--ink); }
.page-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: clamp(28px, 4vw, 48px); }
.sec-num { color: var(--accent); }
.page-head h1 { margin: 0; font: 400 clamp(44px, 6vw, 72px)/1 var(--serif); letter-spacing: -.015em; }
.sec-rule { flex: 1; height: 1px; background: var(--line); align-self: center; min-width: 24px; }
.sec-count { color: var(--ink-3); white-space: nowrap; }
.page-intro { max-width: 60ch; color: var(--ink-2); margin: -16px 0 36px; font-size: 18px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-bottom: 8px;
  background: linear-gradient(var(--line), var(--line)) content-box top / 100% 1px no-repeat; }
.pager a { display: grid; gap: 2px; padding: 24px 0 8px; text-decoration: none; }
.pager span.mono { color: var(--ink-3); }
.pager b { font: 400 clamp(22px, 2.6vw, 30px)/1.1 var(--serif); transition: color .2s; }
.pager a:hover b { color: var(--accent); }
.pager-next { text-align: right; }

.notfound h1 { font: 400 clamp(48px, 8vw, 96px)/1 var(--serif); margin: 8px 0 24px; }

/* ---------- about (optional page type) ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); }
.about-body { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.6; }
.facts { margin: 0; border-top: 1px solid var(--ink); }
.fact { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.fact dt { color: var(--ink-3); text-transform: uppercase; padding-top: 3px; }
.fact dd { margin: 0; }
@media (max-width: 760px) { .about { grid-template-columns: 1fr; } }

/* ---------- education ---------- */
.edu { list-style: none; margin: 0; padding: 0; position: relative; }
.edu::before { content: ""; position: absolute; top: 10px; bottom: 10px; left: 135.5px; width: 1px; background: var(--line); }
.edu-item { display: grid; grid-template-columns: 120px 32px minmax(0, 1fr); padding-bottom: clamp(40px, 6vw, 64px); }
.edu-item:last-child { padding-bottom: 0; }
.edu-when { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; color: var(--ink-2); padding-top: 6px; }
.edu-when span:first-child { color: var(--ink); font-size: 14px; }
.edu-dash { width: 1px; height: 14px; background: var(--line); }
.edu-node {
  justify-self: center; margin-top: 10px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--accent); position: relative; z-index: 1;
  transition: transform .4s var(--ease), background-color .4s;
}
.edu-item:hover .edu-node { transform: scale(1.35); background: var(--accent); }
.edu-body { padding-left: clamp(8px, 2vw, 24px); }
.edu-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.edu-school { margin: 0; font: 400 clamp(28px, 3.6vw, 44px)/1.05 var(--serif); }
.edu-school a { text-decoration: none; background: linear-gradient(var(--accent) 0 0) no-repeat 0 100% / 0 1px; transition: background-size .4s var(--ease); }
.edu-school a:hover { background-size: 100% 1px; }
.badge { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); background: var(--paper-2); white-space: nowrap; }
.edu-degree { margin: 8px 0 0; font-size: 18px; font-weight: 500; }
.edu-degree span { font-weight: 400; color: var(--ink-2); }
.edu-meta { margin: 6px 0 0; color: var(--ink-3); }
.edu-meta i { font-style: normal; margin: 0 8px; color: var(--line); }
.edu-summary { margin: 16px 0 0; color: var(--ink-2); max-width: 64ch; }
.edu-hl { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; }
.edu-hl li { position: relative; padding-left: 22px; color: var(--ink-2); }
.edu-hl li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.edu-courses { margin-top: 18px; }
.edu-courses summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px;
  text-transform: uppercase; color: var(--ink-2); user-select: none;
}
.edu-courses summary::-webkit-details-marker { display: none; }
.edu-courses summary::before { content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid var(--line); border-radius: 50%; transition: transform .3s var(--ease); }
.edu-courses[open] summary::before { transform: rotate(45deg); }
.edu-courses summary span { color: var(--ink-3); }
.chips { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; background: var(--paper); }
.chips b { font: 500 11px var(--mono); color: var(--accent); margin-right: 8px; }
@media (max-width: 640px) {
  .edu::before { left: 5.5px; }
  .edu-item { grid-template-columns: 12px minmax(0, 1fr); }
  .edu-when { grid-column: 2; grid-row: 1; flex-direction: row; align-items: center; gap: 8px; padding: 0 0 6px clamp(8px, 2vw, 24px); }
  .edu-dash { width: 14px; height: 1px; }
  .edu-node { grid-column: 1; grid-row: 1; margin-top: 7px; }
  .edu-body { grid-column: 2; grid-row: 2; }
}

/* ---------- project cards ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  transition: border-color .3s, transform .5s var(--ease), box-shadow .5s var(--ease);
}
.card::before { /* cursor spotlight */
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2; opacity: 0; transition: opacity .3s;
  background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 10%, transparent), transparent 60%);
}
.card:hover { border-color: var(--ink-3); transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgb(0 0 0 / .35); }
.card:hover::before { opacity: 1; }
.card[hidden] { display: none; }
.card-cover { aspect-ratio: 16 / 10; overflow: hidden; background: var(--paper-2); color: var(--ink-3); border-bottom: 1px solid var(--line); }
.card-cover img, .card-cover .gen { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card-cover img, .card:hover .card-cover .gen { transform: scale(1.04); }
.gen { display: block; }
.gen g { opacity: .55; }
.gen-blob { fill: var(--accent); opacity: .85; mix-blend-mode: multiply; }
[data-theme="dark"] .gen-blob { mix-blend-mode: screen; opacity: .7; }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.card-meta { display: flex; gap: 14px; color: var(--ink-3); text-transform: uppercase; }
.card-status { margin-left: auto; color: var(--accent); text-align: right; }
.card-title { margin: 14px 0 0; display: flex; align-items: center; gap: 8px; font: 400 32px/1.05 var(--serif); }
.card-link { text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 3; } /* whole card is clickable */
.card-sum { margin: 10px 0 18px; color: var(--ink-2); font-size: 15px; }
.card .tags { margin-top: auto; }

@media (min-width: 760px) {
  .card--feat { grid-column: 1 / -1; display: grid; grid-template-columns: 1.35fr 1fr; }
  .card--feat .card-cover { aspect-ratio: auto; min-height: 320px; border-bottom: 0; border-right: 1px solid var(--line); }
  .card--feat .card-body { padding: clamp(24px, 3vw, 40px); justify-content: flex-end; }
  .card--feat .card-title { font-size: clamp(44px, 5vw, 64px); }
  .card--feat .card-sum { font-size: 17px; }
}

/* compact horizontal card used on the home page */
.card--digest { display: grid; grid-template-columns: 38% minmax(0, 1fr); }
.card--digest .card-cover { aspect-ratio: auto; min-height: 148px; border-bottom: 0; border-right: 1px solid var(--line); }
.card--digest .card-body { padding: 14px 16px 16px; }
.card--digest .card-title { margin-top: 8px; font-size: 28px; }
.card--digest .card-sum { font-size: 14px; margin: 6px 0 12px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 520px) {
  .card--digest { grid-template-columns: 1fr; }
  .card--digest .card-cover { min-height: 0; aspect-ratio: 16 / 6; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ---------- single project page ---------- */
.pd-cover { aspect-ratio: 21 / 8; overflow: hidden; background: var(--paper-2); color: var(--ink-3); border: 1px solid var(--line); border-radius: 8px; }
.pd-cover img, .pd-cover .gen { width: 100%; height: 100%; object-fit: cover; }
.pd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: clamp(32px, 5vw, 64px); margin-top: clamp(24px, 4vw, 40px); }
.pd-num { color: var(--ink-3); margin: 0; }
.pd-num i { font-style: normal; opacity: .6; }
.pd-title { margin: 6px 0 0; font: 400 clamp(48px, 7vw, 88px)/.95 var(--serif); letter-spacing: -.02em; }
.pd-sum { font: 400 clamp(20px, 2.2vw, 26px)/1.3 var(--serif); color: var(--ink-2); margin: 16px 0 0; max-width: 40ch; }
.pd-desc { margin-top: 28px; max-width: 68ch; }
.pd-side { align-self: start; position: sticky; top: 84px; }
.pd-facts { margin: 0; border-top: 1px solid var(--ink); }
.pd-facts > div { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pd-facts dt { color: var(--ink-3); text-transform: uppercase; padding-top: 2px; }
.pd-facts dd { margin: 0; font-size: 15px; }
.pd-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.pd-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.pd-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 28px; }
.pd-gallery img { border: 1px solid var(--line); border-radius: 6px; }
@media (max-width: 860px) { .pd-grid { grid-template-columns: 1fr; } .pd-side { position: static; } .pd-cover { aspect-ratio: 16 / 9; } }

/* ---------- generic timeline ---------- */
.tl { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.tl-item { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.tl-when { color: var(--ink-3); padding-top: 8px; text-transform: uppercase; }
.tl-title { margin: 0 0 8px; font: 400 28px/1.15 var(--serif); }
.tl-title span { color: var(--ink-3); }
.tl-title a { text-decoration-color: var(--accent); text-underline-offset: 4px; }
.tl-body .tags { margin-top: 14px; }
@media (max-width: 640px) { .tl-item { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- generic list ---------- */
.lst { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.lst-item { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 24px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.lst-year { color: var(--accent); padding-top: 4px; }
.lst-title { margin: 0; font-size: 18px; font-weight: 500; }
.lst-title a { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.lst-title a:hover { color: var(--accent); }
.lst-meta { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.lst-meta strong { color: var(--ink); }

/* ---------- contact ---------- */
.contact-body { max-width: 48ch; font-size: 19px; color: var(--ink-2); margin: 0 0 28px; }
.contact-mail {
  display: inline-flex; align-items: center; gap: .3em; max-width: 100%;
  font: 400 clamp(32px, 7vw, 96px)/1 var(--serif); text-decoration: none; letter-spacing: -.02em;
}
.contact-mail span { overflow-wrap: anywhere; background: linear-gradient(var(--accent) 0 0) no-repeat 0 100% / 0 3px; transition: background-size .5s var(--ease); padding-bottom: .06em; }
.contact-mail:hover span { background-size: 100% 3px; }
.contact-mail .arrow { width: .5em; height: .5em; color: var(--accent); }
.contact-links { list-style: none; padding: 0; margin: 40px 0 0; display: flex; flex-wrap: wrap; gap: 8px 28px; text-transform: uppercase; }
.contact-links a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-2); }
.contact-links a:hover { color: var(--accent); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 28px; padding-block: 20px 28px; color: var(--ink-3); }
.footer-inner a { margin-left: auto; text-decoration: none; }
.footer-inner a:hover { color: var(--accent); }

/* ---------- command palette ---------- */
dialog { padding: 0; border: 0; color: var(--ink); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: color-mix(in srgb, var(--ink) 40%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
dialog[open] { animation: pop .3s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.palette { width: min(560px, calc(100% - 24px)); margin: 12vh auto auto; }
.palette-box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 30px 80px -30px rgb(0 0 0 / .5); }
.palette-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink);
  font: 400 22px var(--serif); padding: 18px 20px; outline: none;
}
.palette-input::placeholder { color: var(--ink-3); }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
.palette-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
.palette-list li .mono { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-list li[aria-selected="true"] { background: var(--paper-3); }
.palette-list li[aria-selected="true"] > span:first-child::before { content: "→ "; color: var(--accent); }
.palette-list .empty { color: var(--ink-3); cursor: default; }
.palette-foot { display: flex; gap: 18px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink-3); background: var(--paper-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
