/* Slot Tailor — the pattern book.
 *
 * A configurator, laid out the way the good ones are: the thing being built large and
 * still on one side, the choices beside it, and the WHOLE build visible at all times.
 * Every step is a section of one page; collapsed it shows what was chosen, open it shows
 * the choices. A thread runs down the left through a knot per step and turns brass as
 * each one is answered -- the progress bar and the table of contents are the same line.
 *
 * One accent (brass: chosen, primary, done), one warning red (ruled out), and neutrals.
 * Every text token below is checked against its surface for WCAG AA at the size it is
 * used; the dark theme is the default because the preview cabinet is always dark.
 */

:root {
  color-scheme: dark light;

  --bg: #101216;
  --bg-2: #14171c;
  --card: #181b21;
  --card-2: #1e222a;
  --plate: #121519;
  --line: #262b34;
  --line-2: #363d49;
  --text: #eeeae1;          /* 14.9:1 on --card */
  --text-2: #b9b4a8;        /*  8.6:1 */
  --text-3: #908b7f;        /*  5.1:1 */

  --accent: #d6ae5c;        /*  8.4:1 as text; brass: chosen, primary, done */
  --accent-2: #e6c27a;
  --accent-ink: #1c1507;
  --accent-soft: rgba(214, 174, 92, .11);
  --accent-line: rgba(214, 174, 92, .5);
  --stop: #e8897a;          /*  6.3:1 */
  --stop-soft: rgba(232, 137, 122, .1);
  --warn: #e3b75e;
  --warn-soft: rgba(227, 183, 94, .1);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 18px 40px -24px rgba(0, 0, 0, .9);
  --glow: 0 0 0 1px var(--accent-line), 0 10px 30px -18px rgba(214, 174, 92, .55);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --bar-h: 68px;
  --pv-w: 460px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* the names preview.css reads, so the shared cabinet wears this theme */
  --ink: var(--text);
  --ink-2: var(--text-2);
  --muted: var(--text-3);
  --rule: var(--line);
  --rule-strong: var(--line-2);
  --surface: var(--card);
  --surface-2: var(--card-2);
  --lift: var(--shadow-2);
  --r: 12px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3efe7;
  --bg-2: #ede8dd;
  --card: #fffdf8;
  --card-2: #f8f4ec;
  --plate: #f1ece2;
  --line: #e2dbcd;
  --line-2: #cdc3b0;
  --text: #1c1a16;          /* 16.6:1 on --card */
  --text-2: #524d45;        /*  8.0:1 */
  --text-3: #6f695e;        /*  5.3:1 */
  --accent: #86630f;        /*  5.4:1 as text and under white */
  --accent-2: #a07814;
  --accent-ink: #ffffff;
  --accent-soft: rgba(134, 99, 15, .09);
  --accent-line: rgba(134, 99, 15, .45);
  --stop: #a8392f;          /*  6.4:1 */
  --stop-soft: rgba(168, 57, 47, .07);
  --warn: #8a5c0e;
  --warn-soft: rgba(138, 92, 14, .08);
  --shadow-1: 0 1px 2px rgba(40, 32, 20, .06);
  --shadow-2: 0 1px 2px rgba(40, 32, 20, .06), 0 16px 34px -22px rgba(40, 32, 20, .35);
  --glow: 0 0 0 1px var(--accent-line), 0 10px 26px -18px rgba(134, 99, 15, .5);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--bar-h) + 16px); }

