/* Sing It — the loop, the drone, play-close-sing-wide, the pendulum, the path.
   Tokens only; every colour, size and radius comes from css/style.css.

   This chapter asks the reader to do something out loud, so it is built with
   more air than the others: one instruction at a time, large, with the piano's
   answer held back behind a deliberate press. */

#ch-sing .sing-card { margin-top: 20px; }
#ch-sing .sing-card:first-of-type { margin-top: 0; }

/* ---------- the four steps and the two rules ---------- */

#ch-sing .sing-steps { list-style: none; counter-reset: s; margin: 16px 0 0; }
#ch-sing .sing-steps li {
  counter-increment: s; position: relative; padding: 0 0 14px 40px;
  font-size: 16px; line-height: 1.62; max-width: 66ch;
}
#ch-sing .sing-steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px;
  width: 25px; height: 25px; border-radius: 999px;
  border: 1.6px solid var(--accent); color: var(--accent-ink);
  font-family: var(--mono); font-size: 12.5px;
  display: grid; place-items: center; transform: rotate(-4deg);
}
#ch-sing .sing-steps li b { font-weight: 700; }

#ch-sing .sing-rules { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 4px; }
#ch-sing .sing-rule {
  font-family: var(--mono); font-size: 12.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent-ink); border: 1.5px solid var(--accent);
  border-radius: 999px; padding: 6px 14px;
}

#ch-sing .sing-honest {
  margin-top: 18px; font-size: 14.5px; line-height: 1.62;
  color: var(--ink-soft); max-width: 68ch;
}
#ch-sing .sing-note {
  margin-top: 16px; font-size: 14.5px; line-height: 1.62;
  color: var(--ink-soft); max-width: 70ch;
}
#ch-sing .sing-note b { color: var(--ink); }

/* A hairline that carries a word — used where a card changes gear. */
#ch-sing .sing-rulebar {
  display: flex; align-items: center; gap: 12px;
  margin: 26px 0 16px; color: var(--ink-soft);
  font-family: var(--mono); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: 0.15em;
}
#ch-sing .sing-rulebar::after {
  content: ''; flex: 1; height: 0; border-top: 1.5px dashed var(--line);
}

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

#ch-sing .sing-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-bottom: 16px;
}
#ch-sing .sing-lab {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft);
  max-width: 100%; min-width: 0;
}
#ch-sing .sing-lab select { min-width: 0; max-width: 100%; }
#ch-sing .sing-lab-pool { margin-left: 4px; }
#ch-sing .sing-pools,
#ch-sing .sing-chips { display: flex; flex-wrap: wrap; gap: 7px; }
#ch-sing .sing-chips { margin-bottom: 12px; }

/* ---------- the machine ---------- */

#ch-sing .sing-machine {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 26px; align-items: start;
}
@media (max-width: 860px) { #ch-sing .sing-machine { grid-template-columns: 1fr; gap: 20px; } }

#ch-sing .sing-cue {
  font-size: 14.5px; color: var(--ink-soft); line-height: 1.55;
  min-height: 44px; max-width: 52ch;
}
#ch-sing .sing-target {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(32px, 5vw, 56px); line-height: 1.05;
  color: var(--accent-ink); margin: 6px 0 2px;
}
#ch-sing .sing-sub { font-size: 16px; color: var(--ink-soft); min-height: 26px; line-height: 1.5; }
#ch-sing .sing-sub .dim { opacity: 0.6; }
#ch-sing .sing-sub .hit { color: var(--accent-ink); }

/* The digest beat, drawn. It is a countdown you are meant to wait through. */
#ch-sing .sing-track {
  height: 3px; background: var(--line); border-radius: 999px;
  margin: 16px 0 18px; overflow: hidden;
}
#ch-sing .sing-fill {
  display: block; height: 100%; width: 0; background: var(--accent);
  border-radius: 999px;
}
/* "settle" is the digest beat you are meant to wait through; "window" is the
   open-ended stretch where the answer is yours and nothing is counting down. */
#ch-sing .sing-fill.settle { width: 100%; transition: width 4.2s linear; }
#ch-sing .sing-fill.window { width: 100%; background: var(--green); }

#ch-sing .sing-acts { display: flex; flex-wrap: wrap; gap: 8px; }
#ch-sing .sing-verdict {
  margin-top: 16px; font-size: 16px; line-height: 1.6;
  max-width: 56ch; opacity: 0; transform: translateY(3px);
  transition: opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
#ch-sing .sing-verdict.show { opacity: 1; transform: none; }
#ch-sing .sing-verdict b { color: var(--accent-ink); }

#ch-sing .sing-side { min-width: 0; }
#ch-sing .sing-tag {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px;
}
#ch-sing .sing-names {
  font-family: var(--serif); font-weight: 700; font-size: 21px;
  margin-top: 10px; text-align: center;
}
#ch-sing .sing-names .dim { color: var(--ink-soft); font-weight: 400; font-size: 16px; }

/* ---------- the drone ---------- */

#ch-sing .sing-drone {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-top: 16px;
}
#ch-sing .sing-drone-read {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-soft);
}
#ch-sing .sing-drone-read.on { color: var(--green); }

/* ---------- the pendulum ---------- */

