/* Site v2 — loaded after style.css on every page.
   Two themes, both plain white with neutral greys: "mist" (Selected Work + Playground, with
   the card space) and "frost" (About + project pages, whose sticky header shares --frost-bg). */

.theme-mist, .theme-frost {
  --bg: #fff;
  --fg: #111416;
  --muted: #747a7d;
  --line: #e5e7e8;
  --surface: #f2f3f3;
  --veil: rgba(255, 255, 255, 0.9);
  --menu-bg: #fff;
  --frost-bg: #fff;
  background: #fff;
  color: var(--fg);
}
.theme-frost .row > .m, .theme-frost .card-media { background: var(--surface); }

/* The big name takes you back to the Selected Work page from the other pages. */
.name-link { display: block; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ───────────── Navigation (shared) ───────────── */

.nav-block { display: flex; gap: 40px; align-items: flex-start; }
.nav-links { display: grid; gap: 8px; list-style: none; margin: 0; padding: 0; }
.nav-link { display: inline-block; white-space: nowrap; }
.nav-link:hover { font-style: italic; }
.nav-link[aria-current] { font-weight: 700; font-style: italic; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* The 01–06 project list: a menu for Selected Work. Open on the Selected Work page;
   elsewhere it drops open while "Selected Work" is hovered or focused. Rows stay muted
   until a project is the current one or is hovered. */
.callouts { list-style: none; margin: 0; padding: 0; display: grid; font: 500 12px/1.25 var(--sans); }
.callouts a { display: flex; gap: 10px; color: var(--muted); white-space: nowrap; transition: color 0.15s; }
.callouts .ci { min-width: 14px; }
.callouts a:hover, .callouts a.is-active, .callouts a[aria-current="page"] { color: var(--fg); font-weight: 700; }
.callouts a:hover .cn, .callouts a.is-active .cn, .callouts a[aria-current="page"] .cn { font-style: italic; }
.nav-block:not(.is-open) .callouts { opacity: 0; visibility: hidden; transform: translateY(-4px); }
.nav-block .callouts { transition: opacity 0.2s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0s; }
.nav-block:not(.is-open) .callouts { transition: opacity 0.15s var(--ease), transform 0.2s var(--ease), visibility 0s linear 0.2s; }
/* Touch screens: tapping Selected Work drops the list open just below it, over the other
   links, with a close button in its top-right corner (added by v2.js). */
.callouts-close { display: none; }
@media (hover: none), (pointer: coarse) {
  .callouts { font-size: 15px; }
  .callouts a { padding: 7px 0; }
  /* On the Selected Work page the list sits beside the menu, row for row with it. */
  .site-head .nav-block[data-nav="open"] .callouts { gap: 8px; line-height: 1.2; }
  .site-head .nav-block[data-nav="open"] .callouts a { padding: 0; }
  .site-head .nav-block { position: relative; }
  /* (Not on the Selected Work page, where the list is always open and stays in the flow.) */
  .site-head .nav-block:not([data-nav="open"]) .callouts {
    position: absolute; z-index: 20; top: var(--drop-top, 100%); left: 0;
    width: 100%; max-width: 360px; padding: 10px 14px;
    border: 1px solid var(--line); background: var(--frost-bg, var(--menu-bg)); background-attachment: fixed;
    box-shadow: 0 24px 48px -28px rgba(0, 0, 0, 0.25);
  }
  .nav-inline .callouts { padding: 10px 16px; min-width: min(320px, calc(100vw - 2 * var(--margin))); }
  .callouts-close { display: block; position: absolute; top: 6px; right: 6px; }
  .callouts-close button {
    display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
    border: 0; background: none; color: var(--fg); cursor: pointer;
  }
  .callouts-close svg { width: 14px; height: 14px; }
}

/* ───────────── Hero header (Selected Work, Playground, About) ───────────── */

.site-top { padding-top: 20px; overflow-x: clip; }
.site-head {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gutter);
  padding: 70px 0 40px; border-bottom: 1px solid var(--line); align-items: start;
}
.site-head .role { grid-column: 1 / span 3; color: var(--muted); max-width: 46em; }
.site-head .nav-block { grid-column: 4; }

/* Write-on copy (Playground): letters arrive one by one behind a small dither symbol. */
.writeon .tip { display: inline-block; margin-left: 1px; font-family: ui-monospace, Menlo, monospace; font-size: 0.85em; }
.writeon .rest { visibility: hidden; }

/* ───────────── Project header (sticky, frosted) ───────────── */

/* Same surface as the page, so the header reads as part of it rather than a separate bar. */
.theme-frost .project-header { background: var(--frost-bg); background-attachment: fixed; }
.project-header .nav-block { position: relative; }
.nav-inline .nav-links { display: flex; gap: 32px; }
.nav-inline .callouts {
  /* The top edge sits exactly on the header's bottom line (the links end one padding above it). */
  position: absolute; top: calc(100% + var(--head-pad-b, 15px) - 1px); left: -14px;
  padding: 12px 14px; gap: 2px;
  background: var(--frost-bg, var(--veil)); background-attachment: fixed;
  border: 1px solid var(--line);
}

/* ───────────── The space (Selected Work + Playground) ───────────── */

/* The space also takes over most of the footer's top padding (--spill), so cards can drift
   down into the room above "Say hello" while the footer stays exactly where it was. */
.space {
  --spill: 144px;
  position: relative;
  height: calc(clamp(560px, 94svh, 980px) + var(--spill));
  margin: 0 calc(-1 * var(--margin));
  overflow: hidden; /* nothing crosses the divider line above */
  isolation: isolate; /* the cards' depth order stays inside, under the Selected Work menu */
  --card-w: clamp(200px, 22vw, 380px);
}
main:has(> .space:last-child) ~ .site-footer { padding-top: calc(200px - 144px); } /* 200px less the --spill */
.space-stage { position: absolute; inset: 0; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.space-stage.is-dragging { cursor: grabbing; }

.orb {
  position: absolute; left: 0; top: 0;
  display: grid; gap: 16px; align-content: start;
  width: calc(var(--card-w) * 2);
  transform-origin: 50% 50%;
  will-change: transform, opacity;
  opacity: 0;
  -webkit-user-drag: none;
  transition: opacity 0.35s var(--ease);
}
/* Number and (on hover) project name above each card, sharing a baseline. Sizes follow the card,
   which is laid out at twice its resting size and scaled down with depth. */
.orb-head { display: flex; align-items: baseline; gap: calc(var(--card-w) * 0.05); white-space: nowrap; }
.orb-idx { font: 500 max(15px, calc(var(--card-w) * 0.06))/1 var(--sans); color: var(--muted); }
.orb-title { font: 400 max(30px, calc(var(--card-w) * 0.16))/1 var(--serif); letter-spacing: -0.01em; visibility: hidden; }
.orb.is-titled .orb-title { visibility: visible; }
.orb-media {
  aspect-ratio: 684 / 513; overflow: hidden; border-radius: 4px;
  background: var(--surface);
}
.orb-media { display: block; }
.piece .orb-media { aspect-ratio: auto; height: 100%; border-radius: 3px; }
.piece { display: block; padding: 0; border: 0; background: none; font: inherit; color: inherit; }
.orb-media img, .orb-media video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.orb:focus-visible { outline: none; }
.orb:focus-visible .orb-media { outline: 2px solid var(--fg); outline-offset: 8px; }


/* ───────────── Playground popup ───────────── */

.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: var(--veil);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  opacity: 0; transition: opacity 0.3s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lb-stage { display: grid; place-items: center; width: min(86vw, 1400px); height: 84vh; }
.lb-stage img, .lb-stage video { width: auto; height: auto; max-width: min(86vw, 1400px); max-height: 84vh; object-fit: contain; box-shadow: 0 60px 120px -60px rgba(0, 0, 0, 0.35); transform: scale(0.97); transition: transform 0.45s var(--ease); }
.lightbox.is-open .lb-stage img, .lightbox.is-open .lb-stage video { transform: none; }
.lb-close { position: absolute; top: 24px; right: var(--margin); font: 500 15px/1 var(--sans); color: var(--fg); background: none; border: 0; padding: 6px 0; cursor: pointer; }
.lb-close:hover { font-style: italic; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 16px; color: var(--fg); cursor: pointer; }
.lb-nav svg { width: 40px; height: 24px; display: block; transition: transform 0.3s var(--ease); }
.lb-prev { left: calc(var(--margin) + 8px); }
.lb-next { right: calc(var(--margin) + 8px); }
.lb-prev:hover svg { transform: translateX(-4px); }
.lb-next:hover svg { transform: translateX(4px); }
html.lb-lock { overflow: hidden; }

/* ───────────── Dither cursor ───────────── */

html.has-cursor, html.has-cursor * { cursor: none !important; }
.cursor {
  position: fixed; left: 0; top: 0; z-index: 2000;
  width: 0; height: 0; pointer-events: none;
  mix-blend-mode: difference; color: #fff;
}
.cursor i { position: absolute; left: 0; top: 0; display: block; transform: translate(-50%, -50%); transition: width 0.18s var(--ease), height 0.18s var(--ease); }
.cursor .s-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.cursor .s-ring, .cursor.is-link i { width: 11px; height: 11px; border-radius: 50%; background: none; box-shadow: inset 0 0 0 1.5px currentColor; clip-path: none; }
.cursor .s-tri { width: 11px; height: 10px; background: currentColor; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.cursor .s-plus { width: 11px; height: 11px; background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat; }
.cursor.is-link i { width: 22px; height: 22px; }
.cursor.is-hidden { opacity: 0; }

/* ───────────── About ───────────── */

.about-intro { padding-top: 96px; align-items: start; }
/* "About" sits in the first column like the Experience / Recognition / Clients labels. */
.about-intro > .label { grid-column: 1; padding-top: 0.5em; }
/* The bio lines up with the Experience / Recognition / Clients columns below. */
.bio { grid-column: 2 / span 3; display: grid; gap: 40px; }
.bio-lede { font: 400 48px/1.08 var(--serif); letter-spacing: -0.01em; }
.bio-body { display: grid; gap: 1.32em; }
.about-list { padding-top: 80px; }
.about-intro + .about-list { padding-top: 64px; }
.about-list .section-inner { row-gap: 20px; }
.about-rows { grid-column: 2 / span 3; display: grid; gap: 29px; }
.about-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); column-gap: var(--gutter); align-items: baseline; }
.about-row .what { font: 500 17px/1.2 var(--sans); letter-spacing: -0.005em; }
.clients { grid-column: 2 / span 3; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: 12px; list-style: none; margin: 0; padding: 0; }
.clients li { font: 500 17px/1.2 var(--sans); letter-spacing: -0.005em; }

/* ───────────── Tablet ───────────── */

/* Column 4 alone gets too narrow for the links plus the open list. */
@media (max-width: 1359px) {
  .site-head .role { grid-column: 1 / span 2; }
  .site-head .nav-block { grid-column: 3 / span 2; }
}

@media (max-width: 1023px) {
  .space { --card-w: clamp(180px, 28vw, 300px); }
  .bio-lede { font-size: 38px; }
}

/* ───────────── Phone ───────────── */

@media (max-width: 699px) {
  .site-top { padding-top: 16px; }
  .site-head { padding: 28px 0 24px; row-gap: 20px; }
  .site-head .role, .site-head .nav-block { grid-column: 1 / -1; }
  .space { --card-w: 40vw; --spill: 72px; height: calc(clamp(520px, 86svh, 760px) + var(--spill)); }
  main:has(> .space:last-child) ~ .site-footer { padding-top: calc(120px - 72px); } /* 120px less the --spill */
  .nav-inline .nav-links { gap: 0; justify-content: space-between; width: 100%; }
  .project-header .nav-block { width: 100%; }
  .nav-inline .callouts { left: 0; }
  .lb-nav { top: auto; bottom: 16px; transform: none; }
  .lb-stage { height: 76vh; }
  .lb-stage img, .lb-stage video { max-height: 76vh; max-width: calc(100vw - 32px); }
  .bio, .about-rows, .clients { grid-column: 1 / -1; }
  .about-intro { padding-top: 40px; row-gap: 16px; }
  .about-intro > .label { grid-column: 1 / -1; padding-top: 0; }
  .bio-lede { font-size: 32px; }
  .about-row { grid-template-columns: 1fr; row-gap: 4px; }
  .clients { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-list { padding-top: 56px; }
  .about-intro + .about-list { padding-top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .orb, .lightbox, .lb-stage img, .lb-stage video { transition: none; }
}

/* ───────────── Dithered titles ───────────── */
/* Your name and the project titles share the hover dither (see v2.js). */
[data-dither] { position: relative; }
[data-dither].is-live { color: transparent; }
[data-dither] canvas { position: absolute; pointer-events: none; letter-spacing: 0; }