body {
  margin: 0; min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.ic {
  width: 18px; height: 18px; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.btn:hover { background: var(--card-2); color: var(--text); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn.icon { width: 38px; padding: 0; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
  box-shadow: 0 8px 20px -12px var(--accent);
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.btn.quiet { border-color: transparent; color: var(--text-3); padding: 0 10px; }
.btn.quiet:hover { color: var(--text); background: var(--card-2); }
.btn.sure { border-color: var(--stop); color: var(--stop); width: auto; padding: 0 12px; }

.show-narrow { display: none; }

/* ------------------------------------------------------------------ the bar */

.bar {
  position: sticky; top: 0; z-index: 40; height: var(--bar-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.bar-in {
  height: 100%; max-width: 1520px; margin: 0 auto; padding: 0 28px;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 32px;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--card-2); border: 1px solid var(--line-2); color: var(--accent);
}
.brand-mark .ic { width: 19px; height: 19px; }
.brand-words b { display: block; font: 600 19px/1.1 var(--serif); letter-spacing: -.01em; }
.brand-words em { display: block; font-style: normal; font-size: 12px; color: var(--text-3); letter-spacing: .02em; }
.bar-tools { display: flex; align-items: center; gap: 8px; }

/* a measuring tape: one tick per step, filled to the steps answered */
.tape { display: flex; align-items: center; gap: 14px; justify-self: center; width: min(420px, 100%); }
.tape-track { position: relative; flex: 1; height: 16px; }
.tape-track::before {
  content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 2px;
  background: var(--line-2); border-radius: 2px;
}
#tape-fill {
  position: absolute; left: 0; top: 7px; height: 2px; width: 0; border-radius: 2px;
  background: var(--accent); transition: width .5s var(--ease);
}
#tape-ticks { position: absolute; inset: 0; display: flex; justify-content: space-between; }
#tape-ticks i {
  width: 2px; height: 10px; margin-top: 3px; border-radius: 1px; background: var(--line-2);
  transition: background .3s;
}
#tape-ticks i.on { background: var(--accent); }
.tape-label { font-size: 13px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tape-label b { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------------ layout */

.work {
  max-width: 1520px; margin: 0 auto; padding: 0 28px;
  display: grid; grid-template-columns: minmax(0, 1fr) var(--pv-w); gap: 40px;
  align-items: start;
}
.book { padding: 36px 0 80px; min-width: 0; max-width: 980px; }
.book:focus { outline: none; }

/* ------------------------------------------------------------------ intro */

.intro { margin: 0 0 28px 56px; }
.intro h1 {
  margin: 0 0 8px; font: 600 clamp(30px, 3vw, 40px)/1.1 var(--serif);
  letter-spacing: -.02em; text-wrap: balance;
}
.intro p { margin: 0; max-width: 60ch; color: var(--text-2); font-size: 16px; }

.alert {
  margin: 0 0 20px 56px; padding: 14px 16px; border-radius: var(--r);
  background: var(--stop-soft); border: 1px solid color-mix(in srgb, var(--stop) 40%, transparent);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: start;
}
.alert b.h { display: block; font-size: 13px; color: var(--stop); letter-spacing: .02em; }
.alert ul { margin: 6px 0 0; padding-left: 18px; font-size: 14px; color: var(--text-2); }
.alert li b { color: var(--text); }

/* ------------------------------------------------------------------ the steps */

.steps { list-style: none; margin: 0; padding: 0; }

.piece {
  display: grid; grid-template-columns: 56px minmax(0, 1fr);
  position: relative;
}
.piece + .piece { margin-top: 12px; }

/* the thread: a knot per step, and the line from it to the next knot */
.knot-col { position: relative; }
.knot-col::after {
  content: ""; position: absolute; left: 19px; top: 52px; bottom: -12px; width: 2px;
  background: var(--line); transition: background .4s;
}
.piece:last-child .knot-col::after { display: none; }
.piece.is-done .knot-col::after { background: var(--accent-line); }

.knot {
  position: absolute; left: 2px; top: 16px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg); border: 1.5px solid var(--line-2); color: var(--text-3);
  transition: background .3s, border-color .3s, color .3s, box-shadow .3s;
}
.knot .ic { width: 17px; height: 17px; }
.piece.is-done .knot { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.piece.is-open .knot {
  border-color: var(--accent); background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}
.piece.is-open .card { border-color: var(--line-2); box-shadow: var(--shadow-2); }

.head {
  width: 100%; min-height: 68px; padding: 12px 18px 12px 20px; border: 0; background: none;
  display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; align-items: center;
  gap: 18px; text-align: left;
}
.head:hover { background: var(--card-2); }
.piece.is-open .head:hover { background: none; }
.head-titles { display: grid; gap: 1px; min-width: 0; }
.kicker {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-3);
}
.piece.is-open .kicker { color: var(--accent); }
.title { font: 600 19px/1.25 var(--serif); letter-spacing: -.01em; color: var(--text); }
.sum {
  justify-self: end; min-width: 0; max-width: 100%;
  font-size: 14px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sum.none { color: var(--text-3); }
.sum.set::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 9px; vertical-align: 1px;
}
.chev {
  grid-column: -2; grid-row: 1;
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  color: var(--text-3); transition: transform .25s var(--ease), color .2s;
}
.piece.is-open .chev { transform: rotate(180deg); color: var(--text); }
.piece.is-open .sum { display: none; }

.body {
  padding: 4px 20px 22px;
  animation: open .32s var(--ease);
}
@keyframes open { from { opacity: 0; transform: translateY(-6px); } }
.lede { margin: 0 0 16px; max-width: 64ch; color: var(--text-2); font-size: 15px; }

/* what the step is asking for, and what the selection has taken off the table */
.rule {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px;
  margin: 0 0 18px; font-size: 13px; color: var(--text-3);
}
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em;
  background: var(--card-2); color: var(--text-2); border: 1px solid var(--line-2);
}
.pill.one { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.pill.many { background: transparent; }
.rule .ruled b { color: var(--stop); font-weight: 600; }
.linkish {
  border: 0; background: none; padding: 0; color: var(--text-2);
  text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px;
  font-size: 13px;
}
.linkish:hover { color: var(--text); text-decoration-color: currentColor; }

.notice {
  margin: 0 0 18px; padding: 12px 14px; border-radius: var(--r);
  background: var(--card-2); border: 1px solid var(--line);
  font-size: 14px; color: var(--text-2);
}
.notice > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
}
.notice > summary::-webkit-details-marker { display: none; }
.notice .nh { font-weight: 650; color: var(--text); font-size: 13.5px; }
.notice .more { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
.notice[open] .more { visibility: hidden; }
.notice p { margin: 10px 0 0; line-height: 1.6; }

/* ------------------------------------------------------------------ swatches */

.swatches { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }

.swatch {
  position: relative; display: flex; flex-direction: column;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--card-2);
  transition: border-color .15s, box-shadow .2s, transform .15s var(--ease), background .15s;
}
.swatch:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.swatch.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--glow); }
.swatch-art {
  height: 92px; margin: 8px 8px 0; border-radius: 8px; background: var(--plate);
  display: grid; place-items: center; padding: 14px 16px;
}
.swatch-art .dia { width: 100%; height: 100%; }
.swatch-meta { flex: 1; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; }
.swatch-use { margin-top: auto; padding-top: 12px; position: relative; z-index: 2; }
.swatch-use .btn { height: 32px; padding: 0 12px; font-size: 13px; }
.swatch-name { font-size: 14.5px; font-weight: 600; line-height: 1.3; color: var(--text); }
.swatch-spec { font-size: 12.5px; line-height: 1.45; color: var(--text-3); }
.swatch-code {
  position: absolute; left: 16px; top: 14px; font: 600 10.5px/1 var(--mono);
  color: var(--text-3); letter-spacing: .04em;
}
.hit { all: unset; position: absolute; inset: 0; border-radius: inherit; cursor: pointer; z-index: 1; }
.hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.check {
  position: absolute; right: 12px; top: 12px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink);
  opacity: 0; transform: scale(.6); transition: opacity .18s, transform .22s var(--ease);
}
.check .ic { width: 13px; height: 13px; stroke-width: 2.4; }
.is-on > .check { opacity: 1; transform: none; }

