/* Daravath Saathvik, portfolio. One stylesheet for every public page.
   An editorial project index: a left-aligned 12-column grid, thin rules instead of cards, the
   work itself in front, one sharp accent. Type: Schibsted Grotesk for text and IBM Plex Mono for
   small labels (kind, year, dates), both self-hosted. Motion is small: the typed word on Home,
   hovers, and the survey card. The rules behind it are in CLAUDE.md. */

/* ---------- Fonts (self-hosted, SIL Open Font License; see assets/fonts/OFL-*.txt) ---------- */
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('../assets/fonts/schibsted-grotesk.woff2') format('woff2');
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url('../assets/fonts/schibsted-grotesk-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/plex-mono-500.woff2') format('woff2');
}

/* ---------- Tokens ---------- */
:root {
  --ink: #121212;
  --ink-2: #444441;            /* secondary text, 9.7:1 on white */
  --ink-3: #66665f;            /* labels, 5.8:1 on white */
  --paper: #ffffff;
  --surface: #f3f3f0;          /* image wells, chart cards, row hover */
  --rule: #e2e2dc;
  --rule-strong: #121212;
  --accent: #e2471a;           /* vermilion: marks, the caret, the active tab */
  --accent-ink: #b0360f;       /* the accent as text (hover), 6.2:1 on white */
  --accent-tint: #fcebe5;
  --error: #b42318;
  --pixel-bg: #0b0b0b;

  --font: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;

  --t-display: clamp(3rem, 1rem + 9.4vw, 9.5rem);
  --t-h1: clamp(2.5rem, 1.5rem + 4vw, 5.25rem);
  --t-h2: clamp(1.625rem, 1.3rem + 1.3vw, 2.5rem);
  --t-h3: clamp(1.125rem, 1.04rem + 0.35vw, 1.375rem);
  --t-lead: clamp(1.1875rem, 1.06rem + 0.5vw, 1.5rem);
  --t-body: 1.0625rem;
  --t-small: 0.9375rem;
  --t-label: 0.8125rem;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px;
  --gutter: clamp(16px, 4vw, 48px);
  --gap: clamp(16px, 2vw, 28px);
  --section: clamp(64px, 3rem + 5vw, 128px);
  --container: 1320px;
  --header-h: 64px;
  --radius: 3px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-body)/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
h1, h2, h3, h4, p, ol, ul, dl, dd, figure, blockquote { margin: 0; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--accent-ink); }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: var(--s4);
  top: -100px;
  z-index: 100;
  padding: var(--s3) var(--s4);
  background: var(--ink);
  color: #fff;
  text-decoration: none;
}
.skip-link:focus { top: var(--s4); color: #fff; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: calc(800px + 2 * var(--gutter)); }
.section { padding-block: var(--section); border-top: 1px solid var(--rule); }

/* Small labels in the mono voice: kind, year, dates. */
.label {
  display: block;
  color: var(--ink-3);
  font: 400 var(--t-label)/1.4 var(--mono);
}
.lead { max-width: 44ch; color: var(--ink-2); font-size: var(--t-lead); line-height: 1.45; }

/* A section's heading row: the title on the left, a link on the right. */
.section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2) var(--s5);
  margin-bottom: clamp(28px, 3vw, 48px);
}
.section-title { font-size: var(--t-h2); }

/* ---------- Buttons and links ---------- */
/* One button style, for the single main action of a block. Everything else is a text link. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 48px;
  padding: 0 var(--s5);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: var(--t-small);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn .icon { width: 18px; height: 18px; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-color: var(--rule); background: var(--paper); color: var(--ink); }
.btn-icon:hover { border-color: var(--ink); background: var(--surface); color: var(--ink); }
.btn-icon .icon { width: 20px; height: 20px; }

.link-arrow, .link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: var(--t-small);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: #b9b9b1;
  text-underline-offset: 0.3em;
  cursor: pointer;
  transition: color 0.15s var(--ease), text-decoration-color 0.15s var(--ease);
}
.link-arrow:hover, .link-button:hover { color: var(--accent-ink); text-decoration-color: currentColor; }
.link-arrow .icon, .link-button .icon { width: 16px; height: 16px; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5); }

/* Feedback: success with a check, errors in red with an alert icon. */
.msg { display: flex; align-items: flex-start; gap: var(--s2); margin-top: var(--s3); font-size: var(--t-small); font-weight: 500; }
.msg:empty { display: none; }
.msg .icon { width: 18px; height: 18px; margin-top: 2px; }
.msg-success { color: var(--ink); }
.msg-success .icon { color: var(--accent); }
.msg-error { color: var(--error); }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--rule);
  background: rgb(255 255 255 / 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }
.brand:hover { color: var(--ink); }
.nav-list { display: flex; align-items: center; gap: clamp(20px, 2.6vw, 40px); margin: 0; padding: 0; list-style: none; }
.nav-list a { position: relative; display: inline-flex; align-items: center; min-height: 44px; font-size: var(--t-small); font-weight: 500; text-decoration: none; }
.nav-list a[aria-current="page"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: 8px; height: 2px; background: var(--accent); }
.nav-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--s2);
  border: 0;
  background: none;
  font: 500 var(--t-label)/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
