/* Vyasha, round 3.
   The site (Home and its frame) is direction A: a cold night with one warm light from the upper right,
   one family (Archivo) in two weights. The Story tab is direction C: a printed book on paper (Literata),
   ink particles, the editor's red pencil, entered through the letter tunnel. */
:root {
  --night: #070b12;      /* ground and shadows */
  --haze: #142236;       /* the far plane */
  --moon: #e9eef3;       /* text */
  --mist: #9aa7b5;       /* quiet text */
  --lamp: #f0b36a;       /* the one light, used almost nowhere */
  --line: rgba(233, 238, 243, .16);
  --text: var(--moon);            /* particles.js and portal.js read these two */
  --accent-bright: var(--lamp);
  --particle-font: "Archivo", "Arial Narrow", sans-serif;
  --particle-weight: 800;
  --sans: "Archivo", system-ui, sans-serif;
  --gutter: clamp(16px, 5vw, 72px);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
body { margin: 0; background: var(--night); color: var(--moon); font: 400 18px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; touch-action: manipulation; }
h1, h2, p, ol, ul { margin: 0; }
::selection { background: var(--lamp); color: var(--night); }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 4px; border-radius: 2px; }
.skip { position: absolute; left: var(--gutter); top: -80px; z-index: 30; padding: 12px 16px; background: var(--moon); color: var(--night); font-weight: 800; }
.skip:focus { top: 12px; }

/* ---------- header ---------- */
.top {
  position: fixed; inset: 0 0 auto; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) 8px max(var(--gutter), env(safe-area-inset-left, 0px));
}
.brand { font-weight: 800; font-stretch: 80%; font-size: 21px; letter-spacing: -.01em; text-decoration: none; padding: 12px 0; transition: opacity 300ms var(--ease-out); }
.top nav { display: flex; gap: clamp(18px, 3vw, 32px); }
.top nav a { color: var(--mist); text-decoration: none; font-size: 15px; padding: 12px 0; transition: color 200ms ease; }
.top nav a[aria-current="page"] { color: var(--moon); }

/* ---------- buttons and links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 22px;
  background: var(--moon); color: var(--night);
  font: 800 15px/1 var(--sans); letter-spacing: .01em; text-decoration: none;
  border-radius: 3px; user-select: none; -webkit-user-select: none;
  transition: transform 160ms var(--ease-out), background-color 200ms ease;
}
.btn:active { transform: scale(.97); }
.link {
  display: inline-flex; align-items: center; min-height: 48px;
  font-size: 16px; text-decoration: underline; text-underline-offset: 7px;
  text-decoration-thickness: 1px; text-decoration-color: var(--line);
  transition: text-decoration-color 200ms ease;
}

/* =========================================================
   HOME: one pinned shot. The particles hold a sphere, write the name, collapse into a "?",
   and the "?" lands in the story's frame beside what I make. Without .scrub (reduced motion,
   no WebGL) it is a plain stacked page.
   ========================================================= */
