/* app.css: screen styles for the AI Readiness Assessment. Consumes tokens.css only.
   DIALS: DENSITY=4 | MOTION=1 | ORNAMENT=2
   The DOM is built by app.js with semantic tags and five class hooks (option, bar + missing/wedge/weakest,
   scores, score-value, interactive, error). Everything else is reached by structure. Where :has() carries a
   rule, the fallback without it is plain readable text, never a broken layout. */

/* ---------- Base ---------- */
:root {
  color-scheme: light;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--text-1b);
  background: var(--white);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--white); min-height: 100vh; }
[hidden] { display: none; }

main {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}
main:has(> article) { max-width: var(--measure-wide); }

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0;
  color: var(--primary-1a);
  line-height: var(--lh-heading);
  margin: 0 0 0.5rem;
  overflow-wrap: break-word;
}
h1 { font-size: var(--fs-xl); line-height: var(--lh-display); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h1:focus, h2:focus { outline: none; } /* app.js moves focus to the heading on each screen; the ring is for keyboard travel, not programmatic focus */

p { margin: 0 0 1rem; overflow-wrap: break-word; }
a {
  color: var(--primary-1a);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--tertiary-1a);
  text-underline-offset: 0.15em;
  transition: text-decoration-color var(--motion), color var(--motion);
}
a:hover { text-decoration-color: var(--primary-1a); }

:focus-visible {
  outline: 3px solid var(--primary-1a);
  outline-offset: 2px;
}

/* ---------- Buttons: coral primary, navy ghost ----------
   Default button = primary action. Back / Clear / Start over / downloads = ghost. Skip = plain text. */
button, .button {
  font: inherit;
  font-weight: 700;
  line-height: 1;
  min-height: var(--tap);
  padding: 0.8em 1.6em;
  margin: 0.25rem 0.5rem 0.25rem 0;
  border: 1px solid var(--secondary-1a);
  border-radius: var(--radius);
  background: var(--secondary-1a);
  color: var(--primary-1a); /* navy on coral is 4.8:1; white on coral would be 2.6:1 */
  cursor: pointer;
  transition: background-color var(--motion), border-color var(--motion), color var(--motion);
}
button:hover:not(:disabled) {
  background: var(--primary-1a);
  border-color: var(--primary-1a);
  color: var(--white);
}
button:disabled {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: var(--text-1b);
  cursor: not-allowed;
}

/* Ghost: Back in the question nav; Back on the bridge and R2; Clear on the resume panel;
   the three download/print buttons; Start over. */
nav > button:first-child:not(:last-child),
main > button:first-of-type:not(:last-of-type),
main > section > button:last-of-type:not(:first-of-type),
section.interactive > button {
  background: transparent;
  border-color: var(--primary-1a);
  color: var(--primary-1a);
}
nav > button:first-child:not(:last-child):hover,
main > button:first-of-type:not(:last-of-type):hover,
main > section > button:last-of-type:not(:first-of-type):hover,
section.interactive > button:hover:not(:disabled) {
  background: var(--accent-1);
  color: var(--primary-1a);
}

/* ---------- Forms shared ---------- */
input, select, textarea { font: inherit; color: var(--primary-1a); }
input[type="radio"], input[type="checkbox"] {
  accent-color: var(--primary-1a);
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  flex: none;
}
textarea, input[type="email"], input[type="text"], select {
  display: block;
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--gray-mid);
  border-radius: var(--radius);
  background: var(--white);
  min-height: var(--tap);
  transition: border-color var(--motion);
}
textarea:hover, input[type="email"]:hover, input[type="text"]:hover, select:hover { border-color: var(--text-1b); }
textarea { min-height: 9rem; resize: vertical; line-height: 1.5; }
fieldset { border: 0; padding: 0; margin: 0 0 0.5rem; min-width: 0; }

/* ---------- Intro (intro.title, intro.lead … intro.scope, intro.button; resume.note, button.resume, button.clear) ---------- */
main > h1:first-child { margin-top: 2.5rem; margin-bottom: 1.25rem; }
main > h1:first-child + p { font-size: var(--fs-md); line-height: 1.45; color: var(--primary-1a); margin-bottom: 1.25rem; }
main > section {
  background: var(--accent-1);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1rem;
  margin: 1.5rem 0;
}
main > section > p:first-child { color: var(--primary-1a); }