/* Below 960px the links fold into a drop-down (matchMedia in main.js uses the same width). */
@media (max-width: 959px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: flex-end; }
  .nav-list {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--s2) var(--gutter) var(--s5);
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
    box-shadow: 0 24px 40px rgb(0 0 0 / 0.06);
  }
  .nav-list.is-open { display: flex; }
  .nav-list li + li { border-top: 1px solid var(--rule); }
  .nav-list a { display: flex; min-height: 56px; font-size: 1.25rem; font-weight: 600; }
  .nav-list a[aria-current="page"]::after { left: auto; right: 0; top: 50%; bottom: auto; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; }

  /* Without JavaScript the drop-down can't open, so the links stay in a row under the name. */
  html:not(.js) .header-inner { flex-wrap: wrap; row-gap: 0; padding-bottom: var(--s1); }
  html:not(.js) .nav-toggle { display: none; }
  html:not(.js) .nav-list { position: static; display: flex; flex-direction: row; flex-wrap: wrap; gap: var(--s5); width: 100%; padding: 0; border: 0; background: none; box-shadow: none; }
  html:not(.js) .nav-list li + li { border-top: 0; }
  html:not(.js) .nav-list a { display: inline-flex; min-height: 44px; font-size: var(--t-small); font-weight: 500; }
  html:not(.js) .nav-list a[aria-current="page"]::after { left: 0; right: 0; top: auto; bottom: 8px; width: auto; height: 2px; margin-top: 0; border-radius: 0; }
}

/* ---------- Page heads (inner pages) ---------- */
.page-head { padding-block: clamp(48px, 2rem + 5vw, 112px) clamp(36px, 1.5rem + 2.5vw, 64px); }
.page-title { font-size: var(--t-h1); font-weight: 600; letter-spacing: -0.04em; line-height: 0.98; }
.page-head .lead { margin-top: var(--s5); }
.page-head .actions { margin-top: var(--s6); }
.load-error { margin-top: var(--s5); color: var(--error); }

/* ---------- Home: intro ---------- */
.intro { padding-block: clamp(40px, 1rem + 6vw, 120px) clamp(56px, 2rem + 5vw, 120px); }
.intro-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s7) var(--gap); align-items: end; }
.intro-copy { grid-column: 1 / span 8; min-width: 0; }
.intro-photo { grid-column: 9 / span 4; }
.intro-title { font-size: var(--t-display); font-weight: 600; letter-spacing: -0.045em; line-height: 0.94; }
.hero-role { display: block; min-height: 1.88em; } /* holds two lines while the first word is typed */
.role-word, .role-rest { display: block; }
.intro-text { max-width: 42ch; margin-top: clamp(28px, 3vw, 44px); color: var(--ink-2); font-size: var(--t-lead); line-height: 1.45; }
.intro-meta { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s5); color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
.intro-meta:empty { display: none; }
.intro-meta .icon { width: 15px; height: 15px; }
.intro .actions { margin-top: var(--s6); }
.photo-frame { overflow: hidden; border-radius: var(--radius); background: var(--surface); aspect-ratio: 4 / 5; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; object-position: 47% 50%; }
.photo-initials { display: grid; place-items: center; width: 100%; height: 100%; color: var(--ink-3); font-size: clamp(2.5rem, 6vw, 5rem); font-weight: 600; }
@media (max-width: 899px) {
  .intro-copy, .intro-photo { grid-column: 1 / -1; }
  .intro-photo { grid-row: 1; width: min(46vw, 220px); }
  .intro-grid { gap: var(--s6); }
}

/* ---------- Work cards (Home "Selected work", the Work page) ---------- */
.work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(40px, 4vw, 64px) var(--gap); margin: 0; padding: 0; list-style: none; }
.selected-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(44px, 5vw, 80px) var(--gap); margin: 0; padding: 0; list-style: none; }
@media (max-width: 1099px) { .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 639px) { .work-grid, .selected-grid { grid-template-columns: minmax(0, 1fr); } }

