/* =============================================================================
   SYSTEM + THEME
   -----------------------------------------------------------------------------
   The reusable visual language. Employee content never touches this file.
   Everything is driven by CSS custom properties so a profile can retheme by
   flipping a few data-attributes on <html> (see script.js applyTheme()).
   ========================================================================== */

/* ---- THEME PRESETS ----------------------------------------------------- */
:root,
:root[data-theme="paper"] {
  --bg:      #F3F0E8;
  --surface: #F8F6F0;
  --ink:     #171717;
  --muted:   #6F6B63;
  --line:    #C9C4B8;
  --accent:  #5D45B8;
  --on-accent: #F8F6F0;
  --hairline: #D8D3C7;   /* even lighter than --line, for background rules */
}

:root[data-theme="archive"] {
  --bg:      #EEEAE0;
  --surface: #F7F3E9;
  --ink:     #24221E;
  --muted:   #777166;
  --line:    #C7BFB0;
  --accent:  #9A3428;
  --on-accent: #F7F3E9;
  --hairline: #D8D0C0;
}

:root[data-theme="technical"] {
  --bg:      #E9EBE8;
  --surface: #F5F6F3;
  --ink:     #151817;
  --muted:   #68706B;
  --line:    #BEC5BF;
  --accent:  #315C55;
  --on-accent: #F5F6F3;
  --hairline: #CFD5CF;
}

:root[data-theme="dark"] {
  --bg:      #151515;
  --surface: #1E1E1C;
  --ink:     #F2F0E8;
  --muted:   #9B9990;
  --line:    #3A3935;
  --accent:  #A890FF;
  --on-accent: #151515;
  --hairline: #2A2926;
}

:root[data-theme="sand"] {
  --bg:      #EDE4D3;
  --surface: #F6EFE1;
  --ink:     #2A2016;
  --muted:   #7C6F5C;
  --line:    #CBBBA0;
  --accent:  #B5651D;
  --on-accent: #F6EFE1;
  --hairline: #DDCFB6;
}

:root[data-theme="sage"] {
  --bg:      #E4EAE2;
  --surface: #F0F3EE;
  --ink:     #1C231C;
  --muted:   #66705F;
  --line:    #BCC7B6;
  --accent:  #4B7A46;
  --on-accent: #F0F3EE;
  --hairline: #CFD8C9;
}

:root[data-theme="slate"] {
  --bg:      #14181D;
  --surface: #1D232A;
  --ink:     #E8ECF0;
  --muted:   #929AA5;
  --line:    #333B45;
  --accent:  #5AA6C7;
  --on-accent: #14181D;
  --hairline: #262D35;
}

:root[data-theme="mono"] {
  --bg:      #ECECEC;
  --surface: #F6F6F6;
  --ink:     #121212;
  --muted:   #6A6A6A;
  --line:    #C4C4C4;
  --accent:  #121212;
  --on-accent: #F6F6F6;
  --hairline: #D6D6D6;
}

/* ---- FONT PAIRINGS ----------------------------------------------------- */
:root,
:root[data-fonts="editorial"] {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
  --display-tracking: -0.015em;
  --display-weight: 460;
}
:root[data-fonts="grotesk"] {
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;
  --display-tracking: -0.02em;
  --display-weight: 600;
}
:root[data-fonts="humanist"] {
  --font-display: "Instrument Serif", Georgia, serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;
  --display-tracking: 0em;
  --display-weight: 400;
}
:root[data-fonts="classic"] {
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body:    "DM Sans", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;
  --display-tracking: 0em;
  --display-weight: 600;
}
:root[data-fonts="display"] {
  --font-display: "DM Serif Display", Georgia, serif;
  --font-body:    "Source Sans 3", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;
  --display-tracking: -0.01em;
  --display-weight: 400;
}
:root[data-fonts="archivo"] {
  --font-display: "Archivo", system-ui, sans-serif;
  --font-body:    "Archivo", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, monospace;
  --display-tracking: -0.025em;
  --display-weight: 700;
}

/* ---- RADIUS + DENSITY -------------------------------------------------- */
:root { --radius: 2px; }
:root[data-radius="0"] { --radius: 0px; }
:root[data-radius="2"] { --radius: 2px; }
:root[data-radius="8"] { --radius: 8px; }

:root { --density: 1; }              /* comfortable */
:root[data-density="compact"] { --density: 0.72; }
:root[data-density="airy"]    { --density: 1.4; }