/* ---------- Question screens (progress.pattern, ladder.instruction, stem, helper, define, options, na.helper, required.note, nav) ---------- */
/* Progress line: the first paragraph of any screen that carries a fieldset or the R2 textarea. */
main:has(> fieldset, > textarea) > p:first-child {
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--text-1b);
  margin: 1rem 0 2rem;
}
/* Ladder instruction sits between the progress line (or act header) and the stem. */
main > p + h2, main > h1 + p + p + h2 { margin-top: 0; }
main:has(> fieldset) > p:not(:first-child) { color: var(--text-1b); }
main:has(> fieldset, > textarea) > h2 {
  font-size: var(--fs-lg);
  line-height: 1.25;
  margin: 0 0 0.75rem;
}
main > h2 + p { color: var(--text-1b); }
main > h2 ~ p + fieldset { margin-top: 1.25rem; }

/* Rung options: the label wraps the radio, the rung text, and (Q0 only) an explanation paragraph. */
.option {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.9rem;
  align-items: start;
  min-height: var(--tap);
  padding: 1rem 1.1rem;
  margin: 0 0 0.75rem;
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--primary-1a);
  line-height: 1.5;
  cursor: pointer;
  transition: border-color var(--motion), background-color var(--motion), box-shadow var(--motion);
}
.option > input[type="radio"] { margin-top: 0.15rem; }
.option > span { display: block; }
.option > p { grid-column: 2; font-size: 0.9375rem; color: var(--text-1b); margin: 0.35rem 0 0; }
.option:hover { border-color: var(--gray-mid); }
.option:has(> input:checked) {
  border-color: var(--primary-1a);
  box-shadow: inset 0 0 0 1px var(--primary-1a);
  background: var(--accent-1);
}
.option:has(> input:focus-visible) {
  outline: 3px solid var(--primary-1a);
  outline-offset: 2px;
}
.option:has(> input:focus-visible) > input { outline: none; }

fieldset > p { font-size: var(--fs-sm); color: var(--text-1b); margin: 0.25rem 0 0; } /* na.helper */
fieldset + p { font-size: var(--fs-sm); color: var(--text-1b); margin: 0.75rem 0 0; } /* required.note */

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--accent-2);
}
nav > button { margin: 0; }
nav > button:first-child:not(:last-child) { margin-right: auto; }

/* ---------- Act headers (actA.header, actA.sub, actB.header, actB.sub): moments, given air ---------- */
main:has(> fieldset) > h1 {
  font-size: var(--fs-xxl);
  margin: 1.5rem 0 0.75rem;
}
main:has(> fieldset) > h1 + p {
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--text-1b);
  margin-bottom: 2.5rem;
}

/* ---------- Bridge (bridge.body, button.back, bridge.button) ---------- */
main > p:first-child:has(+ button) {
  font-family: var(--font-heading);
  font-size: var(--fs-lg);
  line-height: 1.35;
  color: var(--primary-1a);
  margin: 4rem 0 2rem;
}

/* ---------- R2 (stem, textarea, button.back, R2.button, R2.skip) ---------- */
main > textarea { margin: 0.5rem 0 1.25rem; }
main:has(> textarea) > button:last-of-type:not(:first-of-type) {
  background: transparent;
  border-color: transparent;
  color: var(--text-1b);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  font-weight: 400;
}
main:has(> textarea) > button:last-of-type:not(:first-of-type):hover {
  background: transparent;
  border-color: transparent;
  color: var(--primary-1a);
}

/* ---------- Error panel (error.generic, error.retry) ---------- */
.error {
  background: var(--accent-1);
  border-left: 4px solid var(--secondary-1a);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem 0.5rem;
  margin: 1.5rem 0;
}
.error > p { color: var(--primary-1a); }