.info {
  position: absolute; z-index: 2; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--line-2);
  background: var(--card); color: var(--text-3); font: 600 12px/1 var(--serif); font-style: italic;
  opacity: 0; transition: opacity .15s, color .15s, border-color .15s;
}
.swatch .info { right: 12px; bottom: 12px; }
.swatch:hover .info, .opt:hover .info, .info:focus-visible { opacity: 1; }
.info:hover { color: var(--text); border-color: var(--text-3); }
@media (hover: none) { .info { opacity: 1; } }

/* ruled out by an earlier answer: struck through, the answer that did it named */
.is-ruled { opacity: .5; }
.is-ruled:hover { transform: none; box-shadow: none; border-color: var(--line); }
.is-ruled .swatch-name, .is-ruled .opt-name { text-decoration: line-through; text-decoration-color: var(--text-3); }
.is-ruled .hit { cursor: not-allowed; }
.why {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  color: var(--stop);
}
.swatch .why { margin-top: 4px; }

/* ------------------------------------------------------------------ tabs and options */

.tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 14px; padding: 4px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 0; border-radius: 9px; background: none; color: var(--text-3);
  font-size: 13.5px; font-weight: 600; transition: background .15s, color .15s;
}
.tab .ic { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--card-2); color: var(--text); box-shadow: var(--shadow-1); }
.tab .n {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center; font-size: 11px;
  background: var(--line); color: var(--text-3);
}
.tab .n.some { background: var(--accent); color: var(--accent-ink); }

