/* SpiralFi.
   The palette is sampled from his own avatar and banner and does not move. The layout does:
   no top nav bar, no column of identical cards. The page is a descent — the stage is the
   room, the chrome sits in the corners, and the instrument docks on the right when it is
   asked for. */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --violet: #7A56C8;
  --violet-hi: #A98BD4;
  --violet-pale: #C3A6E2;
  --violet-glow: #E9D6FB;
  --violet-deep: #2D1A42;
  --violet-ghost: rgba(122, 86, 200, 0.13);
  --violet-line: rgba(169, 139, 212, 0.30);

  --ink: #000000;
  --glass: rgba(9, 6, 14, 0.70);
  --glass-hi: rgba(16, 11, 24, 0.88);
  --line: rgba(237, 231, 246, 0.10);

  --text: #EDE7F6;
  --muted: #9089A0;
  --faint: #5b5366;

  --display: 'Instrument Serif', Georgia, serif;
  --sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --gut: clamp(18px, 4vw, 64px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: #000; overflow-x: clip; scroll-behavior: smooth; }
body {
  background: transparent; color: var(--text); font-family: var(--sans);
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------- the room */

.stage { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.stage canvas { width: 100%; height: 100%; display: block; }
.stage.no-webgl {
  background:
    radial-gradient(60% 50% at 50% 42%, rgba(122,86,200,.22), transparent 70%),
    radial-gradient(90% 70% at 50% 100%, rgba(45,26,66,.5), #000 75%);
}
/* The well is brightest at its mouth. Past the title card the room darkens — which is the
   shape of the thing, and also the only way a paragraph laid over a lit ribbon stays
   readable. One rule for every act instead of a scrim per block. */
.dim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0;
  transition: opacity .55s ease;
  background:
    linear-gradient(to bottom, rgba(2,1,5,.72), rgba(2,1,5,.66)),
    radial-gradient(70% 60% at 50% 50%, rgba(2,1,5,.4), transparent 75%);
}
.dim.on { opacity: 1; }

.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(118% 88% at 50% 44%, transparent 34%, rgba(0,0,0,.6) 76%, rgba(0,0,0,.9) 100%);
}

/* ------------------------------------------------------- chrome, in the corners */

.chrome { position: fixed; inset: 0 0 auto 0; z-index: 20; display: flex;
  align-items: center; justify-content: space-between; padding: 20px var(--gut); pointer-events: none; }
.chrome > * { pointer-events: auto; }
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.wordmark img { width: 28px; height: 28px; display: block; }
.wordmark b { font-family: var(--display); font-size: 23px; letter-spacing: .06em; text-transform: uppercase; font-weight: 400; }
.pills { display: flex; gap: 8px; align-items: center; }
.pill {
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(6,4,10,.6); backdrop-filter: blur(10px); cursor: pointer;
}
.pill:hover { color: var(--text); border-color: var(--violet-line); }
.pill.lit { color: #0b0710; background: var(--violet-pale); border-color: transparent; font-weight: 600; }

/* the descent: where you are in the well, as a rail of rungs */
.rail { position: fixed; right: calc(var(--gut) - 6px); top: 50%; transform: translateY(-50%);
  z-index: 18; display: flex; flex-direction: column; gap: 14px; align-items: flex-end; }
.rail a { display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.rail i { display: block; width: 26px; height: 1px; background: rgba(237,231,246,.22); transition: .25s; }
.rail a:hover i, .rail a.on i { width: 46px; background: var(--violet-hi); }
.rail a.on { color: var(--violet-pale); }
.rail span { opacity: 0; transition: .25s; }
.rail a:hover span, .rail a.on span { opacity: 1; }

/* the one standing action, bottom left, away from everything else */
.dock {
  position: fixed; left: var(--gut); bottom: 26px; z-index: 20;
  font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  color: #0b0710; background: var(--violet-pale); border: 0; border-radius: 999px;
  padding: 15px 26px; cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  box-shadow: 0 10px 40px rgba(122,86,200,.35);
}
.dock:hover { background: var(--violet-glow); }
.dock b { font-weight: 600; }

/* ------------------------------------------------------------------ the descent */

main { position: relative; z-index: 2; }
.act { min-height: 100svh; display: flex; align-items: center; padding: 110px var(--gut) 90px; }
/* 🔴 min-width: 0. An act is a flex container, so its inner block is a flex item, and a
   flex item refuses to shrink below the widest thing inside it — here a table with eight
   columns. Without this the page scrolls sideways on a phone and the table does not. */
.act > .inner { width: 100%; max-width: 1180px; margin: 0 auto; min-width: 0; }

.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--violet-hi); margin: 0 0 18px; }
.rule-orn { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 14px 0 22px; color: var(--violet-line); }
.rule-orn i { height: 1px; width: 90px; background: linear-gradient(90deg, transparent, var(--violet-line)); display: block; }
.rule-orn i + i { background: linear-gradient(90deg, var(--violet-line), transparent); }
.rule-orn s { width: 7px; height: 7px; border: 1px solid var(--violet-hi); transform: rotate(45deg); text-decoration: none; }

h1 {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(42px, 8.4vw, 118px); line-height: .92; letter-spacing: .02em;
  margin: 0 0 18px; text-shadow: 0 6px 44px rgba(0,0,0,.8);
}
h2 { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .035em;
  font-size: clamp(27px, 3.6vw, 44px); line-height: 1.02; margin: 0 0 14px; }
h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--violet-hi); margin: 0 0 10px; font-weight: 500; }
p { margin: 0 0 14px; color: #cdc6d8; }
.lede { font-size: clamp(16px, 1.5vw, 19px); color: #ded7e8; max-width: 56ch; }
.tiny { font-family: var(--mono); font-size: 10.5px; color: var(--faint); letter-spacing: .06em; }

/* act one is centred on the object, like a title card. The object is brightest exactly
   where the title sits, so the title carries its own darkness with it — a wash, not a
   panel, because a panel here would box in the one shot the page has. */
#well .inner { max-width: 940px; text-align: center; position: relative; }
#well .inner::before {
  /* 🔴 no negative horizontal inset. It widens the flex item it sits in, and the page then
     scrolls sideways by exactly that much with nothing visible out there. */
  content: ""; position: absolute; inset: -14vh 0 -10vh 0; z-index: -1; pointer-events: none;
  background: radial-gradient(74% 56% at 50% 46%, rgba(3,2,7,.93), rgba(3,2,7,.75) 46%, rgba(3,2,7,.34) 70%, transparent 90%);
}
#well .lede { margin: 0 auto 34px; text-align: center; }
#well h1, #well .lede, #well .eyebrow { text-shadow: 0 3px 26px rgba(0,0,0,.9); }

/* the numbered statements: a band across the page, not three identical boxes */
.band { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border-top: 1px solid var(--line); }
.band > div { padding: 26px 26px 26px 0; border-right: 1px solid var(--line); }
.band > div:last-child { border-right: 0; }
.band .n { font-family: var(--display); font-size: 40px; color: var(--violet); line-height: 1; display: block; margin-bottom: 12px; }

/* an asymmetric split, so not every section is two equal columns */
.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(24px, 5vw, 76px); align-items: start; }
.split.flip { grid-template-columns: .85fr 1.15fr; }

