/* Relational Spectrums — page-scoped styles. The rails are self-colored (the poster's own
   palettes), so they are identical in both themes; everything else speaks the site tokens.
   Radii: --radius-sm/md + 999px pills, with 2/4px reserved as the poster-cell detail. */

/* the hidden attribute must always win: several containers carry their own display,
   and a styled display silently defeats the UA's [hidden] rule (it already bit three times) */
.spx [hidden] { display: none !important; }

.spx {
  --spx-gutter: clamp(3.5rem, 8vw, 6.5rem);
  position: relative;
  width: min(calc(100% - 2.5rem), 68rem);
  margin-inline: auto;
  padding-bottom: 6rem;
}
.spx > h1 {
  margin-top: clamp(3.5rem, 6vw, 5rem);
  margin-bottom: 1rem;
  max-width: none;
  font-size: clamp(2.6rem, 4.5vw, 4.25rem);
  line-height: 0.98;
}
.spx > .lede {
  margin-bottom: 1.2rem;
  max-width: 46rem;
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.6vw, 1.28rem);
  line-height: 1.62;
}
.spx > .ref {
  margin-bottom: 2.4rem;
  max-width: 46rem;
}
.spx-noscript {
  max-width: 46rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
}

/* the color key lives in the quiet zone right of the lede on wide screens */
.spx-key {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.1rem;
  margin: 0 0 1.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.spx-key__lead { color: var(--ink-soft); }
.spx-key__item { display: inline-flex; align-items: center; gap: 0.45rem; }
.spx-key__item i {
  width: 1.7rem;
  height: 0;
  border-top: 3px solid;
  border-radius: 999px;
}
.spx-key__item--pos i { border-color: var(--coral); }
.spx-key__item--neg i { border-color: var(--aqua); }
@media (min-width: 1000px) {
  .spx-key { position: absolute; top: clamp(9rem, 14vw, 12rem); right: 0; margin: 0; }
}

/* ---- the board ---- */
.spx-board {
  position: relative;
  display: grid;
  grid-template-columns: var(--spx-gutter) 1fr;
}
.spx-ribbons {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.spx-ribbons path[data-hit] { pointer-events: stroke; cursor: pointer; }
.spx-rows {
  grid-column: 2;
  display: grid;
  gap: clamp(1.1rem, 2.2vw, 1.7rem);
  min-width: 0;
}
@media (max-width: 720px) {
  .spx { --spx-gutter: 0px; }
  .spx-ribbons { display: none; }
  .spx-ord { display: none; }
}

.spx-row { position: relative; min-width: 0; }
.spx-ord {
  position: absolute;
  left: calc(-1 * var(--spx-gutter));
  top: 0;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  color: var(--cobalt);
}
.spx-poles {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  transition: opacity 180ms;
}
.spx-pole small {
  font-size: 0.85em;
  font-weight: 650;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: none;
}
.spx-pole--right { text-align: right; }
.spx-pole__short { display: none; }
@media (max-width: 720px) {
  .spx-pole__full { display: none; }
  .spx-pole__short { display: inline; }
}

/* poles + rail share column 1 so the right label ends where the bar ends */
.spx-railwrap {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 0.55rem;
  align-items: center;
}
.spx-railwrap > .spx-poles { grid-column: 1; grid-row: 1; }
.spx-railwrap > .spx-rail { grid-column: 1; grid-row: 2; }
.spx-railwrap > .spx-tools { grid-column: 2; grid-row: 2; }

.spx-rail {
  position: relative;
  display: flex;
  gap: 3px;
  height: 2.75rem;
  cursor: pointer;
  touch-action: pan-y;
  border-radius: 4px;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--ink) 18%, transparent);
  transition: opacity 180ms;
}
.spx-cell {
  flex: 1;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.07);
}
@media (prefers-color-scheme: dark) {
  .spx-cell { box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14); }
}
/* pinned = deliberate, never disabled: full-strength cells behind a dashed boundary */
.spx-row.is-pinned .spx-rail {
  outline: 1.5px dashed var(--ink-faint);
  outline-offset: 4px;
}
/* Focus mode used to fade every other row to 0.45. Those rows are exactly what the panel is
   for — you are assigning this spectrum's relationship TO them — so fading them greys out the
   controls the reader came to use. They stay legible; the focused row is marked instead. */
