/* Dark only: the splat is a dim room, it looks like a hole on white.
   8 px grid, 64 rem container, 40 rem text measure, 11 rem label rail. */

:root {
  --bg: #121110;
  --bg-2: #1c1a17;
  --fg: #f3efe8;
  --fg-2: #b4ada2;      /* muted: 7.2:1 on bg */
  --line: #2c2824;
  --accent: #f2b85a;    /* the lamps in the flat */
  --wide: 64rem;
  --measure: 40rem;
  --rail: 11rem;
  --gutter: 16px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); font-family: var(--font);
  -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; line-height: 1.5; font-size: 1.0625rem; }
@media (min-width: 700px) { body { font-size: 1.125rem; } }

a { color: inherit; text-decoration-color: color-mix(in srgb, var(--fg-2) 60%, transparent); text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--accent); }
a:focus-visible, button:focus-visible, .flat-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
p { margin: 0; }
.muted { color: var(--fg-2); font-weight: 400; }


main { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }

/* hero */
.hero { padding: 48px 0 48px; }
@media (min-width: 700px) { .hero { padding: 72px 0 80px; } }
.who { font-size: 1.0625rem; line-height: 1.4; margin-bottom: 28px; }
.who strong { font-weight: 600; font-size: 1.125rem; }
@media (min-width: 700px) { .who { margin-bottom: 36px; } .who strong { font-size: 1.25rem; } }
.kicker { color: var(--fg-2); font-weight: 500; }
h1 { font-size: clamp(2.375rem, 3.2vw + 1.4rem, 4.5rem); line-height: 1.04; letter-spacing: -0.03em;
  font-weight: 600; margin: 0 0 8px; max-width: 16ch; text-wrap: balance; }
@media (max-width: 359px) { h1 { font-size: 2rem; } }
/* the head (js/head.js over a poster still), floats right of the hero text.
   A soft oval mask fades the shoulders, so no splat edge meets the box edge. */
.me { float: right; width: 120px; margin: 0 0 16px 16px; text-align: center; }
@media (min-width: 700px) { .me { width: clamp(140px, 20vw, 220px); margin-left: 32px; } }
.me-stage { position: relative; aspect-ratio: 1; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  -webkit-mask-image: radial-gradient(ellipse 50% 56% at 50% 42%, #000 72%, transparent 100%); mask-image: radial-gradient(ellipse 50% 56% at 50% 42%, #000 72%, transparent 100%); }
.me-stage.live { cursor: grab; }
.me-stage.dragging { cursor: grabbing; }
.me-stage img, .me-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity 0.4s; }
.me-stage canvas { opacity: 0; }
.me-stage.live canvas { opacity: 1; }
.me-stage.live img { opacity: 0; }
.me figcaption { margin-top: 4px; font-size: 0.75rem; line-height: 1.35; color: var(--fg-2); }
/* splat or mesh: inline words in the caption, 44 px hit box from padding */
.me-switch button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer;
  display: inline-block; min-width: 44px; padding: 14px 0; margin: -14px -8px;
  text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--fg-2) 60%, transparent); text-underline-offset: 0.18em; }
.me-switch button:hover { text-decoration-color: var(--accent); }
.me-switch button[aria-pressed="true"] { color: var(--fg); text-decoration-color: var(--accent); cursor: default; }
.me-switch button[aria-busy="true"] { opacity: 0.6; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

.btn { display: inline-flex; align-items: center; min-height: 48px; padding: 0 18px; border-radius: 4px;
  border: 1px solid var(--fg-2); text-decoration: none; font-weight: 500; }
.btn:hover { border-color: var(--accent); }

/* sections: label rail + body on desktop */
.sec { padding: 40px 0; border-top: 1px solid var(--line); }
.sec-body { max-width: var(--measure); }
@media (min-width: 900px) {
  .sec { padding: 48px 0; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); column-gap: 32px; }
  .sec > h2 { grid-column: 1; margin: 0; padding-top: 0.5rem; }
  .sec > .sec-body, .sec > .flat { grid-column: 2; }
}
h2 { font-size: 1rem; color: var(--fg-2); font-weight: 500; margin: 0 0 20px; }
h3 { font-size: 1.125rem; font-weight: 600; margin: 40px 0 12px; }
.lead { font-size: 1.375rem; line-height: 1.4; letter-spacing: -0.012em; text-wrap: pretty; }
.lead-sm { font-size: 1.125rem; line-height: 1.5; color: var(--fg-2); text-wrap: pretty; max-width: 36rem; }
@media (min-width: 700px) { .lead { font-size: 1.625rem; } .lead-sm { font-size: 1.25rem; } }
.display { font-size: clamp(1.75rem, 1.6vw + 1.2rem, 2.5rem); line-height: 1.1; letter-spacing: -0.025em; font-weight: 600; margin: 0 0 16px; }
.detail { color: var(--fg-2); font-size: 1rem; line-height: 1.5; margin-top: 10px; text-wrap: pretty; }
@media (min-width: 700px) { .detail { font-size: 1.0625rem; } }

/* work list */
.proof { list-style: none; margin: 0; padding: 0; }
.proof li { padding: 28px 0; border-top: 1px solid var(--line); }
.proof li:first-child { border-top: 0; padding-top: 0; }
.proof li > p:first-child { font-size: 1.375rem; line-height: 1.38; letter-spacing: -0.012em; text-wrap: pretty; }
@media (min-width: 700px) { .proof li > p:first-child { font-size: 1.625rem; } }
.small-link { color: var(--fg-2); white-space: nowrap; display: inline-flex; align-items: center; min-height: 44px; padding: 0 2px; margin: -12px 0; }