.work-card { position: relative; display: flex; flex-direction: column; min-width: 0; }
.work-card-media { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--surface); aspect-ratio: 16 / 10; }
.work-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.work-card:hover .work-card-media img { transform: scale(1.02); }
.work-card-body { display: grid; gap: var(--s2); padding-top: var(--s4); }
.work-card-meta { display: flex; flex-wrap: wrap; gap: 0 var(--s3); color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
.work-card-meta span + span::before { content: '/'; margin-right: var(--s3); color: #b9b9b1; }
.work-card-title { font-size: var(--t-h3); letter-spacing: -0.015em; }
.work-card-title a { text-decoration: none; }
/* The title link covers the whole card, so the card is one click target. */
.work-card-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.work-card-title a:focus-visible { outline: none; }
.work-card:focus-within { outline: 2px solid var(--accent); outline-offset: 6px; }
.work-card:hover .work-card-title a { color: var(--accent-ink); }
.work-card-desc { max-width: 56ch; color: var(--ink-2); font-size: var(--t-small); }
.selected-grid .work-card-title { font-size: var(--t-h2); letter-spacing: -0.025em; }
.selected-grid .work-card-desc { font-size: var(--t-body); }

/* Work without a cover (the marketing case studies): its main number is the picture. */
.work-card-media.is-empty { display: grid; place-items: center; }
.tone-tint { background: var(--surface); color: var(--ink); }
.tone-ink { background: var(--ink); color: #fff; }
.project-media-empty { display: grid; justify-items: center; gap: var(--s2); padding: var(--s5); text-align: center; }
.empty-figure { font-size: clamp(3rem, 2rem + 4vw, 5.5rem); font-weight: 600; letter-spacing: -0.045em; line-height: 0.9; }
.empty-label { font: 400 var(--t-label)/1.4 var(--mono); opacity: 0.8; }
.empty-title { font-size: var(--t-h2); font-weight: 600; }
.tone-tint .empty-figure { color: var(--accent-ink); }

/* Pixel-art covers: sharp pixels, letterboxed on a dark well, never cropped. */
.is-pixel-art .work-card-media { background: var(--pixel-bg); }
.is-pixel-art .work-card-media img { object-fit: contain; image-rendering: pixelated; }
/* Shots far off their frame's shape are shown whole on a matte of their own edge colour (fitImage in main.js). */
.work-card-media img.is-fit, .detail-cover img.is-fit, .gallery-item img.is-fit { object-fit: contain; background-color: var(--matte, var(--pixel-bg)); }

/* ---------- Home: the list of the rest ---------- */
.index { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.index-row { border-bottom: 1px solid var(--rule); }
.index-link {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1.3fr) 6.5rem minmax(0, 1.5fr) 20px;
  align-items: baseline;
  gap: var(--gap);
  min-height: 64px;
  padding: var(--s4) 0;
  text-decoration: none;
  transition: background-color 0.15s var(--ease), padding 0.25s var(--ease);
}
.index-year, .index-kind { color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
.index-title { font-size: var(--t-h3); font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.index-tools { overflow: hidden; color: var(--ink-2); font-size: var(--t-small); text-overflow: ellipsis; white-space: nowrap; }
.index-arrow { align-self: center; color: var(--ink-3); }
.index-arrow .icon { width: 18px; height: 18px; }
.index-link:hover { padding-inline: var(--s3); background: var(--surface); color: var(--ink); }
.index-link:hover .index-title, .index-link:hover .index-arrow { color: var(--accent-ink); }
@media (max-width: 899px) {
  .index-link { grid-template-columns: 3.25rem minmax(0, 1fr) auto; row-gap: 2px; }
  .index-tools, .index-arrow { display: none; }
}
/* Hovering a row floats its cover beside the pointer (mouse only; motion.js). */
.index-preview {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: 300px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.16);
  aspect-ratio: 16 / 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s var(--ease);
}
.index-preview.is-on { opacity: 1; }
.index-preview img { width: 100%; height: 100%; object-fit: cover; }
.index-preview.is-pixel-art { background: var(--pixel-bg); }
.index-preview.is-pixel-art img { object-fit: contain; image-rendering: pixelated; }

/* ---------- Home: how I work ---------- */
.approach-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s5) var(--gap); }
.approach-head { grid-column: 1 / span 4; }
.approach-head p { max-width: 30ch; margin-top: var(--s4); color: var(--ink-2); }
.approach { grid-column: 5 / -1; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.approach li {
  display: grid;
  grid-template-columns: 2.5rem 8.5rem minmax(0, 1fr);
  align-items: baseline;
  gap: var(--s2) var(--gap);
  padding: var(--s5) 0;
  border-bottom: 1px solid var(--rule);
}
.approach-num { color: var(--accent-ink); font: 500 var(--t-label)/1.4 var(--mono); }
.approach-title { font-size: var(--t-h3); }
.approach-text { color: var(--ink-2); }
@media (max-width: 899px) {
  .approach-head, .approach { grid-column: 1 / -1; }
  .approach-head { margin-bottom: var(--s4); }
  .approach li { grid-template-columns: 2.25rem minmax(0, 1fr); }
  .approach-text { grid-column: 2; }
}

/* ---------- Work page: filter tabs ---------- */
.work-tabs-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  border-bottom: 1px solid var(--rule);
  background: rgb(255 255 255 / 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.work-tabs { display: flex; gap: clamp(16px, 3vw, 32px); overflow-x: auto; scrollbar-width: none; }
.work-tabs::-webkit-scrollbar { display: none; }
.work-tab {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: 52px;
  color: var(--ink-2);
  font-size: var(--t-small);
  font-weight: 500;
  text-decoration: none;
}
.work-tab:hover { color: var(--ink); }
.work-tab[aria-current="true"] { color: var(--ink); font-weight: 600; }
.work-tab[aria-current="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.work-tab-count { color: var(--ink-3); font: 400 var(--t-label)/1 var(--mono); }
.work-list { padding-block: clamp(36px, 4vw, 64px) var(--section); }
.work-soon { max-width: 720px; }
.work-soon .lead { color: var(--ink); }
.soon-links { display: grid; margin: var(--s5) 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule); }
.soon-links li { border-bottom: 1px solid var(--rule); }
.soon-links .link-arrow { min-height: 56px; font-size: var(--t-body); text-decoration: none; }
.empty-state { padding-bottom: var(--section); }
.empty-state .actions { margin-top: var(--s5); }

/* ---------- About ---------- */
.about-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s6) var(--gap); padding-bottom: var(--section); }
.about-photo { grid-column: 1 / span 4; }
.about-copy { grid-column: 6 / span 7; display: grid; align-content: start; gap: var(--s6); }
.about-text { display: grid; gap: var(--s5); }
.about-text p:first-child { font-size: clamp(1.375rem, 1.1rem + 1vw, 2rem); font-weight: 500; letter-spacing: -0.015em; line-height: 1.3; }
.about-text p:not(:first-child) { max-width: 58ch; color: var(--ink-2); font-size: var(--t-lead); line-height: 1.5; }
.about-subhead { margin-top: var(--s5); font-size: var(--t-h3); line-height: 1.25; }
@media (max-width: 899px) {
  .about-photo, .about-copy { grid-column: 1 / -1; }
  .about-photo { width: min(70vw, 340px); }
}

/* Rows: a heading in the left columns, the content on the right (Experience, Education, Skills …). */
.rows-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s5) var(--gap); }
.rows-grid > .section-title { grid-column: 1 / span 4; }
.rows-body { grid-column: 5 / -1; min-width: 0; }
@media (max-width: 899px) { .rows-grid > .section-title, .rows-body { grid-column: 1 / -1; } }