.spx-row.is-dim .spx-poles { opacity: 0.8; }
.spx-row.is-focus .spx-rail { outline: 2px solid var(--cobalt); outline-offset: 3px; }

/* entrance: the poster assembles from its own cells; pure CSS on server markup */
@media (prefers-reduced-motion: no-preference) {
  .spx-cell {
    animation: spx-cell-in 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--row, 0) * 55ms + var(--cell, 0) * 18ms);
  }
  .spx-ord, .spx-key {
    animation: spx-fade-in 400ms ease-out both;
    animation-delay: 500ms;
  }
}
@keyframes spx-cell-in {
  from { opacity: 0; transform: scaleY(0.55); }
  to { opacity: 1; transform: none; }
}
@keyframes spx-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* the comfort range: brackets + a veil over the ground the value may not enter */
.spx-band {
  position: absolute;
  top: -3px;
  bottom: -3px;
  border-inline: 2px solid var(--ink);
  pointer-events: none;
}
.spx-veil {
  position: absolute;
  top: 0;
  bottom: 0;
  background: color-mix(in oklab, var(--paper) 62%, transparent);
  pointer-events: none;
  transition: background-color 300ms;
}
.spx-row.is-clipped .spx-veil { background: color-mix(in oklab, var(--gold) 42%, transparent); }
.spx-bracket {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 34px;
  margin: -17px 0 0 -6px;
  padding: 0;
  border: 0;
  background: var(--ink);
  border-radius: 3px;
  cursor: ew-resize;
  touch-action: none;
}
.spx-bracket::after {
  content: "";
  position: absolute;
  inset: 4px 4px;
  border-radius: 2px;
  background: var(--paper-bright);
}

/* handles: a reading against the scale, not a bead on it. --hring is computed per-handle
   from the sampled fill's luminance so the ring never dissolves into its own rail. */
.spx-handle {
  position: absolute;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--hring, var(--paper-bright)), 0 1px 2px rgb(0 0 0 / 0.3);
  cursor: grab;
  touch-action: none;
}
.spx-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -10px;
  bottom: -10px;
  width: 1.5px;
  margin-left: -0.75px;
  background: var(--hring, var(--paper-bright));
}
.spx-handle:hover .spx-handle__tip { opacity: 1; }
.spx-handle:active { cursor: grabbing; }
.spx-handle--b {
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 4px;
  transform: rotate(45deg);
}
.spx-handle--b::before { display: none; }
.spx-handle__tip {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.1rem 0.45rem;
  border-radius: 0.5rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 120ms;
  pointer-events: none;
}
.spx-handle--b .spx-handle__tip { transform: translateX(-50%) rotate(-45deg); transform-origin: top center; }
.spx-row.is-dragging .spx-handle__tip, .spx-handle:focus-visible .spx-handle__tip { opacity: 1; }
.spx-handle--pinned::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: var(--hring, var(--paper-bright));
}

