/* ============================================================
   Attune - program.css
   The tinnitus program: the hub (8-week arc) and the week
   lessons, plus the three persistent rails rendered as
   in-session tools (skills library, diary, homework) and the
   optional user-initiated sound-enrichment player.
   Reuses tokens.css + base.css for the shell.
   ============================================================ */

/* ---------- program header ---------- */
.program-bar .wrap { justify-content: space-between; }
.program-bar .where { color: var(--muted); font-size: .92rem; letter-spacing: .04em; }
.program-bar .links { display: flex; gap: 1.6rem; align-items: center; }
.program-bar .links a { color: var(--ink-soft); text-decoration: none; font-size: .98rem; }
.program-bar .links a:hover { color: var(--accent); }

/* ---------- shared lesson/hub container ---------- */
.doc { max-width: 44rem; margin: 0 auto; padding: clamp(2.5rem, 7vh, 4.5rem) clamp(1.4rem, 5vw, 3rem) 5rem; }
.doc .eyebrow { margin-bottom: 1rem; }
.doc h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); line-height: 1.12; margin-bottom: 1.2rem; }
.doc .standfirst { font-size: clamp(1.12rem, 1.02rem + 0.4vw, 1.34rem); color: var(--ink-soft); margin: 0 0 1.4rem; max-width: 36rem; }
.doc p { margin: 0 0 1.2rem; }

/* ---------- three rails intro (hub) ---------- */
.rails { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin: 2.4rem 0 1rem; }
.rails .rail { padding: 1.4rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: 4px; }
.rails .rail h3 { font-size: 1.15rem; margin: 0 0 .5rem; }
.rails .rail p { font-size: .98rem; color: var(--ink-soft); margin: 0; line-height: 1.55; }
@media (max-width: 720px) { .rails { grid-template-columns: 1fr; } }

/* ---------- the 8-week arc (hub) ---------- */
.arc { list-style: none; margin: 2rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.week-card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 5px; padding: 1.4rem 1.5rem;
  background: var(--card);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.week-card .row { display: flex; align-items: baseline; gap: 1rem; }
.week-card .num { font-family: var(--font-display); font-size: 1rem; color: var(--muted); flex: 0 0 auto; min-width: 4.4rem; letter-spacing: .1em; text-transform: uppercase; }
.week-card .title { font-family: var(--font-display); font-size: 1.28rem; color: var(--ink); line-height: 1.25; }
.week-card .focus { color: var(--ink-soft); font-size: 1rem; margin: .5rem 0 0 5.4rem; }
.week-card .chip {
  display: inline-block; margin: .7rem 0 0 5.4rem; font-size: .76rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent-deep);
  background: color-mix(in srgb, var(--accent-soft) 20%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--accent-soft) 40%, transparent);
  border-radius: 2rem; padding: .25em .8em;
}
a.week-card.open:hover { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.week-card.soon { opacity: .72; }
.week-card.soon .num::after { content: " · opens next"; color: var(--muted); font-size: .7rem; letter-spacing: .06em; }
@media (max-width: 620px) {
  .week-card .focus, .week-card .chip { margin-left: 0; }
  .week-card .num { width: auto; }
  .week-card .row { flex-wrap: wrap; gap: .3rem 1rem; }
}

/* ---------- week lesson ---------- */
.lesson { margin-top: 2.4rem; }
.lesson section { margin: 0 0 2.8rem; scroll-margin-top: 8.4rem; }
.section-anchor { display: block; height: 0; scroll-margin-top: 8.4rem; }
.lesson h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.85rem); margin: 0 0 1rem; }
.lesson p { font-size: clamp(1.05rem, 1rem + 0.25vw, 1.18rem); }
.lesson strong { color: var(--ink); font-weight: 500; }
.lesson .callout {
  border-left: 2px solid var(--accent-soft); padding: .3rem 0 .3rem 1.4rem; margin: 1.6rem 0;
  font-family: var(--font-display); font-size: 1.2rem; line-height: 1.45; color: var(--ink);
}
.lesson ol.ref-steps { font-size: clamp(1.05rem, 1rem + 0.25vw, 1.18rem); color: var(--ink-soft); padding-left: 1.4rem; margin: 0 0 1.2rem; }
.lesson ol.ref-steps li { margin: 0 0 .7rem; }

/* ---------- "this week" jump-nav strip ----
   Sizes are from the Magic Patterns component; colors are aliases of
   the site tokens so the strip follows the theme. */