.entries { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.entry { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: var(--s2) var(--gap); padding: var(--s5) 0; border-bottom: 1px solid var(--rule); }
.entry-date { display: flex; flex-wrap: wrap; align-content: flex-start; align-items: baseline; gap: 2px var(--s2); color: var(--ink-3); font: 400 var(--t-label)/1.5 var(--mono); }
.tag-current { color: var(--accent-ink); font: 500 var(--t-label)/1.5 var(--mono); }
.entry-body h3 { font-size: var(--t-h3); }
.entry-sub { margin-top: 2px; color: var(--ink-2); font-size: var(--t-small); }
.entry-body ul { display: grid; gap: var(--s2); margin-top: var(--s3); padding-left: 1.1em; color: var(--ink-2); font-size: var(--t-small); }
.entry-body li::marker { color: var(--ink-3); }
.entry-body > p:not(.entry-sub) { margin-top: var(--s3); color: var(--ink-2); font-size: var(--t-small); }
.entry-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s5); margin-top: var(--s3); }
.entry-links-label { flex-basis: 100%; margin-top: var(--s2); color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
@media (max-width: 599px) { .entry { grid-template-columns: minmax(0, 1fr); } }

.stats { display: flex; flex-wrap: wrap; gap: var(--s5) clamp(32px, 5vw, 72px); margin: 0; padding: 0; list-style: none; }
.stat-value { display: block; font-size: clamp(2rem, 1.5rem + 2vw, 3.25rem); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.stat-label { display: block; max-width: 22ch; margin-top: var(--s2); color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
.rows-body > .stats { margin-bottom: var(--s7); }

.skill-groups { margin: 0; border-top: 1px solid var(--rule-strong); }
.skill-group { display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: var(--s2) var(--gap); padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.skill-group-title { color: var(--ink-3); font: 400 var(--t-label)/1.7 var(--mono); }
.tag-list { margin: 0; padding: 0; list-style: none; }
.tag-list li { display: inline; }
.tag-list li + li::before { content: ', '; }
@media (max-width: 599px) { .skill-group { grid-template-columns: minmax(0, 1fr); } }

.cert-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6) var(--gap); margin: 0; padding: 0; list-style: none; }
@media (max-width: 1099px) { .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 479px) { .cert-grid { grid-template-columns: minmax(0, 1fr); } }
.cert-card { display: grid; gap: var(--s2); text-decoration: none; }
.cert-thumb { overflow: hidden; margin-bottom: var(--s2); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); aspect-ratio: 4 / 3; }
.cert-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cert-name { font-size: var(--t-body); font-weight: 600; line-height: 1.3; }
.cert-card:hover .cert-name { color: var(--accent-ink); }
.cert-meta { color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
.cert-paper { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2); height: 100%; padding: var(--s5); text-align: center; }
.cert-paper-label { color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
.cert-paper-name { font-size: 1.125rem; font-weight: 600; line-height: 1.25; }
.cert-paper-issuer { color: var(--ink-2); font-size: var(--t-small); }
.cert-paper-badge { margin-top: var(--s2); color: var(--accent-ink); font: 500 var(--t-label)/1 var(--mono); }

/* Kind words: real quotes only, hidden while there are none. */
.quote-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: var(--s6) var(--gap); }
.quote { padding-top: var(--s5); border-top: 1px solid var(--rule-strong); }
.quote blockquote p { font-size: var(--t-lead); font-weight: 500; letter-spacing: -0.01em; line-height: 1.4; }
.quote figcaption { margin-top: var(--s4); color: var(--ink-3); font: 400 var(--t-label)/1.5 var(--mono); }
.quote-name { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 500; }
.quote figcaption > span:not(.quote-name) { display: block; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s7) var(--gap); }
.contact-block { grid-column: 1 / span 7; min-width: 0; }
.contact-links { grid-column: 9 / -1; }
@media (max-width: 899px) { .contact-block, .contact-links { grid-column: 1 / -1; } }
.contact-block .label, .contact-links .label { margin-bottom: var(--s3); }
.contact-email {
  display: inline-block;
  max-width: 100%;
  font-size: clamp(1.375rem, 0.6rem + 3.4vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}
.contact-block .actions { margin-top: var(--s6); }
.contact-location { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s6); color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
.contact-location:empty { display: none; }
.contact-location .icon { width: 15px; height: 15px; }
.link-rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.link-rows li { border-bottom: 1px solid var(--rule); }
.link-rows a { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 60px; font-size: var(--t-h3); font-weight: 600; text-decoration: none; }
.link-rows .icon { width: 20px; height: 20px; }

/* ---------- Project and certificate pages ---------- */
.back-row { padding-top: var(--s5); }
.back-link { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--ink-3); font: 400 var(--t-label)/1 var(--mono); text-decoration: none; }
.back-link:hover { color: var(--accent-ink); }
.back-link .icon { width: 16px; height: 16px; }

.project-header { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s6) var(--gap); padding-block: clamp(20px, 3vw, 48px) clamp(36px, 4vw, 64px); }
.project-header-main { grid-column: 1 / span 7; min-width: 0; }
.project-header-main .label { margin-bottom: var(--s4); }
.project-header-main h1 { font-size: var(--t-h1); letter-spacing: -0.04em; line-height: 0.98; }
.project-header-main .lead { margin-top: var(--s5); max-width: 40ch; }
.project-header-main .actions { margin-top: var(--s6); }
.project-header .facts { grid-column: 9 / -1; align-self: end; }
@media (max-width: 899px) { .project-header-main, .project-header .facts { grid-column: 1 / -1; } }
.facts { display: grid; margin: 0; border-top: 1px solid var(--rule-strong); }
.facts div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--ink-3); font: 400 var(--t-label)/1.6 var(--mono); }
.facts dd { font-size: var(--t-small); line-height: 1.5; }