/* readings, laid on a line rather than in cards */
.readout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.readout > div { background: rgba(6,4,10,.66); backdrop-filter: blur(12px); padding: 16px 18px; }
.readout .k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.readout .v { font-family: var(--mono); font-size: 23px; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.readout .s { font-size: 12px; color: var(--muted); }

.glass { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; }

/* ------------------------------------------------------- hold to spiral deeper */

.hold { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.hold .tiny { background: rgba(5,3,9,.72); padding: 5px 14px; border-radius: 999px; }
.holdbar {
  width: min(520px, 90vw); height: 2px; background: rgba(237,231,246,.14); position: relative; border-radius: 2px;
}
.holdbar i { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--violet-hi);
  box-shadow: 0 0 16px rgba(169,139,212,.8); border-radius: 2px; }
/* the reading sits on its own dark bar: it is numbers over a lit object, and numbers
   over a lit object are numbers nobody can read */
.holdrow { display: inline-flex; align-items: baseline; gap: 16px; font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  background: rgba(5,3,9,.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 999px; padding: 10px 24px; }
.holdrow b { font-family: var(--display); font-size: 34px; color: var(--text); letter-spacing: .02em; line-height: 1; }
.holdrow em { font-style: normal; color: var(--violet-pale); font-size: 11px; }
.holdbtn {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text); background: rgba(8,5,13,.86); backdrop-filter: blur(12px); border: 1px solid var(--violet-line);
  border-radius: 999px; padding: 13px 28px; cursor: pointer; user-select: none; touch-action: none;
}
.holdbtn:active, .holdbtn.down { background: var(--violet-ghost); color: var(--violet-glow); }

/* ------------------------------------------------------------- the console */

.console {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); z-index: 30;
  background: var(--glass-hi); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-left: 1px solid var(--violet-line); padding: 22px 24px 30px; overflow-y: auto;
  transform: translateX(100%); transition: transform .32s cubic-bezier(.3,.8,.3,1);
  box-shadow: -30px 0 90px rgba(0,0,0,.6);
}
/* 🔴 an off-canvas panel parked with a transform still counts toward the document's scroll
   width in Chrome, which shows up as a page that scrolls sideways by the width of the
   scrollbar and nothing else. Hidden until it is asked for, so it cannot. */