.week-nav-strip {
  --nav-ink: var(--ink);
  --nav-ink-muted: var(--muted);
  --nav-ink-faint: color-mix(in srgb, var(--muted) 75%, var(--paper));
  --nav-kodama: var(--accent);
  --nav-rule: var(--line);

  position: sticky;
  top: 4.6rem;
  z-index: 39;
  margin: 0 0 1.6rem;
  padding: .55rem 0 0;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.05) blur(6px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.wns-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  padding-bottom: .55rem;
}
.wns-links {
  display: flex;
  flex-shrink: 0;
  gap: 1.4rem;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
}
.wns-links::-webkit-scrollbar { display: none; }
.wns-links a {
  display: inline-flex;
  align-items: center;
  gap: .375rem;              /* gap-1.5 */
  font-family: var(--font-mono);
  font-size: .6875rem;       /* text-[11px] */
  letter-spacing: .16em;     /* tracking-[0.16em] */
  text-transform: uppercase;
  font-weight: 500;
  color: var(--nav-ink-faint);
  text-decoration: none;
  transition: color .2s ease;
}
.wns-links a:hover { color: var(--nav-ink-muted); }
.wns-links a.is-visited { color: var(--nav-kodama); }
.wns-links a.is-visited:hover { color: var(--nav-ink); }
.wns-links a.is-active,
.wns-links a[aria-current="true"] { color: var(--nav-ink); }

/* Underline lives on the label only, not the dot - matches the
   source component's <span className={isActive ? 'border-b ...' */
.wns-label {
  padding-bottom: .125rem;   /* pb-0.5 */
  border-bottom: 1px solid transparent;
}
.wns-links a.is-active .wns-label,
.wns-links a[aria-current="true"] .wns-label {
  border-bottom-color: var(--nav-ink);
}

/* Fixed 14px slot (h-3.5 w-3.5) so the dot and the check icon that
   replaces it share the same footprint and don't shift the label. */
.wns-dot {
  flex: 0 0 auto;
  width: .875rem;
  height: .875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wns-dot::before {
  content: '';
  width: .375rem;            /* h-1.5 w-1.5 */
  height: .375rem;
  border-radius: 50%;
  border: 1px solid rgba(138, 130, 113, .6); /* border-ink-faint/60 */
  background: transparent;
}
.wns-links a.is-active .wns-dot::before,
.wns-links a[aria-current="true"] .wns-dot::before {
  border-color: var(--nav-ink);
  background: var(--nav-ink);
}
.wns-links a.is-visited .wns-dot {
  width: .875rem;
  height: .875rem;
  background-color: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.wns-links a.is-visited .wns-dot::before { display: none; }

.wns-progress-count {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.wns-count {
  font-family: var(--font-mono);
  font-size: .6875rem;       /* text-[11px] */
  letter-spacing: .14em;     /* tracking-[0.14em] */
  text-transform: uppercase;
  color: var(--nav-ink-muted);
  white-space: nowrap;
  margin: 0;
}
.wns-count-num { color: var(--nav-ink); }
.wns-top {
  flex: 0 0 auto;
  font-size: .875rem;        /* text-sm */
  color: var(--nav-ink-muted);
  text-decoration: none;
  padding-left: 1rem;
  border-left: 1px solid var(--line);
  white-space: nowrap;
  transition: color .2s ease;
}
.wns-top:hover { color: var(--nav-ink); }

.wns-progress-track {
  height: 1px;
  background: var(--nav-rule);
}
.wns-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--nav-kodama);
  transition: width .4s ease;
}
@media (prefers-reduced-motion: reduce) { .wns-progress-fill { transition: none; } }

@media (max-width: 640px) {
  .wns-links { gap: 1.1rem; }
}

/* ---------- CBT cycle diagram ---------- */
.cycle { margin: 2rem auto; max-width: 30rem; }
.cycle svg { width: 100%; height: auto; display: block; }
.cycle .node rect { fill: color-mix(in srgb, var(--paper) 55%, var(--sage)); stroke: var(--accent-soft); }
.cycle .node text { fill: var(--ink); font-family: var(--font-body); font-size: 14px; }
.cycle .arrow { stroke: var(--accent-soft); fill: none; }
.cycle .arrow-head { fill: var(--accent-soft); }
.cycle .egtext { fill: var(--ink-soft); font-family: var(--font-body); font-size: 12.5px; font-style: italic; }

/* ---------- the loop diagram (shared: Weeks 1, 6, 8) ---------- */
.loop-diagram { margin: 2rem 0; }
.loop-diagram-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .8rem; margin: 0 0 1.2rem;
}
.loop-diagram-head .kicker {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin: 0;
}
.loop-toggle {
  display: inline-flex; border: 1px solid var(--line); border-radius: 2rem;
  padding: .2rem; background: var(--paper-2);
}
.loop-toggle-btn {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-soft);
  border: none; background: transparent; border-radius: 2rem;
  padding: .45em 1.1em; cursor: pointer; transition: background-color .2s ease, color .2s ease;
}
.loop-toggle-btn:hover { color: var(--ink); }
.loop-toggle-btn.is-active { background: var(--accent); color: var(--card); }