.spx-tools { display: flex; gap: 0.3rem; }
.spx-tool {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--paper-bright);
  color: var(--ink-soft);
  cursor: pointer;
  transition: transform 90ms, border-color 180ms, color 180ms;
}
.spx-tool:active { transform: scale(0.9); }
.spx-tool svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }
.spx-tool svg [stroke-width] { fill: none; stroke: currentColor; }
.spx-tool--tune svg { transition: transform 180ms; }
.spx-tool--tune[aria-expanded="true"] svg { transform: rotate(90deg); }
.spx-tool:hover { color: var(--ink); border-color: var(--ink-faint); }
.spx-tool[aria-pressed="true"], .spx-tool[aria-expanded="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
/* a phone gives the poster the full width; the tools drop under the rail's right end */
@media (max-width: 720px) {
  .spx-railwrap { grid-template-columns: 1fr; }
  .spx-railwrap > .spx-poles { grid-column: 1; grid-row: 1; }
  .spx-railwrap > .spx-rail { grid-column: 1; grid-row: 2; }
  .spx-railwrap > .spx-tools {
    grid-column: 1;
    grid-row: 3;
    justify-content: flex-end;
    margin-top: 0.45rem;
  }
  .spx-tools { gap: 0.45rem; }
  .spx-tool { width: 2.6rem; height: 2.6rem; }
  .spx-tool svg { width: 17px; height: 17px; }
}

/* ---- threads under rows while a spectrum is focused: the instrument's close-up ---- */
.spx-thread { overflow: hidden; }
.spx-thread__inner { padding: 0.55rem 0 0.15rem; }
.spx-thread--panel .spx-thread__inner {
  margin-top: 0.55rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--paper-bright);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.spx-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.spx-seg button {
  padding: 0.28rem 0.75rem;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms, color 160ms;
}
.spx-seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.spx-linkish {
  border: 0;
  background: none;
  padding: 0;
  color: var(--cobalt);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* a focused row's neighbours each carry one compact rail: caption left, scale right */
.spx-thread__row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
}
.spx-thread__cap {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.spx-wrail {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 0.7rem;
  width: 100%;
}
.spx-wrail__ends {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.spx-thread__row .spx-wrail { width: 100%; }
.spx-thread__row .spx-wrail__ends { display: none; }
.spx-wrail__track {
  position: relative;
  height: 20px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(90deg,
    color-mix(in oklab, var(--aqua) 55%, var(--surface-2)),
    var(--surface-2) 46%, var(--surface-2) 54%,
    color-mix(in oklab, var(--coral) 60%, var(--surface-2)));
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.spx-wrail__tick {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: var(--line-2);
}
.spx-chip {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  padding: 0;
  border: 3px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.35);
  cursor: grab;
  touch-action: none;
  transition: background-color 160ms;
}
.spx-chip:active { cursor: grabbing; }
.spx-wrail__track::before { content: ""; position: absolute; inset: -14px 0; }
.spx-wrail[data-sign="pos"] .spx-chip { background: var(--coral); }
.spx-wrail[data-sign="neg"] .spx-chip { background: var(--aqua); }
.spx-wrail__value {
  min-width: 4ch;
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
@media (max-width: 720px) {
  .spx-chip { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
  .spx-thread__row { flex-wrap: wrap; justify-content: flex-start; }
  .spx-thread__row .spx-wrail { width: 100%; }
}

/* ---- controls: one instrument surface, no native chrome ---- */
.spx-ui { margin-top: 2.2rem; }
.spx-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.7rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-bright);
  font-size: 0.82rem;
}
.spx-controls button:not(.spx-seg button), .spx-strain button,
.spx-pretools button:not(.spx-seg button), .spx-sharebar button,
.spx-cell-editor__acts button {
  padding: 0.32rem 0.75rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 90ms, border-color 180ms, background-color 160ms, color 160ms;
}
.spx-controls button:not(.spx-seg button):hover, .spx-strain button:hover,
.spx-pretools button:not(.spx-seg button):hover, .spx-sharebar button:hover {
  border-color: var(--ink-faint);
}
.spx-controls button:active { transform: scale(0.94); }
.spx-controls button[aria-pressed="true"]:not(.spx-seg button) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.spx-controls button:disabled { opacity: 0.4; cursor: default; }
.spx-controls .spx-quiet, .spx-pretools .spx-quiet { border-color: transparent; color: var(--ink-soft); }
.spx-controls .spx-quiet:hover, .spx-pretools .spx-quiet:hover { border-color: var(--line-2); }
.spx-pretools [data-share] { min-width: 6ch; }
.spx-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink-soft);
  font-weight: 700;
}
.spx-controls select, .spx-sharebar input,
.spx-cell-editor input[type="number"] {
  appearance: none;
  height: 2.125rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 650;
}
.spx-controls select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23887f6e' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
}
.spx-depth { transition: opacity 180ms; }
.spx-depth.is-parked { opacity: 0.35; pointer-events: none; }
.spx-spacer { flex: 1; }
@media (max-width: 720px) { .spx-spacer { display: none; } }

.spx-sharebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.spx-sharebar input { flex: 1; min-width: 14rem; font-variant-numeric: tabular-nums; }
.spx-status { margin: 0.6rem 0 0; font-size: 0.82rem; font-weight: 700; color: var(--brand-2); }