/* The playtest facts inside a stage (playtestFacts in detail.js), and a reference near the end */
.playtest { max-width: 560px; margin-bottom: var(--s6); }
.playtest .label { margin-bottom: var(--s3); }
.reference { font-size: var(--t-body); line-height: 1.6; }
.reference-role { color: var(--ink-2); }

.detail-cover { overflow: hidden; border-radius: var(--radius); background: var(--surface); }
.detail-cover img { width: 100%; height: auto; }
.is-pixel-art .detail-cover { background: var(--pixel-bg); }
.is-pixel-art .detail-cover img { image-rendering: pixelated; }
.detail-stats { margin-top: clamp(40px, 5vw, 72px); padding-top: var(--s5); border-top: 1px solid var(--rule-strong); }
.detail-stats.is-panel { padding-top: 0; border-top: 0; }

/* Story sections: the heading in the left columns (it stays in view while you read), content on the right. */
.detail-section { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s4) var(--gap); padding-top: var(--section); }
.detail-section > .section-title { grid-column: 1 / span 3; align-self: start; position: sticky; top: calc(var(--header-h) + 24px); font-size: var(--t-h3); line-height: 1.25; }
.section-num { display: block; margin-bottom: var(--s3); color: var(--accent-ink); font: 500 var(--t-label)/1 var(--mono); letter-spacing: 0; }
.detail-body { grid-column: 4 / -1; min-width: 0; }
.detail-body > * + * { margin-top: var(--s5); }
.detail-section.is-headless { padding-top: var(--s7); }
@media (max-width: 899px) {
  .detail-section > .section-title, .detail-body { grid-column: 1 / -1; }
  .detail-section > .section-title { position: static; font-size: var(--t-h2); }
}

.prose { max-width: 68ch; }
.prose > * + * { margin-top: 1em; }
.prose h2, .prose h3 { margin-top: 2em; font-size: var(--t-h3); }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { display: grid; gap: 0.45em; padding-left: 1.2em; }
.prose li::marker { color: var(--ink-3); }
.prose a { color: var(--accent-ink); }

/* Section images: always whole, at their own shape. "stack" = one per row, large (screenshots with small text). */
.section-media > * + * { margin-top: var(--s5); }
.shot-grid { display: grid; align-items: start; gap: var(--gap); }
.shots-2, .shots-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.shots-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.shots-stack { grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
@media (max-width: 599px) { .shots-2, .shots-3 { grid-template-columns: minmax(0, 1fr); } }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: var(--s5) var(--gap); margin: 0; padding: 0; list-style: none; }
.gallery-item { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: zoom-in; }
.gallery-item img { width: 100%; border-radius: var(--radius); background: var(--surface); transition: opacity 0.15s var(--ease); }
.gallery .gallery-item img { aspect-ratio: 4 / 3; object-fit: cover; }
.gallery-item:hover img { opacity: 0.9; }
/* A hairline around section shots, so white screenshots (like the store pages) don't melt into the page. */
.shot-grid .gallery-item img { box-shadow: 0 0 0 1px var(--rule); }
/* Section shots never grow past the screen height (phone screenshots stay phone-sized) and never
   stretch past their own size (small captures stay sharp). */
.shot-grid .gallery-item img { width: auto; max-width: 100%; max-height: 85vh; }
.shots-stack .gallery-item img { max-height: 90vh; }
.gallery .gallery-item img.is-tall { aspect-ratio: 9 / 16; }
/* App screens with rounded, see-through corners: no square border or backdrop, an outline that follows the shape. */
.gallery-item img.is-cutout, .shot-grid .gallery-item img.is-cutout { background: none; box-shadow: none; border-radius: 0; filter: drop-shadow(0 0 1px rgb(18 18 18 / 0.35)); }
/* On a phone the column is one shot wide, and a phone screenshot (capped at the screen height) comes
   out narrower than it: centre it, with its caption. */