/* ---------- Results: mirror-back (mirror.*, mirror.saidHeader, mirror.r1Label, mirror.r2Label) ---------- */
article { display: block; }
article > p:first-child {
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--primary-1a);
  margin: 2.5rem 0 1.5rem;
}
article > h2 { margin-top: 1.5rem; }
article > section { margin: 2.5rem 0; }

/* ---------- Verdict (verdict.[tier].name/outcome/body, verdict.scope) ---------- */
article > section:has(> h1) {
  background: var(--accent-1);
  border-radius: var(--radius);
  padding: 2rem 1.5rem 1.25rem;
}
article > section > h1 { font-size: var(--fs-xxl); margin-bottom: 1rem; }
article > section > h1 + p {
  font-size: var(--fs-md);
  line-height: 1.45;
  color: var(--primary-1a);
}
article > section:has(> h1) > p:last-child { font-size: var(--fs-sm); margin-top: 1.25rem; } /* verdict.scope */

/* ---------- Scores (scores.foundation.*, scores.amplifier.*, .score-value) ---------- */
.scores {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.scores > div {
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1rem;
}
.scores h2 {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--text-1b);
  margin-bottom: 0.5rem;
}
.score-value {
  font-family: var(--font-heading);
  font-size: var(--fs-xxl);
  font-weight: 700;
  line-height: 1;
  color: var(--primary-1a);
  font-variant-numeric: tabular-nums;
  margin: 0 0 0.5rem;
}
.scores p:last-child { font-size: var(--fs-sm); margin: 0; }
.scores + p { margin-top: 1.5rem; } /* scores.defensibility.p1 */

/* ---------- Layer and dimension bars (layers.*, dimensions.*, .bar, .missing, .wedge, .weakest, L6 details) ---------- */
.bar {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 1rem;
  align-items: end;
  margin: 0 0 1.25rem;
  --bar-fill: var(--tertiary-1b);
  --bar-mark: transparent;
}
.bar > p:first-child { grid-column: 1; margin: 0 0 0.4rem; color: var(--primary-1a); font-weight: 700; line-height: 1.35; }
.bar > span {
  grid-column: 2;
  margin-bottom: 0.4rem;
  font-weight: 700;
  color: var(--primary-1a);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.bar > progress { grid-column: 1 / -1; }
.bar > progress + p, .bar > details { grid-column: 1 / -1; }
.bar > p:first-child:only-child { margin-bottom: 0; } /* a bar with no number (D3 not in use) */
.bar > p:first-child + p { grid-column: 1 / -1; margin: 0.25rem 0 0; font-size: var(--fs-sm); }
.missing { --bar-fill: var(--secondary-1a); --bar-mark: var(--secondary-1a); }
.wedge, .weakest { --bar-fill: var(--tertiary-1c); --bar-mark: var(--tertiary-1c); }

/* Marker line under a flagged bar: a square in the bar color, then the authored marker text in body gray. */
.bar > progress + p {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-1b);
  margin: 0.45rem 0 0;
}
.bar > progress + p::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
  background: var(--bar-mark);
  transform: translateY(0.05rem);
}

progress {
  display: block;
  width: 100%;
  height: 0.625rem;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--accent-2);
  accent-color: var(--bar-fill);
  -webkit-appearance: none;
  appearance: none;
}
progress::-webkit-progress-bar { background: var(--accent-2); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--bar-fill); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--bar-fill); border-radius: 999px; }

/* L6 Measurement: details/summary sits under the L6 bar; the sub-bars are smaller and quieter. */
.bar > details { margin-top: 0.5rem; font-size: 0.9375rem; }
.bar > details > summary {
  cursor: pointer;
  color: var(--text-1b);
  font-size: var(--fs-sm);
  padding: 0.35rem 0;
  min-height: var(--tap);
  display: flex;
  align-items: center;
  list-style-position: inside;
}
.bar > details > summary:hover { color: var(--primary-1a); }
.bar > details > .bar { margin: 0.75rem 0 0.5rem 1rem; }
.bar > details > .bar > p:first-child { font-weight: 400; color: var(--text-1b); }
.bar > details > .bar > span { font-weight: 400; color: var(--text-1b); }
.bar > details > .bar > progress { height: 0.4rem; }