/* ---- SPACE SCALE (density-aware) --------------------------------------- */
:root {
  --s-1: calc(0.5rem  * var(--density));
  --s-2: calc(0.75rem * var(--density));
  --s-3: calc(1rem    * var(--density));
  --s-4: calc(1.5rem  * var(--density));
  --s-5: calc(2.25rem * var(--density));
  --s-6: calc(3.5rem  * var(--density));
  --s-7: calc(5.5rem  * var(--density));
  --measure: 66ch;
  --maxw: 1120px;
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
}

/* =============================================================================
   RESET + BASE
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
.section, .masthead { scroll-margin-top: var(--s-4); }
/* no vertical scroll-snap: it fought in-place editing near the header,
   yanking the page back to the masthead as contenteditable changed heights.
   (Landscape orientation opts back into snap on the x-axis — see below.) */
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}
h1, h2, h3, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { list-style: none; padding: 0; }
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

/* ---- BACKGROUND TREATMENTS (very subtle, behind everything) ------------ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  background-image: none;
}
:root[data-bg="grid"] body::before {
  background-image:
    linear-gradient(to right, var(--hairline) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hairline) 1px, transparent 1px);
  background-size: 96px 96px;
  opacity: .35;
}
:root[data-bg="graph"] body::before {
  background-image:
    linear-gradient(to right, var(--hairline) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hairline) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .28;
}
:root[data-bg="dots"] body::before {
  background-image: radial-gradient(var(--line) 1.4px, transparent 1.5px);
  background-size: 24px 24px;
  opacity: .8;
}
:root[data-bg="lines"] body::before {
  background-image: linear-gradient(to bottom, var(--hairline) 1px, transparent 1px);
  background-size: 100% 32px;
  opacity: .5;
}
:root[data-bg="diagonal"] body::before {
  background-image: repeating-linear-gradient(45deg, var(--hairline) 0 1px, transparent 1px 12px);
  opacity: .4;
}
:root[data-bg="cross"] body::before {
  background-image:
    radial-gradient(var(--line) 1px, transparent 1.5px),
    radial-gradient(var(--line) 1px, transparent 1.5px);
  background-position: 0 0, 14px 14px;
  background-size: 28px 28px;
  opacity: .5;
}

/* =============================================================================
   TYPOGRAPHY PRIMITIVES
   ========================================================================== */
.display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.02;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  align-items: baseline;
  gap: 0.6em;
}
.eyebrow .idx {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.lead {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.16;
}

/* =============================================================================
   PAGE FRAME + GRID
   ========================================================================== */
.page {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  /* extra inline padding so the (optional) --sections-bg panel breathes around
     the content instead of sitting flush against the intro and section text. */
  padding: var(--s-4) max(var(--gutter), var(--s-6)) var(--s-7);
  /* solid backdrop behind the whole content column — intro + sections — so a
     calm colour can cover the page pattern. Blank → transparent (no change). */
  background: var(--sections-bg, transparent);
}

/* 12-col grid used by masthead and any layout that opts in. */
.grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--s-4); }

/* top rule — the "internal document" chrome */
.docrule {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--ink);
  flex-wrap: wrap;
}
.docrule .mono { color: var(--ink); }
.docrule .docrule__right { color: var(--muted); }

/* =============================================================================
   MASTHEAD
   ========================================================================== */
.masthead { margin-bottom: var(--s-7); }
.masthead__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-4) var(--s-5);
  align-items: start;
}
.masthead__name {
  font-size: clamp(2.75rem, 9vw, 6.5rem);
  margin: 0;
  max-width: 14ch;
}
.masthead__pron {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  vertical-align: super;
  letter-spacing: 0.02em;
  margin-left: 0.5em;
}
.masthead__lead {
  grid-column: 1 / 2;
  font-size: clamp(1.35rem, 1rem + 1.9vw, 2.35rem);
  max-width: 22ch;
  margin-top: var(--s-3);
  color: var(--ink);
}
.masthead__body {
  grid-column: 1 / 2;
  max-width: var(--measure);
  margin-top: var(--s-4);
  color: var(--muted);
}
.masthead__aside {
  grid-column: 2 / 3;
  grid-row: 1 / span 3;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  align-items: flex-end;
  text-align: right;
  min-width: 190px;
}
.avatar {
  position: relative;
  width: clamp(200px, 24vw, 340px); height: clamp(200px, 24vw, 340px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  display: grid; place-items: center;
  cursor: pointer;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
/* photo frame shapes */
:root[data-photo="circle"] .avatar { border-radius: 50%; }
:root[data-photo="blob"] .avatar { border-radius: 46% 54% 62% 38% / 48% 42% 58% 52%; }
/* photo drop affordance (dev only) */
.avatar__hint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 4px;
  font-family: var(--font-mono); font-size: 0.58rem; line-height: 1.3; letter-spacing: 0.03em;
  color: var(--on-accent);
  background: color-mix(in srgb, var(--ink) 58%, transparent);
  opacity: 0; transition: opacity .15s ease;
}
.avatar:hover .avatar__hint,
.avatar:focus-visible .avatar__hint,
.avatar.is-drop .avatar__hint { opacity: 1; }
.avatar.is-drop { outline: 2px dashed var(--accent); outline-offset: 2px; }
.avatar .monogram {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 3.6rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.identity-meta {
  display: grid;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
}
.identity-meta b { color: var(--ink); font-weight: 500; }
.identity-meta .status {
  display: inline-flex; align-items: center; gap: 0.45em;
  color: var(--ink);
}
.identity-meta .status::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
}

/* =============================================================================
   SECTION SHELL
   ========================================================================== */
.sections { display: flex; flex-direction: column; }
.section {
  padding: var(--s-7) 0;
  border-top: 1px solid var(--line);
}
.section:first-child { border-top: none; padding-top: var(--s-5); }

.section__head { margin-bottom: var(--s-5); }
.section__title {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.05;
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.6rem);
  margin-top: 0.3rem;
}
.section__meta {
  display: flex; gap: 1.2rem; flex-wrap: wrap;
  margin-top: 0.75rem;
}
.tag-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.15em 0.6em;
  display: inline-flex; align-items: center; gap: 0.5em;
}
.tag-status::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.section__meta .mono { align-self: center; }