/* 🔴 an off-canvas panel parked with a transform still counts toward the document's scroll
   width, which reads as a page that scrolls sideways for no visible reason. It is taken
   out of the layout entirely between uses; js/app.js puts it back one frame before it
   slides in, so the transition still runs. */
.console[hidden] { display: none; }
.console.open { transform: translateX(0); }
.console header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.console header h2 { margin: 0; font-size: 26px; }
.close { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 999px;
  width: 30px; height: 30px; cursor: pointer; font-size: 15px; line-height: 1; }
.close:hover { color: var(--text); border-color: var(--violet-line); }

/* ------------------------------------------------------------------ controls */

button, .btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: #0b0710; background: var(--violet-pale); border: 0; border-radius: 999px;
  padding: 12px 20px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
button:hover, .btn:hover { background: var(--violet-glow); }
button.ghost, .btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--violet-line); }
button.ghost:hover { background: var(--violet-ghost); }
button[disabled] { opacity: .4; cursor: not-allowed; }
button.small { font-size: 10.5px; padding: 8px 14px; }
.cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--faint); display: block; margin-bottom: 7px; }
input[type=text], input[type=number], select, textarea {
  width: 100%; background: rgba(0,0,0,.5); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 13px; font-family: var(--mono); font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet-line); }
textarea { resize: vertical; min-height: 86px; line-height: 1.45; }
input[type=range] { width: 100%; accent-color: var(--violet-hi); }

.dial { display: flex; align-items: center; gap: 14px; }
.turns { display: flex; gap: 4px; }
.turns i { width: 14px; height: 4px; border-radius: 3px; background: rgba(237,231,246,.12); display: block; }
.turns i.on { background: var(--violet-hi); box-shadow: 0 0 10px rgba(169,139,212,.6); }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; }
.kv:first-child { border-top: 0; }
.kv b { font-weight: 500; font-variant-numeric: tabular-nums; }
.kv span { color: var(--muted); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid var(--line); font-size: 10px; padding: 8px 13px; }
.tabs button[aria-selected="true"] { color: var(--violet-pale); border-color: var(--violet-line); background: var(--violet-ghost); }