.loop-svg { width: 100%; height: auto; display: block; color: var(--accent-soft); transition: color .4s ease; }
.loop-diagram.is-now .loop-svg { color: var(--accent); }
.loop-ring { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 6; }
.loop-arcs path { fill: none; stroke: currentColor; stroke-width: 1.25; }

/* Full-bleed: this figure needs more width than the article column
   (--measure/.doc cap at 44rem) gives it, or the corner cards sit too
   close to the ring for a comfortable margin. Breaks out to its own
   width, centered independent of .doc's max-width. */
.loop-diagram-wide {
  position: relative;
  width: 100vw;
  max-width: 840px;
  margin-left: 50%;
  transform: translateX(-50%);
  aspect-ratio: 1;
}
.loop-diagram-wide .loop-svg { position: absolute; inset: 0; }
.loop-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 38%; height: 38%; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1.25rem;
  background: var(--paper-2); border: 1px solid var(--line);
}
.loop-corner {
  position: absolute; width: 38%;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  padding: .875rem; text-align: left;
  box-shadow: 0 1px 0 rgba(28, 26, 22, .04);
}
.loop-corner--top { top: 0; left: 50%; transform: translate(-50%, 0); }
.loop-corner--right { top: 50%; right: 0; transform: translate(0, -50%); }
.loop-corner--bottom { bottom: 0; left: 50%; transform: translate(-50%, 0); }
.loop-corner--left { top: 50%; left: 0; transform: translate(0, -50%); }

/* Week 6: recalls the loop "from its last corner" - behavior picked out
   from the other three, not toggled, just singled out. */
.loop-corner--emphasis {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.loop-corner--emphasis .loop-corner-label { color: var(--accent-deep); }

.loop-corner-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 .35rem;
}
.loop-center .loop-corner-label,
.loop-center .loop-week1-text,
.loop-center .loop-now-text {
  max-width: 10rem;
}
.loop-week1-text { font-size: 13px; line-height: 1.375; margin: 0; color: var(--ink-soft); }
.loop-now-text { margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.loop-skill { font-size: 13px; line-height: 1.375; margin: 0 0 .2rem; color: var(--accent-deep); font-weight: 600; }
.loop-skill-detail { font-size: 12px; line-height: 1.375; margin: 0; color: var(--muted); }

.loop-diagram-narrow { display: none; list-style: none; margin: 0; padding: 0; }
.loop-diagram-narrow .loop-corner {
  position: static; width: auto; margin: 0 0 .8rem;
}

.loop-caption {
  margin: 1.4rem 0 0; padding-top: .9rem; border-top: 1px solid var(--line);
  font-size: .88rem; line-height: 1.5; color: var(--muted);
}

@media (max-width: 680px) {
  .loop-diagram-wide { display: none; }
  .loop-diagram-narrow { display: block; }
}

/* ---------- quiet-line module header (nav trial, option 1b) ----------
   One sticky row: wordmark + module progress. Replaces .topbar/.program-bar
   and the .week-nav-strip on pages whose data sets quiet_nav. The hairline
   appears only once the page has scrolled (.scrolled, set in shared.js). */
.mod-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 91%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid transparent;
}
.mod-header.scrolled { border-bottom-color: var(--line); }
.mod-header-inner {
  width: min(100% - 2.5rem, 72rem); margin-inline: auto;
  display: flex; align-items: center; gap: 2rem; height: 4rem;
}
.mod-header .brand {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-display); font-size: 1.25rem;
  color: var(--ink); text-decoration: none;
}
.mod-header .brand img { width: 22px; height: 22px; }