/* ---- strain: a small taut instrument, not a stray rule ---- */
.spx-strain[hidden] { display: none; }
.spx-strain {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.8rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.spx-strain__track {
  flex: 0 0 14rem;
  height: 7px;
  border-radius: 999px;
  background: var(--surface-hi);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.spx-strain__track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--coral));
}
.spx-strain__word { min-width: 6ch; font-weight: 750; text-transform: none; letter-spacing: 0.02em; }

.spx-readout {
  margin-top: 1.6rem;
  max-width: 46rem;
  font-family: var(--serif);
  font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  line-height: 1.6;
  color: var(--ink);
}

/* ---- the lattice: one ruled table in the site's own joined-grid idiom ---- */
.spx-lattice-wrap { margin-top: 2rem; }
.spx-lattice-wrap > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  color: var(--ink);
  padding: 0.4rem 0;
}
.spx-lattice-wrap > summary::-webkit-details-marker { display: none; }
.spx-lattice-wrap > summary::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.55em;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(-45deg) translateY(-0.1em);
  transition: transform 180ms;
}
.spx-lattice-wrap[open] > summary::before { transform: rotate(45deg); }
.spx-lattice-wrap > .ref { max-width: 46rem; margin: 0.4rem 0 0.9rem; }
.spx-lattice-scroll { max-width: 100%; overflow-x: auto; }
.spx-lattice {
  display: grid;
  gap: 1px;
  width: 100%;
  min-width: 30rem;
  padding: 1px;
  background: var(--line);
  border-radius: var(--radius-md);
  overflow: clip;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.spx-lattice .spx-lab {
  display: grid;
  place-items: center;
  padding: 0.45rem 0.6rem;
  background: var(--paper-bright);
  font-size: 0.74rem;
}
/* This corner is the key to reading the whole grid — which axis listens and which speaks — so
   it cannot be the faintest, smallest text on the page. */
.spx-lattice .spx-lab--corner {
  justify-items: start;
  font-size: 0.66rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
.spx-lattice .spx-lab--row { justify-items: end; }
.spx-lattice button {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 3.1rem;
  border: 0;
  border-radius: 0;
  background: var(--paper-bright);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: ew-resize;
  touch-action: none;
  transition: background-color 160ms, box-shadow 160ms;
}
.spx-lattice button .spx-cellbg {
  position: absolute;
  inset: 0;
  background: color-mix(in oklab, var(--tone) calc(var(--w) * 55%), transparent);
  transition: background-color 160ms;
  pointer-events: none;
}
.spx-lattice button span { position: relative; }
.spx-lattice button:hover { box-shadow: inset 0 0 0 1.5px var(--ink-faint); }
.spx-lattice button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--cobalt); }
.spx-lattice button:disabled { background: var(--surface-2); cursor: default; }
.spx-lattice button[data-note]::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cobalt);
}
@media (max-width: 720px) {
  .spx-lattice .spx-lab--row {
    position: sticky;
    left: 1px;
    z-index: 1;
  }
  .spx-lattice-scroll {
    -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
    mask-image: linear-gradient(90deg, #000 92%, transparent);
  }
}

.spx-cell-editor {
  margin-top: 1.1rem;
  padding: 1.15rem 1.35rem 1.25rem;
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  background: var(--paper-bright);
}
/* The two directions of a pair sit side by side: the reverse ear is never off-screen. */
.spx-cell-editor__dir + .spx-cell-editor__dir { margin-top: 1.15rem; }
@media (min-width: 860px) {
  .spx-cell-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 2.2rem;
    row-gap: 1.1rem;
    align-items: start;
  }
  .spx-cell-editor__dir + .spx-cell-editor__dir { margin-top: 0; }
  .spx-cell-editor__acts, .spx-cell-editor .spx-note, .spx-cell-editor .spx-note__law {
    grid-column: 1 / -1;
  }
}
/* Linked, the pair moves as one, so the second rail is a readout of the same decision. */
/* Linked, the second direction mirrors the first — but it is still editable, and 0.72 opacity
   reads as switched off. Say it with a label instead of by dimming a live control. */