.msg { font-family: var(--mono); font-size: 11.5px; padding: 10px 12px; border-radius: 10px; margin-top: 12px; display: none; }
.msg.on { display: block; }
.msg.err { background: rgba(224,91,91,.1); color: #e8a0a0; border: 1px solid rgba(224,91,91,.25); }
.msg.ok { background: rgba(127,212,168,.08); color: #7fd4a8; border: 1px solid rgba(127,212,168,.22); }
.msg.work { background: var(--violet-ghost); color: var(--violet-pale); border: 1px solid var(--violet-line); }

/* ------------------------------------------------------------------- tables */

/* a table of eight columns does not fit a phone, and a page that scrolls sideways as a
   whole is worse than a table that scrolls on its own. */
.scrollx { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; contain: paint; }
.scrollx table { min-width: 560px; }

table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12.5px; }
th { text-align: left; font-weight: 500; color: var(--faint); font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; padding: 0 12px 10px 0; white-space: nowrap; }
td { padding: 12px 12px 12px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; }
tr:hover td { background: rgba(255,255,255,.02); }

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

footer { position: relative; z-index: 2; padding: 40px var(--gut) 110px; color: var(--faint);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; display: flex; gap: 18px;
  flex-wrap: wrap; justify-content: space-between; border-top: 1px solid var(--line); }
footer a { color: var(--muted); text-decoration: none; }
footer a:hover { color: var(--violet-pale); }

/* --------------------------------------------------------------------- docs */

/* the docs are a different gabarit on purpose: no stage, a sticky contents column,
   and one long measure of text — nothing here is a panel on a 3D scene. */
body.docs { background: #05040a; }
body.docs .vignette { background: radial-gradient(120% 80% at 80% 0%, rgba(45,26,66,.5), transparent 60%); }
.doc-wrap > * { min-width: 0; }
.doc pre, .doc table { max-width: 100%; }
.doc-wrap { position: relative; z-index: 2; display: grid; grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(26px, 5vw, 80px); max-width: 1160px; margin: 0 auto; padding: 104px var(--gut) 120px; }
.toc { position: sticky; top: 104px; align-self: start; }
.toc div { font-family: var(--mono); font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 14px; }
.toc a { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted);
  text-decoration: none; padding: 6px 0 6px 14px; border-left: 1px solid var(--line); }
.toc a:hover { color: var(--text); border-color: var(--violet-line); }
.toc a.on { color: var(--violet-pale); border-color: var(--violet-hi); }
.doc h1 { font-size: clamp(38px, 5.5vw, 64px); margin-bottom: 10px; }
.doc h2 { font-size: clamp(23px, 2.6vw, 31px); margin: 54px 0 14px; padding-top: 22px; border-top: 1px solid var(--line); }
.doc h3 { margin-top: 26px; }
.doc p, .doc li { color: #cdc6d8; font-size: 15.5px; line-height: 1.68; max-width: 70ch; }
.doc ul { padding-left: 18px; }
.doc li { margin-bottom: 8px; }
.doc code { font-family: var(--mono); font-size: 13px; color: var(--violet-pale);
  background: rgba(122,86,200,.11); padding: 2px 6px; border-radius: 5px; }
.doc pre { font-family: var(--mono); font-size: 12.5px; color: #d9d2e6; background: rgba(0,0,0,.45);
  border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; overflow-x: auto; line-height: 1.6; }
.doc pre code { background: none; color: inherit; padding: 0; }
.doc table { margin: 16px 0 6px; }
.doc .callout { border-left: 2px solid var(--violet-hi); background: rgba(122,86,200,.08);
  padding: 14px 18px; border-radius: 0 12px 12px 0; margin: 20px 0; }
.doc .callout p { margin: 0; color: #ded7e8; }

/* --------------------------------------------------------------------- small */

@media (max-width: 1020px) {
  .rail { display: none; }
  .split, .split.flip { grid-template-columns: 1fr; }
  .readout { grid-template-columns: repeat(2, 1fr); }
  .band { grid-template-columns: 1fr; }
  .band > div { border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; }
  .doc-wrap { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc a { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; margin: 0 6px 6px 0; }
}
@media (max-width: 560px) {
  .act { min-height: auto; padding: 96px var(--gut) 64px; }
  #well { min-height: 100svh; }
  .readout { grid-template-columns: 1fr 1fr; }
  .dock { left: 50%; transform: translateX(-50%); width: calc(100% - 2 * var(--gut)); justify-content: center; }
  .console { width: 100vw; }
  .chrome { padding: 14px var(--gut); }
  .wordmark b { font-size: 19px; }
}