.mod-progress { margin: 0 0 0 auto; display: flex; align-items: center; gap: .85rem; }
.mod-rungs { display: flex; gap: 4px; }
.mod-rungs i {
  width: 16px; height: 3px; border-radius: 2px;
  background: color-mix(in srgb, var(--line) 80%, var(--ink) 6%);
}
.mod-rungs i.is-done { background: var(--accent); }
.mod-count {
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .1em; color: var(--ink-soft);
}

@media (max-width: 640px) {
  .mod-rungs { display: none; }
  .mod-header-inner { height: 3.5rem; gap: 1rem; }
}

/* ---------- module illustration figures ---------- */
.module-figure { margin: 2rem 0; }
.module-figure img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 6px;
}
.module-figure svg {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: 6px;
}
.module-figure figcaption {
  margin-top: .6rem; font-size: .88rem; line-height: 1.5; color: var(--muted);
}

/* Opt-in click-to-enlarge on module figures (.module-figure--zoom).
   The lightbox itself is built by program.js on demand. */
.module-figure--zoom img { cursor: zoom-in; }
.figure-lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem; cursor: zoom-out;
}
.figure-lightbox img {
  max-width: min(1400px, 96vw); max-height: 92vh; width: auto; height: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 24px 64px color-mix(in srgb, var(--ink) 35%, transparent);
}
.figure-lightbox-close {
  position: absolute; top: 1rem; right: 1rem;
  width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-size: 1.4rem; line-height: 1; cursor: pointer;
}

/* ---------- distortion cards (named thinking-pattern grid) ---------- */
.distortion-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 1.6rem 0; }
.distortion-cards .card {
  padding: 1.3rem 1.4rem;
  background: color-mix(in srgb, var(--paper) 70%, var(--sage));
  border: 1px solid color-mix(in srgb, var(--accent-soft) 35%, transparent);
  border-radius: 3px;
}
.distortion-cards h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.15rem; color: var(--accent-deep); margin: 0 0 .4rem; letter-spacing: -0.01em; }
.distortion-cards p { font-size: .95rem; line-height: 1.55; color: var(--ink-soft); margin: 0; }
.distortion-cards p em { font-style: italic; color: var(--ink); }
@media (max-width: 620px) { .distortion-cards { grid-template-columns: 1fr; } }

/* ---------- generic tool panel ---------- */
.tool { border: 1px solid var(--line); border-radius: 6px; background: var(--paper-2); padding: clamp(1.4rem, 4vw, 2rem); margin: 1.6rem 0; }
.tool .tool-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tool h3 { font-size: 1.2rem; margin: 0; }
.tool .kicker { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--highlight-deep); }
.tool .note { font-size: .92rem; color: var(--muted); margin: 1rem 0 0; }

/* ---------- tool category system (try / save / keep) ----------
   Additive only: keys off new modifier classes never applied on
   the hyperacusis/misophonia tracks, so those pages are unaffected
   even though they also load this file. */

.tool-state {
  display: inline-flex; align-items: center; gap: .45em;
  font-size: .74rem; letter-spacing: .1em; text-transform: uppercase;
  font-weight: 500; margin: 0 0 .9rem;
}
.tool-state::before {
  content: ""; display: inline-block; width: 15px; height: 15px;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
  flex: 0 0 auto;
}

/* Try it here - practice, nothing saved */
.tool--try { border: 1px solid var(--line); border-left: 3px solid var(--accent-soft); }
.tool-state--try { color: var(--accent-soft); }
.tool-state--try::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpolygon points='10 8 16 12 10 16 10 8'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpolygon points='10 8 16 12 10 16 10 8'/%3E%3C/svg%3E");
}

/* Save it in Practice Better - stronger CTA, distinct border */
.tool--save { border: 1px solid var(--line); border-left: 3px solid var(--accent); }
.tool-state--save { color: var(--accent); }
.tool-state--save::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z'/%3E%3Cpolyline points='17 21 17 13 7 13 7 21'/%3E%3Cpolyline points='7 3 7 8 15 8'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z'/%3E%3Cpolyline points='17 21 17 13 7 13 7 21'/%3E%3Cpolyline points='7 3 7 8 15 8'/%3E%3C/svg%3E");
}
.tool--save .btn-primary {
  padding: .95em 2.1em;
  font-weight: 600;
  box-shadow: 0 2px 0 var(--accent-deep);
}
.tool--save .btn-primary:hover { box-shadow: 0 1px 0 var(--accent-deep); transform: translateY(1px); }
@media (prefers-reduced-motion: reduce) { .tool--save .btn-primary:hover { transform: none; } }