/* ---------- Three moves (moves.header, moves.sub, action, moves.goodLabel, what_good_looks_like, episode_pointer) ---------- */
article ol {
  list-style: none;
  counter-reset: move;
  margin: 1.5rem 0 0;
  padding: 0;
}
article ol > li {
  counter-increment: move;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 1.25rem;
  margin: 0 0 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--accent-2);
}
article ol > li::before {
  content: counter(move);
  grid-row: 1 / span 4;
  font-family: var(--font-heading);
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1;
  color: var(--tertiary-1c);
  min-width: 1.5ch;
}
article ol > li > * { grid-column: 2; }
article ol > li > p:first-of-type { font-size: 1.125rem; line-height: 1.5; color: var(--primary-1a); }
article ol > li > h3 {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--text-1b);
  margin: 0.25rem 0 0.35rem;
}
article ol > li > h3 ~ p { color: var(--text-1b); }
article ol > li > p:last-child { margin-bottom: 0; }

/* ---------- Cards: download/print (download.*, print.button), call (call.*), offer (offer.*), opt-in (optin.*) ---------- */
article > section.interactive:has(> h2),
article > section:has(> a),
article > section:has(> h3),
article > section:has(> form) {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.75rem 1.5rem 1.5rem;
}
article > section.interactive:has(> h2) > button { margin: 0.25rem 0.5rem 0.75rem 0; }
article > section.interactive:has(> h2) > p:last-child { font-size: var(--fs-sm); margin: 0.5rem 0 0; }

/* The booking link is the one coral action on the results page. */
article > section > a {
  display: inline-block;
  font-weight: 700;
  line-height: 1;
  min-height: var(--tap);
  padding: 0.9em 1.6em;
  border: 1px solid var(--secondary-1a);
  border-radius: var(--radius);
  background: var(--secondary-1a);
  color: var(--primary-1a);
  text-decoration: none;
  transition: background-color var(--motion), border-color var(--motion), color var(--motion);
}
article > section > a:hover { background: var(--primary-1a); border-color: var(--primary-1a); color: var(--white); }

/* Offer rungs: three h3 + p pairs, each pair a cream block. Grid placement is explicit because there is no wrapper. */
article > section:has(> h3) { display: grid; grid-template-columns: 1fr; column-gap: 1rem; row-gap: 0; }
article > section:has(> h3) > h2 { margin-bottom: 0.5rem; }
article > section:has(> h3) > h3 {
  font-size: 1.125rem;
  background: var(--accent-1);
  border-radius: var(--radius) var(--radius) 0 0;
  margin: 1rem 0 0;
  padding: 1.25rem 1.25rem 0.25rem;
}
article > section:has(> h3) > h3 + p {
  background: var(--accent-1);
  border-radius: 0 0 var(--radius) var(--radius);
  margin: 0;
  padding: 0 1.25rem 1.25rem;
}
article > section:has(> h3) > p:last-child { font-size: var(--fs-sm); margin: 1.25rem 0 0; } /* offer.scope */
article > section:has(> h3) a { overflow-wrap: anywhere; } /* bare URLs break inside the cream blocks instead of overflowing */

/* Opt-in form: plain. The email and role inputs precede their label text in the DOM, so those labels flip. */
form { margin-top: 1rem; }
form > label { display: block; margin: 0 0 1rem; color: var(--primary-1a); }
form > label:has(> input[type="email"], > input[type="text"]) { display: flex; flex-direction: column-reverse; gap: 0.35rem; }
form > label:has(> input[type="checkbox"]) {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.75rem;
  align-items: start;
  padding: 0.5rem 0;
  cursor: pointer;
}
form > label:has(> input[type="checkbox"]) > input { margin-top: 0.2rem; }
form > label > select { margin-top: 0.35rem; }
form > p { font-size: var(--fs-sm); color: var(--text-1b); }
form > button { margin-top: 0.5rem; }
form > p[role="status"] { color: var(--primary-1a); margin: 0.75rem 0 0; }
form > p[role="status"]:empty { display: none; }