.opts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.opt {
  position: relative; min-height: 64px; padding: 12px 44px 12px 14px;
  display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; align-items: center;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--card-2);
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--line-2); }
.opt.is-on { border-color: var(--accent); background: var(--accent-soft); }
.box {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2);
  display: grid; place-items: center; color: transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.box .ic { width: 12px; height: 12px; stroke-width: 2.6; }
.opt.one .box { border-radius: 50%; }
.opt.is-on .box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.opt-text { display: grid; gap: 2px; min-width: 0; }
.opt-name { font-size: 14.5px; font-weight: 600; line-height: 1.3; color: var(--text); }
.opt-spec { font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
.opt .info { right: 10px; top: 50%; margin-top: -13px; }
.opt-code { font: 600 10.5px/1 var(--mono); color: var(--text-3); margin-right: 6px; }

/* ------------------------------------------------------------------ measurements */

.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.field {
  padding: 14px 16px 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--card-2); display: grid; gap: 8px; align-content: start;
  transition: border-color .15s, background .15s;
}
.field.is-set { border-color: var(--accent-line); background: var(--accent-soft); }
.field-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field label { font-size: 13px; font-weight: 650; color: var(--text); }
.select { position: relative; }
.select select {
  width: 100%; height: 42px; padding: 0 38px 0 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  font-size: 14.5px; appearance: none; cursor: pointer;
}
.select select:hover { border-color: var(--text-3); }
.select::after {
  content: ""; position: absolute; right: 15px; top: 50%; width: 7px; height: 7px;
  margin-top: -5px; border: solid var(--text-3); border-width: 0 1.6px 1.6px 0;
  transform: rotate(45deg); pointer-events: none;
}
.field .hint { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text-3); }
.play-mini {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2);
  background: none; color: var(--text-3); display: grid; place-items: center;
}
.play-mini:hover, .play-mini.live { color: var(--accent); border-color: var(--accent-line); }
.play-mini .ic { width: 12px; height: 12px; }

/* ------------------------------------------------------------------ note + foot */

.note { margin: 20px 0 0; }
.note > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.note > summary::-webkit-details-marker { display: none; }
.note > summary:hover { color: var(--text); }
.note > summary .ic { width: 16px; height: 16px; color: var(--accent); }
.note .flag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.note textarea { margin-top: 10px; min-height: 90px; }
.note .hint { margin: 6px 0 0; font-size: 12.5px; color: var(--text-3); }

textarea {
  width: 100%; resize: vertical; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  font-size: 14.5px; line-height: 1.6;
}
textarea::placeholder { color: var(--text-3); }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

.foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line);
}
.foot .hint { font-size: 13px; color: var(--text-3); }

.review-cta {
  margin: 28px 0 0 56px; padding: 22px 24px; border-radius: var(--r-lg);
  border: 1px dashed var(--line-2); display: flex; align-items: center; gap: 20px;
  justify-content: space-between; flex-wrap: wrap;
}
.review-cta b { display: block; font: 600 19px/1.25 var(--serif); }
.review-cta span { font-size: 14px; color: var(--text-3); }
.alt { margin: 18px 0 0 56px; font-size: 13px; color: var(--text-3); }
.alt a { color: var(--text-2); }

/* ------------------------------------------------------------------ preview column */