#ch-sing .sing-pend {
  display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr);
  gap: 26px; align-items: start;
}
@media (max-width: 860px) { #ch-sing .sing-pend { grid-template-columns: 1fr; gap: 18px; } }

#ch-sing .sing-axis { width: 100%; }
#ch-sing .axis-svg { width: 100%; height: auto; display: block; }
#ch-sing .axis-spine { stroke: var(--line); stroke-width: 1.6; stroke-dasharray: 2 6; }
#ch-sing .axis-hit { fill: transparent; }
#ch-sing .axis-row { cursor: pointer; }
#ch-sing .axis-row:hover .axis-hit { fill: var(--paper-tint); }
#ch-sing .axis-lab {
  font-family: var(--mono); font-size: 11.5px; fill: var(--ink-soft);
}
#ch-sing .axis-note {
  font-family: var(--sans); font-weight: 600; font-size: 13.5px; fill: var(--ink);
}
#ch-sing .axis-dot { fill: var(--card); stroke: var(--line); stroke-width: 1.6; }
#ch-sing .axis-row.home .axis-dot { fill: var(--ink); stroke: var(--ink); }
#ch-sing .axis-row.home .axis-note { font-weight: 700; }
#ch-sing .axis-row.lit .axis-dot { fill: var(--accent); stroke: var(--accent); }
#ch-sing .axis-row.lit .axis-note { fill: var(--accent-ink); font-weight: 700; }
#ch-sing .axis-row.lit .axis-lab { fill: var(--accent-ink); }

#ch-sing .sing-figure {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(26px, 3.6vw, 42px); line-height: 1.15;
  color: var(--accent-ink); margin: 6px 0 2px;
}

/* ---------- the path ---------- */

#ch-sing .sing-path { margin-top: 16px; }
#ch-sing .path-stage {
  padding: 18px 0; border-top: 1.5px dashed var(--line);
}
#ch-sing .path-stage:first-child { border-top: none; padding-top: 4px; }
#ch-sing .path-head {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 10px 16px;
}
#ch-sing .path-n {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ink-soft);
}
#ch-sing .path-name { font-family: var(--serif); font-weight: 700; font-size: 26px; line-height: 1.15; }
#ch-sing .path-why {
  font-size: 14.5px; color: var(--ink-soft); line-height: 1.6;
  margin: 8px 0 12px; max-width: 70ch;
}
#ch-sing .path-items { display: flex; flex-direction: column; gap: 2px; }
#ch-sing .path-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  padding: 8px 10px; border-radius: 6px;
}
#ch-sing .path-item:hover { background: var(--paper-tint); }
#ch-sing .path-iv {
  font-family: var(--serif); font-weight: 700; font-size: 19px;
  flex: 0 0 auto; min-width: 168px;
}
#ch-sing .path-notes {
  font-size: 14.5px; color: var(--ink-soft); flex: 0 0 auto; min-width: 108px;
}
#ch-sing .path-note {
  font-size: 13.5px; color: var(--ink-soft); font-style: italic;
  flex: 1 1 200px; min-width: 0;
}

/* ---------- what goes wrong ---------- */

#ch-sing .sing-wrong { list-style: none; margin: 0; }
#ch-sing .sing-wrong li {
  padding: 11px 0 11px 20px; position: relative;
  font-size: 16px; line-height: 1.62; max-width: 72ch;
}
#ch-sing .sing-wrong li::before {
  content: '✕'; position: absolute; left: 0; top: 12px;
  font-size: 12.5px; color: var(--ink-red); opacity: 0.75;
}
#ch-sing .sing-wrong b { font-weight: 700; }

/* ---------- the crutch, folded away ---------- */

#ch-sing .sing-anchors { margin-top: 26px; }
#ch-sing .sing-anchors summary {
  cursor: pointer; list-style: none;
  font-family: var(--mono); font-size: 12.5px;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-soft);
  padding: 10px 0; border-top: 1.5px dashed var(--line);
}
#ch-sing .sing-anchors summary::-webkit-details-marker { display: none; }
#ch-sing .sing-anchors summary::before { content: '+ '; color: var(--accent-ink); }
#ch-sing .sing-anchors[open] summary::before { content: '− '; }
#ch-sing .sing-anchors summary:hover { color: var(--ink); }
#ch-sing .sing-anchors summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#ch-sing .sing-anchor-wrap { overflow-x: auto; margin-top: 14px; }
#ch-sing .sing-anchor-table { border-collapse: collapse; width: 100%; }
#ch-sing .sing-anchor-table td {
  border-bottom: 1.4px dashed var(--line); padding: 10px 14px 10px 0;
  font-size: 14.5px; vertical-align: top; line-height: 1.5;
}
#ch-sing .anchor-iv {
  font-family: var(--serif); font-weight: 700; font-size: 17.5px;
  white-space: nowrap; width: 158px;
}
#ch-sing .anchor-ref { color: var(--ink-soft); min-width: 168px; }
#ch-sing .anchor-char { color: var(--ink); }
#ch-sing .dim { color: var(--ink-soft); opacity: 0.75; }

@media (max-width: 520px) {
  #ch-sing .sing-anchor-table tr {
    display: block; padding: 11px 0; border-bottom: 1.4px dashed var(--line);
  }
  #ch-sing .sing-anchor-table td { display: block; border-bottom: none; padding: 0 0 3px; }
  #ch-sing .anchor-iv { width: auto; white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  #ch-sing .sing-fill.settle { transition: none; }
  #ch-sing .sing-verdict { transition: none; transform: none; }
}
