/* Survey-map palette: cool paper, map ink, water blue, forest green, contour grey. */
:root {
  --paper: #f3f6f5;
  --ink: #17232d;
  --muted: #56646f;
  --water: #1e5e9c;
  --forest: #2f6f4e;
  --contour: #c3d0d8;
  --contour-idx: #9fb2bf;
  --rule: #d5dfe4;
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  color-scheme: light dark;
  /* Older names still used by the inline diagrams */
  --bg: var(--paper);
  --text: var(--ink);
  --accent: var(--water);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1a21;
    --ink: #e2eaee;
    --muted: #97a7b2;
    --water: #82b6e8;
    --forest: #7fc29b;
    --contour: #2a3f4e;
    --contour-idx: #3e5c6f;
    --rule: #22333f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font);
  font-stretch: 100%;
  overflow-wrap: break-word;
  overflow-x: clip;
}
main { max-width: 68rem; margin: 0 auto; padding: 0 1rem; }
a { color: var(--water); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--water); outline-offset: 3px; border-radius: 2px; }
h1, h2 { margin: 0; line-height: 1.1; }

/* Hero: the one loud element, a contour map behind the name */
#hero {
  position: relative;
  margin-inline: calc(50% - 50vw);
  padding: 5rem calc(max(0px, 50vw - 34rem) + 1rem) 3rem;
  border-bottom: 1px solid var(--rule);
  isolation: isolate;
  overflow: hidden;
}
.topo {
  position: absolute;
  top: 0;
  right: -55%;
  width: 240%;
  height: 100%;
  z-index: -1;
  fill: none;
  stroke: var(--contour);
  stroke-width: 1.1;
  stroke-linejoin: round;
  opacity: 0.7;
}
.topo .idx { stroke: var(--contour-idx); stroke-width: 1.6; }
.role { margin: 0 0 0.75rem; color: var(--muted); font-style: italic; font-size: 1rem; }
#hero h1 {
  font-size: clamp(2.5rem, 12.5vw, 8.5rem);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.035em;
  line-height: 0.95;
}
.thesis { margin: 1.5rem 0 0; font-size: clamp(1.6rem, 4.2vw, 2.75rem); font-weight: 700; font-stretch: 85%; line-height: 1.1; letter-spacing: -0.01em; max-width: 20ch; }
.lede { font-size: 1.15rem; line-height: 1.55; margin: 1rem 0 1.25rem; max-width: 36rem; color: var(--ink); }
.hero-links { margin: 0; }
.hero-links a { display: inline-block; padding: 0.35rem 0; font-weight: 600; }


