/*
 * Bushigemener Labs: the page over the black-hole scene (scene.css).
 *
 * The scene is FIG. 01 and stays the strongest thing on the page: the hero copy keeps the
 * renderer's copy column (main.js sizes the hole from its box), nothing sits over the hole or in
 * the landscape top right, and the only colour besides ink is the disk's own peach. Below the
 * hero the page reads like a few plates from a lab notebook - figures, one table, plain prose.
 */

:root {
  color-scheme: dark;
  background: #010203;
  --ink: #e6e9ee;
  --ink-2: #c3cad3;
  --muted: #a3abb6;
  --faint: #87909c;
  --line: rgba(195, 203, 211, 0.14);
  --line-2: rgba(195, 203, 211, 0.26);
  --peach: #f0ded0;
  --void: #030508;
  /* Never inside a notch or rounded corner (phones in landscape). */
  --gutter: max(6vw, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
  --sans: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { margin: 0; width: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; width: 100%; background: #010203; color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
p, h1, h2, h3, figure { margin: 0; }
h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; touch-action: manipulation; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 5px; border-radius: 1px; }
#content { position: relative; z-index: 1; outline: none; }

/* ------------------------------------------------------------------------------ transition */

/* Passing the horizon: as the hero scrolls away the whole scene closes in on the hole and dims.
   Scaling about the hole by at most 6% never uncovers the cropped frame (the largest safe rise
   is (s - 1)(H - cy), ~3.75vh), and it ends before the renderer idles (hero + 400px), so a held
   frame is never scaled mid-move. Browsers without scroll timelines get the same from page.js;
   with reduced motion there is no movement at all - the sections' scrim does the dimming. */
#universe { transform-origin: var(--cx) var(--cy); }

@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    #universe {
      will-change: transform, opacity;
      animation: horizon linear both;
      animation-timeline: scroll(root);
      animation-range: 0 100vh;
    }
  }
}

@keyframes horizon {
  to { transform: translate3d(0, -3vh, 0) scale(1.06); opacity: 0.7; }
}

/* The small dark world is the hero's scale reference; in the lab it would read as a stray mark
   over the text, so it is left behind once the hero is mostly gone (page.js sets the class). */
#craft, .scale-body { transition: opacity 0.8s ease; }
.past-horizon #craft, .past-horizon .scale-body { opacity: 0; }

/* ------------------------------------------------------------------------------ header */