/* Keep it with you - copy-and-carry */
.tool--keep { border: 1px solid var(--accent-soft); border-left: 3px solid var(--accent-deep); }
.tool-state--keep { color: var(--accent-deep); }
.tool-state--keep::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21l-7-5-7 5V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}

/* Final saved view - post-copy state, .tool--keep only */
.tool--keep.is-saved .tool-state,
.tool--keep.is-saved .tool-head .kicker,
.tool--keep.is-saved .diary-field--optional,
.tool--keep.is-saved .field-hint,
.tool--keep.is-saved .note { display: none; }
.tool--keep.is-saved { border-style: dashed; }
.tool--keep.is-saved .tool-head { margin-bottom: .6rem; }
.tool--keep.is-saved .diary-field textarea,
.tool--keep.is-saved .diary-field input {
  border-color: transparent; background: transparent; resize: none;
}
.tool--keep.is-saved .diary-field label { color: var(--muted); }
.tool--keep .copy-confirm { display: none; }
.tool--keep.is-saved .copy-confirm {
  display: inline-flex; align-items: center; gap: .4em;
  color: var(--accent-deep); font-size: .95rem; font-weight: 500;
}

/* ---------- arrival check-in: PB-primary / on-page-secondary split ----------
   Scoped to #sec-checkin because the "arrive" class name is also reused,
   unrelated, on the Week 8 "Then and now" comparison tool. */
#sec-checkin .tool.arrive .tool-head { margin-bottom: .6rem; }
#sec-checkin .tool.arrive > p { margin: 0 0 1.3rem; }
#sec-checkin .tool.arrive > .btn-primary { margin: 0 0 .6rem; }
#sec-checkin .tool.arrive > .note { margin: 0; }

.arrive-alt { margin-top: 1.6rem; padding-top: 1.4rem; border-top: 1px dashed var(--line); }
.arrive-alt summary {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  cursor: pointer; list-style: none;
  font-family: var(--font-body); font-size: 1rem; color: var(--ink-soft);
}
.arrive-alt summary::-webkit-details-marker { display: none; }
.arrive-alt summary::before {
  content: "+"; display: inline-block; width: 1.1em; margin-right: .4em;
  color: var(--accent); font-family: var(--font-display); font-size: 1.35em; line-height: 1;
}
.arrive-alt[open] summary::before { content: "\2013"; }
.arrive-alt summary:hover { color: var(--ink); }
.arrive-alt-body { margin-top: 1.1rem; }
.arrive-alt-body > .field-hint { margin: 0 0 1.2rem; }

/* ---------- spike card (crisis-moment reference card) ---------- */
.spike-card { background: color-mix(in srgb, var(--paper) 55%, var(--sage) 45%); border: 1px solid var(--accent-soft); border-radius: 6px; padding: 1.4rem 1.5rem; margin: 0 0 1.4rem; }
.spike-card .sc-title { font-family: var(--font-display); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 1rem; }
.spike-card .sc-line { font-size: 1.02rem; line-height: 1.5; color: var(--ink); margin: 0 0 .65rem; }
.spike-card .sc-line strong { color: var(--accent-deep); }
.spike-card .sc-line:last-child { margin-bottom: 0; }

/* ---------- spike card screenshot view (Week 7) ----
   A scrim + centered, phone-proportioned card holding a live clone
   of the spike card's own title/lines (see spikeCardShot in
   program.js) - no header, Skills control, input, or buttons. The
   close control sits outside .shot-card-inner so a screenshot
   cropped to the card border naturally excludes it. */
.shot-scrim { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--ink) 45%, transparent); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.shot-scrim:not([hidden]) { opacity: 1; pointer-events: auto; }

