/* ─────────────────────────────────────────────────────────────────────
   Live wire, archive issues and /preprint. Loaded after stack.css by
   the_stack.html and the_preprint.html only, so it can't reach the archive index.
   Ink plus the one site accent: rules and type, no boxes.
   ───────────────────────────────────────────────────────────────────── */

/* ── Shared spider marks ─────────────────────────────────────────────── */
.sp-ring { fill: none; stroke: var(--rule-2); stroke-width: 1; }
.sp-spoke { stroke: var(--rule-2); stroke-width: 1; }
.sp-shape { fill: var(--ink); fill-opacity: .1; stroke: var(--ink); stroke-width: 1.25; stroke-linejoin: round; }
.sp-dot { fill: var(--ink); }
.sp-dot.is-primary { fill: var(--accent); }

/* ── The shape of the wire ───────────────────────────────────────────── */
.shape { background: var(--paper-2); border-top: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); }
.shape[hidden] { display: none !important; }
/* The Brief and the shape share one band, so no rule where they meet */
.brief:has(+ .shape:not([hidden])) { border-bottom: 0; }
.brief:not([hidden]) + .shape { border-top: 0; }
.shape--inline { margin-top: 2.2rem; background: none; border: 0; }
.shape--inline .wrap { padding: 0; }
.shape .wrap { padding-block: 1.35rem 1.5rem; }
.shape__head { display: flex; align-items: baseline; gap: .9rem; }
.shape__head h2 { margin: 0; white-space: nowrap; font: 600 .72rem/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); }
.shape__head hr { flex: 1; height: 0; margin: 0; border: 0; border-top: 1px solid var(--ink); }
.shape__grid { display: grid; grid-template-columns: minmax(0, 25rem) minmax(0, 1fr); gap: 0 2.5rem; align-items: center; margin-top: .75rem; }
.shape__figure { margin: 0; }
.shape__figure svg { display: block; width: 100%; height: auto; overflow: visible; }
.shape__figure figcaption { margin-top: .2rem; font: .72rem/1.4 var(--sans); color: var(--ink-4); text-align: center; }
.shape .sp-ring, .shape .sp-spoke { stroke: #cfc9bd; }
.sp-shape--day { fill: var(--accent); fill-opacity: .14; stroke: var(--accent); stroke-width: 1.75; }
.sp-spoke.is-selected { stroke: var(--accent); stroke-width: 1.5; }
.sp-tick { font: 10px var(--sans); fill: var(--ink-3); font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--paper-2); stroke-width: 3px; stroke-linejoin: round; }
.sp-axis { font: 500 13px var(--sans); fill: var(--ink-2); }
.sp-axis[data-beat] { cursor: pointer; }
.sp-axis[data-beat]:hover { fill: var(--accent); }
.sp-axis.is-selected { fill: var(--accent); font-weight: 700; }

.shape__reading { margin: 0; font: 1.32rem/1.34 var(--serif); color: var(--ink); text-wrap: pretty; }
.shape__reading b { font-weight: 600; }
.shape__also { margin: .5rem 0 0; font: .78rem/1.4 var(--sans); color: var(--ink-3); }
.shape__also:empty { display: none; }
.shape__also i { font-style: normal; color: var(--ink-4); font-variant-numeric: tabular-nums; }
.shape__also span { white-space: nowrap; }
.shape__also a { color: var(--accent); text-decoration: none; }
.shape__also a:hover { text-decoration: underline; text-underline-offset: 2px; }
.shape[data-mode="previous"] .shape__also { font-size: .85rem; margin-top: .85rem; }

/* Beat filter: a ruled table, not a row of pills */
.shape .chips { display: block; overflow: visible; margin-top: 1rem; padding: 0; border-top: 1px solid var(--ink); cursor: default; user-select: auto; -webkit-user-select: auto; }
.shape .chip {
  display: grid; grid-template-columns: minmax(0, 1fr) 4.5rem 1.8rem; gap: .75rem; align-items: center;
  width: 100%; padding: .36rem 0; border: 0; border-bottom: 1px solid var(--rule-2); border-radius: 0;
  background: transparent; color: var(--ink-2); text-align: left; white-space: normal;
  font: 500 .8rem/1.2 var(--sans);
}
.shape .chip i { margin: 0; text-align: right; color: var(--ink-3); }
.chip__bar { display: block; height: 3px; background: var(--rule-2); }
.chip__bar span { display: block; height: 100%; background: var(--ink-3); }
.shape .chip:hover { color: var(--accent); border-color: var(--rule-2); }
.shape .chip:hover .chip__bar span { background: var(--accent); }
.shape .chip[aria-pressed=true] { background: transparent; border-color: var(--rule-2); color: var(--accent); font-weight: 700; }
.shape .chip[aria-pressed=true] i { color: var(--accent); }
.shape .chip[aria-pressed=true] .chip__bar span { background: var(--accent); }
/* "All" is the default, not a selection: no bar, no accent */
.shape .chip[data-cat="all"] .chip__bar, .shape .chip[data-cat="__hl"] .chip__bar { visibility: hidden; }
.shape .chip[data-cat="all"][aria-pressed=true], .shape .chip[data-cat="all"][aria-pressed=true] i { color: var(--ink); }