/* =============================================================================
   LAYOUT: FEATURE  — the prominent statement
   ========================================================================== */
.sec--feature .section__title { font-size: clamp(1.9rem, 1.2rem + 2.6vw, 3.4rem); }
.l-feature__lead {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.14;
  font-size: clamp(1.4rem, 1rem + 1.7vw, 2.1rem);
  max-width: 24ch;
  margin: var(--s-3) 0 var(--s-4);
}
.l-feature__points {
  display: grid;
  gap: 0;
  max-width: var(--measure);
  counter-reset: pt;
}
.l-feature__points li {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 1rem;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--hairline);
  align-items: baseline;
}
.l-feature__points li::before {
  counter-increment: pt;
  content: "0" counter(pt);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
}

/* =============================================================================
   LAYOUT: SPLIT
   ========================================================================== */
.l-split__grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--s-5);
  align-items: start;
}
.l-split__body { max-width: var(--measure); }
.l-split__aside { color: var(--muted); }

/* =============================================================================
   LAYOUT: PROJECT
   ========================================================================== */
.l-project__grid {
  display: grid;
  grid-template-columns: 1fr minmax(0, 46%);
  gap: var(--s-5);
  align-items: start;
}
.l-project__summary {
  font-size: 1.12rem;
  max-width: 52ch;
  margin-bottom: var(--s-4);
}
.spec {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.55rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  border-top: 1px solid var(--hairline);
  padding-top: var(--s-3);
}
.spec dt { color: var(--muted); letter-spacing: 0.03em; }
.spec dd { margin: 0; color: var(--ink); }
.chiprow { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: var(--s-3); }
.chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.2em 0.6em;
  color: var(--ink);
  background: var(--surface);
}
.project-notes { margin-top: var(--s-3); color: var(--muted); font-size: 0.92rem; }
.project-notes li { position: relative; padding-left: 1.1em; margin-top: 0.3em; }
.project-notes li::before { content: "·"; position: absolute; left: 0; color: var(--accent); }