.spx-cell-editor.is-linked [data-dir-rev] .spx-cell-editor__name::after {
  content: " (mirrors the first)";
  font-weight: 600;
  color: var(--ink-faint);
}
.spx-cell-editor__name { margin: 0 0 0.6rem; font-size: 0.95rem; font-weight: 700; color: var(--ink); }
.spx-cell-editor__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.9rem; }
.spx-cell-editor__acts [data-cell-link][aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.spx-cell-editor input[type="number"] { width: 5.5rem; border-radius: 999px; text-align: center; }
.spx-note { display: grid; gap: 0.3rem; margin-top: 0.8rem; font-size: 0.76rem; font-weight: 700; color: var(--ink-soft); }
.spx-note textarea {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: 0.82rem/1.5 var(--sans);
  resize: vertical;
}
.spx-note__law { margin: 0.35rem 0 0; font-size: 0.72rem; color: var(--ink-soft); }

.spx-after { margin-top: 3.5rem; max-width: 46rem; }
.spx-after h2 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); line-height: 1.1; }
.spx-after p { color: var(--ink-soft); }

/* a phone hides the ribbons; a travelling listener surfaces its number instead */
.spx-row.is-echoing .spx-handle__tip { opacity: 1; }

/* ---- Baseline: the way in, and the questions behind it ---- */
.spx-baseline-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.55rem 1rem;
  margin: 0 0 1.6rem;
}
.spx-baseline-btn {
  padding: 0.7rem 1.5rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 700 1rem/1 var(--sans);
  cursor: pointer;
  transition: transform 90ms, box-shadow 200ms, background-color 160ms;
}
.spx-baseline-btn:hover { box-shadow: 0 4px 18px oklch(0 0 0 / 0.18); }
.spx-baseline-btn:active { transform: scale(0.97); }
/* Cold start: nothing is threaded, so the way in is the loudest thing on the board. */
.spx-baseline-entry.is-cold .spx-baseline-btn {
  padding: 0.85rem 1.9rem;
  font-size: 1.08rem;
  box-shadow: 0 6px 26px oklch(0 0 0 / 0.16);
}
.spx-baseline-note { font-size: 0.8rem; font-weight: 650; color: var(--ink-soft); }

.spx-intake {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 2rem);
  background: oklch(0.16 0.01 70 / 0.62);
  backdrop-filter: blur(6px) saturate(0.9);
  overflow-y: auto;
}
@media (prefers-reduced-motion: no-preference) {
  .spx-intake { animation: spx-fade-in 180ms ease-out both; }
  .spx-intake__card { animation: spx-card-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both; }
  .spx-intake__opt { animation: spx-opt-in 260ms cubic-bezier(0.22, 1, 0.36, 1) both; }
  .spx-intake__opts .spx-intake__opt:nth-child(1) { animation-delay: 40ms; }
  .spx-intake__opts .spx-intake__opt:nth-child(2) { animation-delay: 80ms; }
  .spx-intake__opts .spx-intake__opt:nth-child(3) { animation-delay: 120ms; }
  .spx-intake__opts .spx-intake__opt:nth-child(4) { animation-delay: 160ms; }
}
@keyframes spx-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes spx-opt-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.spx-intake__card {
  width: min(46rem, 100%);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: clamp(1.25rem, 3vw, 2.1rem);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-md);
  background: var(--paper-bright);
  box-shadow: 0 24px 70px oklch(0 0 0 / 0.28);
}
.spx-intake__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.spx-intake__step {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.spx-intake__close {
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: 700 0.78rem/1 var(--sans);
  cursor: pointer;
}
.spx-intake__close:hover { border-color: var(--ink-faint); color: var(--ink); }
.spx-intake__progress {
  margin: 0 0 0 auto;
  align-self: center;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
/* The situation and the question are one passage, not a caption perched on a headline: same
   family, one step apart in size and weight, set close enough to read as continuous prose. */
.spx-intake__scene {
  margin: 1.5rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1rem, 1.5vw, 1.14rem);
  line-height: 1.5;
  color: var(--ink-soft);
}
.spx-intake__scene + .spx-intake__scene { margin-top: 0.45rem; }
.spx-intake__q {
  margin: 0.55rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  line-height: 1.3;
  color: var(--ink);
}
/* With no heading above it, a question that opens its own card needs the room a heading took. */
.spx-intake__tracks + .spx-intake__q { margin-top: 1.5rem; }
.spx-intake__q:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 4px; }
.spx-intake__hint { margin: 0.4rem 0 0; font-size: 0.78rem; color: var(--ink-soft); }
.spx-intake__note { margin: 0.9rem 0 0; font-size: 0.82rem; color: var(--ink-soft); }
.spx-intake__opts { display: grid; gap: 0.55rem; margin-top: 1.4rem; }
.spx-intake__opt {
  position: relative;
  padding: 1rem 1.15rem 1rem 1.5rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: 600 1rem/1.45 var(--sans);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform 90ms, border-color 160ms, background-color 160ms,
              box-shadow 200ms, padding-left 200ms;
}
/* One of these is chosen, so approach lights a single edge rather than the whole row —
   the four stay a set right up until one is taken. */