.pv {
  position: sticky; top: var(--bar-h);
  height: calc(100vh - var(--bar-h)); overflow-y: auto; overscroll-behavior: contain;
  padding: 36px 0 28px; display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
}
.pv { --pv-fit: 320px; }
.pv-head { display: flex; align-items: center; justify-content: space-between; min-height: 20px; }
.pv-kicker { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.pv > #pv, .pv > .pv-head { flex: 0 0 auto; }
.pv > #pv > * { flex: 0 0 auto; }
@media (max-height: 900px) { .pv { --pv-fit: 270px; } }
@media (max-height: 780px) { .pv { --pv-fit: 230px; } }

.about {
  flex: 0 0 auto; margin-top: 6px; padding: 18px 18px 20px;
  border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line);
}
.about h3 { margin: 0 0 2px; font: 600 18px/1.3 var(--serif); letter-spacing: -.01em; }
.about .code { font: 600 11px/1 var(--mono); color: var(--text-3); margin-right: 8px; }
.about .sp { margin: 0 0 12px; font-size: 13px; color: var(--text-3); }
.about p { margin: 0 0 10px; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.state {
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px;
  border-radius: 10px; font-size: 13.5px; background: var(--card-2); color: var(--text-2);
}
.state::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--text-3); }
.state b { color: var(--text); }
.state.on { background: var(--accent-soft); }
.state.on::before, .state.open::before { background: var(--accent); }
.state.stop { background: var(--stop-soft); }
.state.stop::before { background: var(--stop); }
.state.care { background: var(--warn-soft); }
.state.care::before { background: var(--warn); }
.rel { display: grid; gap: 8px; margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.rel > div { display: grid; grid-template-columns: 84px 1fr; gap: 10px; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.rel .tag { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding-top: 2px; }
.rel .ok .tag { color: var(--accent); }
.rel .care .tag { color: var(--warn); }
.rel .stop .tag { color: var(--stop); }
.spec-list { display: grid; gap: 14px; margin-top: 12px; }
.spec-step .st { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.spec-line { display: grid; grid-template-columns: 48px 1fr; gap: 8px; font-size: 13.5px; color: var(--text-2); padding: 2px 0; }
.spec-line .c { font: 600 11px/1.9 var(--mono); color: var(--text-3); }
.about .btn { height: 32px; font-size: 13px; margin-top: 4px; }

/* ------------------------------------------------------------------ the sheet */

.sheet {
  width: min(640px, calc(100vw - 32px)); max-height: min(82vh, 780px);
  padding: 0; border: 1px solid var(--line-2); border-radius: 18px;
  background: var(--card); color: var(--text); box-shadow: 0 30px 80px -30px #000;
}
.sheet::backdrop { background: rgba(8, 9, 12, .6); backdrop-filter: blur(3px); }
.sheet[open] { animation: rise .28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.985); } }
.sheet-close { position: absolute; top: 14px; right: 14px; margin: 0; }
#sheet-body { padding: 28px 30px 30px; overflow-y: auto; max-height: min(82vh, 780px); }
#sheet-body .code { font: 600 11px/1 var(--mono); color: var(--text-3); letter-spacing: .04em; }
#sheet-body h2 { margin: 8px 48px 4px 0; font: 600 26px/1.2 var(--serif); letter-spacing: -.015em; }
#sheet-body .sub { margin: 0 0 18px; font-size: 14px; color: var(--text-3); }
#sheet-body p { margin: 0 0 12px; font-size: 15px; line-height: 1.65; color: var(--text-2); }
#sheet-body table { width: 100%; border-collapse: collapse; margin: 14px 0 4px; font-size: 13.5px; }
#sheet-body th, #sheet-body td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
#sheet-body th { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
#sheet-body td.k { font-weight: 600; color: var(--text); white-space: nowrap; }
.sheet-acts { display: flex; gap: 10px; margin-top: 22px; }

/* ------------------------------------------------------------------ the brief */

.brief-head { margin: 0 0 24px; }
.brief-head .back { margin: 0 0 18px; padding-left: 0; }
.brief-head h1 { margin: 0 0 8px; font: 600 clamp(30px, 3vw, 40px)/1.1 var(--serif); letter-spacing: -.02em; }
.brief-head p { margin: 0; color: var(--text-2); font-size: 16px; max-width: 60ch; }

.doc { display: grid; gap: 12px; }
.doc-card {
  padding: 20px 22px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line);
}
.doc-card h3 {
  margin: 0 0 12px; display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3);
}
.doc-card h3 .ic { width: 16px; height: 16px; color: var(--accent); }
.doc-line {
  display: grid; grid-template-columns: 56px 1fr; gap: 14px;
  padding: 8px 10px; margin: 0 -10px; border-radius: 8px;
  transition: background .3s, box-shadow .3s;
}
.doc-line + .doc-line { border-top: 1px solid var(--line); }
.doc-line .c { font: 600 11px/2 var(--mono); color: var(--text-3); }
.doc-line b { font-weight: 600; }
.doc-line .s { display: block; font-size: 13px; color: var(--text-3); margin-top: 1px; }
.said { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--card-2); border-left: 2px solid var(--accent); }
.said .h { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.said p { margin: 0; font-size: 14px; color: var(--text-2); white-space: pre-wrap; }
.flags { padding: 16px 18px; border-radius: var(--r-lg); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.flags b.h { display: block; margin-bottom: 8px; font-size: 13px; color: var(--warn); }
.flags p { margin: 0 0 8px; font-size: 14px; color: var(--text-2); }
.flags p:last-child { margin: 0; }
.steps-next { counter-reset: n; display: grid; }
.nxt { counter-increment: n; display: grid; grid-template-columns: 28px 1fr; gap: 14px; padding: 12px 0; }
.nxt + .nxt { border-top: 1px solid var(--line); }
.nxt::before {
  content: counter(n); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700;
}
.nxt b { display: block; font-size: 15px; }
.nxt p { margin: 2px 0 0; font-size: 14px; color: var(--text-2); }
.nxt em { display: block; font-style: normal; font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.fine { font-size: 13px; color: var(--text-3); margin: 4px 0 0; }
pre.plain {
  margin: 12px 0 0; padding: 16px; border-radius: 12px; overflow-x: auto;
  background: var(--bg-2); border: 1px solid var(--line);
  font: 12px/1.55 var(--mono); color: var(--text-2);
}

/* what the preview is playing right now: a basting stitch round it */
.swatch.is-live, .opt.is-live, .field.is-live { outline: 1.5px dashed var(--accent); outline-offset: 3px; }
.doc-line.is-live { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.doc-line.is-live .c { color: var(--accent); }
.doc-line.is-live b::after {
  content: "Playing"; margin-left: 10px; padding: 2px 7px; border-radius: 999px; vertical-align: 2px;
  font: 700 10px/1.4 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent);
}

.watch {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; border-radius: var(--r-lg);
  background: linear-gradient(120deg, var(--accent-soft), transparent 65%), var(--card);
  border: 1px solid var(--accent-line);
}
.watch > div { flex: 1; min-width: 0; }
.watch b { display: block; margin-bottom: 2px; font: 600 19px/1.25 var(--serif); }
.watch > div > span { font-size: 14px; color: var(--text-2); }
.watch-ic {
  flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 6px var(--accent-soft);
}
.watch-ic .ic { width: 18px; height: 18px; margin-left: 2px; }
@media (max-width: 760px) {
  .watch { flex-wrap: wrap; }
  .watch .btn { width: 100%; }
}

/* ------------------------------------------------------------------ toast, scrim */

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 70;
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--text); color: var(--bg); box-shadow: 0 16px 40px -16px #000;
  animation: rise .25s var(--ease);
}
.scrim { position: fixed; inset: 0; z-index: 44; background: rgba(8, 9, 12, .55); }

/* ------------------------------------------------------------------ narrow */

@media (max-width: 1240px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .book { max-width: none; }
  .show-narrow { display: inline-flex; }
  .pv {
    position: fixed; z-index: 45; top: 0; right: 0; bottom: 0; height: 100vh;
    width: min(460px, 94vw); padding: 18px 18px 24px;
    background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-2);
    transform: translateX(102%); transition: transform .3s var(--ease);
  }
  .pv.open { transform: none; }
}
@media (min-width: 1241px) { .scrim { display: none !important; } }