/* several projects stacked in one section */
.l-projects { display: grid; gap: var(--s-6); }
.l-projects .l-project__grid { padding-top: var(--s-6); border-top: 1px solid var(--hairline); }
.l-projects .l-project__grid:first-child { padding-top: 0; border-top: none; }
.l-project__name {
  font-size: clamp(1.35rem, 1rem + 1.4vw, 2rem);
  line-height: 1.05; margin-bottom: var(--s-3);
}
/* remove-project control — only in edit mode */
.l-project__grid { position: relative; }
.l-project__remove {
  display: none;
  position: absolute; top: 0; right: 0; z-index: 2;
  width: 1.7rem; height: 1.7rem;
  align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.78rem; line-height: 1;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.l-project__remove:hover { color: var(--accent); border-color: var(--accent); }
body.editing .l-project__remove { display: inline-flex; }

/* "Add project" — only in edit mode */
.l-projects__add {
  display: none;
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.02em;
  color: var(--muted); background: transparent;
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 0.8em 1em; cursor: pointer; width: 100%;
  transition: color .15s ease, border-color .15s ease;
}
.l-projects__add:hover { color: var(--accent); border-color: var(--accent); }
body.editing .l-projects__add { display: block; }

/* editorial image treatments */
figure { margin: 0; }
.media { position: relative; background: transparent; }
/* project image drop affordance (edit mode) */
.media__hint {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0.6rem;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.03em;
  color: var(--on-accent); background: color-mix(in srgb, var(--ink) 55%, transparent);
  opacity: 0; transition: opacity .15s ease; pointer-events: none;
}
body.editing .media--editable:hover .media__hint { opacity: 1; }
body.editing .media--editable img { cursor: pointer; }
.media--editable.is-drop { outline: 2px dashed var(--accent); outline-offset: 3px; }
.media--editable.is-drop .media__hint { opacity: 1; }
.media img, .media svg { width: 100%; height: auto; border-radius: var(--radius); }
.media--framed img, .media--framed svg { border: 1px solid var(--line); background: var(--surface); }
.media--thumbnail { max-width: 220px; }
.media--full img, .media--full svg { border-radius: 0; }
.media figcaption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.6rem;
  padding-left: 0.1rem;
}
.media--zoomable img, .media--zoomable svg { cursor: zoom-in; }

/* =============================================================================
   LAYOUT: LIST
   ========================================================================== */
.l-list { max-width: var(--measure); }
.l-list li {
  display: grid;
  grid-template-columns: minmax(9rem, 15rem) 1fr;
  gap: 1rem 1.6rem;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--hairline);
}
.l-list li:first-child { border-top: none; }
.l-list .li-title { font-weight: 500; }
.l-list .li-note { color: var(--muted); }
/* looser variant: single column prompts, lighter rhythm */
.l-list--loose { max-width: 58ch; }
.l-list--loose li { grid-template-columns: 1fr; gap: 0.2rem; padding: var(--s-2) 0; }
.l-list--loose .li-title { font-size: 1.12rem; font-weight: 450; }

/* =============================================================================
   LAYOUT: TAGS
   ========================================================================== */
.l-tags__note { color: var(--muted); margin-bottom: var(--s-3); max-width: 48ch; }
.l-tags__wrap { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.l-tags__wrap .tag {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4em 0.85em;
  background: var(--surface);
  font-size: 0.95rem;
  transition: border-color .2s ease, color .2s ease;
}
.l-tags__wrap .tag:hover { border-color: var(--accent); color: var(--accent); }

/* =============================================================================
   LAYOUT: METADATA
   ========================================================================== */
.l-meta { max-width: 62ch; }
.l-meta__rows {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0 var(--s-4);
}
.l-meta__rows > div {
  display: contents;
}
.l-meta dt {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--accent);
  padding: var(--s-3) 0;
  border-top: 1px solid var(--hairline);
}
.l-meta dd {
  margin: 0;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--hairline);
}

/* =============================================================================
   LAYOUT: FACTS
   ========================================================================== */
.l-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  column-gap: var(--s-5);
  row-gap: var(--s-4);
  border-top: 1px solid var(--line);
  padding-top: var(--s-4);
}
/* Native <details> — works with zero JS, keyboard-accessible for free. */
.fact { border: none; }
.fact__btn {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: start;
  padding: 0 0 var(--s-2) 0;
  cursor: pointer;
  list-style: none;
}
.fact__btn::-webkit-details-marker { display: none; }
.fact__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fact__num { font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent); }
.fact__text { font-size: 1.08rem; margin-top: 0.35rem; }
.fact__sign {
  font-family: var(--font-mono);
  color: var(--muted);
  transition: transform .2s ease;
}
.fact[open] .fact__sign { transform: rotate(45deg); }
.fact__detail {
  color: var(--muted);
  max-width: 40ch;
  padding: 0 0 var(--s-2) 0;
}

/* =============================================================================
   LAYOUT: QUOTE
   ========================================================================== */
.l-quote { max-width: 42rem; }
.l-quote blockquote {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.18;
  font-size: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  max-width: 16em;
}
.l-quote figcaption {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: var(--s-3);
}
.l-quote figcaption::before { content: "· "; color: var(--accent); }

/* =============================================================================
   LAYOUT: FAVORITES
   ========================================================================== */
.l-fav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 0;
  border-top: 1px solid var(--hairline);
}
.l-fav > div {
  padding: var(--s-3) var(--s-4) var(--s-3) 0;
  border-bottom: 1px solid var(--hairline);
}
.l-fav .fav-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.25rem;
}
.l-fav .fav-value { font-size: 1.05rem; }

/* =============================================================================
   LAYOUT: LINKS
   ========================================================================== */