/* ---------- Footer (footer.substack, footer.book) and start-over (results.startOverConfirm, button.startOver) ---------- */
article > footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--accent-2);
  font-size: var(--fs-sm);
  color: var(--text-1b);
}
article > footer a { color: var(--text-1b); }
article > footer a:hover { color: var(--primary-1a); }
article > section.interactive:last-child { margin-top: 2rem; font-size: var(--fs-sm); }

/* ---------- Breakpoints ---------- */
@media (min-width: 48em) {
  main { padding: 2.5rem 2rem 5rem; }
  main > h1:first-child { margin-top: 3.5rem; }
  main:has(> fieldset) > h1 { margin-top: 2.5rem; }
  .scores { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
  .scores > div { padding: 1.5rem 1.75rem 1.25rem; }
  article > section:has(> h1) { padding: 2.5rem 2.25rem 1.5rem; }
  article > section.interactive:has(> h2),
  article > section:has(> a),
  article > section:has(> h3),
  article > section:has(> form) { padding: 2rem 2rem 1.75rem; }
}

@media (min-width: 64em) {
  main { padding-top: 3.5rem; }
  /* Offer rungs side by side: header and product line span, the three pairs sit in two rows. */
  /* minmax(0, 1fr): a plain 1fr track can't shrink below its longest unbroken string (the bare URLs), which pushed
     the rungs past the card's right edge whenever the left column was narrow. */
  article > section:has(> h3) { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 1.25rem; }
  article > section:has(> h3) > h2,
  article > section:has(> h3) > p:first-of-type,
  article > section:has(> h3) > p:last-child { grid-column: 1 / -1; }
  article > section:has(> h3) > h3:nth-of-type(1) { grid-column: 1; grid-row: 3; }
  article > section:has(> h3) > h3:nth-of-type(2) { grid-column: 2; grid-row: 3; }
  article > section:has(> h3) > h3:nth-of-type(3) { grid-column: 3; grid-row: 3; }
  article > section:has(> h3) > p:nth-of-type(2) { grid-column: 1; grid-row: 4; }
  article > section:has(> h3) > p:nth-of-type(3) { grid-column: 2; grid-row: 4; }
  article > section:has(> h3) > p:nth-of-type(4) { grid-column: 3; grid-row: 4; }
}

/* ---------- Dusty panel (DD-313): the Ames pattern, two panels ----------
   DIALS: DENSITY=5 | MOTION=1 | ORNAMENT=2 (same file, same dials; the chevron on the drawer toggle is the one glyph).
   DOM contract: spec/dusty-layout-ruby.md. The JS wraps main#assessment and aside.panel-dusty in div.two-panel only
   when FEATURE_DUSTY is on; with the flag off, or after "switch to the plain version", there is no wrapper and no
   panel, and main is the direct child of body exactly as phase 1. Every main > rule above is untouched because
   main is still the left panel. Mobile-first: the panel is a fixed bottom drawer with a toggle; from 64em it is a
   sticky right column. Nothing here animates; --motion already zeroes under reduced motion. */

/* Wrapper: layout-inert below 64em (a plain block), a two-column grid from 64em. */
.two-panel { display: block; }
.two-panel > main { padding-bottom: 8rem; } /* room under the last Next button for the collapsed drawer bar */

/* Panel shell (mobile default: bottom drawer). Column flex; the thread is the only thing that scrolls inside. */
.panel-dusty {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  max-height: min(85vh, 44rem);
  max-height: min(85dvh, 44rem);
  background: var(--accent-1);
  color: var(--text-1b);
}
.panel-header { flex: none; position: relative; } /* the positioning box for .panel-avatar on mobile */
.panel-title { display: none; } /* the toggle carries dusty.title on mobile */
/* Dusty's mark (Curtis, 2026-09-09): the team asset, a basset hound on a navy disc, served at 96 and 192 px.
   The PNG is already a disc with transparent corners (checked 2026-09-09: alpha 0 at the corners, fully opaque from 97%
   of the half-width inward), so border-radius: 50% is the whole crop; the navy background only fills the antialiased rim
   so no light seam shows on either the cream panel or the navy toggle bar. Decorative: alt is empty, the title names her.
   Nothing here animates. print.css hides .panel-dusty, so both marks stay off paper with the rest of the panel. */
.panel-avatar,
.msg-avatar {
  display: block;
  flex: none;
  border-radius: 50%;
  background: var(--primary-1a);
  object-fit: cover;
}
.panel-avatar { /* mobile: 32 px inside the 56 px toggle bar, left of the title text; the bar stays one row */
  position: absolute;
  left: 1.25rem;
  top: 0.75rem; /* (3.5rem bar - 2rem mark) / 2 */
  z-index: 1; /* the toggle is positioned and later in the DOM; without this it paints over the mark */
  width: 2rem;
  height: 2rem;
  pointer-events: none; /* the whole bar stays the toggle's tap target */
}
.panel-header:has(> .panel-avatar) > .panel-toggle { padding-left: 4rem; } /* 1.25rem edge + 2rem mark + 0.75rem gap */
.panel-toggle { /* one line, 56 px, always: the long title clips with an ellipsis at 375 rather than wrapping and growing the bar
                   (DD-313 verify, 2026-09-09). The accessible name is still the full dusty.title; only the paint is clipped. */
  display: block;
  position: relative;
  width: 100%;
  height: 3.5rem;
  min-height: 3.5rem;
  margin: 0;
  padding: 0 3rem 0 1.25rem;
  text-align: left;
  line-height: calc(3.5rem - 2px); /* the button's own 1px borders sit inside the 56 (border-box) */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--primary-1a);
  border-color: var(--primary-1a);
  border-radius: 0;
  color: var(--white);
}
.panel-toggle:hover:not(:disabled) { background: var(--primary-1a); border-color: var(--primary-1a); color: var(--white); }
.panel-toggle:focus-visible { outline-offset: -4px; outline-color: var(--white); }
.panel-toggle::after { /* chevron: points up when closed, down when open */
  content: "";
  position: absolute;
  right: 1.25rem;
  top: 50%;
  width: 0.6rem;
  height: 0.6rem;
  margin-top: 0; /* the L-shape's visual centre sits above its box centre when it points up */
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-135deg);
}
.panel-toggle[aria-expanded="true"]::after { margin-top: -0.6rem; transform: rotate(45deg); }
.panel-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.panel-dusty:not(.is-open) > .panel-body { display: none; }