.spx-intake__opt::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cobalt);
  transform: scaleY(0);
  transform-origin: 50% 50%;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
.spx-intake__opt:hover, .spx-intake__opt:focus-visible {
  border-color: var(--ink-faint);
  background: var(--paper-bright);
  box-shadow: 0 3px 14px oklch(0 0 0 / 0.07);
  padding-left: 1.7rem;
}
.spx-intake__opt:hover::before, .spx-intake__opt:focus-visible::before { transform: scaleY(1); }
.spx-intake__opt:active { transform: scale(0.995); }
.spx-intake__acts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin-top: 1.5rem; }
.spx-intake__go {
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 700 0.92rem/1 var(--sans);
  cursor: pointer;
}
.spx-intake__quiet {
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: 700 0.88rem/1 var(--sans);
  cursor: pointer;
}
.spx-intake__quiet:hover { border-color: var(--line-2); color: var(--ink); }

.spx-mini { display: grid; gap: 2px; margin-top: 1.2rem; }
.spx-mini__lab {
  display: grid;
  place-items: center;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.spx-mini__cell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--surface-2);
}
.spx-mini__cell[data-state="self"] { background: transparent; }
.spx-mini__cell[data-state="unset"] { background: var(--surface-2); }
/* Asked and empty is a fact, so it reads as a closed cell rather than a blank one. */
.spx-mini__cell[data-state="empty"] {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.spx-mini__cell[data-state="provisional"] {
  background: color-mix(in oklab, var(--coral) 34%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--coral) 55%, transparent);
}
.spx-mini__cell[data-state="same"] { background: var(--coral); }
.spx-mini__cell[data-state="opposite"] { background: var(--aqua); }

.spx-mini-rail {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  font-weight: 750;
  color: var(--ink-soft);
}
.spx-mini-rail__track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  cursor: pointer;
  touch-action: none;
}
.spx-mini-rail__mark {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  padding: 0;
  border: 3px solid var(--paper-bright);
  border-radius: 50%;
  background: var(--ink-soft);
  box-shadow: 0 1px 4px oklch(0 0 0 / 0.3);
  cursor: grab;
  touch-action: none;
}
.spx-mini-rail__note {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--ink-faint);
}

/* Lattice cell states: never-asked and asked-and-empty must not read the same. */
.spx-lattice button[data-state="unset"] span { opacity: 0.5; }
.spx-lattice button[data-state="empty"] { background: var(--surface-2); }
.spx-lattice button[data-state="empty"] span { opacity: 0.75; }
.spx-lattice button[data-state="provisional"] { box-shadow: inset 0 0 0 2px var(--line-2); }
.spx-lattice button[data-state="provisional"] span { font-style: italic; opacity: 0.85; }

/* A lattice cell is a control you drag, so it says so on approach rather than after. */
.spx-lattice button:not(:disabled)::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, color-mix(in oklab, var(--aqua) 22%, transparent), transparent 34%),
    linear-gradient(270deg, color-mix(in oklab, var(--coral) 22%, transparent), transparent 34%);
  opacity: 0;
  transition: opacity 160ms;
  pointer-events: none;
}
.spx-lattice button:not(:disabled):hover::before,
.spx-lattice button:not(:disabled):focus-visible::before { opacity: 1; }
.spx-lattice button:not(:disabled):hover { box-shadow: inset 0 0 0 1.5px var(--ink-faint); }
.spx-lattice button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--cobalt); }
.spx-lattice button:active { box-shadow: inset 0 0 0 2px var(--ink); }