@media (max-width: 599px) {
  .shot-grid:not(.shots-4) .gallery-item:has(img.is-tall) { text-align: center; }
  .shot-grid:not(.shots-4) .gallery-item img.is-tall { margin-inline: auto; }
}
/* A gallery of phone screenshots gets narrower columns, so four fit in a row. */
.gallery:has(img.is-tall) { grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.gallery-caption { display: block; padding-top: var(--s2); color: var(--ink-2); font-size: var(--t-small); line-height: 1.45; }
.is-pixel-art .gallery-item img { background: var(--pixel-bg); image-rendering: pixelated; }
.is-pixel-art .gallery .gallery-item img { object-fit: contain; }
.is-pixel-art .shots-1 .gallery-item { width: auto; max-width: 100%; }
.is-pixel-art .shots-1 .gallery-item img { width: auto; max-width: 100%; max-height: 80vh; }

.video-item video { width: 100%; border-radius: var(--radius); background: #000; }
.video-item.is-portrait { max-width: min(100%, 420px); }
.clip-list { display: grid; gap: var(--s5); }
@media (min-width: 768px) { .clips-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.embed iframe { display: block; width: 100%; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); }
.embed-figma iframe { min-height: 360px; aspect-ratio: 16 / 10; }
.embed + .actions { margin-top: var(--s3); }
/* A Figma prototype: a phone-shaped frame, centred, tall enough to show the whole app screen. */
.figma-proto { display: flex; flex-direction: column; align-items: center; }
.figma-proto .embed { width: min(100%, 440px); }
.figma-proto .embed-figma iframe { min-height: 0; aspect-ratio: 440 / 900; max-height: calc(100vh - var(--header-h) - 40px); background: #000; }
.figma-proto .actions { justify-content: center; }

/* Work without a cover: the numbers in a panel of the project's tone. */
.stats-panel { container-type: inline-size; padding: clamp(32px, 5vw, 64px) clamp(20px, 3vw, 40px); border-radius: var(--radius); }
.stats-panel .stats { justify-content: space-between; }
.stats-panel .stat-value { font-size: clamp(2.25rem, 7cqi, 4.5rem); }
.tone-ink .stat-label { color: rgb(255 255 255 / 0.75); }
.tone-tint .stat-value { color: var(--accent-ink); }

.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); margin-top: var(--section); padding-block: var(--s6) var(--section); border-top: 1px solid var(--rule-strong); }
.pager a { display: grid; align-content: start; gap: var(--s2); text-decoration: none; }
.pager-next { grid-column: 2; justify-items: end; text-align: right; }
.pager-label { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font: 400 var(--t-label)/1 var(--mono); }
.pager-label .icon { width: 16px; height: 16px; }
.pager-title { font-size: var(--t-h3); font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.pager a:hover .pager-title { color: var(--accent-ink); }

.cert-view { max-width: 960px; }
.cert-pdf { display: block; width: 100%; height: min(85vh, 900px); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.cert-image img { width: 100%; border: 1px solid var(--rule); object-fit: contain; }
.cert-solo { max-width: 520px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); aspect-ratio: 4 / 3; }

/* ---------- Charts drawn from data (chartFigure in detail.js): ink, the accent and greys ---------- */
.chart { max-width: 1000px; }
.chart-plot { min-height: 200px; }
.chart-plot svg { display: block; overflow: visible; max-width: 100%; height: auto; } /* drawn at the page width; a saved copy still fits a phone */
.chart text { fill: var(--ink-3); font-family: var(--mono); font-size: 11px; }
.chart .chart-axis-label, .chart .chart-panel-label { fill: var(--ink); font-family: var(--font); font-size: 13px; font-weight: 600; }
.chart .chart-band-label { fill: var(--accent-ink); font-family: var(--font); font-size: 12px; font-weight: 600; }
.chart-grid { stroke: var(--rule); stroke-width: 1; }
.chart-axis { stroke: #9b9b94; stroke-width: 1; }
.chart-band { fill: var(--accent-tint); }
.chart-bar.c-teal, .chart-dot.c-teal { fill: var(--accent); }
.chart-bar.c-ink, .chart-dot.c-ink { fill: var(--ink); }
.chart-bar.c-grey { fill: #b8b8b0; }
.chart-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.c-teal { stroke: var(--accent); }
.chart-line.c-ink { stroke: var(--ink); }
.chart-dot { stroke: var(--paper); stroke-width: 2; }
.chart-marker { stroke: #9b9b94; stroke-dasharray: 3 3; stroke-width: 1; }
.chart-marker-dot { fill: var(--ink); }
.chart .chart-marker-num { fill: #fff; font-size: 10px; font-weight: 500; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: var(--s4) 0 0; padding: 0; list-style: none; font-size: var(--t-small); }
.chart-legend li { display: flex; align-items: center; gap: var(--s2); }
.chart-swatch { flex: none; width: 12px; height: 12px; border-radius: 2px; }
.chart-swatch.is-line { width: 18px; height: 3px; }
.chart-swatch.c-teal { background: var(--accent); }
.chart-swatch.c-ink { background: var(--ink); }
.chart-swatch.c-grey { background: #b8b8b0; }
.chart-markers { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: var(--s2) var(--s5); margin: var(--s4) 0 0; padding: 0; list-style: none; font-size: var(--t-small); }
.chart-markers li { display: flex; align-items: center; gap: var(--s2); }
.chart-marker-chip { display: inline-grid; flex: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; font: 500 10px/1 var(--mono); }
.chart-note { margin-top: var(--s3); color: var(--ink-3); font: 400 var(--t-label)/1.5 var(--mono); }
.chart .gallery-caption { padding-top: var(--s3); }

/* ---------- Diagrams drawn from data (DIAGRAMS in detail.js): sitemap, flows, palette, components ----------
   Straight on the page (no card): thin rules, dots and real text, aligned to a grid. */
.diagram { --g: 24px; --line: #b9b9b1; }
.detail-body > * + .diagram, .detail-body > * + .chart { margin-top: var(--s6); }
.diagram h3 { font-size: var(--t-small); font-weight: 600; letter-spacing: 0; }
.diagram .label, .diagram h3.label { margin-bottom: var(--s4); font: 400 var(--t-label)/1.4 var(--mono); color: var(--ink-3); }
.diagram > .gallery-caption { padding-top: var(--s5); }

/* Steps as a timeline: a line with a dot per step, the text under each dot; the last step in the accent.
   Horizontal on wide screens (columns line up across flows), vertical on narrow ones. */
.diagram-steps { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0 var(--g); margin: 0; padding: 0; list-style: none; }
.diagram-steps > li { position: relative; padding-top: 22px; font-size: var(--t-small); line-height: 1.4; color: var(--ink); }
.diagram-steps > li::before { content: ''; position: absolute; top: 0; left: 0; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
.diagram-steps > li:not(:last-child)::after { content: ''; position: absolute; top: 4px; left: 9px; right: calc(-1 * var(--g)); height: 1px; background: var(--line); }
.diagram-steps > li.is-last { font-weight: 600; }
.diagram-steps > li.is-last::before { background: var(--accent); }
.diagram-steps.is-launch > li.is-last { font-weight: 400; }
.diagram-steps.is-launch > li.is-last::before { background: var(--ink); }
@media (max-width: 767px) {
  .diagram-steps { grid-auto-flow: row; grid-auto-columns: auto; }
  .diagram-steps > li { padding: 0 0 var(--s4) 24px; }
  .diagram-steps > li::before { top: 6px; }
  .diagram-steps > li:not(:last-child)::after { top: 15px; bottom: 0; left: 4px; right: auto; width: 1px; height: auto; }
}

/* Sitemap */
.sitemap-launch { padding-bottom: var(--s2); }
@media (max-width: 1099px) {
  .sitemap-launch .diagram-steps { grid-auto-flow: row; grid-auto-columns: auto; }
  .sitemap-launch .diagram-steps > li { padding: 0 0 var(--s3) 24px; }
  .sitemap-launch .diagram-steps > li::before { top: 6px; }
  .sitemap-launch .diagram-steps > li:not(:last-child)::after { top: 15px; bottom: 0; left: 4px; right: auto; width: 1px; height: auto; }
}
.sitemap-hub { position: relative; display: grid; gap: 2px; width: min(100%, 360px); margin: var(--s6) 0 40px; padding: var(--s4); border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); }
.sitemap-hub strong { font-size: var(--t-h3); font-weight: 600; }
.sitemap-hub span { color: var(--ink-2); font-size: var(--t-small); }
/* One connector, left-aligned: down from the hub onto one rule that runs over all five tabs. */
.sitemap-hub::after { content: ''; position: absolute; top: 100%; left: 4px; width: 1px; height: 40px; background: var(--rule-strong); }
.sitemap-tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--g); margin: 0; padding: var(--s4) 0 0; border-top: 1px solid var(--rule-strong); list-style: none; }
.sitemap-tab h3 { margin-bottom: var(--s3); }
.sitemap-tab ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; color: var(--ink-2); font-size: var(--t-small); line-height: 1.35; }
@media (max-width: 1099px) { .sitemap-tab ul { font-size: 0.875rem; } }
@media (max-width: 899px) {
  .sitemap-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6) var(--g); padding-top: 0; border-top: 0; }
  .sitemap-tab { padding-top: var(--s3); border-top: 1px solid var(--rule-strong); }
  .sitemap-hub::after { display: none; }
  .sitemap-hub { margin-bottom: var(--s6); }
}
@media (max-width: 479px) { .sitemap-tabs { grid-template-columns: minmax(0, 1fr); } }

/* User flows: five fixed columns, so step 1, 2, 3 … of every flow line up */
.flows { display: grid; gap: var(--s6); margin: 0; padding: 0; list-style: none; }
.flow { padding-top: var(--s4); border-top: 1px solid var(--rule); }
.flow:first-child { padding-top: 0; border-top: 0; }
.flow h3 { display: flex; align-items: baseline; gap: var(--s2); margin-bottom: var(--s4); }
.flow-num { color: var(--accent-ink); font: 500 var(--t-label)/1 var(--mono); }
.flow .diagram-steps { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-flow: row; }
@media (max-width: 767px) { .flow .diagram-steps { grid-template-columns: minmax(0, 1fr); } }

/* Colour palette */
.palette-group + .palette-group { margin-top: var(--s6); }
.palette-swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s5) var(--g); margin: 0; padding: 0; list-style: none; }
.palette-swatches li { display: grid; align-content: start; gap: 2px; min-width: 0; }
.palette-chip { display: block; margin-bottom: var(--s3); border-radius: var(--radius); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); aspect-ratio: 16 / 9; }
.palette-swatches strong { font-size: var(--t-small); font-weight: 600; }
.palette-hex { color: var(--ink-3); font: 400 var(--t-label)/1.5 var(--mono); }
.palette-use { color: var(--ink-2); font-size: 0.8125rem; line-height: 1.4; }
@media (max-width: 767px) { .palette-swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Component library: icons with names, then each component at its real size, outlined along its own shape */
.components-group + .components-group { margin-top: var(--s7); }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: var(--s5) var(--s2); margin: 0; padding: 0; list-style: none; }
.icon-grid li { display: grid; justify-items: center; gap: 8px; text-align: center; }
.icon-grid img { width: 24px; height: 24px; }
.icon-grid span { color: var(--ink-2); font: 400 11px/1.3 var(--mono); }
@media (max-width: 599px) { .icon-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.component-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s7) var(--g); align-items: end; margin: 0; padding: 0; list-style: none; }
.component-grid li { display: grid; justify-items: start; gap: var(--s3); min-width: 0; }
.component-grid img { max-width: 100%; height: auto; filter: drop-shadow(0 0 1px rgb(18 18 18 / 0.45)); }
.component-name { color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
@media (max-width: 899px) { .component-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s6); } }