/* Thread: newest at the bottom; the only scroller in the panel. */
.thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
}
.msg {
  max-width: 92%;
  min-width: 0;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.msg > p { margin: 0 0 0.6rem; }
.msg > :last-child { margin-bottom: 0; }
.msg-dusty {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--accent-2);
  color: var(--text-1b);
}
.msg-dusty:has(> .msg-avatar),
.msg-pending { /* the pending dots hold the same column so the reply does not jump left when the mark arrives */
  position: relative;
  margin-left: 2.25rem; /* 1.75rem mark + 0.5rem gap */
  max-width: calc(92% - 2.25rem);
}
.msg-avatar {
  position: absolute;
  left: calc(-2.25rem - 1px); /* measured from the padding box: step back over the bubble's 1px border so the mark sits on the thread's content edge */
  top: calc(0.85rem + (0.9375rem * 1.55 - 1.75rem) / 2); /* bubble padding-top, then centre the mark on the first line box */
  width: 1.75rem;
  height: 1.75rem;
}
.msg-you {
  align-self: flex-end;
  max-width: 85%;
  background: var(--primary-1a);
  color: var(--white);
}
.msg-recorded { /* dusty.rung.recorded.pattern: a quiet trace of the click, not a bubble */
  align-self: flex-end;
  max-width: 100%;
  padding: 0.15rem 0.75rem;
  border-right: 2px solid var(--tertiary-1a);
  border-radius: 0;
  font-size: var(--fs-sm);
  color: var(--text-1b);
}
.msg-note { /* dusty.unavailable: interface line, same shape as .error */
  border-left: 4px solid var(--secondary-1a);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--primary-1a);
}
.msg-pending { color: var(--text-1b); letter-spacing: 0.2em; }