/* Projects as atlas sheets: label column on the left, content on the right */
#projects { padding: 1rem 0 2rem; }
.card { padding: 2.5rem 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.card:last-of-type { border-bottom: 0; }
.card-meta { margin: 0 0 0.6rem; font-size: 0.9rem; color: var(--muted); }
.card h2 { font-size: 1.75rem; font-weight: 700; font-stretch: 85%; letter-spacing: -0.01em; }
.tags { list-style: none; margin: 0.9rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.15rem 0.9rem; font-size: 0.85rem; color: var(--muted); }
.card-body { min-width: 0; margin-top: 1.25rem; }
.card-body > p { max-width: 40rem; }
.card-summary { margin: 0 0 1rem; }
.card-impact { margin: 0 0 1rem; font-size: 1.1rem; }
.card-impact strong { color: var(--water); font-weight: 700; }
.card-moment { margin: 0 0 1rem; padding-left: 1rem; border-left: 2px solid var(--water); }
.card-moment { max-width: 40rem; }
.card-moment ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.card-moment li + li { margin-top: 0.3rem; }
.card-check { margin: 0 0 1rem; padding-left: 1rem; border-left: 2px solid var(--forest); }
.card-check strong { display: block; font-weight: 600; font-style: italic; color: var(--forest); }
.also { margin: 0; padding: 1.5rem 0 0; border-top: 1px solid var(--rule); color: var(--muted); max-width: 44rem; }
/* Labelled like water on a map: italic, blue */
.card-moment strong { display: block; font-weight: 600; font-style: italic; color: var(--water); }

.visual { margin: 1.5rem 0 0; }
.visual img, .visual video { max-width: 100%; height: auto; display: block; border: 1px solid var(--rule); }
.visual figcaption { margin-top: 0.5rem; font-size: 0.85rem; color: var(--muted); }
.diagram svg { width: 100%; max-width: 40rem; height: auto; display: block; }
.dg-box { fill: var(--paper); stroke: var(--muted); stroke-width: 1.5; }
.dg-accent { stroke: var(--water); stroke-width: 2; }
.dg-doc { fill: var(--paper); stroke: var(--water); stroke-width: 1.5; stroke-dasharray: 5 4; }
.dg-line { stroke: var(--ink); stroke-width: 1.5; }
.dg-dash { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.dg-head { fill: var(--ink); }
.dg-label { fill: var(--ink); font: 600 16px var(--font); text-anchor: middle; }
.dg-sub { fill: var(--muted); font: 13px var(--font); text-anchor: middle; }
.tags:empty, .visual:empty { display: none; }

/* Notes to myself: four short notes, one per row */
#how { padding: 2.5rem 0 3rem; border-top: 1px solid var(--ink); }
#how h2 { font-size: 1.75rem; font-weight: 700; font-stretch: 85%; margin-bottom: 1.5rem; }
.how-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 1.5rem; max-width: 40rem; }
.how-list strong { display: block; font-size: 1.05rem; margin-bottom: 0.2rem; }

#footer { max-width: 68rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9rem; }
#footer p { margin: 0; }

/* One orchestrated moment: contours appear ring by ring on load */
@media (prefers-reduced-motion: no-preference) {
  .topo polyline { opacity: 0; animation: survey 0.9s ease-out forwards; }
  .topo polyline:nth-child(1) { animation-delay: 0.00s; }
  .topo polyline:nth-child(2) { animation-delay: 0.06s; }
  .topo polyline:nth-child(3) { animation-delay: 0.12s; }
  .topo polyline:nth-child(4) { animation-delay: 0.18s; }
  .topo polyline:nth-child(5) { animation-delay: 0.24s; }
  .topo polyline:nth-child(6) { animation-delay: 0.30s; }
  .topo polyline:nth-child(7) { animation-delay: 0.36s; }
  .topo polyline:nth-child(8) { animation-delay: 0.42s; }
  .topo polyline:nth-child(9) { animation-delay: 0.48s; }
  .topo polyline:nth-child(10) { animation-delay: 0.54s; }
  .topo polyline:nth-child(11) { animation-delay: 0.60s; }
  .topo polyline:nth-child(12) { animation-delay: 0.66s; }
  .topo polyline:nth-child(13) { animation-delay: 0.72s; }
  .topo polyline:nth-child(14) { animation-delay: 0.78s; }
  .topo polyline:nth-child(15) { animation-delay: 0.84s; }
  .topo polyline:nth-child(16) { animation-delay: 0.90s; }
  .topo polyline:nth-child(17) { animation-delay: 0.96s; }
  .topo polyline:nth-child(18) { animation-delay: 1.02s; }
  .topo polyline:nth-child(19) { animation-delay: 1.08s; }
  .topo polyline:nth-child(20) { animation-delay: 1.14s; }
}
@keyframes survey { to { opacity: 1; } }

@media (min-width: 760px) {
  main { padding: 0 2rem; }
  #footer { padding-left: 2rem; padding-right: 2rem; }
  #hero { padding: 7rem calc(max(0px, 50vw - 34rem) + 2rem) 4rem; }
  .topo { right: 0; width: 100%; opacity: 1; mask-image: linear-gradient(to right, transparent 15%, #000 55%); -webkit-mask-image: linear-gradient(to right, transparent 15%, #000 55%); }
  .card { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 0 3rem; }
  .card-head { position: sticky; top: 1.5rem; align-self: start; }
  .card-body { margin-top: 0; }
}
.jump { margin: 1.5rem 0 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; font-size: 0.95rem; }
.jump a { display: inline-block; padding: 0.3rem 0; }
.jump span { color: var(--muted); }