.track { position: relative; }
.stage { position: relative; isolation: isolate; }
/* far plane: the lamp's glow, upper right, over a cold haze */
.stage::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 100svh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(48% 46% at 96% -4%, rgba(240, 179, 106, .30), rgba(240, 179, 106, .08) 45%, transparent 70%),
    radial-gradient(60% 55% at 52% 30%, rgba(20, 34, 54, .85), transparent 75%);
}
.stage canvas.particles { position: absolute; inset: 0 0 auto 0; width: 100%; height: 100svh; z-index: 0; display: block; }
/* close plane: the floor darkens to 70% so white type sits on the scene with no box, then a fine grain */
.stage::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 100svh; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, transparent 45%, rgba(8, 8, 12, .7));
}
.grain {
  position: absolute; inset: 0 0 auto 0; height: 100svh; z-index: 1; pointer-events: none; opacity: .07;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
.scene { position: relative; z-index: 2; padding: 0 max(var(--gutter), env(safe-area-inset-left, 0px)); }

/* opening: the name huge, bottom left, and one plain line under it */
.opening { min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: clamp(32px, 8svh, 80px); }
.opening h1 { font-weight: 800; font-stretch: 78%; font-size: clamp(76px, 13vw, 200px); line-height: .84; letter-spacing: -.04em; padding-bottom: .14em; /* room for the y's tail */ }
.sub { margin-top: 18px; max-width: 36ch; color: var(--mist); font-size: clamp(17px, 1.35vw, 20px); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-top: 28px; }

/* landing: what I make, beside the frame the "?" lands in */
.landing { min-height: 100svh; display: grid; align-items: center; gap: 36px; padding-top: 88px; padding-bottom: 48px; }
@media (min-width: 760px) { .landing { grid-template-columns: minmax(0, 1fr) auto; gap: clamp(40px, 6vw, 112px); } }
.landing h2 { font-weight: 800; font-stretch: 78%; font-size: clamp(36px, 4.2vw, 60px); line-height: 1; letter-spacing: -.03em; margin-bottom: 20px; }
.make-list { list-style: none; padding: 0; border-top: 1px solid var(--line); max-width: 620px; }
.make-list li { border-bottom: 1px solid var(--line); }
.make-list a { display: grid; gap: 4px; padding: 18px 0; text-decoration: none; }
.make-name { font-weight: 800; font-stretch: 78%; font-size: clamp(30px, 3.6vw, 48px); line-height: 1; letter-spacing: -.02em; transition: color 200ms ease; }
.make-note { color: var(--mist); font-size: 16px; }
.cover {
  justify-self: center; height: min(64svh, 620px); aspect-ratio: 4 / 5; max-width: 100%;
  border: 1px solid var(--line); border-radius: 2px;
  background: radial-gradient(80% 60% at 70% 0%, rgba(96, 197, 255, .08), transparent 70%);
}
@media (max-width: 759px) {
  .landing { align-content: center; justify-items: start; gap: 22px; padding-top: 76px; }
  .cover { grid-row: 1; height: 30svh; }
  .make-list a { padding: 14px 0; }
}
/* on Home the header shows the name only once the big one has gone */
html.scrub .home:has(.track[data-step="0"]) .brand { opacity: 0; }

/* the pinned shot, only when particles.js runs it (it writes --p and data-step on the track) */
.scrub .track { height: 340svh; }
.scrub .stage { position: sticky; top: 0; height: 100svh; overflow: clip; }
.scrub .scene { position: absolute; inset: 0; }
.scrub .opening {
  --k: clamp(0, (var(--p, 0) - .03) / .14, 1);
  opacity: calc(1 - var(--k));
  transform: translateY(calc(var(--k) * -16px));
  filter: blur(calc(var(--k) * 6px));
}
.scrub .track:not([data-step="0"]) .opening { visibility: hidden; }
.scrub .landing-text {
  --k: clamp(0, (var(--p, 0) - .74) / .16, 1); /* rises while the "?" flies, done as it lands */
  clip-path: inset(calc((1 - var(--k)) * 100%) 0 -20px 0);
  transform: translateY(calc((1 - var(--k)) * 24px));
}
.scrub .cover { opacity: clamp(0, (var(--p, 0) - .7) / .16, 1); }
.scrub .track[data-step="0"] .landing, .scrub .track[data-step="1"] .landing { visibility: hidden; }
/* reduced motion or no WebGL: the frame shows a still question mark */
html:not(.scrub) .cover { display: grid; place-items: center; }
html:not(.scrub) .cover::before { content: "?"; font-weight: 800; font-stretch: 78%; font-size: min(26svh, 240px); line-height: 1; color: var(--moon); }

/* ---------- footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px;
  padding: 28px max(var(--gutter), env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) max(var(--gutter), env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--line); color: var(--mist); font-size: 15px;
}
.foot nav { display: flex; gap: 24px; }
.foot a { text-decoration: none; padding: 12px 0; }

/* =========================================================
   STORY TAB: the book world. Paper, ink, the red pencil, Literata.
   ========================================================= */
.book-world {
  --ground: #e8e8e3; --page: #f5f5f1; --ink: #1b1c20; --ink-soft: #55575e; --pencil: #c0392b; --rule: rgba(27, 28, 32, .14);
  --text: var(--ink); --accent-bright: var(--ink-soft);
  --particle-font: "Literata", Georgia, serif; --particle-weight: 400;
  --serif: "Literata", Georgia, serif;
  background: var(--ground); color: var(--ink); font-family: var(--serif); font-optical-sizing: auto;
  color-scheme: light;
}
.book-world ::selection { background: var(--ink); color: var(--page); }
.book-world :focus-visible { outline-color: var(--ink); }
/* the site's header, in ink on the paper, not fixed */
.book-world .top { position: relative; color: var(--ink); font-family: var(--sans); }
.book-world .top nav a { color: var(--ink-soft); }
.book-world .top nav a[aria-current="page"] { color: var(--ink); }

/* the entrance: a short flight through the letters of the title, then the book */
.intro { display: none; }
html.intro .intro {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 20;
  background: var(--night); color: var(--moon);
  --text: var(--moon); --accent-bright: var(--lamp); --portal-font: "Literata", Georgia, serif;
  transition: opacity 520ms var(--ease-out);
}
html.intro .intro.out { opacity: 0; pointer-events: none; }
.intro canvas.portal { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.intro-title { position: relative; font-family: "Literata", Georgia, serif; font-size: clamp(34px, 5vw, 64px); letter-spacing: -.02em; text-shadow: 0 0 40px rgba(7, 11, 18, .9); }
.skip-intro {
  position: absolute; right: max(var(--gutter), env(safe-area-inset-right, 0px)); bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 3px; background: transparent; color: var(--moon);
  font: 400 15px var(--sans); cursor: pointer; user-select: none; -webkit-user-select: none;
}

/* the open book */
.spread {
  display: grid; margin: 0 max(var(--gutter), env(safe-area-inset-left, 0px));
  min-height: calc(100svh - 72px - var(--gutter));
  background: var(--page);
  box-shadow: 0 1px 2px rgba(27, 28, 32, .06), 0 18px 40px -24px rgba(27, 28, 32, .28);
}
@media (min-width: 900px) {
  .spread { grid-template-columns: 1fr 1fr;
    background: linear-gradient(to right, transparent calc(50% - 28px), rgba(27, 28, 32, .07) 50%, transparent calc(50% + 28px)), var(--page); }
}
.page { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: clamp(28px, 5vw, 72px); min-width: 0; }
.plate { position: relative; width: min(100%, 440px); aspect-ratio: 4 / 5; border: 1px solid var(--rule); outline: 1px solid var(--rule); outline-offset: 6px; cursor: pointer; }
.plate canvas.particles { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.title-page { text-align: center; }
.title-page h1 { font-weight: 400; font-size: clamp(44px, 5.6vw, 88px); line-height: 1.02; letter-spacing: -.02em; font-variation-settings: "opsz" 72; text-wrap: balance; }
.q { position: relative; display: inline-block; }
/* the editor's red pencil: two passes, the second fainter, wobbling with grain like real pencil */
.pencil { position: absolute; left: 50%; top: 52%; width: 1.22em; height: 1.22em; transform: translate(-50%, -50%); overflow: visible; pointer-events: none; }
.pencil path { fill: none; stroke: var(--pencil); stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; filter: url(#pencil-rough); }
.pencil .stroke { stroke-width: 3.2; animation: draw 1000ms var(--ease-out) 450ms both; }
.pencil .grain-stroke { stroke-width: 1.5; opacity: .45; animation: draw 900ms var(--ease-out) 620ms both; }
html.intro .pencil .stroke { animation-delay: 1900ms; }      /* the pencil comes last, after the flight */
html.intro .pencil .grain-stroke { animation-delay: 2070ms; }
@keyframes draw { from { stroke-dashoffset: 1; } }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.byline { margin-top: 26px; font-style: italic; font-size: clamp(18px, 1.5vw, 21px); color: var(--ink-soft); }
.author { margin-top: clamp(36px, 8svh, 88px); font-size: 22px; letter-spacing: .02em; }
.book-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 32px; margin-top: clamp(32px, 7svh, 80px); }
.book-status { margin-top: 10px; font-style: italic; font-size: 15px; color: var(--ink-soft); }
/* links set like a book: the main one heavier, both underlined, the pencil on hover */
.read, .more {
  display: inline-flex; align-items: center; min-height: 48px; text-decoration: underline; text-underline-offset: 8px;
  user-select: none; -webkit-user-select: none; transition: text-decoration-color 200ms ease, transform 160ms var(--ease-out);
}
.read { font-weight: 600; font-size: 19px; text-decoration-thickness: 2px; text-decoration-color: var(--ink); }
.more { font-size: 17px; text-decoration-thickness: 1px; text-decoration-color: var(--rule); color: var(--ink-soft); }
.read:active, .more:active { transform: scale(.97); }

/* contents and the art of the story */
.book-section { max-width: 760px; margin: 0 auto; padding: clamp(72px, 12svh, 140px) max(var(--gutter), env(safe-area-inset-left, 0px)) 0; }
.book-section h2 { font-weight: 400; font-size: clamp(36px, 3.6vw, 52px); line-height: 1.1; text-align: center; margin-bottom: 36px; font-variation-settings: "opsz" 60; }
.contents ol { list-style: none; padding: 0; }
.contents .row { display: flex; align-items: baseline; gap: 14px; padding: 14px 0; text-decoration: none; }
.contents .num { width: 2.6rem; flex: none; font-style: italic; color: var(--ink-soft); }
.contents .name { font-size: 22px; }
.contents .dots { flex: 1; min-width: 24px; border-bottom: 2px dotted rgba(27, 28, 32, .3); transform: translateY(-5px); }
.contents .state { font-style: italic; color: var(--ink-soft); }
.art { max-width: 1040px; padding-bottom: clamp(72px, 12svh, 140px); }
.art .lede { text-align: center; color: var(--ink-soft); font-style: italic; margin: -20px 0 36px; }
.art-plates { list-style: none; padding: 0; display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.art-plates li { aspect-ratio: 3 / 4; border: 1px solid var(--rule); outline: 1px solid var(--rule); outline-offset: 5px; background: var(--page); display: grid; place-items: center; }
.art-plates span { font-style: italic; color: var(--ink-soft); font-size: 22px; }
.book-world .foot { border-top-color: var(--rule); color: var(--ink-soft); }

@media (max-width: 899px) {
  .spread { min-height: 0; margin: 0 12px; }
  .page { padding: 24px 16px; }
  .plate-page { padding-bottom: 8px; }
  .plate { width: auto; height: min(38svh, 340px); max-width: 100%; }
  .title-page { padding-top: 28px; padding-bottom: 36px; }
  .author { margin-top: 28px; }
  .book-actions { margin-top: 28px; }
  .contents .num { width: 1.8rem; }
  .contents .name { font-size: 19px; white-space: nowrap; }
  .contents .state { font-size: 15px; white-space: nowrap; }
  .contents .dots { min-width: 12px; }
}

@media (hover: hover) and (pointer: fine) {
  .top nav a:hover, .foot a:hover { color: var(--moon); }
  .btn:hover { background: #fff; }
  .link:hover { text-decoration-color: var(--lamp); }
  .make-list a:hover .make-name { color: #fff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; }
  .book-world .top nav a:hover, .book-world .foot a:hover { color: var(--ink); }
  .read:hover, .more:hover { text-decoration-color: var(--pencil); }
  .contents a.row:hover .name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .pencil path { animation: none; }
  .btn, .read, .more { transition: none; }
}

/* =========================================================
   SITE PAGES on the night: Works, About, 404. The same lamp, upper right, quieter than Home.
   ========================================================= */
.night-page {
  position: relative; isolation: isolate; min-height: 100svh;
  padding: calc(128px + env(safe-area-inset-top, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px)) clamp(72px, 12svh, 140px) max(var(--gutter), env(safe-area-inset-left, 0px));
}
.night-page::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 100svh; z-index: -1; pointer-events: none;
  background: radial-gradient(48% 46% at 96% -4%, rgba(240, 179, 106, .22), rgba(240, 179, 106, .06) 45%, transparent 70%);
}
.wrap { max-width: 1240px; margin: 0 auto; }
.page-title { font-weight: 800; font-stretch: 78%; font-size: clamp(56px, 9vw, 140px); line-height: .88; letter-spacing: -.04em; padding-bottom: .1em; }
.page-lead { margin-top: 18px; max-width: 46ch; color: var(--mist); font-size: clamp(17px, 1.35vw, 20px); }

/* works: each project is its picture beside its words; the first is the story */
.projects { list-style: none; padding: 0; margin-top: clamp(48px, 8svh, 96px); border-top: 1px solid var(--line); }
.project { border-bottom: 1px solid var(--line); }
.project a { display: grid; gap: 28px; padding: 36px 0; text-decoration: none; }
@media (min-width: 760px) { .project a { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center; gap: clamp(32px, 5vw, 80px); } }
.project .frame {
  aspect-ratio: 4 / 5; max-width: 520px; overflow: hidden; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 2px;
  background: radial-gradient(80% 60% at 70% 0%, rgba(96, 197, 255, .08), transparent 70%);
}
.project .frame span { font-weight: 800; font-stretch: 78%; font-size: clamp(120px, 18vw, 260px); line-height: 1; color: var(--moon); }
.project .frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 300ms var(--ease-out); }
.project-meta { color: var(--mist); font-size: 15px; }
.project-title { font-weight: 800; font-stretch: 78%; font-size: clamp(40px, 5vw, 72px); line-height: .95; letter-spacing: -.03em; margin: 10px 0 14px; }
.project-desc { color: var(--mist); max-width: 46ch; margin-bottom: 6px; }

/* about: the avatar and name beside the words */
.about { display: grid; gap: 40px; }
@media (min-width: 900px) { .about { grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: clamp(40px, 6vw, 96px); align-items: start; } }
.about-side { display: grid; gap: 12px; justify-items: start; }
.avatar { width: 120px; height: auto; }
.about-name { font-weight: 800; font-stretch: 80%; font-size: 22px; }
.about-block { margin-top: clamp(40px, 7svh, 72px); padding-top: 24px; border-top: 1px solid var(--line); max-width: 760px; }
.about-block h2 { font-size: 15px; font-weight: 800; color: var(--mist); margin-bottom: 14px; }
.quote { font-size: clamp(24px, 2.6vw, 36px); line-height: 1.2; letter-spacing: -.01em; }
.about-block p + p { margin-top: 10px; color: var(--mist); }

/* 404: the "?" above, the words at the bottom left, like Home */
.lost { display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: clamp(32px, 8svh, 80px); }
.lost canvas.particles { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; }
.lost .actions { margin-top: 28px; }

/* =========================================================
   CHAPTER PAGES: a page of the book, set for reading.
   ========================================================= */
.chapter-head { text-align: center; padding: clamp(48px, 9svh, 112px) max(var(--gutter), env(safe-area-inset-left, 0px)) 0; }
.running-head { font-style: italic; color: var(--ink-soft); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.chapter-head h1 { font-weight: 400; font-size: clamp(44px, 6vw, 88px); line-height: 1.02; letter-spacing: -.02em; font-variation-settings: "opsz" 72; }
.read-wrap { max-width: 68ch; margin: 0 auto; padding: 0 max(var(--gutter), env(safe-area-inset-left, 0px)); }
.unpublished { margin: clamp(40px, 8svh, 80px) auto 0; text-align: center; font-style: italic; color: var(--ink-soft); }
.prose { margin-top: clamp(40px, 8svh, 80px); }
.prose p { font-size: 20px; line-height: 1.75; margin: 0 0 1.1em; }
.prose > p:first-of-type::first-letter { float: left; font-size: 3.6em; line-height: .9; padding: .06em .08em 0 0; }
.prose blockquote { margin: 1.6em 0; padding-left: 1em; border-left: 2px solid var(--pencil); font-style: italic; font-size: 22px; }
.prose hr { border: 0; width: 8px; height: 8px; margin: 2.4em auto; background: var(--ink-soft); transform: rotate(45deg); } /* a scene break */
.author-note { display: flex; gap: 16px; align-items: flex-start; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--rule); font-style: italic; color: var(--ink-soft); }
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: clamp(48px, 9svh, 96px); margin-bottom: clamp(72px, 12svh, 140px); padding-top: 24px; border-top: 1px solid var(--rule); }
.chapter-nav > * { display: grid; align-content: start; gap: 2px; min-height: 48px; text-decoration: none; }
.chapter-nav .next { text-align: right; justify-items: end; }
.chapter-nav .dir { font-style: italic; color: var(--ink-soft); font-size: 15px; }
.chapter-nav .title { font-size: 21px; }
.chapter-nav .soon { font-size: 14px; font-style: italic; color: var(--ink-soft); }
.chapter-nav [aria-disabled="true"] .title { color: var(--ink-soft); }

@media (hover: hover) and (pointer: fine) {
  .project a:hover .project-title { color: #fff; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; }
  .project a:hover .frame img { transform: scale(1.03); }
  .project a:hover .link { text-decoration-color: var(--lamp); }
  .running-head:hover, a.chapter-nav-link:hover .title { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
}

/* site pages share the header's left edge (the gutter), not a centred column */
.night-page .wrap { max-width: none; }
/* a short book page never shows the night below its footer */
html:has(> body.book-world) { background: #e8e8e3; color-scheme: light; }
.book-world { min-height: 100svh; }

/* =========================================================
   Round 3.1: ChatGPT's review. The page you are on is marked; gold (the lamp) in small doses on
   Works and About; the 3D renders; a shorter shot on phones.
   ========================================================= */
.top nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; text-decoration-color: var(--lamp); }
.book-world .top nav a[aria-current="page"] { text-decoration-color: var(--pencil); }
.project-meta { color: var(--lamp); }
.about-block h2 { color: var(--lamp); }

/* a picture frame holding a render */
.render { display: block; width: 100%; height: 100%; object-fit: cover; background: #dfe3e2; }
.project .frame:has(.render) { background: #dfe3e2; }
.render-strip { display: flex; gap: 12px; margin-top: 18px; }
.render-strip img { width: 84px; aspect-ratio: 4 / 5; object-fit: cover; border: 1px solid var(--line); border-radius: 2px; background: #dfe3e2; }
/* the story's frame on Works: a page of the book with its pencilled "?" */
.project .frame.story-frame { background: #f5f5f1; }
.story-frame .story-q { position: relative; font-family: "Literata", Georgia, serif; font-weight: 400; font-size: clamp(120px, 16vw, 230px); line-height: 1; color: #1b1c20; }
.story-frame .pencil { width: 1.1em; height: 1.1em; top: 54%; }
.story-frame .pencil path { filter: none; stroke: #c0392b; }
.more-soon { margin-top: 28px; color: var(--mist); }

/* about: a smaller headline, the render beside the words */
.about .page-title { font-size: clamp(44px, 6vw, 92px); }
.about-side .portrait { width: min(100%, 300px); aspect-ratio: 4 / 5; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.bio { margin-top: 22px; max-width: 62ch; display: grid; gap: 14px; font-size: clamp(17px, 1.3vw, 19px); }
.bio p { color: var(--moon); }
.now-list { list-style: none; padding: 0; display: grid; gap: 10px; }
.now-list li { font-size: clamp(19px, 1.8vw, 24px); line-height: 1.3; }
@media (max-width: 899px) { .about-side .portrait { width: min(70%, 260px); } }

/* phones: a shorter, lighter shot on Home */
@media (max-width: 759px) { .scrub .track { height: 270svh; } }
/* fixes after the first look: the story "?" in ink (beat .project .frame span), thumbnails keep their shape */
.project .frame .story-q { color: #1b1c20; font-family: "Literata", Georgia, serif; font-weight: 400; font-stretch: 100%; }
.render-strip { align-items: flex-start; }
.render-strip img { height: auto; }
/* on the plain night pages the header scrolls away with the page, so light pictures never pass under it */
body:not(.home):not(.book-world) .top { position: absolute; }

/* =========================================================
   Home intro (like the portfolio reel): a short counter, the dots gather into my face, the words
   rise after them, and Reveal wipes a circle from the dots to the 3D render and back.
   ========================================================= */
.scrub .track { height: 420svh; }                 /* four shapes now: face, name, Lying to Whom?, ? */
@media (max-width: 759px) { .scrub .track { height: 330svh; } }

.loader { display: none; }
html.loading .loader {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 40;
  background: radial-gradient(60% 50% at 50% 50%, #121a26, var(--night) 70%);
  transition: opacity 600ms var(--ease-out);
}
html.loaded .loader { opacity: 0; pointer-events: none; }
.loader .count { grid-area: 1 / 1; font: 800 18px/1 var(--sans); color: var(--moon); font-variant-numeric: tabular-nums; }
.loader .ring { grid-area: 1 / 1; position: relative; width: clamp(56px, 7svh, 72px); aspect-ratio: 1; border-radius: 50%; box-shadow: 0 0 18px rgba(94, 240, 165, .28), inset 0 0 14px rgba(94, 240, 165, .14); }
.loader .ring::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: conic-gradient(var(--mint) calc(var(--k, 0) * 1turn), rgba(94, 240, 165, .16) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
}

@keyframes rise-in { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } }
.home .opening h1 { animation: rise-in 900ms var(--ease-out) 900ms both; }
.home .opening .sub { animation: rise-in 800ms var(--ease-out) 1050ms both; }
.home .opening .actions { animation: rise-in 800ms var(--ease-out) 1180ms both; }
html.loading:not(.loaded) .home .opening > * { animation-play-state: paused; } /* the words wait for the counter */

/* the render sits exactly where the particle face is (the face is 4.6 x 0.8 units tall, raised 20%) */
.face-reveal {
  position: absolute; left: 50%; top: 30%; z-index: 1; height: 50.5%; width: auto; aspect-ratio: 4 / 5;
  transform: translate(-50%, -50%); pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at 50% 36%, #000 var(--wipe), transparent calc(var(--wipe) + 9svh));
  mask-image: radial-gradient(circle at 50% 36%, #000 var(--wipe), transparent calc(var(--wipe) + 9svh));
}
@media (orientation: portrait) { .face-reveal { height: 37.2%; } }
.stage canvas.particles { transition: opacity 500ms ease; }
.scrub .face-reveal { opacity: calc(1 - clamp(0, (var(--p, 0) - .03) / .14, 1)); }
.reveal-btn {
  min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--moon); font: 400 15px var(--sans); cursor: pointer;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: border-color 200ms ease, transform 160ms var(--ease-out);
}
.reveal-btn:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .reveal-btn:hover { border-color: var(--lamp); } }

/* =========================================================
   Page to page: the old page steps back and softens, the new one settles in; the header stays put.
   ========================================================= */
@view-transition { navigation: auto; }
.top { view-transition-name: site-header; }
::view-transition-old(root) { animation: vt-out 200ms cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vt-in 420ms var(--ease-out) both; }
@keyframes vt-out { to { opacity: 0; transform: scale(.985); filter: blur(4px); } }
@keyframes vt-in { from { opacity: 0; transform: scale(1.012); filter: blur(6px); } }

@media (prefers-reduced-motion: reduce) {
  .home .opening > * { animation: none; }
  .face-reveal, .stage canvas.particles { transition: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* =========================================================
   ROUND 4 (the brief in PLAN-round4.md): the Vesper palette (near-black, indigo and soft-blue dots,
   mint accents, sky haze), the dock, the portfolio-reel intro, the Story threads.
   ========================================================= */
:root {
  --night: #08080c; --moon: #eef0f6; --mist: #9ea3ba; --line: rgba(238, 240, 246, .14);
  --lamp: #5ef0a5;                          /* the accent is mint now (every old --lamp use follows) */
  --mint: #5ef0a5; --sky: #60c5ff; --indigo: #4f3bff;
  --text: #a9b6ff; --accent-bright: #5ef0a5; /* particles: soft-blue dots, mint sprinkles */
  --portal-font: "Archivo", sans-serif;
}
.stage::before { background: radial-gradient(40% 46% at 50% 36%, rgba(96, 197, 255, .20), rgba(79, 59, 255, .10) 46%, transparent 72%), radial-gradient(70% 60% at 50% 40%, rgba(20, 18, 48, .9), transparent 76%); }
.night-page::before { background: radial-gradient(48% 46% at 50% -6%, rgba(96, 197, 255, .16), rgba(79, 59, 255, .07) 46%, transparent 72%); }
html.loading .loader { background: radial-gradient(60% 50% at 50% 50%, #14132a, var(--night) 70%); }

/* ---------- the dock: Story, Works, About in a glass pill, centred, a little below the top ---------- */
.top { view-transition-name: none; }
.top nav {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 30;
  display: flex; gap: 2px; padding: 5px; border-radius: 999px;
  background: rgba(18, 18, 30, .55); border: 1px solid rgba(238, 240, 246, .12);
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 10px 30px -14px rgba(0, 0, 0, .7);
  transform: translateX(-50%); view-transition-name: dock;
  animation: dock-in 700ms var(--ease-out) 200ms both;
}
.top nav a { padding: 10px 16px; border-radius: 999px; color: var(--mist); text-decoration: none !important; transition: background-color 200ms ease, color 200ms ease, transform 200ms var(--ease-out); }
.top nav a[aria-current="page"] { background: rgba(238, 240, 246, .1); color: var(--moon); }
.top nav a:active { transform: scale(.96); }
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, -12px) scale(.96); } }
@media (hover: hover) and (pointer: fine) { .top nav a:hover { background: rgba(238, 240, 246, .08); color: var(--moon); transform: translateY(-1px) scale(1.04); } }
@media (max-width: 520px) { .top .brand { display: none; } .top nav a { padding: 10px 14px; } }

/* ---------- Home: the reel intro. A giant word behind the dot portrait, centred; words and buttons below ---------- */
.home .stage canvas.particles { z-index: 1; }
.home .face-reveal { z-index: 2; top: 50svh; height: 77.5svh; } /* the portrait is 5.65 of the 7.29 units in view */
@media (orientation: portrait) { .home .face-reveal { height: 57.1svh; } } /* the camera pulls back to 9.5: 9.89 units */
.giant {
  position: absolute; left: 0; right: 0; top: 40svh; z-index: 0; transform: translateY(-50%);
  margin: 0; text-align: center; pointer-events: none;
  font: 800 min(24vw, 42svh)/.8 var(--sans); font-stretch: 78%; letter-spacing: -.02em; text-transform: uppercase;
  color: rgba(238, 240, 246, .14);
  clip-path: inset(0 100% 0 0); animation: giant-wipe 1100ms var(--ease-out) 1500ms forwards;
  transition: color 600ms ease;
}
@keyframes giant-wipe { to { clip-path: inset(0 0 0 0); } }
html.loading:not(.loaded) .giant { animation-play-state: paused; }
html.revealed .giant { color: rgba(94, 240, 165, .55); }
.scrub .giant { opacity: calc(1 - clamp(0, (var(--p, 0) - .03) / .14, 1)); }
.home .opening { align-items: center; text-align: center; padding-bottom: clamp(24px, 6svh, 64px); }
.home .opening .sub { margin-top: 0; }
.home .opening .actions { justify-content: center; margin-top: 18px; }
/* the Reveal pill sits under the portrait, like the reel, so the buttons below never re-wrap when it toggles */
.home .reveal-btn {
  position: absolute; left: 0; right: 0; top: 83svh; margin: 0 auto; width: fit-content;
  display: inline-flex; align-items: center; gap: 10px; padding: 0 14px; border: 0; background: none;
  font: 800 12px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--moon);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .85);
  animation: rise-in 800ms var(--ease-out) 1200ms both;
}
.home .reveal-btn::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid currentColor; box-shadow: 0 0 10px rgba(94, 240, 165, .5); transition: background-color 300ms ease, border-color 300ms ease; }
html.revealed .home .reveal-btn::before { background: var(--mint); border-color: var(--mint); }
@media (orientation: portrait) { .home .reveal-btn { top: 80svh; } }
@media (hover: hover) and (pointer: fine) { .home .reveal-btn:hover { color: var(--mint); } }

/* ---------- Story: the tunnel hero (the earlier one) and the threads ---------- */
.portal-hero { position: relative; min-height: 100svh; display: grid; place-items: center; text-align: center; padding: 96px max(var(--gutter), env(safe-area-inset-left, 0px)) 48px; isolation: isolate; overflow: clip; }
.portal-hero canvas.portal { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; }
.portal-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(50% 40% at 50% 50%, rgba(8, 8, 12, .75), transparent 70%); }
.portal-hero h1 { font: 800 clamp(56px, 10vw, 150px)/.9 var(--sans); font-stretch: 78%; letter-spacing: -.04em; padding-bottom: .08em; }
.portal-hero .page-lead { margin: 18px auto 28px; text-wrap: balance; }
.threads { position: relative; overflow-x: clip; padding: clamp(80px, 12svh, 140px) max(var(--gutter), env(safe-area-inset-left, 0px)); }
.threads h2, .art-dark h2 { font: 800 clamp(36px, 4.2vw, 60px)/1 var(--sans); font-stretch: 78%; letter-spacing: -.03em; margin-bottom: 36px; }
.flow { position: relative; }
.ribbon .band { opacity: .5; }
.ribbon .streaks { opacity: .7; animation: streak 3.2s linear infinite; }
@keyframes streak { to { stroke-dashoffset: -321; } }
.ribbon { position: absolute; left: -6%; top: -18%; width: 112%; height: 136%; z-index: 0; pointer-events: none; overflow: visible; }
.flow-card {
  position: relative; z-index: 1; border-radius: 18px; padding: clamp(20px, 4vw, 44px);
  background: rgba(16, 16, 28, .5); border: 1px solid rgba(238, 240, 246, .12);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
}
.nodes { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 72px; }
.node { position: relative; margin: 0; }
.node > a, .node > div { display: grid; align-content: start; gap: 4px; height: 100%; padding: 16px 18px; border-radius: 12px; text-decoration: none; background: rgba(8, 8, 12, .7); border: 1px solid rgba(238, 240, 246, .14); transition: border-color 200ms ease, transform 200ms var(--ease-out); }
.node .num { color: var(--mint); font-weight: 800; font-size: 14px; }
.node .name { font-weight: 800; font-stretch: 80%; font-size: clamp(20px, 2vw, 26px); line-height: 1.05; }
.node .state { color: var(--mist); font-size: 14px; }
/* a connector in the gap: a thin line, an arrowhead, and a streak of light running along it (transform only) */
.wire { position: absolute; left: calc(100% + 8px); top: 50%; width: 56px; height: 2px; margin-top: -1px; background: rgba(238, 240, 246, .2); clip-path: inset(-8px 0); }
.wire::after { content: ""; position: absolute; right: 0; top: 50%; transform: translateY(-50%); border: 5px solid transparent; border-left: 8px solid rgba(238, 240, 246, .5); border-right: 0; }
.wire::before { content: ""; position: absolute; inset: -1px 0; background: linear-gradient(90deg, transparent 10%, var(--mint) 80%, transparent); transform: translateX(-100%); animation: wire-run 2.6s cubic-bezier(.45, 0, .2, 1) infinite; }
.node:nth-child(2) .wire::before { animation-delay: 1.3s; }
@keyframes wire-run { to { transform: translateX(100%); } }
/* the branch drops from the first card to the one below it */
.branch { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 72px; margin-top: 56px; }
.wire.down, .branch .node .wire { left: 50%; top: auto; bottom: calc(100% + 8px); width: 2px; height: 40px; margin: 0 0 0 -1px; clip-path: inset(0 -8px); }
.wire.down::after { right: auto; left: 50%; top: auto; bottom: 0; transform: translateX(-50%); border: 5px solid transparent; border-top: 8px solid rgba(238, 240, 246, .5); border-bottom: 0; }
.wire.down::before { inset: 0 -1px; background: linear-gradient(180deg, transparent 10%, var(--sky) 80%, transparent); transform: translateY(-100%); animation: drop-run 2.6s cubic-bezier(.45, 0, .2, 1) .6s infinite; }
@keyframes drop-run { to { transform: translateY(100%); } }
@media (max-width: 759px) {
  .nodes, .branch { grid-template-columns: minmax(0, 1fr); gap: 56px; }
  .nodes .wire { left: 50%; top: calc(100% + 8px); width: 2px; height: 40px; margin: 0 0 0 -1px; clip-path: inset(0 -8px); }
  .nodes .wire::after { right: auto; left: 50%; top: auto; bottom: 0; transform: translateX(-50%); border: 5px solid transparent; border-top: 8px solid rgba(238, 240, 246, .5); border-bottom: 0; }
  .nodes .wire::before { inset: 0 -1px; background: linear-gradient(180deg, transparent 10%, var(--mint) 80%, transparent); transform: translateY(-100%); animation-name: drop-run; }
}
.journey { padding-top: 0; }
.btn { border-radius: 999px; }
/* the chapter page on the night: the book colours mapped to the theme */
.chapter { --ink: var(--moon); --ink-soft: var(--mist); --rule: var(--line); --pencil: var(--mint); }
.chapter .chapter-head { padding-top: calc(120px + env(safe-area-inset-top, 0px)); }
.chapter .running-head { font-style: normal; color: var(--mint); }
.chapter .chapter-head h1 { font-weight: 800; font-stretch: 78%; letter-spacing: -.04em; font-size: clamp(56px, 9vw, 140px); line-height: .9; }
.chapter .unpublished, .chapter .chapter-nav .dir, .chapter .chapter-nav .soon { font-style: normal; }
.chapter .chapter-nav .title { font-weight: 800; font-stretch: 80%; }
@media (hover: hover) and (pointer: fine) { .node a:hover { border-color: var(--mint); transform: translateY(-2px); } .btn:hover { background: var(--mint); } .chapter .running-head:hover { color: var(--moon); } }
.art-dark { padding: 0 max(var(--gutter), env(safe-area-inset-left, 0px)) clamp(80px, 12svh, 140px); }
.art-dark .lede { color: var(--mist); margin: -20px 0 32px; }
.glass-plates { list-style: none; padding: 0; display: grid; gap: clamp(10px, 2vw, 20px); grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 880px; }
.glass-plates li { aspect-ratio: 3 / 4; border-radius: 14px; display: grid; place-items: center; background: rgba(16, 16, 28, .5); border: 1px solid rgba(238, 240, 246, .12); color: var(--mist); font-weight: 800; font-stretch: 80%; font-size: clamp(16px, 2vw, 22px); }
@media (prefers-reduced-motion: reduce) {
  .giant { animation: none; clip-path: none; }
  .home .reveal-btn { animation: none; }
  .top nav { animation: none; }
  .wire::before { animation: none; display: none; }
  .ribbon circle { display: none; }
  .ribbon .streaks { animation: none; }
}

/* =========================================================
   Round 4.1: closer to the portfolio reel (Gemini compared the two, frame by frame).
   ========================================================= */
/* one value drives the Reveal: the photo shows inside a soft circle from the face, the dots go where it reaches */
@property --wipe { syntax: "<length>"; inherits: true; initial-value: 0px; }
.home .stage { --wipe: -12svh; transition: --wipe 700ms cubic-bezier(.22, 1, .36, 1); }
html.revealed .home .stage { --wipe: 125svh; }
.home .track[data-step="0"] canvas.particles {
  -webkit-mask-image: radial-gradient(circle at 50% 39.2%, transparent var(--wipe), #000 calc(var(--wipe) + 9svh));
  mask-image: radial-gradient(circle at 50% 39.2%, transparent var(--wipe), #000 calc(var(--wipe) + 9svh));
}
@media (orientation: portrait) {
  .home .track[data-step="0"] canvas.particles {
    -webkit-mask-image: radial-gradient(circle at 50% 42%, transparent var(--wipe), #000 calc(var(--wipe) + 9svh));
    mask-image: radial-gradient(circle at 50% 42%, transparent var(--wipe), #000 calc(var(--wipe) + 9svh));
  }
}
/* the name: tall and narrow across the screen, solid slate that darkens at the sides, mint once revealed;
   it wipes in only after the face has formed */
.giant {
  top: 47svh; font-size: min(32.5vw, 52svh); font-stretch: 62%; color: #34363c;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, .3), #000 30%, #000 70%, rgba(0, 0, 0, .3));
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, .3), #000 30%, #000 70%, rgba(0, 0, 0, .3));
  animation-duration: 1000ms; animation-delay: 2000ms;
}
html.revealed .giant { color: #34d399; }
/* the glow behind the face, quieter */
.stage::before { background: radial-gradient(40% 46% at 50% 40%, rgba(96, 197, 255, .08), rgba(79, 59, 255, .05) 46%, transparent 72%), radial-gradient(70% 60% at 50% 45%, rgba(16, 15, 30, .6), transparent 76%); }
/* on Home the dock arrives after the face, not during the gathering */
.home .top nav { animation-delay: 1600ms; }
html.loading:not(.loaded) .top nav { animation-play-state: paused; }
.landing .sub { margin: -6px 0 22px; }
/* the name sits behind the person: a dark silhouette of the photo between the name and the dots */
.face-shadow {
  position: absolute; left: 50%; top: 50svh; z-index: 0; height: 77.5svh; width: auto; aspect-ratio: 4 / 5;
  transform: translate(-50%, -50%) scale(1.04); pointer-events: none; filter: brightness(0) blur(8px); opacity: .92; /* soft: the dots turn in 3D */
  animation: shadow-in 900ms ease 500ms both;
}
@media (orientation: portrait) { .face-shadow { height: 57.1svh; } }
@keyframes shadow-in { from { opacity: 0; } }
html.loading:not(.loaded) .face-shadow { animation-play-state: paused; }
.scrub .face-shadow { opacity: calc(.92 * (1 - clamp(0, (var(--p, 0) - .03) / .14, 1))); }
.face-shadow { transition: opacity 500ms ease; }
html.revealed .face-shadow { opacity: 0; } /* the photo sits straight on the name, like the reel */
@media (prefers-reduced-motion: reduce) {
  .home .stage { transition: none; }
}