.skip-link { position: fixed; z-index: 5; top: 16px; left: var(--gutter); padding: 14px 20px; background: #10151b; color: var(--ink); font-size: 13px; transform: translateY(-180%); }
.skip-link:focus { transform: none; }

/* Landscape: a small cluster on the dark left; the top right belongs to the lensed arc. */
.site-header { position: absolute; z-index: 2; top: 30px; left: var(--gutter); right: var(--gutter); display: flex; align-items: center; gap: clamp(28px, 3.4vw, 56px); }
.mark { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -8px; color: var(--ink); }
.mark svg { width: 30px; height: 19px; overflow: visible; }
.mark svg * { fill: none; stroke: currentColor; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.mark .m-halo { stroke-opacity: 0.45; }
.mark .m-hole { fill: #010203; }
.mark .m-band { stroke-linecap: round; }
.site-nav { display: flex; gap: 26px; }
.site-nav a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 6px; margin: 0 -6px; color: #b3bbc5; font-size: 12px; letter-spacing: 0.04em; transition: color 0.2s; }
.site-nav a:hover { color: #fff; }

/* ------------------------------------------------------------------------------ hero */

/* The copy column is base-v1's (width rule and top), so main.js's composition still holds: the
   hole's lensed arcs stay clear of it, and the second line of the title sits level with the
   small dark world - text, then the small world, then the hole, as one line of scale. */
.hero { position: relative; min-height: 640px; height: 100svh; padding: 32svh var(--gutter) 120px; }
.hero-copy { position: relative; width: min(620px, 48vw); }
h1 { font-family: var(--display); font-weight: 300; font-size: clamp(2.5rem, 5.2vw, 4.25rem); line-height: 1; letter-spacing: 0.12em; text-transform: uppercase; }
h1 span { display: block; margin-right: -0.12em; }
.h1-b { margin-top: 0.16em; color: var(--muted); }
.descriptor { margin-top: 30px; font-size: 14px; line-height: 1.5; letter-spacing: 0.03em; color: #b5bdc7; }
.descriptor span { white-space: nowrap; }
.lede { margin-top: 14px; max-width: 42ch; font-size: 16px; line-height: 1.6; color: var(--ink-2); }
.scroll-cue { position: absolute; bottom: 38px; left: var(--gutter); display: inline-flex; align-items: center; gap: 14px; min-height: 44px; color: #a9b2bd; font-size: 11px; letter-spacing: 0.08em; }
.cue-line { width: 32px; height: 1px; background: currentColor; opacity: 0.55; transform-origin: left center; }
.cue-arrow { margin-left: 4px; }
.scroll-cue:hover { color: #fff; }
.scene-caption { position: absolute; right: var(--gutter); bottom: 52px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: #8b94a0; }

@media (prefers-reduced-motion: no-preference) {
  .hero-copy { animation: arrive 0.9s ease-out both; }
  .cue-line { animation: draw 1.4s 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes arrive { from { opacity: 0; } to { opacity: 1; } }
  @keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* ------------------------------------------------------------------------------ the lab */

/* The scrim under the sections: >= .92 behind the content column, so text keeps its contrast,
   easing to .8 beyond it, where the faded hole stays in view as a texture on wide screens. */
.lab { position: relative; padding: 150px var(--gutter) 0; }
.lab::before { content: ""; position: absolute; z-index: -1; inset: -260px 0 0; pointer-events: none; background: linear-gradient(90deg, rgba(2, 4, 6, 0.94) calc(6vw + 1160px), rgba(2, 4, 6, 0.8) calc(6vw + 1160px + 16vw)); -webkit-mask-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.85) 230px, #000 420px); mask-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.85) 230px, #000 420px); }
/* The sections keep the hero's left axis (and its composition: text on the left, the hole's
   faint image on the right) instead of centring in the window. */
.section { max-width: 1120px; padding-bottom: 150px; scroll-margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 32px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
h2 { font-family: var(--display); font-weight: 300; font-size: clamp(32px, 3.1vw, 48px); line-height: 1.12; letter-spacing: -0.02em; }
.section-intro { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Entries: text on the left, the figure always on the right. */
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: clamp(40px, 6vw, 112px); align-items: start; padding: 52px 0 48px; border-bottom: 1px solid var(--line); transition: border-color 0.4s; }
.entry-text { max-width: 580px; }
h3 { font-family: var(--display); font-weight: 300; font-size: clamp(26px, 2.3vw, 34px); line-height: 1.2; letter-spacing: -0.015em; }
.kicker { margin-top: 12px; font-size: 16px; line-height: 1.55; color: var(--ink); text-wrap: balance; }
.body { margin-top: 14px; max-width: 62ch; color: var(--muted); font-size: 14.5px; line-height: 1.75; }
.entry-link { margin-top: 16px; }
.entry-link a { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; font-size: 14px; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-decoration-thickness: 1px; text-underline-offset: 6px; transition: text-decoration-color 0.3s, color 0.3s; }
/* inline-block: the link's underline does not propagate into it, so it stops before the arrow */
.entry-link a span { display: inline-block; color: var(--muted); }
.entry-link a:hover { color: #fff; text-decoration-color: var(--peach); }

/* ------------------------------------------------------------------------------ figures */

/* One drawing system (see tools/figures.py): hairlines by opacity, dashes only for "private" or
   "not yet", a near-black void where something is hidden behind, one peach mark. */
.figure { width: 340px; }
.fig-frame { position: relative; aspect-ratio: 5 / 3; color: var(--ink); }
.fig-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
:where(.fig-frame svg *) { fill: none; stroke: none; vector-effect: non-scaling-stroke; }
.fig-frame .f-1 { stroke: rgba(230, 233, 238, 0.48); stroke-width: 1px; }
.fig-frame .f-2 { stroke: rgba(230, 233, 238, 0.26); stroke-width: 1px; }
.fig-frame .f-dash { stroke-dasharray: 2 4; }
.fig-frame .f-void { fill: var(--void); }
.fig-frame .f-peach { stroke: var(--peach); stroke-width: 1px; }
.fig-frame .f-peach-dot { fill: var(--peach); }
.fig-frame .f-task { fill: rgba(230, 233, 238, 0.85); }
.fig-label { position: absolute; left: var(--x); top: var(--y); font-family: var(--mono); font-size: 11px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; color: var(--muted); }
.fig-label.quiet { color: var(--faint); }
.a-c { transform: translate(-50%, -50%); }
.a-t { transform: translate(-50%, 0); }
.a-b { transform: translate(-50%, -100%); }
.a-l { transform: translate(-100%, -50%); }
.a-r { transform: translate(0, -50%); }
.a-tl { transform: translate(-100%, -100%); }
.a-br, .a-tl0 { transform: none; }
.a-bl0 { transform: translate(0, -100%); }
figcaption { margin-top: 14px; color: var(--faint); font-size: 12px; line-height: 1.6; }
.fig-no, .fig-status { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.fig-no { color: var(--muted); }
.fig-status { color: var(--ink-2); }
.fig-status::before { content: "· "; color: var(--faint); }
.fig-text { display: block; margin-top: 4px; }

@media (hover: hover) {
  .entry:hover { border-bottom-color: var(--line-2); }
  .fig-frame .f-1, .fig-frame .f-2 { transition: stroke 0.5s; }
  .entry:hover .fig-frame .f-1 { stroke: rgba(230, 233, 238, 0.62); }
  .entry:hover .fig-frame .f-2 { stroke: rgba(230, 233, 238, 0.34); }
}

/* ------------------------------------------------------------------------------ setup */

.setup-table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
.setup-table caption { caption-side: bottom; padding-top: 18px; text-align: left; color: var(--faint); font-size: 12px; }
.setup-table thead th { padding: 26px 0 12px; text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.setup-table tbody th, .setup-table tbody td { padding: 20px 24px 20px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: baseline; }
.setup-table tbody tr:last-child > * { border-bottom: 1px solid var(--line); }
.setup-table tbody th { width: 44%; font-weight: 400; color: var(--ink); }
.setup-table tbody td { padding-right: 0; color: var(--muted); }

/* ------------------------------------------------------------------------------ about */

/* The About copy starts on the same line as the setup table's second column. */
.about { display: grid; grid-template-columns: 44% minmax(0, 1fr); align-items: start; padding-top: 4px; }
.about-head { padding-right: 32px; }
.statement { margin-top: 14px; color: var(--muted); font-size: 15px; letter-spacing: 0.02em; }
.about-copy > p:first-child { font-family: var(--display); font-weight: 300; font-size: clamp(21px, 1.85vw, 26px); line-height: 1.55; letter-spacing: -0.01em; color: var(--ink); }
.about-copy .muted { margin-top: 22px; max-width: 54ch; color: var(--muted); font-size: 15px; }
.signature { margin-top: 30px; color: var(--ink-2); font-size: 15px; }
.sign { margin-left: 8px; color: var(--muted); }

/* ------------------------------------------------------------------------------ footer */

.foot { position: relative; z-index: 1; padding: 0 var(--gutter); background: linear-gradient(90deg, rgba(2, 4, 6, 0.94) calc(6vw + 1160px), rgba(2, 4, 6, 0.8) calc(6vw + 1160px + 16vw)); }
.site-footer { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 32px; max-width: 1120px; padding: 22px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.foot-mark { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); }
.foot-mark span { margin-left: 14px; letter-spacing: 0.04em; color: var(--faint); }
.foot-links { display: flex; flex-wrap: wrap; gap: 0 28px; }
.foot-links a { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; transition: color 0.2s; }
.foot-links a:hover { color: #fff; }
.colophon { grid-column: 1 / -1; color: var(--faint); font-size: 11px; }

/* ------------------------------------------------------------------------------ 404 */

.not-found h1 { font-size: clamp(2.5rem, 4.4vw, 3.5rem); }
.not-found .h1-b { margin-top: 0.9em; font-size: 0.42em; letter-spacing: 0.18em; }
.not-found .entry-link { margin-top: 18px; }

/* ------------------------------------------------------------------------------ responsive */

@media (max-width: 1100px) and (orientation: landscape) {
  .hero-copy { width: 49vw; }
  .lede { max-width: 32ch; font-size: 15px; }
}

@media (max-width: 960px) {
  .entry { grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; }
  .figure { width: 260px; }
}

/* Short landscape screens (phones on their side): the title on one line, the copy compact. */
@media (orientation: landscape) and (max-height: 480px) {
  .site-header { top: 14px; }
  .hero { min-height: 100svh; height: auto; padding-top: max(84px, 30svh); padding-bottom: 96px; }
  h1 { font-size: clamp(1.75rem, 3.6vw, 2.125rem); }
  h1 span { display: inline; margin-right: 0; }
  .descriptor { margin-top: 16px; font-size: 12px; }
  .lede { margin-top: 10px; max-width: 30ch; font-size: 13px; }
  .scroll-cue { bottom: 18px; }
  .scene-caption { display: none; }
}

/* Very small landscape viewports (e.g. 400% zoom: 320 x 256): the nav reaches the lensed arc, so
   it gets the same short fade as in portrait. Phones on their side keep the arc untouched. */
@media (orientation: landscape) and (max-height: 480px) and (max-width: 480px) {
  .site-header::before { content: ""; position: absolute; z-index: -1; top: -14px; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter)); height: 100px; background: linear-gradient(#010203f2, #010203d0 58%, transparent); pointer-events: none; }
  .site-nav a { color: var(--ink-2); }
  /* The copy column cannot clear the hole at this size: the copy gets a dark ground of its own. */
  .hero-copy { width: 100%; isolation: isolate; }
  /* ...and the poster's first-paint composition (scene.css) follows the wider copy box, as
     main.js will, so the scene does not jump when the script measures it. */
  :root { --copy-right: calc(100vw - var(--gutter)); }
  .hero-copy::before { content: ""; position: absolute; z-index: -1; inset: -12px calc(-1 * var(--gutter)); background: linear-gradient(90deg, rgba(1, 2, 3, 0.94), rgba(1, 2, 3, 0.9) 75%, rgba(1, 2, 3, 0.7)); pointer-events: none; }
}

/* Portrait: the hole fills the upper right (main.js), the copy starts at 58svh under it. */
@media (orientation: portrait) {
  .site-header { top: max(18px, env(safe-area-inset-top)); justify-content: space-between; }
  /* A short top fade keeps the nav legible over the bright portrait arc. */
  .site-header::before { content: ""; position: absolute; z-index: -1; top: calc(-1 * max(18px, env(safe-area-inset-top))); left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter)); height: calc(124px + env(safe-area-inset-top)); background: linear-gradient(#010203f0, #010203cc 46%, transparent); pointer-events: none; }
  .site-nav { gap: 20px; }
  .site-nav a { font-size: 12px; color: var(--ink-2); }
  .hero { height: auto; min-height: 100svh; padding-top: 58svh; padding-bottom: 104px; }
  .hero-copy { width: min(100%, 580px); }
  h1, .not-found h1 { font-size: clamp(2rem, 9.2vw, 3.5rem); }
  .descriptor { margin-top: 20px; font-size: 13px; }
  .lede { margin-top: 10px; font-size: 15px; }
  .scroll-cue { bottom: 24px; }
  .scene-caption { display: none; }
  .lab { padding-top: 96px; }
  .foot { background: rgba(2, 4, 6, 0.94); }
  .lab::before { top: -140px; background: linear-gradient(to bottom, rgba(2, 4, 6, 0), rgba(2, 4, 6, 0.86) 180px, rgba(2, 4, 6, 0.94) 380px); -webkit-mask-image: none; mask-image: none; }
  .section { padding-bottom: 110px; }
  .entry { grid-template-columns: minmax(0, 1fr); gap: 30px; padding: 40px 0 38px; }
  .figure { width: min(100%, 270px); }
}

@media (orientation: portrait) and (max-height: 700px) {
  .scroll-cue { display: none; }
}

@media (max-width: 640px) {
  .entry { grid-template-columns: minmax(0, 1fr); gap: 30px; padding: 40px 0 38px; }
  .figure { width: min(100%, 270px); }
  .section-head { display: block; padding-bottom: 24px; }
  .section-intro { margin-top: 12px; font-size: 13px; }
  h2 { font-size: 32px; }
  h3 { font-size: 26px; }
  .kicker { font-size: 15px; }
  .body { font-size: 14px; }
  .setup-table { font-size: 13.5px; }
  /* The columns explain themselves on a phone; the header row stays for screen readers. */
  .setup-table thead th { padding: 0; }
  .setup-table thead th span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .setup-table tbody tr:first-child > * { padding-top: 20px; }
  .setup-table tbody th, .setup-table tbody td { padding: 16px 12px 16px 0; }
  .setup-table tbody th { width: 44%; }
  .about { display: block; }
  .about-copy { margin-top: 26px; }
  .about-copy > p:first-child { font-size: 20px; }
  .site-footer { grid-template-columns: 1fr; padding-top: 18px; }
}

@media (max-width: 360px) {
  .site-nav { gap: 14px; }
  .site-nav a { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* FIG. 02's drifting task is SMIL, which the rule below cannot stop (page.js pauses it too). */
  .fig-frame .f-task { visibility: hidden; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