.l-links { max-width: 52ch; }
.l-links a, .l-links .link-row {
  display: grid;
  grid-template-columns: 7rem 1fr auto;
  gap: 1rem;
  align-items: baseline;
  padding: var(--s-3) 0;
  border-top: 1px solid var(--hairline);
  text-decoration: none;
  color: var(--ink);
}
.l-links .link-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.l-links .link-value { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); }
.l-links a:hover .link-value { text-decoration-color: var(--accent); color: var(--accent); }
.copy-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  padding: 0.15em 0.55em;
  cursor: pointer;
  color: var(--muted);
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn[data-copied="1"] { color: var(--accent); border-color: var(--accent); }

/* =============================================================================
   LAYOUT: COMPACT
   ========================================================================== */
.l-compact { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; max-width: 60ch; }
.l-compact li {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ink);
  position: relative;
  padding-left: 1.1em;
}
.l-compact li::before { content: "·"; position: absolute; left: 0; color: var(--accent); font-size: 1.2em; line-height: 0.9; }

/* =============================================================================
   GALLERY
   ========================================================================== */
.l-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: var(--s-4);
}

/* =============================================================================
   COLOPHON
   ========================================================================== */
.colophon {
  margin-top: var(--s-6);
  padding-top: var(--s-3);
  border-top: 1px solid var(--ink);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

/* =============================================================================
   LIGHTBOX
   ========================================================================== */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in srgb, var(--ink) 82%, transparent);
  display: grid; place-items: center;
  padding: var(--gutter);
}
.lightbox[hidden] { display: none; }
.lightbox img, .lightbox svg { max-width: min(90vw, 1000px); max-height: 88vh; width: auto; border: 1px solid var(--line); background: var(--surface); }
.lightbox__close {
  position: absolute; top: var(--s-4); right: var(--gutter);
  font-family: var(--font-mono); font-size: 0.8rem;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.4em 0.8em; cursor: pointer;
}

/* =============================================================================
   ACCESSIBILITY HELPERS
   ========================================================================== */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 0.6em 1em; border-radius: var(--radius);
}
.skip-link:focus { left: var(--gutter); top: var(--s-2); }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