/* ---------- Image viewer ---------- */
.lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: var(--s4);
  border: 0;
  background: rgb(255 255 255 / 0.98);
  color: var(--ink);
}
.lightbox[open] { display: flex; flex-direction: column; gap: var(--s4); }
.lightbox::backdrop { background: transparent; }
.lightbox-bar, .lightbox-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); }
.lightbox-count { color: var(--ink-3); font: 400 var(--t-label)/1 var(--mono); }
.lightbox-figure { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: var(--s3); min-height: 0; }
.lightbox-img { max-width: 100%; max-height: calc(100dvh - 200px); object-fit: contain; }
.is-pixel-art .lightbox-img { background: var(--pixel-bg); image-rendering: pixelated; }
.lightbox-caption { max-width: 70ch; color: var(--ink-2); text-align: center; }
.lightbox-nav { justify-content: center; gap: var(--s5); }

/* ---------- Visitor survey: a small card in the corner; the page stays usable around it ---------- */
.survey {
  position: fixed;
  inset: auto var(--s5) var(--s5) auto;
  z-index: 40;
  width: min(380px, calc(100% - 2 * var(--s5)));
  max-height: calc(100dvh - var(--header-h) - 2 * var(--s4));
  overflow-y: auto;
  margin: 0;
  padding: var(--s5);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 48px rgb(0 0 0 / 0.12);
}
@media (max-width: 599px) { .survey { inset: auto var(--s3) var(--s3); width: auto; } }
.survey-close { position: absolute; top: var(--s2); right: var(--s2); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.survey-close:hover { color: var(--ink); }
.survey-close .icon { width: 20px; height: 20px; }
.survey-title { padding-right: 36px; font-size: var(--t-h3); }
.survey-intro { margin-top: var(--s2); color: var(--ink-2); font-size: var(--t-small); }
.survey-start { margin-top: var(--s4); }
.survey-form { display: grid; gap: var(--s4); margin-top: var(--s4); }
.field { display: grid; gap: var(--s2); }
.field-label { font-size: var(--t-small); font-weight: 600; }
.field input, .field select {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--s3);
  border: 1px solid #8a8a83;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.4 var(--font);
}
.field input:focus-visible, .field select:focus-visible { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 1px; }
.field [aria-invalid="true"] { border-color: var(--error); }
.survey-note { margin-top: var(--s4); color: var(--ink-3); font-size: var(--t-label); }
.survey-thanks { display: flex; align-items: center; gap: var(--s2); font-weight: 600; }
.survey-thanks .icon { width: 20px; height: 20px; color: var(--accent); }