/* ── Toolbar: one quiet row ──────────────────────────────────────────── */
.toolbar .wrap { padding-block: .6rem .55rem; }
.toolbar .bar-1 { flex-wrap: nowrap; align-items: baseline; justify-content: space-between; gap: 1.5rem; }
.toolbar .search { flex: 1 1 10rem; min-width: 8rem; max-width: 15rem; }
.toolbar .controls { flex: none; flex-wrap: nowrap; gap: 1.25rem; }
.activebeat { margin: .45rem 0 0; font: .78rem/1.3 var(--sans); color: var(--ink-3); }
.activebeat[hidden] { display: none; }
.activebeat b { color: var(--accent); font-weight: 600; }
.activebeat button { border: 0; background: none; padding: 0 .25rem; margin-left: .15rem; cursor: pointer; font: inherit; color: var(--ink-3); }
.activebeat button:hover { color: var(--accent); }

/* ── Story glyph ─────────────────────────────────────────────────────── */
.beat-glyph { display: block; width: 100%; max-width: 8.5rem; height: auto; margin: .35rem 0 .15rem; overflow: visible; }
.sp-tag { font: 500 10.5px var(--sans); fill: var(--ink-3); cursor: pointer; }
.sp-tag.is-primary { font-weight: 700; fill: var(--ink); }
.sp-tag:hover { fill: var(--accent); text-decoration: underline; }
.story:not(:hover) .beat-glyph .sp-shape { fill-opacity: .08; }
.story.is-read .beat-glyph, .story.is-read .beat-mark { opacity: .6; }

/* Front-page Share on archive issues: same look as .btn-share in stack.css */
.lead-link { border: 0; background: none; padding: 0; margin: 0 0 0 .2rem; cursor: pointer; font: 600 .68rem/1 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-4); vertical-align: baseline; transition: color .15s ease; }
.lead-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.lead-link.is-copied { color: var(--accent); font-weight: 700; }

/* Rail footer: the share icon stays on screen while the story does, then settles
   at the foot of the rail. The .rail-end wrapper starts below the meta and spider,
   so the footer can never ride up over them. */
.rail-end { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: flex-end; min-height: 0; }
.rail-foot { position: sticky; bottom: .75rem; display: flex; flex-direction: column; align-items: flex-start; padding-top: .6rem; }
.rail-share { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; margin: .1rem 0 0 -.47rem; padding: 0; border: 0; border-radius: 3px; background: none; color: var(--ink-4); cursor: pointer; transition: color .15s ease; }
.rail-share:hover { color: var(--accent); }
.rail-share svg { display: block; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rail-share .i-done { display: none; stroke-width: 2.2; }
.rail-share.is-copied { color: var(--accent); }
.rail-share.is-copied .i-share { display: none; }
.rail-share.is-copied .i-done { display: block; }

/* Phone byline mark and beat names: hidden until the phone layout */
.beat-mark, .beat-names { display: none; }
.beat-name { border: 0; background: none; margin: -.25rem 0; padding: .25rem 0; cursor: pointer; font: 500 .75rem/1.35 var(--sans); color: var(--ink-2); text-align: left; }
.beat-name.is-primary { font-weight: 700; color: var(--ink); }
.beat-name:hover { color: var(--accent); }
.beat-sep { color: var(--ink-4); }

/* ── Tablet and phone ────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .toolbar .bar-1 { flex-wrap: wrap; gap: .5rem 1.25rem; }
  .toolbar .search { flex: 1 1 100%; max-width: none; }
  .toolbar .controls { flex: 1 1 100%; flex-wrap: wrap; gap: .4rem 1.25rem; }
}
@media (max-width: 768px) {
  /* Filters sit in the shape section, so the phone gets its screen back */
  html[data-page] { --bar-h: 0px !important; }
  .toolbar { position: static; }

  .shape__grid { grid-template-columns: minmax(0, 1fr); gap: .7rem 0; }
  .shape__figure { order: 2; width: min(100%, 22rem); margin-inline: auto; }
  .shape__side { display: contents; }
  .shape__reading { order: 1; font-size: 1.14rem; }
  .shape[data-mode="today"] .shape__also, .shape__figure figcaption { display: none; }
  .shape[data-mode="previous"] .shape__also { order: 1; margin-top: -.25rem; }
  #shape-filter { display: contents; }
  .sp-axis { font-size: 15px; }
  .shape .chips { order: 3; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; margin-top: .2rem; }
  .shape .chip { grid-template-columns: minmax(0, 1fr) auto; padding: .55rem 0; }
  .chip__bar { display: none; }

  /* No side rail on phones: spider as a byline mark, meta and beat names beside it,
     share icon at the right. The icon's 44px target ends at the screen margin. */
  .rail-end, .rail-foot { display: contents; }
  .rail-end::before, .rail-foot::before { content: none !important; }
  .story:not(.shelf-card) > .rail { position: relative; padding-right: 2.1rem; }
  .rail .beat-glyph { display: none; }
  .rail-share { position: absolute; top: 50%; right: -.85rem; transform: translateY(-50%); width: 2.75rem; height: 2.75rem; margin: 0; }
  .story.has-beats .rail { min-height: 3.5rem; padding-left: 3.8rem; padding-bottom: 0; margin-bottom: .8rem; align-content: center; }
  .story.has-beats .rail > .beat-mark { display: block; position: absolute; top: 50%; left: 0; transform: translateY(-50%); width: 3.06rem; height: 3.5rem; }
  .story.has-beats .rail > .beat-names { display: block; flex-basis: 100%; }
  .story.has-beats .rail > .beat-names::before { content: none; }
  .story.has-beats .rail > .beat-names ~ * { margin-top: .1rem; }
  .story.has-beats .rail > .flag::before { content: none; }
}
@media (max-width: 400px) {
  .shape .chip { font-size: .76rem; }
}
@media print {
  .shape { display: none !important; }
  .beat-glyph, .beat-mark, .beat-names, .rail-end { display: none !important; }
}