/* in-page text editing (dev only) */
body.editing [contenteditable="true"] {
  outline: 1px dashed var(--line); outline-offset: 3px;
  border-radius: 1px; cursor: text;
}
body.editing [contenteditable="true"]:hover { outline-color: var(--muted); }
body.editing [contenteditable="true"]:focus-visible { outline: 2px solid var(--accent); }
.edit-banner {
  position: fixed; left: 1rem; bottom: 1rem;
  z-index: 52; max-width: min(320px, calc(100vw - 2rem));
  font-family: var(--font-mono); font-size: 0.72rem; line-height: 1.4;
  background: var(--ink); color: var(--bg);
  padding: 0.5em 0.9em; border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.edit-banner[hidden] { display: none; }

.noscript-note {
  max-width: 40ch; margin: 20vh auto; text-align: center;
  font-family: var(--font-body); color: var(--muted); padding: 0 1.5rem;
}
.noscript-note strong { color: var(--ink); }

/* =============================================================================
   DEV PANEL  (optional, development-only customiser)
   ========================================================================== */
.dev-toggle {
  position: fixed; z-index: 50; right: 1rem; bottom: 1rem;
  font-family: var(--font-mono); font-size: 0.72rem;
  background: var(--ink); color: var(--bg);
  border: none; border-radius: var(--radius);
  padding: 0.6em 0.9em; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.dev-panel {
  position: fixed; z-index: 51; right: 1rem; bottom: 3.6rem;
  width: min(300px, calc(100vw - 2rem));
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s-3);
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  max-height: min(78vh, 640px); overflow: auto;
}
.dev-panel[hidden] { display: none; }
.dev-panel h3 { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 0.75rem; text-transform: uppercase; }
.dev-field { display: grid; gap: 0.3rem; margin-bottom: 0.85rem; }
.dev-field > span { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.dev-field select, .dev-field input[type="color"] {
  font: inherit; font-size: 0.85rem;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.35em 0.5em;
}
.dev-field input[type="color"] { height: 2.2rem; padding: 0.2em; cursor: pointer; }
.dev-seg { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.dev-seg button { flex: 1; background: var(--bg); border: none; padding: 0.4em 0; font-family: var(--font-mono); font-size: 0.72rem; cursor: pointer; color: var(--muted); }
.dev-seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.dev-seg button + button { border-left: 1px solid var(--line); }
.dev-vis { display: grid; gap: 0.3rem; margin-top: 0.4rem; }
.dev-vis label { display: flex; align-items: center; gap: 0.5em; font-size: 0.82rem; }
.dev-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.dev-actions button {
  flex: 1; font-family: var(--font-mono); font-size: 0.72rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); padding: 0.5em; cursor: pointer;
}
.dev-actions button.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.dev-note { font-size: 0.7rem; color: var(--muted); margin-top: 0.6rem; line-height: 1.4; }
.dev-hint { font-size: 0.68rem; color: var(--muted); margin: 0.1rem 0 0.4rem; line-height: 1.4; }

/* =============================================================================
   SECTION NAV  — a quiet dot rail; smooth-scrolls section to section.
   ========================================================================== */
.section-nav {
  position: fixed; z-index: 40; right: 1.1rem; top: 50%; transform: translateY(-50%);
}
.section-nav ul { display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-end; }
.section-nav__dot {
  position: relative; display: flex; align-items: center; justify-content: flex-end;
  height: 16px; text-decoration: none;
}
.section-nav__mark {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid var(--muted); background: transparent;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.section-nav__dot:hover .section-nav__mark { border-color: var(--accent); }
.section-nav__dot[aria-current="true"] .section-nav__mark {
  background: var(--accent); border-color: var(--accent); transform: scale(1.2);
}
.section-nav__label {
  position: absolute; right: 18px; white-space: nowrap;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.02em;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.15em 0.55em;
  opacity: 0; transform: translateX(4px); pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.section-nav__dot:hover .section-nav__label,
.section-nav__dot:focus-visible .section-nav__label { opacity: 1; transform: none; }
@media (max-width: 1024px) { .section-nav { display: none; } }

/* =============================================================================
   MOTION  — restrained + motivated: a hero load-in, sections rise on entry.
   All of it is opt-out via prefers-reduced-motion, and the hidden state for
   sections is only ever added by JS, so no-JS renders everything visible.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .section.reveal { opacity: 0; transform: translateY(14px); }
  .section.reveal.is-in {
    opacity: 1; transform: none;
    transition: opacity .7s cubic-bezier(.16, 1, .3, 1), transform .7s cubic-bezier(.16, 1, .3, 1);
  }
  /* hero load-in (pure CSS, staggered) */
  .docrule        { animation: rise .6s .00s both cubic-bezier(.16, 1, .3, 1); }
  .masthead__name { animation: rise .8s .06s both cubic-bezier(.16, 1, .3, 1); }
  .masthead__aside{ animation: rise .8s .14s both cubic-bezier(.16, 1, .3, 1); }
  .masthead__lead { animation: rise .8s .20s both cubic-bezier(.16, 1, .3, 1); }
  .masthead__body { animation: rise .8s .26s both cubic-bezier(.16, 1, .3, 1); }
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* tactile feedback on press */
.copy-btn:active, .dev-actions button:active, .dev-toggle:active, .dev-seg button:active,
.dev-field select:active { transform: translateY(1px); }
.l-links a { transition: color .18s ease; }

/* =============================================================================
   RESPONSIVE  — tablet then mobile. Not just "stack everything".
   ========================================================================== */
@media (max-width: 900px) {
  .l-project__grid { grid-template-columns: 1fr; }
  .l-project__grid .media { order: -1; }        /* screenshot leads on tablet */
  .l-split__grid { grid-template-columns: 1fr; gap: var(--s-4); }
}

@media (max-width: 680px) {
  .page { padding-top: var(--s-3); }
  .masthead__grid {
    grid-template-columns: 1fr;
    gap: var(--s-3);
  }
  /* avatar + meta become a compact header strip ABOVE the name */
  .masthead__aside {
    order: -1;
    grid-row: auto; grid-column: 1;
    flex-direction: row; align-items: flex-start; text-align: left;
    gap: var(--s-3); flex-wrap: nowrap;
    padding-bottom: var(--s-3); margin-bottom: var(--s-2);
    border-bottom: 1px solid var(--hairline);
  }
  .masthead__aside .identity-meta { font-size: 0.72rem; }
  .avatar { width: clamp(120px, 34vw, 180px); height: clamp(120px, 34vw, 180px); }
  .avatar .monogram { font-size: 2.6rem; }
  .identity-meta { text-align: left; }
  .masthead__name { font-size: clamp(2.4rem, 13vw, 3.4rem); max-width: none; }
  .masthead__lead, .masthead__body { grid-column: 1; }

  .l-list li { grid-template-columns: 1fr; gap: 0.25rem; }
  .l-list .li-title { font-size: 1.05rem; }
  .l-links a, .l-links .link-row { grid-template-columns: 5.5rem 1fr; }
  .l-links .copy-btn { grid-column: 2; justify-self: start; margin-top: 0.2rem; }
  .spec { grid-template-columns: 1fr; gap: 0.15rem; }
  .spec dt { padding-bottom: 0; border-top: 1px solid var(--hairline); }
  .spec dd { padding-top: 0.1rem; border-top: none; }
}

/* =============================================================================
   TIMELINE  — a career progress line; nodes click open to reveal the story.
   ========================================================================== */
.l-timeline {
  position: relative; margin: 0;
  display: flex; flex-direction: row; flex-wrap: nowrap;
  gap: var(--s-4);
  overflow-x: auto; scroll-snap-type: x proximity;
  padding: 0 0 var(--s-2);
  scrollbar-width: thin;
}
/* the progress line runs horizontally through the dot centres */
.l-timeline::before {
  content: ""; position: absolute; top: 11px; left: 12px; right: 12px;
  height: 2px; background: var(--hairline);
}
.tl-item {
  position: relative; flex: 0 0 clamp(180px, 22vw, 240px);
  padding-top: 2.4rem; scroll-snap-align: start;
}
.tl-node {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem;
  width: 100%; text-align: left; padding: 0;
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
  list-style: none;
}
.tl-node::-webkit-details-marker { display: none; }
.tl-dot {
  position: absolute; top: 0; left: 0;
  width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface);
  display: grid; place-items: center; font-size: 0.8rem; line-height: 1;
  transition: border-color .25s ease, background .25s ease, transform .25s ease;
}
.tl-details[open] .tl-dot {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  transform: scale(1.1);
}
.tl-year { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.tl-title { font-weight: 600; color: var(--ink); line-height: 1.25; }
.tl-details[open] .tl-title { color: var(--accent); }
.tl-details:not([open]) .tl-detail { display: none; }
/* while editing, notes must stay visible so their text is reachable */
body.editing .tl-details:not([open]) .tl-detail { display: block; }
.tl-detail { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.92rem; }
.tl-detail p { margin: 0; }

/* remove control (edit mode) — mirrors .l-project__remove */
.tl-item__remove {
  display: none;
  position: absolute; top: 0; right: 0; z-index: 2;
  width: 1.5rem; height: 1.5rem;
  align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.72rem; line-height: 1;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.tl-item__remove:hover { color: var(--accent); border-color: var(--accent); }
body.editing .tl-item__remove { display: inline-flex; }

/* "Add milestone" — a dashed slot in the row, only in edit mode */
.tl-item--add { display: none; }
body.editing .tl-item--add { display: block; padding-top: 2.4rem; }
.l-timeline__add {
  width: 100%; height: 100%; min-height: 3.4rem;
  font-family: var(--font-mono); font-size: 0.76rem; letter-spacing: 0.02em;
  color: var(--muted); background: transparent;
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 0.6em 0.8em; cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.l-timeline__add:hover { color: var(--accent); border-color: var(--accent); }

/* section reorder controls — only in edit mode */
.section__move { display: none; }
body.editing .section { position: relative; }
body.editing .section__move {
  display: flex; flex-direction: column; gap: 0.25rem;
  position: absolute; top: 0; right: 0; z-index: 3;
}
.section__move button {
  width: 1.7rem; height: 1.7rem;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.9rem; line-height: 1;
  color: var(--muted); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.section__move button:hover { color: var(--accent); border-color: var(--accent); }

/* =============================================================================
   COUNTRIES  — places visited: flag grid, running count, check marks.
   ========================================================================== */
.l-countries__count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); margin: 0.5rem 0 var(--s-3); }
.l-countries__count b { color: var(--ink); font-size: 1.1rem; }
.l-countries {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.6rem;
}
.country {
  display: flex; align-items: center; gap: 0.6rem;
  min-height: 2.9rem; padding: 0.55rem 0.8rem;
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
}
.country__flag {
  flex: 0 0 1.6em; width: 1.6em; text-align: center;
  font-size: 1.35rem; line-height: 1;
}
.country__name { flex: 1 1 auto; min-width: 0; }
.country__check {
  flex: 0 0 auto; margin-left: 0.35rem;
  color: var(--accent); font-weight: 700; font-size: 0.95rem;
}
.country--todo { opacity: 0.55; border-style: dashed; }

/* =============================================================================
   FUN MODE  — opt-in personality: emoji, springier motion. Off by default.
   ========================================================================== */
.eyebrow__emoji { display: none; }
:root[data-mode="fun"] .eyebrow__emoji { display: inline-block; margin-right: 0.4em; font-size: 1.05em; }
@media (prefers-reduced-motion: no-preference) {
  :root[data-mode="fun"] .section:hover .eyebrow__emoji { animation: wiggle .5s ease; }
  :root[data-mode="fun"] .tag { transition: transform .15s ease, border-color .15s ease; }
  :root[data-mode="fun"] .tag:hover { transform: translateY(-2px) rotate(-1.5deg); border-color: var(--accent); }
  :root[data-mode="fun"] .country { transition: transform .15s ease, border-color .15s ease; }
  :root[data-mode="fun"] .country:hover { transform: translateY(-2px); border-color: var(--accent); }
  :root[data-mode="fun"] .fact:hover .fact__num { transform: scale(1.15); transition: transform .2s ease; }
}
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

/* =============================================================================
   ORIENTATION  — landscape turns the WHOLE site horizontal: the masthead is
   the first full-height panel, every section is a panel after it, and the page
   scrolls sideways as one deck. Default (scroll) is untouched.
   ========================================================================== */
:root[data-orientation="landscape"] { height: 100%; }
:root[data-orientation="landscape"] body { height: 100vh; overflow: hidden; }

/* the page becomes the horizontal scroll track */
:root[data-orientation="landscape"] .page {
  max-width: none; width: 100vw; height: 100vh; margin: 0; padding: 0;
  display: flex; flex-direction: row; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
/* internal chrome doesn't belong in a horizontal deck */
:root[data-orientation="landscape"] .docrule,
:root[data-orientation="landscape"] .colophon { display: none; }

/* unwrap the sections list so its cards join the page's horizontal flow */
:root[data-orientation="landscape"] .sections { display: contents; }

/* masthead + every section are equal full-viewport panels */
:root[data-orientation="landscape"] .masthead,
:root[data-orientation="landscape"] .section {
  flex: 0 0 100vw; width: 100vw; height: 100vh;
  margin: 0; border: 0;
  padding: var(--s-5) var(--gutter) var(--s-6);
  overflow-y: auto;
  scroll-snap-align: start;
  display: flex; flex-direction: column; justify-content: safe center;
}
:root[data-orientation="landscape"] .masthead > .masthead__grid { width: 100%; max-width: var(--maxw); margin: 0 auto; }
:root[data-orientation="landscape"] .section > * { width: 100%; max-width: var(--maxw); margin-inline: auto; }
:root[data-orientation="landscape"] .section:first-child { padding-top: var(--s-5); }
/* a hidden section (customiser) must not leave a blank panel */
:root[data-orientation="landscape"] .section[style*="display: none"] { display: none !important; }

/* prev / next pager — only shown in landscape */
.deck-arrows { display: none; }
:root[data-orientation="landscape"] .deck-arrows {
  position: fixed; z-index: 40; bottom: 1.1rem; left: 50%; transform: translateX(-50%);
  display: flex; gap: 0.5rem;
}
.deck-arrows button {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--ink) 12%, transparent);
  transition: border-color .18s ease, transform .12s ease;
}
.deck-arrows button:hover { border-color: var(--accent); }
.deck-arrows button:active { transform: translateY(1px); }

/* =============================================================================
   PRINT  — the page is a document; let it print like one.
   ========================================================================== */
@media print {
  /* keep the theme's colours in the PDF — browsers drop backgrounds otherwise */
  :root, body, .page, .section, .masthead {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  body { background: var(--bg) !important; }

  .dev-toggle, .dev-panel, .skip-link, .lightbox,
  .section-nav, .edit-banner, .avatar__hint, .media__hint,
  .l-projects__add, .l-project__remove, .l-timeline__add, .tl-item--add, .tl-item__remove, .section__move, .deck-arrows { display: none !important; }
  .section { break-inside: avoid; }
  a { text-decoration: none; }
  /* motion is JS-driven; force any un-revealed section visible for print */
  .section.reveal { opacity: 1 !important; transform: none !important; }
  /* expand every fact so the PDF carries the full text */
  .fact__detail { display: block !important; }
  .fact__sign { display: none !important; }

  /* landscape deck flattens back to a vertical printable document */
  :root[data-orientation="landscape"] body { height: auto; overflow: visible; }
  :root[data-orientation="landscape"] .page {
    display: block; width: auto; height: auto;
    overflow: visible; padding: var(--s-4) var(--gutter);
  }
  :root[data-orientation="landscape"] .docrule,
  :root[data-orientation="landscape"] .colophon { display: flex; }
  :root[data-orientation="landscape"] .sections { display: flex; flex-direction: column; }
  :root[data-orientation="landscape"] .masthead,
  :root[data-orientation="landscape"] .section {
    width: auto; height: auto; min-height: 0; overflow: visible;
    display: block; padding-inline: 0;
  }
}