/* ---------- Legal pages ---------- */
.legal-updated { margin-top: var(--s4); color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); }
.legal .prose h2 { font-size: var(--t-h3); }

/* ---------- Footer ---------- */
.site-footer { padding-block: clamp(56px, 6vw, 96px) var(--s6); border-top: 1px solid var(--rule-strong); }
.footer-top { padding-bottom: clamp(40px, 5vw, 72px); }
[data-page="contact"] .footer-top { display: none; } /* the page itself is the big email */
.footer-email {
  display: inline-block;
  max-width: 100%;
  margin-top: var(--s3);
  font-size: clamp(1.375rem, 0.6rem + 3.4vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.footer-email:hover { color: var(--accent-ink); }
.footer-email, .contact-email { padding-block: var(--s2); }
.footer-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--s6) var(--gap); padding-top: var(--s6); border-top: 1px solid var(--rule); }
.footer-pages { grid-column: 1 / span 4; }
.footer-elsewhere { grid-column: 5 / span 4; }
.footer-meta { grid-column: 9 / -1; display: grid; align-content: start; gap: var(--s2); color: var(--ink-3); font: 400 var(--t-label)/1.5 var(--mono); }
.footer-title { margin-bottom: var(--s2); color: var(--ink-3); font: 400 var(--t-label)/1.4 var(--mono); letter-spacing: 0; }
.footer-links { margin: 0; padding: 0; list-style: none; }
.footer-links a { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; font-size: var(--t-small); text-decoration: none; }
.footer-links .icon { width: 14px; height: 14px; color: var(--ink-3); }
.footer-links .footer-sub a { padding-left: var(--s4); color: var(--ink-2); }
.footer-legal { display: flex; flex-wrap: wrap; gap: 0 var(--s4); margin: 0; padding: 0; list-style: none; }
.footer-legal a { display: inline-flex; align-items: center; min-height: 36px; text-decoration: none; }
@media (max-width: 899px) {
  .footer-pages, .footer-elsewhere { grid-column: span 6; }
  .footer-meta { grid-column: 1 / -1; }
}

.noscript { padding-block: var(--s5); color: var(--ink-2); }
.loading-note { color: var(--ink-3); }

/* ---------- Text alignment ----------
   Long reading text is justified where its lines are long enough to stay even: project
   write-ups, card summaries, job bullets and the How I work lines from 360px wide, the About
   text from 768px. Everything else stays left-aligned: headings, labels, captions, buttons,
   the big intro and summary lines at the top of pages (too few words per line to justify
   without gaps), short one-line items and the resume. Hyphenation softens the gaps where the
   browser supports it. */
.prose p, .prose li, .work-card-desc, .entry-body li, .entry-body > p:not(.entry-sub),
.approach-text, .about-text p:not(:first-child) {
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 7 3 3;
}
@media (min-width: 360px) {
  .prose p, .prose li, .work-card-desc, .entry-body li, .entry-body > p:not(.entry-sub) { text-align: justify; }
}
@media (min-width: 768px) {
  .approach-text, .about-text p:not(:first-child) { text-align: justify; }
}

/* The 12-column grids become one column on small screens, after their desktop rules (their gaps alone would be too wide). */
@media (max-width: 899px) {
  .intro-grid, .about-grid, .approach-grid, .rows-grid, .contact-grid, .project-header, .detail-section { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Motion: the typed word, small hovers, the survey card ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js .type-caret { display: inline-block; width: 0.07em; height: 0.78em; margin-left: 0.04em; background: var(--accent); vertical-align: -0.02em; animation: caret-blink 1s steps(1) infinite; }
  @keyframes caret-blink { 50% { opacity: 0; } }
  .js .survey[open] { animation: survey-in 0.4s var(--ease) both; }
  @keyframes survey-in { from { opacity: 0; transform: translate3d(0, 16px, 0); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media print {
  .site-header, .site-footer, .skip-link, .survey, .work-tabs-bar { display: none !important; }
}