/* A rail chip under the hand gets bigger, so a drag never feels like a slip. */
.spx-chip { transition: background-color 160ms, transform 120ms, box-shadow 160ms; }
.spx-wrail__track:hover .spx-chip { transform: scale(1.08); }
.spx-chip:active { transform: scale(1.14); box-shadow: 0 2px 10px oklch(0 0 0 / 0.4); }
.spx-chip:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }

/* The rail reads its own sign: the live half lights, the dead half stays quiet. */
.spx-wrail[data-sign="pos"] .spx-wrail__ends i:last-child,
.spx-wrail[data-sign="neg"] .spx-wrail__ends i:first-child { color: var(--ink); }
.spx-wrail[data-sign="none"] .spx-wrail__ends i:nth-child(2) { color: var(--ink); }

/* Asking about a square is offered as the equal of setting its number, not as a footnote. */
.spx-cell-ask {
  border-color: var(--cobalt) !important;
  color: var(--cobalt) !important;
  font-weight: 750 !important;
}
.spx-cell-ask:hover {
  background: var(--cobalt) !important;
  border-color: var(--cobalt) !important;
  color: var(--paper) !important;
}

/* The way onward stays reachable without scrolling for it: the card scrolls, so the actions
   ride its bottom edge rather than sitting at the end of whatever the screen happens to hold. */
.spx-intake__acts {
  position: sticky;
  bottom: calc(clamp(1.25rem, 3vw, 2.1rem) * -1);
  z-index: 1;
  margin-top: 1.5rem;
  padding-block: 0.9rem;
  background: linear-gradient(to top,
    var(--paper-bright) 0 72%, color-mix(in oklab, var(--paper-bright) 0%, transparent));
}

/* Three ways in, differing in reach. The bar rides every screen so changing depth never costs
   a trip back to a menu, and a track that has run out says so instead of going quiet. */