/* plain lists */
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 14px 0; border-top: 1px solid var(--line); }
.plain li:first-child { border-top: 0; padding-top: 0; }
.projects a { font-weight: 600; display: inline-block; padding: 12px 0; margin: -12px 0; }
.projects span { color: var(--fg-2); }
@media (min-width: 700px) { .projects li { display: grid; grid-template-columns: 17rem 1fr; column-gap: 20px; } }

/* the flat */
.sec-flat .flat { margin: 28px 0 0; }
.flat-stage { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000;
  touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.flat-stage.dragging { cursor: grabbing; }
@media (max-width: 699px) { .flat-stage { aspect-ratio: 4 / 3; } }
.flat-stage canvas, .flat-poster { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.flat-poster { transition: opacity 0.8s ease; }
.flat-stage.live .flat-poster { opacity: 0; pointer-events: none; }
.flat-status { position: absolute; left: 14px; bottom: 12px; margin: 0; font-size: 0.9375rem; font-weight: 500; color: var(--fg);
  background: rgba(18, 17, 16, 0.78); padding: 8px 12px; border-radius: 4px; pointer-events: none; z-index: 2; }
.flat-status:empty { display: none; }
figcaption { margin-top: 12px; font-size: 0.9375rem; color: var(--fg-2); }

/* contact */
.contact-mail { font-size: clamp(1.5rem, 1.4vw + 1rem, 2.5rem); font-weight: 600; letter-spacing: -0.025em; word-break: break-word; line-height: 1.2; }
.contact-mail a { text-decoration-color: var(--accent); display: inline-block; padding: 8px 0; margin: -8px 0; }
#contact .actions { margin-top: 24px; }

.foot { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); color: var(--fg-2); font-size: 0.9375rem; }
.foot p { border-top: 1px solid var(--line); padding: 32px 0 48px; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .flat-poster { transition: none; } }

/* head caption: how it was made */
.me-how { display: block; }

/* few-photo study page */
.study { padding-top: 24px; padding-bottom: 32px; }
.study h1 { font-size: clamp(2rem, 2.4vw + 1.2rem, 3.25rem); margin: 32px 0 16px; }
.study .lead-sm { margin-bottom: 40px; }
.study .sec-body > p + p, .study .sec-body > p + figure, .study .sec-body > figure + p,
.study .table-wrap + p { margin-top: 16px; }
.back a { display: inline-block; padding: 12px 0; margin: -12px 0; color: var(--fg-2); }
.still { margin: 20px 0 0; }
.still img, .still video { display: block; width: 100%; height: auto; border-radius: 4px; background: var(--bg-2); }
.table-wrap { overflow-x: auto; margin-top: 20px; }
table { border-collapse: collapse; width: 100%; font-size: 1rem; font-variant-numeric: tabular-nums; }
caption { caption-side: bottom; text-align: left; color: var(--fg-2); font-size: 0.9375rem; padding-top: 10px; }
th, td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th[scope="row"], thead th:first-child { text-align: left; font-weight: 400; white-space: normal; }
thead th { color: var(--fg-2); font-weight: 500; }
td strong { font-weight: 600; color: var(--accent); }
.study .detail a, .foot a { display: inline-block; padding: 12px 0; margin: -12px 0; }
.byline { color: var(--fg-2); font-size: 1rem; margin: -4px 0 20px; }
.byline a { display: inline-block; padding: 12px 0; margin: -12px 0; }
.study > p { max-width: var(--measure); }
.study > p + p { margin-top: 16px; }
.study .lead-sm strong { color: var(--fg); font-weight: 600; }
.study .lead-sm { margin-bottom: 16px; }
.method li { color: var(--fg-2); font-size: 1rem; }
.credits { max-width: var(--measure); color: var(--fg-2); font-size: 0.9375rem; padding: 32px 0 0; border-top: 1px solid var(--line); }
.credits a { display: inline-block; padding: 12px 0; margin: -12px 0; }
/* coverage charts: 2 small multiples; blue = loop path, amber = planner path (validated pair) */
.cov-pair { display: grid; gap: 12px; }
svg.cov { width: 100%; max-width: 34rem; height: auto; display: block; touch-action: pan-y; }
svg.cov .grid { stroke: var(--line); stroke-width: 1; }
svg.cov .tick, svg.cov .name { fill: var(--fg-2); font-size: 14.5px; font-family: var(--font); }
svg.cov .name { fill: var(--fg); font-weight: 500; }
svg.cov polyline { fill: none; stroke-width: 2; stroke-linejoin: round; }
svg.cov .loop { stroke: #4f8be0; }
svg.cov .plan { stroke: #c08328; }
svg.cov .cross { stroke: var(--fg-2); stroke-width: 1; opacity: 0; }
.cov-key { margin-top: 8px; font-size: 0.9375rem; color: var(--fg-2); display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center; }
.cov-key .k { display: inline-block; width: 16px; height: 2px; margin-right: 6px; vertical-align: middle; }
.cov-key .k.loop { background: #4f8be0; }
.cov-key .k.plan { background: #c08328; }
.cov-read { min-height: 1.5em; font-size: 0.9375rem; color: var(--fg); margin-top: 4px; font-variant-numeric: tabular-nums; }
.hero-study { margin-top: 10px; }
