/* Dyshell subpages: About, Work, Careers, Get a quote (/book), 404 (docs/docs-plan-overhaul-dec1.md 2.8). Base tokens and components
   are in base.css; the work cards are work.css; the request form is book.css.
   Page hero: label, h1 with a muted second line, lede, at most one button, copy left; art on the right running behind the
   transparent nav (js/pages.js draws it; without JS a still of it, see "Without JS" below). The art is dimmed under the nav so the links stay calm. */

/* ---------- Page hero ---------- */
.page-hero { position: relative; isolation: isolate; overflow: hidden; display: grid; grid-template-rows: auto 1fr; align-items: start;
  min-height: max(38rem, min(90svh, 60rem)); margin-top: calc(var(--header-h) * -1);
  padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); padding-bottom: var(--s-8);
  --statue-c: var(--tone-2b); --planet-c: var(--tone-2); --statue: url("../img/hero-statue.png"); --nav-calm: rgb(0 0 0 / .14); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .page-hero { --statue-c: var(--tone-3); --statue: url("../img/hero-statue-ink.png"); } }
:root[data-theme="light"] .page-hero { --statue-c: var(--tone-3); --statue: url("../img/hero-statue-ink.png"); }

.page-art { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(38% 44% at 74% 40%, color-mix(in srgb, var(--tone-2) 20%, transparent), transparent 70%);
  -webkit-mask-image: linear-gradient(var(--nav-calm) calc(var(--header-h) - .5rem), #000 calc(var(--header-h) + 6rem));
  mask-image: linear-gradient(var(--nav-calm) calc(var(--header-h) - .5rem), #000 calc(var(--header-h) + 6rem)); }
.page-art[data-live] { background: none; }
.page-art > * { position: absolute; display: block; }
.page-art canvas { inset: 0; width: 100%; height: 100%; z-index: 0; }
/* the art settles in once it is live, so the first frame never pops */
@media (prefers-reduced-motion: no-preference) { .page-art[data-live] canvas { animation: art-in 1.4s var(--ease) both; } }
@keyframes art-in { from { opacity: 0; } }

/* Statue head and planet limb: the homepage's 1-bit masks, tinted with the art tones */
.pa-statue { bottom: 0; aspect-ratio: 1549 / 1100; background: var(--statue-c);
  -webkit-mask: var(--statue) left bottom / contain no-repeat; mask: var(--statue) left bottom / contain no-repeat; }
.pa-planet { right: -4%; bottom: 0; width: min(58%, 60rem); aspect-ratio: 20 / 9; background: var(--planet-c);
  -webkit-mask: url("../img/hero-planet.png") right bottom / contain no-repeat; mask: url("../img/hero-planet.png") right bottom / contain no-repeat; }

/* Copy, over a soft pool of ground so it never sits on art */
.page-hero-in { position: relative; width: 100%; padding-top: clamp(3.5rem, 15svh, 9.5rem); display: grid; justify-items: start; }
.page-hero-in::before { content: ""; position: absolute; z-index: -1; inset: 0 auto auto 0; width: min(46rem, 92%); height: 100%; pointer-events: none;
  background: radial-gradient(60% 60% at 30% 50%, color-mix(in srgb, var(--ink) 76%, transparent), transparent 76%); }
.page-hero-in > .label { margin-bottom: var(--s-5); }
.page-hero h1 { max-width: 20ch; }
.page-hero h1 .ln { display: block; }
.page-hero .lede { margin-top: var(--s-5); max-width: 26rem; }
.page-hero-in > .btn { margin-top: var(--s-6); }
@media (prefers-reduced-motion: no-preference) {
  .page-hero-in > * { animation: page-in var(--t-slow) var(--ease) both; }
  .page-hero-in > :nth-child(2) { animation-delay: 60ms; } .page-hero-in > :nth-child(3) { animation-delay: 120ms; } .page-hero-in > :nth-child(4) { animation-delay: 180ms; }
  .hero-foot { animation: page-in var(--t-slow) 300ms var(--ease) both; }
}
@keyframes page-in { from { opacity: 0; transform: translateY(12px); } }

/* The foot of the hero: notes (About), project cards (Work), values (Careers) */
.hero-foot { align-self: end; width: 100%; padding-top: var(--s-8); }

/* ---------- About: the ring seen from further off, the statue bottom centre left, the planet limb bottom right ---------- */
.page-hero--about { min-height: max(40rem, min(94svh, 62rem)); }
.page-hero--about .pa-statue { left: 36%; height: 40%; }
.page-hero--about .pa-planet { width: min(50%, 52rem); }
/* the art settles into the ground under the notes */
.page-hero--about .page-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12rem; z-index: 3;
  background: linear-gradient(transparent, color-mix(in srgb, var(--ink) 92%, transparent) 50%, var(--ink)); }
.page-hero--about .hero-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--s-5) var(--s-7); }
.hero-note { max-width: 18rem; padding-top: var(--s-4); border-top: 1px solid var(--line); font-size: var(--t-sm); line-height: 1.5; color: var(--mist); }
.hero-note--right { display: flex; gap: var(--s-3); align-items: start; border-top-color: transparent; }
.hero-note--right .arrow { flex: none; width: 1rem; height: 1rem; margin-top: .2rem; color: var(--paper); }