/* Citations under a reply: label, then one chip per source. */
.cite {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--accent-2);
}
.cite > p { margin: 0; }
.cite > p:first-child {
  flex-basis: 100%;
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: var(--eyebrow-tracking);
  text-transform: uppercase;
  color: var(--text-1b);
}
.cite a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
  background: var(--accent-1);
  font-size: var(--fs-sm);
  color: var(--primary-1a);
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: border-color var(--motion), background-color var(--motion);
}
.cite a:hover { border-color: var(--primary-1a); background: var(--white); }

/* Composer: turns counter, then the ask form, or dusty.turnCap once the cap is reached. */
.composer {
  flex: none;
  padding: 0.75rem 1.25rem 0.85rem;
  border-top: 1px solid var(--accent-2);
}
.turns {
  font-size: var(--fs-sm);
  color: var(--text-1b);
  font-variant-numeric: tabular-nums;
  margin: 0 0 0.5rem;
}
.ask { margin: 0; }
.ask > label { display: block; font-weight: 700; color: var(--primary-1a); margin: 0 0 0.4rem; }
.ask textarea { min-height: 3.5rem; margin: 0; font-size: 1rem; line-height: 1.5; resize: vertical; } /* two lines; 16px stops iOS focus-zoom (Ames, 2026-08-06) */
.ask textarea[readonly] { color: var(--text-1b); }
.ask > p { font-size: var(--fs-sm); color: var(--text-1b); margin: 0.5rem 0 0.75rem; }
.ask > button { /* navy ghost: the assessment's Next keeps the one coral action in view */
  display: block;
  width: 100%;
  margin: 0;
  background: transparent;
  border-color: var(--primary-1a);
  color: var(--primary-1a);
}
.ask > button:hover:not(:disabled) { background: var(--primary-1a); color: var(--white); }
.turn-cap {
  margin: 0;
  padding: 0.85rem 1.1rem;
  background: var(--white);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text-1b);
}

/* Footer: the plain-version link, then dusty.footer.disclosure. */
.panel-footer {
  flex: none;
  padding: 0.15rem 1.25rem 0.6rem;
  border-top: 1px solid var(--accent-2);
  font-size: var(--fs-sm);
  color: var(--text-1b);
}
.panel-footer > p { margin: 0; }
.switch-plain {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--text-1b);
}
.switch-plain:hover { color: var(--primary-1a); }

@media (min-width: 48em) {
  .two-panel > main { padding-bottom: 9rem; }
  .thread, .composer, .panel-footer { padding-left: 1.5rem; padding-right: 1.5rem; }
}

/* Desktop: two columns. Left flexible (min 0 so long content can never widen the page), right 360 to 420 px.
   The panel is a sticky column the height of the viewport; top is 0 because this page has no site chrome.
   If the assessment is ever embedded under a fixed header, that one value is the sticky offset. */
@media (min-width: 64em) {
  .two-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(22.5rem, 30vw, 26.25rem);
    align-items: start;
  }
  .two-panel > main { padding-bottom: 5rem; }
  .panel-dusty {
    position: sticky;
    top: 0;
    inset: 0 auto auto auto;
    z-index: auto;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-top: 0;
    border-left: 1px solid var(--accent-2);
  }
  .panel-header { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.5rem 0.85rem; border-bottom: 1px solid var(--accent-2); }
  .panel-avatar { position: static; width: 3rem; height: 3rem; pointer-events: auto; } /* 48 px beside the title */
  .panel-title { display: block; flex: 1 1 auto; min-width: 0; font-size: 1.125rem; line-height: 1.3; margin: 0; }
  .panel-toggle { display: none; }
  .panel-dusty:not(.is-open) > .panel-body { display: flex; } /* the drawer state has no meaning here */
  .thread { padding: 1.25rem 1.5rem; }
  .panel-footer { padding-bottom: 0.75rem; }
}

/* Between 64em and 80em the left column runs 600 to 776 px wide: the three offer rungs stack instead of
   sitting three across. display: block ignores the explicit grid placement above, and the h3 + p pairs
   already read as stacked cream blocks in DOM order. */
@media (min-width: 64em) and (max-width: 79.99em) {
  .two-panel article > section:has(> h3) { display: block; }
}