.spx-intake__tracks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.spx-intake__track {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.9rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: 750 0.82rem/1 var(--sans);
  cursor: pointer;
  transition: background-color 160ms, border-color 160ms, color 160ms;
}
.spx-intake__track:hover:not(:disabled) { border-color: var(--ink-faint); color: var(--ink); }
.spx-intake__track[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.spx-intake__track:disabled { opacity: 0.42; cursor: default; }
.spx-intake__trackn {
  min-width: 1.4em;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: color-mix(in oklab, currentColor 16%, transparent);
  font-size: 0.74em;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Saying there is no link is a different kind of answer from placing one, so it sits apart
   from the gradient rather than reading as its quietest member. */
.spx-intake__opt--none {
  margin-top: 0.5rem;
  border-style: dashed;
  color: var(--ink-soft);
  font-weight: 560;
}
.spx-intake__opt--none::before { background: var(--ink-faint); }

/* ---- the way in, centred, with its explanation beside it ---- */
.spx-baseline-entry {
  justify-content: center;
  align-items: center;
  margin: clamp(2rem, 5vw, 3.2rem) 0 2.4rem;
  text-align: center;
}
.spx-baseline-note { flex-basis: 100%; }
.spx-explain-btn {
  padding: 0.7rem 1.3rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 700 0.95rem/1 var(--sans);
  cursor: pointer;
  transition: border-color 160ms, background-color 160ms;
}
.spx-explain-btn:hover { border-color: var(--ink); background: var(--paper-bright); }

/* ---- what the seven are: as long as it needs to be, folded until asked for ---- */
.spx-explain__title { margin: 1.4rem 0 0; font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.15; }
.spx-explain__lede {
  margin: 0.7rem 0 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.spx-explain__item { margin-top: 2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.spx-explain__name { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }
.spx-explain__rail {
  display: flex;
  gap: 2px;
  height: 0.85rem;
  margin: 0.6rem 0 0.35rem;
  border-radius: 3px;
  overflow: hidden;
}
.spx-explain__rail i { flex: 1; }
.spx-explain__poles {
  display: flex;
  justify-content: space-between;
  margin: 0;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.spx-explain__about { margin: 0.7rem 0 0; color: var(--ink-soft); line-height: 1.6; }
/* Three examples across, in the spectrum's own direction: cool at the left pole, warm at the
   right, so the row reads as the rail it describes rather than as a stack of links. */
.spx-explain__examples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 0.85rem;
}
@media (max-width: 640px) {
  .spx-explain__examples { grid-template-columns: 1fr; }
}
.spx-explain__ex {
  --tint: oklch(0.70 0.085 195);
  padding: 0.55rem 0.7rem;
  border: 1px solid color-mix(in oklab, var(--tint) 45%, transparent);
  border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--tint) 9%, transparent);
  align-self: start;
}
.spx-explain__ex[style*="--ex: 1"] { --tint: oklch(0.745 0.105 95); }
.spx-explain__ex[style*="--ex: 2"] { --tint: oklch(0.675 0.145 50); }
.spx-explain__ex > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.35;
  color: color-mix(in oklab, var(--tint) 72%, var(--ink));
}
.spx-explain__ex > summary::-webkit-details-marker { display: none; }
.spx-explain__ex > summary::before { content: "+ "; font-weight: 800; }
.spx-explain__ex[open] > summary::before { content: "3 "; }
.spx-explain__ex[open] { background: color-mix(in oklab, var(--tint) 14%, transparent); }
.spx-explain__ex > p {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.spx-explain__law {
  margin: 2rem 0 0;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--ink-faint);
}

/* ---- the lattice is the instrument's other half, not a disclosure ---- */
.spx-lattice-head {
  margin: 0 0 0.3rem;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  line-height: 1.15;
}
.spx-lattice-wrap { margin-top: 3rem; }

/* In focus mode each other row carries the rail that assigns ITS relationship to the focused
   one. Sitting below the spectrum it adjusts, it read as a separate list; laid over the rail
   itself, the control and the thing it controls are the same object. */
.spx-row.is-dim .spx-thread {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 0.3rem 0.55rem;
  border-radius: 4px;
  background: color-mix(in oklab, var(--paper-bright) 90%, transparent);
  box-shadow: 0 1px 10px oklch(0 0 0 / 0.16), inset 0 0 0 1px var(--line-2);
  backdrop-filter: blur(3px);
}
.spx-row.is-dim .spx-thread__inner { width: 100%; }
.spx-row.is-dim .spx-thread .spx-wrail__track { height: 16px; }
@media (max-width: 720px) {
  .spx-row.is-dim .spx-thread { position: static; backdrop-filter: none; margin-top: 0.4rem; }
}

/* ---- controls: two even groups below, the board's own settings above ---- */
.spx-pretools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.7rem 1.2rem;
  margin: 0 0 1.8rem;
}
.spx-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.7rem 1.2rem;
  padding: 0.7rem 0.9rem;
}
.spx-controls__group,
.spx-pretools__acts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
/* One height and one shape for every control, so a row of them reads as a row rather than as
   whatever each widget happened to measure. */
.spx-controls button:not(.spx-seg button),
.spx-pretools button:not(.spx-seg button) {
  min-height: 2.125rem;
  padding-inline: 0.95rem;
}
.spx-seg button { min-height: 2.125rem; }
.spx-pretools [data-share] { min-width: 0; }
@media (max-width: 720px) {
  .spx-controls { justify-content: center; }
  .spx-controls__group { justify-content: center; }
}

/* Both spectrums a question is about, captioned so its shape is visible without naming the
   machinery: if this one moves, does that one move with it or against it. */
.spx-pair {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}
@media (min-width: 780px) { .spx-pair { grid-template-columns: 1fr 1fr; gap: 1.6rem; } }
.spx-pair__cap {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.spx-pair .spx-mini-rail { margin-top: 0; padding-top: 0; border-top: 0; }

/* The follow-up restates what was just said, quietly, so it is plainly about that and nothing
   else — the reader should never have to hold the previous screen in mind. */
.spx-intake__said {
  margin: 0.6rem 0 0;
  padding-left: 0.85rem;
  border-left: 2px solid var(--line-2);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* Small controls stay comfortable on a touch screen. 29px clears the 24px minimum but is a
   mean target for a thumb, and these are the controls a reader uses most. */
@media (pointer: coarse) {
  .spx-intake__track { min-height: 2.5rem; padding-inline: 1rem; }
  .spx-intake__quiet, .spx-intake__go, .spx-intake__close { min-height: 2.5rem; }
  .spx-explain__ex > summary { min-height: 2.25rem; display: flex; align-items: center; }
}

.spx-review-link {
  margin: 0 0 1.4rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