/* ---------- Work: a partial Dyson sphere cut by the top and right edges; the cards sit along the foot ---------- */
.page-hero--work { min-height: 0; }
@media (min-width: 50rem) { .page-hero--work .page-hero-in { padding-top: clamp(2.5rem, 11svh, 7rem); } }
.page-hero--work .hero-foot { padding-top: clamp(3rem, 8svh, 5rem); }

/* ---------- Careers: the Temple of the Sibyl as a live ordered dither, values along the foot ---------- */
.page-hero--careers { min-height: max(40rem, min(94svh, 62rem)); }
.page-art[data-art="careers"] canvas { inset: auto; width: auto; height: auto; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; }
.values { --hgrid-bg: var(--ink); width: min(100%, 40rem); grid-template-columns: repeat(3, minmax(0, 1fr)); border-radius: var(--r-sm); overflow: hidden; }
.value { padding: var(--s-4) var(--s-5); font-size: var(--t-sm); font-weight: 500; line-height: 1.35; color: var(--paper); }
.value .mono { display: block; margin-bottom: var(--s-3); font-size: var(--t-label); font-weight: 500; color: var(--dim); }

/* ---------- Get a quote (/book): the star rises over the planet limb; the art is gone before the form card's top edge ---------- */
.page-hero--book { --card-top: 4rem; }
.page-hero--book .page-art {
  -webkit-mask-image: linear-gradient(var(--nav-calm) calc(var(--header-h) - .5rem), #000 calc(var(--header-h) + 6rem), #000 calc(100% - var(--card-top) - 7rem), transparent calc(100% - var(--card-top) - 1rem));
  mask-image: linear-gradient(var(--nav-calm) calc(var(--header-h) - .5rem), #000 calc(var(--header-h) + 6rem), #000 calc(100% - var(--card-top) - 7rem), transparent calc(100% - var(--card-top) - 1rem)); }
.page-hero--book.grain::after { -webkit-mask-image: linear-gradient(#000 calc(100% - var(--card-top) - 6rem), transparent calc(100% - var(--card-top) - 1rem));
  mask-image: linear-gradient(#000 calc(100% - var(--card-top) - 6rem), transparent calc(100% - var(--card-top) - 1rem)); }
/* The planet: a solid disc of ground (the limb's circle, fitted to the mask: centre 117.05% / 426.3% of the box, radius
   182% of its width) so the rising star is hidden behind it, then the halftone limb on top. js/pages.js mirrors the box */
.page-art[data-art="book"]::before, .page-art[data-art="book"]::after { content: ""; position: absolute; right: -4%; bottom: 0; width: min(62%, 62rem); aspect-ratio: 20 / 9; }
.page-art[data-art="book"]::before { z-index: 1; background: radial-gradient(182% 404.5% at 117.05% 426.3%, var(--ink) 99.8%, transparent 100%); }
.page-art[data-art="book"]::after { z-index: 2; background: var(--planet-c);
  -webkit-mask: url("../img/hero-planet.png") right bottom / contain no-repeat; mask: url("../img/hero-planet.png") right bottom / contain no-repeat; }
@media (scripting: enabled) { .page-art[data-art="book"]:not([data-live])::before { display: none; } }

/* ---------- 404: an empty horizon ---------- */
.page-hero--404 { min-height: max(34rem, min(80svh, 52rem)); }
.page-hero--404 .page-art { background: radial-gradient(26% 30% at 84% 62%, color-mix(in srgb, var(--tone-2) 16%, transparent), transparent 70%); }
.page-hero--404 .pa-planet { width: min(70%, 66rem); }

/* ---------- Phones: copy on top, the art below it ---------- */
@media (max-width: 49.99rem) {
  .page-hero { min-height: 0; }
  .page-hero-in { padding-top: clamp(2.5rem, 7svh, 4rem); }
  .page-hero-in::before { width: 100%; }
  /* until the art is live, the wash sits where it will be, under the copy */
  .page-art { background: radial-gradient(70% 26% at 64% 78%, color-mix(in srgb, var(--tone-2) 18%, transparent), transparent 70%); }
  /* the ring alone: with the statue as well the column is too crowded to keep the art off the copy */
  .page-hero--about .hero-foot { padding-top: 72vw; }
  .page-hero--about :is(.pa-statue, .pa-planet) { display: none; }
  .page-hero--about .page-art::after { height: 5rem; }
  .hero-note--right { display: none; }
  .page-hero--work .hero-foot { padding-top: min(92vw, 23rem); }
  .page-hero--careers .hero-foot { padding-top: min(116vw, 29rem); }
  .page-hero--book { --card-top: 4rem; }
  .page--book .page-hero--book { padding-bottom: calc(var(--card-top) + min(40vw, 11rem)); }
  .page-art[data-art="book"]::before, .page-art[data-art="book"]::after { right: -12%; width: 124%; }
  .page-hero--404 { padding-bottom: min(54vw, 14rem); }
  .page-hero--404 .page-art { background: none; }
  .page-hero--404 .pa-planet { width: 120%; right: -10%; }
}
@media (max-width: 29.99rem) {
  .values { grid-template-columns: minmax(0, 1fr); }
  .value { display: flex; align-items: baseline; gap: var(--s-4); }
  .value .mono { margin: 0; }
}

/* ---------- Without JS: a still of each page's art, captured from the live canvas (tools/pages/make_stills.py) and placed
   where pages.js draws it. Only matched with scripting off, so visitors with JS never download them. Wide: on the art box,
   scaled the way the canvas layout scales (Careers by height, the rest by width). Narrow: under the copy, full width ---------- */
@media (scripting: none) {
  .page-hero--about { --still-d: url("../img/pages/still-about-dark.webp"); --still-l: url("../img/pages/still-about-light.webp"); }
  .page-hero--work { --still-d: url("../img/pages/still-work-dark.webp"); --still-l: url("../img/pages/still-work-light.webp"); }
  .page-hero--careers { --still-d: url("../img/pages/still-careers-dark.webp"); --still-l: url("../img/pages/still-careers-light.webp"); }
  .page-hero--book { --still-d: url("../img/pages/still-book-dark.webp"); --still-l: url("../img/pages/still-book-light.webp"); }
  .page-hero { --still: var(--still-d); }
  :root[data-theme="light"] .page-hero { --still: var(--still-l); }
  .page-art[data-art] { background: var(--still) 0 0 / 100% auto no-repeat; }
  .page-art[data-art="about"] { background-position: 0 33%; }
  .page-art[data-art="work"] { background-position: 0 30%; }
  .page-art[data-art="careers"] { background-size: auto 100%; background-position: 100% 0; image-rendering: pixelated; }
  .page-art[data-art="book"] { background-position: 0 100%; }
}
@media (scripting: none) and (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .page-hero { --still: var(--still-l); } }
@media (scripting: none) and (max-width: 49.99rem) {
  .page-hero--about { --still-d: url("../img/pages/still-about-phone-dark.webp"); --still-l: url("../img/pages/still-about-phone-light.webp"); }
  .page-hero--work { --still-d: url("../img/pages/still-work-phone-dark.webp"); --still-l: url("../img/pages/still-work-phone-light.webp"); }
  .page-hero--careers { --still-d: url("../img/pages/still-careers-phone-dark.webp"); --still-l: url("../img/pages/still-careers-phone-light.webp"); }
  .page-hero--book { --still-d: url("../img/pages/still-book-phone-dark.webp"); --still-l: url("../img/pages/still-book-phone-light.webp"); }
  .page-art[data-art]:not([data-art="book"]) { background: none; }
  :is(.page-hero--about, .page-hero--work, .page-hero--careers) .page-hero-in::after { content: ""; position: absolute; z-index: -1; top: 100%;
    left: calc(50% - 50vw); width: 100vw; height: 200vw; pointer-events: none; background: var(--still) 0 0 / 100% auto no-repeat; }
  /* stop above the values box, as the live dither does */
  .page-hero--careers .page-hero-in::after { image-rendering: pixelated; height: calc(min(116vw, 29rem) - 1.5rem);
    -webkit-mask-image: linear-gradient(#000 calc(100% - 5rem), transparent); mask-image: linear-gradient(#000 calc(100% - 5rem), transparent); }
}

/* ---------- Rows (services, other projects) ---------- */
.rows { display: grid; border-top: 1px solid var(--line); }
.row { display: grid; gap: var(--s-1) var(--s-6); padding-block: var(--s-5); border-bottom: 1px solid var(--line); }
@media (min-width: 40rem) { .row { grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); align-items: baseline; } }
.row p { color: var(--mist); }
.rows--tight .row { padding-block: var(--s-4); }
.rows--tight .row h3 { font-size: var(--t-lg); }
.stack { display: grid; gap: var(--s-6); align-content: start; }
.stack > p:not(.statement) { font-size: var(--t-lg); line-height: 1.5; color: var(--mist); max-width: 40rem; }

/* ---------- About: the security headers this site sends (values read from public/_headers at build time) ---------- */
.proof { width: 100%; border-collapse: collapse; margin-top: var(--s-4); font-size: var(--t-sm); line-height: 1.5; }
.proof caption { caption-side: top; text-align: left; padding-bottom: var(--s-4); font: 500 var(--t-label)/1.2 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.proof th, .proof td { padding: var(--s-4) 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; font-weight: 400; }
.proof tr:last-child > * { border-bottom: 1px solid var(--line); }
.proof th { width: 58%; padding-right: var(--s-6); font-family: var(--f-mono); }
.proof-name { display: block; color: var(--paper); font-weight: 500; }
.proof-val { display: block; margin-top: var(--s-1); color: var(--dim); font-size: var(--t-label); overflow-wrap: anywhere; }
.proof td { color: var(--mist); }
@media (max-width: 39.99rem) {
  .proof, .proof caption, .proof tbody, .proof tr, .proof th, .proof td { display: block; width: auto; }
  .proof th { padding: var(--s-4) 0 var(--s-2); }
  .proof td { padding: 0 0 var(--s-4); border-top: 0; }
  .proof tr:last-child > * { border-bottom: 0; }
  .proof tr:last-child { border-bottom: 1px solid var(--line); }
}

/* ---------- Closing band ---------- */
.cta-band { background: var(--ink-2); border-top-color: var(--line); }
.cta-in { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s-6); }
.cta-in h2 { max-width: 16ch; }
.cta-note { color: var(--mist); font-size: var(--t-lg); max-width: 34ch; }

@media (forced-colors: active) { .page-art, .page-hero-in::after { display: none; } }