@media (max-width: 760px) {
  :root { --bar-h: 60px; }
  .bar-in { padding: 0 14px; gap: 12px; grid-template-columns: auto 1fr auto; }
  .brand-words em, .tape-label, #tape-ticks { display: none; }
  .brand-words b { white-space: nowrap; }
  /* stretch, or an absolute box with justify-self:center shrinks to nothing between its insets */
  .tape { position: absolute; left: 0; right: 0; bottom: -1px; width: auto; justify-self: stretch; }
  .tape-track { height: 2px; }
  .tape-track::before, #tape-fill { top: 0; }
  .bar-tools { grid-column: 3; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; }
  #review span, #review { font-size: 13px; }
  .work { padding: 0 14px; }
  .book { padding-top: 22px; }
  .piece { grid-template-columns: 40px minmax(0, 1fr); }
  .knot { width: 30px; height: 30px; left: 0; top: 18px; }
  .knot-col::after { left: 14px; top: 48px; }
  .intro, .alert, .review-cta, .alt { margin-left: 40px; }
  .head { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 12px 12px 16px; }
  .sum { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .body { padding: 2px 14px 18px; }
  .swatches { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }
  .opts, .fields { grid-template-columns: minmax(0, 1fr); }
  .foot { flex-direction: column-reverse; align-items: stretch; }
}

/* ------------------------------------------------------------------ print */

@media print {
  .bar, .pv, .toast, .scrim, .actions, .foot, .review-cta, .alt, .brief-head .back { display: none !important; }
  body { background: #fff; color: #000; }
  .work { display: block; padding: 0; }
  .book { padding: 0; max-width: none; }
  .doc-card { border: 1px solid #bbb; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* a callout with no heading is one paragraph, not a fold */
div.notice > p:first-child { margin-top: 0; }

@media (max-width: 440px) {
  .brand-words { display: none; }
  .bar-tools { gap: 6px; }
  #review { padding: 0 12px; }
}