.shot-modal { position: fixed; inset: 0; z-index: 61; display: flex; align-items: center; justify-content: center; padding: 1.5rem; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.shot-modal.open { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .shot-scrim, .shot-modal { transition: none; } }

.shot-close { position: absolute; top: 1rem; right: 1.2rem; background: none; border: 0; font-size: 1.8rem; line-height: 1; color: #fff; cursor: pointer; padding: .2em; }
.shot-close:hover { color: var(--sage); }

.shot-card-inner {
  width: 100%; max-width: 22rem; max-height: 85vh; overflow-y: auto;
  background: color-mix(in srgb, var(--paper) 55%, var(--sage) 45%);
  border: 1px solid var(--accent-soft); border-radius: 10px;
  padding: 2rem 1.8rem;
  box-shadow: 0 12px 40px color-mix(in srgb, var(--ink) 25%, transparent);
}
.shot-card-inner .sc-title { font-family: var(--font-display); font-size: 1.5rem; text-transform: none; letter-spacing: normal; color: var(--ink); margin: 0 0 1.3rem; }
.shot-card-inner .sc-line { font-size: 1.05rem; line-height: 1.6; color: var(--ink); margin: 0 0 .9rem; }
.shot-card-inner .sc-line strong { color: var(--accent-deep); }
.shot-card-inner .sc-line:last-child { margin-bottom: 0; }
.shot-card-inner .sc-esc { font-size: .95rem; color: var(--accent-deep); border-top: 1px dashed var(--line); margin: 1rem 0 0; padding-top: 1rem; }
.shot-personal { font-size: .98rem; color: var(--ink-soft); font-style: italic; border-top: 1px dashed var(--line); margin: 1.1rem 0 0; padding-top: 1rem; }

/* ---------- sound enrichment player ---------- */
.player-controls { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.player-btn {
  font-family: var(--font-body); font-size: 1.02rem; cursor: pointer;
  border: 1px solid var(--accent); color: var(--accent); background: none;
  border-radius: 3px; padding: .6em 1.3em; transition: background .2s ease, color .2s ease;
}
.player-btn:hover { background: color-mix(in srgb, var(--accent-soft) 16%, var(--paper)); }
.player-btn.on { background: var(--accent); color: var(--paper); }
.player .vol { display: flex; align-items: center; gap: .7rem; color: var(--ink-soft); font-size: .95rem; }
.player .status { color: var(--muted); font-size: .92rem; min-height: 1.2em; }

/* range inputs (calm) */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 4px; background: var(--line); outline-offset: 4px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 0; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 0; }

/* ---------- skills library ---------- */
.skills { display: flex; flex-direction: column; gap: .8rem; }
.skill { display: flex; gap: 1rem; align-items: baseline; padding: 1rem 1.15rem; background: var(--card); border: 1px solid var(--line); border-radius: 4px; }
.skill .sk-name { font-family: var(--font-display); color: var(--ink); font-size: 1.1rem; flex: 0 0 auto; max-width: 11rem; }
.skill .sk-what { color: var(--ink-soft); font-size: .98rem; min-width: 0; overflow-wrap: break-word; }
@media (max-width: 480px) {
  .skill { flex-direction: column; gap: .3rem; }
  .skill .sk-name { max-width: none; }
}
.skills .pending { color: var(--muted); font-size: .95rem; font-style: italic; padding: .4rem 0 0; }

.skills-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* ---------- printable skills summary (Week 8) ----------
   The "Print this list" button builds a plain #skills-print-sheet
   (a fresh element appended directly to <body>) and adds
   body.printing-skills just before window.print(), removed on
   afterprint. Hiding is done with display:none on body's direct
   children rather than visibility:hidden - visibility does not
   collapse layout height, which previously left the full (very
   tall) page height intact and produced many blank printed pages. */
#skills-print-sheet { display: none; }
@media print {
  body.printing-skills > *:not(#skills-print-sheet) { display: none !important; }
  body.printing-skills #skills-print-sheet {
    display: block !important;
    font-family: var(--font-body); color: #000;
  }
  #skills-print-sheet h1 { font-family: var(--font-display); font-size: 1.4rem; margin: 0 0 1.2rem; }
  #skills-print-sheet ul { list-style: none; margin: 0; padding: 0; }
  #skills-print-sheet li { margin: 0 0 .9rem; line-height: 1.5; }
  #skills-print-sheet li strong { font-family: var(--font-display); }
}

/* ---------- rule list (bold-led guidance cards) ---------- */
.rule-list { display: flex; flex-direction: column; gap: .9rem; margin: 1.6rem 0; }
.rule { padding: 1.1rem 1.3rem; background: var(--card); border: 1px solid var(--line); border-radius: 4px; }
.rule .rule-name { display: block; font-family: var(--font-display); color: var(--ink); font-size: 1.08rem; margin: 0 0 .35rem; }
.rule .rule-what { display: block; color: var(--ink-soft); font-size: .98rem; line-height: 1.55; }

/* ---------- diary tool ---------- */
.diary-field { margin: 0 0 1.3rem; }
.diary-field label { display: block; color: var(--ink); font-size: 1rem; margin-bottom: .5rem; }
.diary-field .scale-row { display: flex; align-items: center; gap: 1rem; }
.diary-field .scale-row input[type="range"] { flex: 1; min-width: 0; }
.diary-field .scale-anchors { display: flex; justify-content: space-between; gap: 1rem; margin: .35rem 0 0; font-size: .78rem; color: var(--muted); }
.diary-field output { font-family: var(--font-display); color: var(--accent-deep); font-size: 1.1rem; width: 1.6rem; text-align: center; }
.diary-field textarea { width: 100%; min-height: 4.5rem; resize: vertical; font-family: var(--font-body); font-size: 1.02rem; color: var(--ink); line-height: 1.6; background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: .8rem 1rem; }
.diary-field textarea:focus { border-color: var(--accent); }
.diary-field input[type="text"] { width: 100%; font-family: var(--font-body); font-size: 1.02rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: .8rem 1rem; }
.diary-field input[type="text"]:focus { border-color: var(--accent); }

/* gentle inline notice for a required field left empty on save */
.field-notice { margin: .4rem 0 0; font-size: .88rem; color: var(--accent-deep); }
.field-notice:empty { display: none; }
.diary-add { margin-top: .4rem; }

/* ---------- weekly goals ---------- */
.goal-rows { display: flex; flex-direction: column; gap: .8rem; margin: 1rem 0; }
.goal-input { width: 100%; font-family: var(--font-body); font-size: 1.02rem; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: .8rem 1rem; }
.goal-input:focus { border-color: var(--accent); }
.tool-summary { margin: 1.4rem 0 0; padding: .7rem 1rem; background: color-mix(in srgb, var(--paper) 55%, var(--sage) 25%); border: 1px solid var(--accent-soft); border-radius: 4px; color: var(--ink-soft); font-size: .9rem; }
.tool-summary b { color: var(--accent-deep); font-weight: 500; }
.tool-summary + .entries { margin-top: .7rem; }
.entries { list-style: none; margin: 1.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.entry { padding: .9rem 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: 4px; }
.entry .when { color: var(--muted); font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; }
.entry .vals { color: var(--ink); font-size: .98rem; margin: .25rem 0 0; }
.entry .sit { color: var(--ink-soft); font-size: .96rem; margin: .3rem 0 0; }

/* ---------- interactive checklist (self-check / agreement / trigger inventory) ----------
   NOTE: the homework checklist that used to live in sec-plan has moved to Practice
   Better (see .homework-list below) and no longer uses these classes. This toggleable
   checklist markup is still used for a few unrelated on-page self-assessment blocks
   (e.g. "The agreement", "The readiness check", "Common trigger categories", "A
   gradual weaning plan") - do not remove without checking those first. */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.check {
  display: flex; gap: .9rem; align-items: flex-start; padding: .9rem 1.1rem;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 4px; cursor: pointer; text-align: left; font-family: var(--font-body);
  font-size: 1.03rem; color: var(--ink); width: 100%; transition: border-color .2s ease;
}
.check:hover { border-color: var(--accent-soft); }
.check .box {
  flex: 0 0 auto; width: 1.3rem; height: 1.3rem; border: 1.5px solid var(--accent-soft);
  border-radius: 4px; display: grid; place-items: center; color: var(--paper); font-size: .85rem; margin-top: .1rem;
}
.check[aria-pressed="true"] { border-color: var(--accent); }
.check[aria-pressed="true"] .box { background: var(--accent); border-color: var(--accent); }
.check[aria-pressed="true"] .label { color: var(--ink-soft); }
.check .box .tick { opacity: 0; }
.check[aria-pressed="true"] .box .tick { opacity: 1; }

/* ---------- homework list (non-interactive; tracked in Practice Better) ---------- */
.homework-list { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .55rem; }
.homework-list li {
  position: relative; padding-left: 1.1rem; font-family: var(--font-body);
  font-size: 1.02rem; line-height: 1.5; color: var(--ink-soft);
}
.homework-list li::before { content: "\2013"; position: absolute; left: 0; color: var(--accent-soft); }

/* ---------- page progress summary (Week 8) ---------- */
.section-progress-summary { margin-top: 2.6rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.section-progress-summary .kicker {
  font-family: var(--font-mono); font-size: .74rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted); margin: 0;
}
.section-progress-text { font-size: .95rem; color: var(--ink-soft); margin: .5rem 0 0; max-width: 34rem; }
.section-progress-summary .btn-text { display: block; margin-top: .6rem; font-size: .92rem; }

/* ---------- week navigation ---------- */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.8rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.week-nav a.back { color: var(--muted); text-decoration: none; font-size: 1rem; }
.week-nav a.back:hover { color: var(--accent); }
.week-done { margin-top: 1.4rem; padding: 1.4rem 1.6rem; background: var(--sage); border: 1px solid color-mix(in srgb, var(--accent-soft) 35%, transparent); border-radius: 5px; display: none; }
.week-done.show { display: block; }
.week-done p { margin: 0 0 1rem; color: var(--ink); }
.week-done p:last-child { margin-bottom: 0; }

.prev-modules { margin-top: 1.6rem; }
.prev-modules-label { margin: 0 0 .5rem; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.prev-modules-list { display: flex; flex-wrap: wrap; gap: .4rem .9rem; list-style: none; margin: 0; padding: 0; }
.prev-modules-list a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; font-size: .95rem; }
.prev-modules-list a:hover, .prev-modules-list a:focus-visible { color: var(--accent); text-decoration-color: var(--accent); }
.pb-note { margin-top: 1.2rem; font-size: .88rem; color: var(--muted); }
.pb-note a { color: var(--accent); }

/* reveal (program pages) */
.p-reveal { opacity: 0; transform: translateY(14px); transition: opacity .3s ease, transform .3s ease; }
.p-reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .p-reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- self-paced stepper (PMR / attention / sitting-with-it) ---------- */
.stepper .step-count { font-family: var(--font-body); font-style: italic; color: var(--muted); font-size: .85rem; }
.stepper .step-title { font-family: var(--font-display); font-weight: 500; color: var(--ink); font-size: 1.18rem; margin: .35rem 0 .55rem; }
.stepper .step-body { color: var(--ink-soft); line-height: 1.65; font-size: 1rem; min-height: 5.5em; }
.step-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1.2rem; }
.step-dots { display: flex; gap: .4rem; }
.step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background .2s ease; }
.step-dot.on { background: var(--accent); }
.step-prev[disabled] { opacity: .4; cursor: default; }
@media (prefers-reduced-motion: reduce) { .step-dot { transition: none; } }

/* ---------- paced breath (Week 3) ---------- */
.breath { display: flex; flex-direction: column; align-items: center; gap: 1.1rem; padding: 1.4rem 0 0.4rem; }
.breath-stage { display: flex; align-items: center; justify-content: center; height: 150px; }
.breath-circle { width: 110px; height: 110px; border-radius: 50%; background: var(--sage); border: 1.5px solid var(--accent-soft); transform: scale(.62); }
.breath-cue { font-family: var(--font-display); font-style: italic; color: var(--accent-deep); font-size: 1.05rem; text-align: center; min-height: 1.5em; margin: .8rem 0; }
@media (prefers-reduced-motion: reduce) { .breath-circle { transition: none !important; } }

/* ---------- structured log entries (thought record / ladder / experiment) ---------- */
.map-entry { list-style: none; border: 1px solid var(--line); border-radius: 4px; background: var(--card); padding: .85rem 1rem .9rem; margin: 0 0 .6rem; }
.map-entry .me-line { display: block; font-size: .92rem; line-height: 1.55; color: var(--ink-soft); margin: .1rem 0; }
.map-entry .me-line b { font-family: var(--font-body); font-weight: 500; font-style: italic; color: var(--muted); margin-right: .3rem; }
.map-entry .me-line.me-trigger b { color: var(--accent-deep); font-style: normal; }
.tr-shift { display: flex; flex-wrap: wrap; gap: .35rem 1.3rem; margin-top: .6rem; padding-top: .55rem; border-top: 1px dashed var(--line); }
.tr-metric { font-family: var(--font-body); font-size: .9rem; color: var(--ink-soft); }
.tr-metric b { font-weight: 500; font-style: italic; color: var(--muted); margin-right: .35rem; }
.tr-metric .to { color: var(--muted); margin: 0 .25rem; }
.tr-metric.better .now { color: var(--accent-deep); font-family: var(--font-display); }


/* --- prospective-patient preview page (preview-*.html, all tracks) -------- */
.preview-banner {
  max-width: var(--measure);
  margin: 1.2rem 0 0;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--paper);
}
.preview-banner p { margin: 0; color: var(--ink-soft); line-height: 1.6; font-size: 0.95rem; }
.preview-note { font-style: italic; }
