/* =============================================================
   Psychofarm Library: one product (2026-11-30, fourth pass)
   -------------------------------------------------------------
   Greg: every shelf looked a little different (the guides, What We've Said,
   the Q&As...). This file puts every Library page in the same frame. It is
   linked from the tab bar (the library-tabs region that sync-site-header.mjs
   stamps from site-plans.mjs), so it loads last on every page that has the
   tab bar: the Library home, the nine shelves, every guide, rating scale,
   tool and What We've Said page, including the pages other scripts build.
   Loading last, it wins over the shelf's own stylesheet without !important.

   The rules (see redesign/README.md, "The Library as one product"):
   1. Same top on every page: the tab bar, each shelf with its colour dot.
   2. One colour per shelf (--sh, from the tab bar's data-shelf): the tab,
      the header wash, and every page inside that shelf.
   3. One header: kicker line (the group, or the shelf you came from), the
      title, one line with the count. Detail pages add one meta row.
   4. One band: the search, a "Try" row, one row of filter chips.
   5. One filter chip, one suggestion chip, one small tag.
   6. Two headings: a section title with its count, and a group heading
      (a bar in the group's colour, the name, a count, a hairline).
   7. One card frame: tinted in its group's hue with a 5px edge, the star top
      right, the members lock or Free badge at the bottom.
   8. One note box, one contents panel (right of the article).
   ============================================================= */

/* ---------- 1. The shelf's colour, read from the tab bar ---------- */
body:has(.lib-tabs[data-shelf="guides"])   { --sh: 250; }
body:has(.lib-tabs[data-shelf="dsm"])      { --sh: 274; }
body:has(.lib-tabs[data-shelf="said"])     { --sh: 298; }
body:has(.lib-tabs[data-shelf="qa"])       { --sh: 320; }
body:has(.lib-tabs[data-shelf="handouts"]) { --sh: 205; }
body:has(.lib-tabs[data-shelf="patients"]) { --sh: 172; }
body:has(.lib-tabs[data-shelf="scales"])   { --sh: 18; }
body:has(.lib-tabs[data-shelf="tools"])    { --sh: 44; }
body:has(.lib-tabs[data-shelf="misc"])     { --sh: 232; }

/* ---------- 2. Tab bar: a dot in each shelf's colour, the current shelf a white pill ---------- */
.lib-tab[data-shelf] { gap: 5px; }
.lib-tab[data-shelf]::before {
  content: ''; flex: none; width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-dot); opacity: .75; transition: opacity .16s;
}
.lib-tab[data-shelf]:hover::before, .lib-tab[data-shelf][aria-current="page"]::before { opacity: 1; }
.lib-tab[aria-current="page"] { color: var(--heading-ink); }
@media (min-width: 1144px) {
  .lib-tab { padding-inline: 7px; font-size: 0.8rem; }
  .lib-tab-sep { margin-inline: 3px; }
  .lib-tabs-home, .lf-open-btn { width: 34px !important; height: 34px !important; }
}

/* ---------- 3. The header: the same block on every shelf and every page in it ---------- */
/* the wash: the shelf's hue, strongest at the top left, a neighbour hue at the top right */
@supports (color: oklch(0.5 0.1 200)) {
  body:has(.lib-tabs[data-shelf]) .lib-tabs { background: oklch(0.975 0.014 var(--sh)); }
  body:has(.lib-tabs[data-shelf]) .lib-tabs::before { background: linear-gradient(270deg, transparent, oklch(0.975 0.014 var(--sh)) 75%); }
  body:has(.lib-tabs[data-shelf]) .lib-tabs::after { background: linear-gradient(90deg, transparent, oklch(0.975 0.014 var(--sh)) 75%); }
  body:has(.lib-tabs[data-shelf]) :is(.lib-head, .calc-hero, .ws-controls, .ws-top, .page-hero) {
    background:
      radial-gradient(70% 160% at 0% 0%, oklch(0.91 0.07 var(--sh)) 0%, transparent 62%),
      radial-gradient(55% 140% at 100% 0%, oklch(0.93 0.055 calc(var(--sh) + 40)) 0%, transparent 66%),
      oklch(0.962 0.024 var(--sh));
  }
  body:has(.lib-tabs[data-shelf]) .lib-band:not(.ws-controls):not(.ws-top) { background: oklch(0.962 0.024 var(--sh)); }
  /* the kicker's bar and the "Try" label take the shelf's colour */
  body:has(.lib-tabs[data-shelf]) :is(.lib-head-kicker, .calc-crumbs, .ws-back, .guide-breadcrumb)::before { background: oklch(0.66 0.15 var(--sh)); }
}
/* the faint serotonin drawing other page headers carry stays off the Library's headers */
body:has(.lib-tabs) .page-hero::before, body:has(.lib-tabs) .page-hero::after { display: none; }
body:has(.lib-tabs) .page-hero .hero-grid-bg, .calc-hero .hero-grid-bg, .ws-top .hero-grid-bg { display: none; }

/* one size, one rhythm */
body:has(.lib-tabs) :is(.lib-head, .calc-hero, .ws-controls, .ws-top, .page-hero) {
  position: relative; top: auto; padding: 32px 0 30px; border-bottom: 1px solid var(--line-dark); color: var(--on-dark);
}
body:has(.lib-tabs) .lib-head:has(+ .lib-band) { padding-bottom: 4px; border-bottom: 0; }
body:has(.lib-tabs) .page-hero .container { position: relative; z-index: 2; }

/* the kicker line: a short bar, then the group, or the way back to the shelf */
.lib-head-kicker, .calc-crumbs, .ws-back, body:has(.lib-tabs) .guide-breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; width: fit-content; margin: 0 0 12px;
  font-family: var(--font-body); font-size: 0.8125rem; font-weight: 500; line-height: 1.3; letter-spacing: 0;
  color: var(--on-dark-soft); text-decoration: none; text-transform: none;
}
.lib-head-kicker::before, .calc-crumbs::before, .ws-back::before, body:has(.lib-tabs) .guide-breadcrumb::before {
  content: ''; flex: none; width: 22px; height: 3px; border-radius: 2px; background: var(--c-dot-hi);
}
.lib-head-kicker a, .calc-crumbs a, body:has(.lib-tabs) .guide-breadcrumb a { color: var(--on-dark-soft); text-decoration: none; }
.lib-head-kicker a:hover, .calc-crumbs a:hover, .ws-back:hover, body:has(.lib-tabs) .guide-breadcrumb a:hover { color: var(--heading-ink); }
.calc-crumbs > span[aria-hidden], body:has(.lib-tabs) .guide-breadcrumb-sep { opacity: .55; margin: 0; }
/* a guide: "Prescribing guides / Mood stabilizers" on one line; the page's own name is the title below */
body:has(.lib-tabs) .guide-breadcrumb { display: inline-flex; margin-right: 0; vertical-align: middle; }
body:has(.lib-tabs) .guide-breadcrumb .guide-breadcrumb-sep, body:has(.lib-tabs) .guide-breadcrumb .guide-breadcrumb-sep + span { display: none; }
body:has(.lib-tabs) .guide-breadcrumb .lf-open-pill { display: none; }
body:has(.lib-tabs) .page-hero .guide-breadcrumb ~ .eyebrow {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 12px 10px; vertical-align: middle;
  font-family: var(--font-body); font-size: 0.8125rem; font-weight: 500; line-height: 1.3; letter-spacing: 0; text-transform: none;
  color: var(--on-dark-soft);
}
body:has(.lib-tabs) .page-hero .guide-breadcrumb ~ .eyebrow::before { display: inline; content: '/'; width: auto; height: auto; background: none; opacity: .55; }

/* the title */
.lib-head h1, .ws-title, .ws-top h1, .calc-hero h1, body:has(.lib-tabs) .page-hero h1, .lib-home-title {
  display: block; margin: 0; font-family: var(--font-display); color: var(--heading-ink);
  font-size: clamp(1.9rem, 1.3rem + 1.6vw, 2.6rem); font-weight: 600; line-height: 1.08; letter-spacing: -0.03em;
}
.ws-top h1.ws-h-ep { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.15rem); max-width: 900px; }
/* What We've Said: "What we've said about" is the kicker's job; the topic is the title */
.ws-top .ws-h-kick { display: block; margin: 0 0 6px; font-family: var(--font-body); font-size: 0.9375rem; font-weight: 500; letter-spacing: 0; color: var(--on-dark-soft); }

/* the one line under it */
.lib-head-sub, .ws-lede, .calc-hero .calc-full, .ws-top .ws-count, body:has(.lib-tabs) .page-hero h1 + p {
  margin: 10px 0 0 !important; max-width: 48rem !important; color: var(--on-dark-soft) !important;
  font-size: 1rem !important; line-height: 1.55 !important;
}
.lib-head-sub b, .ws-lede b { color: var(--on-dark); font-weight: 600; }
.ws-top .ws-also { margin: 4px 0 0; max-width: 48rem; color: var(--muted-light); font-size: 0.875rem; line-height: 1.5; }

/* a page inside a shelf: one meta row (time, update, links) and the star */
body:has(.lib-tabs) .page-hero .guide-hero-meta, .calc-hero .pf-fav-row, .ws-top .pf-fav-row, .lib-head .pf-fav-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 16px 0 0;
}
body:has(.lib-tabs) .page-hero .guide-hero-meta-item { font-size: 0.8125rem; color: var(--on-dark-soft); }

/* What We've Said's own search on a topic page: the Library search look, smaller */
.ws-top .ws-mini { display: flex; gap: 8px; max-width: 520px; margin: 18px 0 0; }
.ws-top .ws-mini input {
  flex: 1; min-width: 0; height: 44px; box-sizing: border-box; padding: 0 16px 0 44px; border-radius: 999px;
  border: 1px solid rgb(19 27 45 / .12); box-shadow: 0 1px 2px rgb(19 27 45 / .05); color: var(--heading-ink); font: 400 0.9375rem/1.3 var(--font-body);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='17' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='M21 21l-4.35-4.35'/%3E%3C/svg%3E") no-repeat 16px 50%;
}
.ws-top .ws-mini input:focus { outline: none; border-color: rgb(63 111 214 / .5); box-shadow: 0 0 0 3px rgb(63 111 214 / .22); }
.ws-top .ws-mini button {
  flex: none; height: 44px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--heading-ink); color: #fff; font: 600 0.875rem/1 var(--font-body);
}
.ws-top .ws-mini button:hover { background: #24304A; }

/* ---------- 4. The band: search, then "Try", then filters ---------- */
body:has(.lib-tabs) .lib-band { padding: 18px 0 20px; }
.lib-head + .lib-band { padding-top: 20px; }
.ws-controls .ws-search-wrap { margin-top: 20px; }
.qa-band { margin-bottom: 0; }

/* the label in front of a row: Try, Topic, Chapter, Drug class, Or browse */
.filter-label, .fr-row .lbl, .dc-try-label, .ws-try > span, .qa-suggest-lbl, .ws-browse > span, .lib-try > span {
  font-family: var(--font-body) !important; font-size: 0.8125rem !important; font-weight: 500 !important; letter-spacing: 0 !important;
  text-transform: none !important; color: var(--on-dark-soft) !important;
}
/* "Try": examples that fill the search box, lighter than the filters under them */
.ws-try, .qa-suggest, .lib-try { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; max-width: 900px; padding-left: 5rem; }
.ws-try > span, .qa-suggest-lbl, .lib-try > span { flex: none; width: 5rem; margin: 0 -6px 0 -5rem; }
.ws-try button, .qa-sugg, .lib-try button {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; margin: 0;
  border: 0; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: rgb(255 255 255 / .62); color: var(--heading-ink); box-shadow: inset 0 0 0 1px rgb(19 27 45 / .06);
  font-family: var(--font-body); font-size: 0.8125rem; font-weight: 500; line-height: 1; letter-spacing: 0; text-transform: none; text-decoration: none;
  transition: background .16s, box-shadow .16s;
}
.ws-try button:hover, .qa-sugg:hover, .lib-try button:hover { background: #fff; box-shadow: inset 0 0 0 1px rgb(19 27 45 / .16); color: var(--heading-ink); }
.ws-try button:focus-visible, .qa-sugg:focus-visible, .lib-try button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* the filters: one chip everywhere (guides, handouts, DSM-5, Q&As, patients, scales) and the jump chips on Tools and Misc */
.lib-band :is(.filter-chip, .calc-chip, .fr-chip, .dc-try .dc-chip), .mr-jump a {
  display: inline-flex; align-items: center; height: 34px; padding: 0 13px; gap: 0;
  border: 1px solid rgb(19 27 45 / .1); border-radius: 999px; background: #fff; color: var(--heading-ink);
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 500; line-height: 1; letter-spacing: 0; text-transform: none; text-decoration: none;
  box-shadow: 0 1px 1px rgb(19 27 45 / .03); white-space: nowrap;
}
.lib-band :is(.filter-chip, .calc-chip, .fr-chip, .dc-try .dc-chip):hover, .mr-jump a:hover { border-color: rgb(19 27 45 / .24); background: #fff; color: var(--heading-ink); }
.lib-band :is(.filter-chip.active, .calc-chip[aria-pressed="true"], .fr-chip[aria-pressed="true"], .dc-try .dc-chip[aria-pressed="true"]) {
  background: var(--heading-ink); border-color: var(--heading-ink); color: #fff; font-weight: 600;
}
.mr-jump { display: flex; flex-wrap: wrap; gap: 6px; }
.mr-jump a b, .mr-jump a small { margin-left: 7px; font-size: 0.75rem; font-weight: 500; color: var(--muted-light); }
.mr-jump a .chip-dot { margin-right: 8px; }
.tk-jumpband { padding-top: 20px; }

/* What We've Said: "Or browse" lists as chips, and the newest episode as one quiet line */
.ws-below { margin-top: 14px; }
.ws-browse { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 5rem; }
.ws-browse > span { flex: none; width: 5rem; margin: 0 -6px 0 -5rem; }
.ws-browse a {
  display: inline-flex; align-items: center; height: 34px; padding: 0 13px; border: 1px solid rgb(19 27 45 / .1); border-radius: 999px;
  background: #fff; color: var(--heading-ink); font-size: 0.875rem; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.ws-browse a:hover { border-color: rgb(19 27 45 / .24); color: var(--heading-ink); }
.ws-browse a small { margin-left: 7px; font-size: 0.75rem; color: var(--muted-light); }
.ws-new { margin: 16px 0 0; padding: 12px 0 0; border-top: 1px solid rgb(19 27 45 / .08); font-size: 0.875rem; }
.ws-new-tag { background: var(--heading-ink); color: #fff; border-radius: 999px; padding: 3px 8px; font-size: 0.625rem; }

@media (max-width: 640px) {
  .ws-try, .qa-suggest, .lib-try, .ws-browse { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 22px var(--s-5) 2px; margin-inline: calc(var(--s-5) * -1); position: relative; }
  .ws-try::-webkit-scrollbar, .qa-suggest::-webkit-scrollbar, .lib-try::-webkit-scrollbar, .ws-browse::-webkit-scrollbar { display: none; }
  .ws-try > span, .qa-suggest-lbl, .lib-try > span, .ws-browse > span { position: absolute; top: 0; left: var(--s-5); width: auto; margin: 0; }
  .ws-try button, .qa-sugg, .lib-try button, .ws-browse a { flex: none; }
  .lib-try, .ws-browse { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
}

/* ---------- 5. Notes: one quiet box ---------- */
.dc-notice, .library-moved, .qa-ask, .lt-note {
  display: block; max-width: 52rem;
  margin: 24px 0 0; padding: 14px 18px; border: 0; border-radius: 12px;
  background: rgb(255 255 255 / .8); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--slate); font-size: 0.875rem; line-height: 1.55;
}
.dc-notice { display: flex; gap: 12px; align-items: flex-start; }
.qa-ask { display: flex; gap: 12px 20px; max-width: none; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 18px 20px; margin-top: 40px; }
.qa-ask p { font-size: 0.9375rem; }
.dc-notice > svg { color: var(--muted-light); }
.dc-notice b, .library-moved b, .qa-ask b { color: var(--heading-ink); font-weight: 600; }
.library-moved a, .dc-notice a { color: var(--teal-deep); font-weight: 600; }

/* ---------- 6. Headings: a section title, and a group heading in the group's colour ---------- */
/* the line that says how many are showing */
.library-count, .dc-status, .lib-count, .fr-count, .qa-count {
  margin: 26px 0 0; font-size: 0.875rem; line-height: 1.4; color: var(--muted-light);
}
/* a section of a shelf: Antidepressants, Diagnosis overviews, Browse by chapter, Every topic, All Q&As */
.cat-title, .fr-section-head, .fr-pick-h, .qa-home-h, .ws-home-sec > h2, .dc-browse-h, .dc-home h2, .tk-index > section > h2:not(.lt-group-h):not(#tk-feature-h) {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 48px 0 4px;
  font-family: var(--font-display); font-size: 1.625rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; color: var(--heading-ink);
}
.class-group:first-child .cat-title, .fr-section:first-child .fr-section-head, .fr-pick-h, .qa-home-h, .ws-home-sec:first-child > h2 { margin-top: 28px; }
.cat-title .cat-n, .fr-section-n, .ws-home-sec > h2 small {
  margin: 0; font-family: var(--font-body); font-size: 0.875rem; font-weight: 500; letter-spacing: 0; color: var(--muted-light); background: none; padding: 0;
}
.fr-section-sub, .fr-pick-p, .ws-index-note, .lt-group-p, .ws-home-sec > p {
  margin: 6px 0 18px; max-width: 46rem; color: var(--muted-light); font-size: 0.9375rem; line-height: 1.55;
}
/* a group of cards: a bar in the group's colour, the name, the count, a hairline to the edge */
.class-group-head, .fr-sub-head, .ws-group h3, .lt-group-h, .calc-group > h2, .calc-index h2 {
  display: flex; align-items: center; gap: 10px; margin: 28px 0 12px;
  font-family: var(--font-body); font-size: 1.0625rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.005em; color: var(--c-ink);
}
.class-group-head :is(h2, h3) { font-size: 1.0625rem; }
.class-group-head::before, .fr-sub-head::before, .ws-group h3::before, .lt-group-h::before, .calc-group > h2::before, .calc-index h2::before {
  content: ''; display: block; position: static; flex: none; width: 4px; height: 18px; border-radius: 2px; background: var(--c-dot);
}
.class-group-head::after, .fr-sub-head::after, .ws-group h3::after, .lt-group-h::after, .calc-group > h2::after, .calc-index h2::after {
  content: ''; order: 2; flex: 1; height: 1px; background: var(--c-line); opacity: .8;
}
.class-group-head .grp-count, .fr-sub-n, .ws-group h3 span, .lt-group-h b, .lt-group-h small, .lt-group-h .lt-n, .calc-group > h2 small, .calc-index h2 small {
  order: 1; margin: 0; font-family: var(--font-body); font-size: 0.8125rem; font-weight: 500; line-height: 1; color: var(--muted-light); background: none; padding: 0;
}
@media (max-width: 640px) {
  .cat-title, .fr-section-head, .fr-pick-h, .qa-home-h, .ws-home-sec > h2 { font-size: 1.375rem; margin-top: 40px; }
}

/* ---------- 7. Cards: one frame ---------- */
/* Patient resources and Misc resources: the same card as a guide or a scale */
.fr-item, .fr-pick-btn {
  background: linear-gradient(165deg, var(--c-card-hi) 0%, var(--c-card-lo) 100%) !important;
  box-shadow: inset 0 0 0 1px var(--c-line), inset 5px 0 0 var(--c-dot), 0 1px 2px rgb(19 27 45 / .04) !important;
  border: 0 !important; border-radius: var(--lib-r, 14px) !important; color: var(--heading-ink); filter: none !important;
  transition: box-shadow .18s var(--lib-ease), transform .18s var(--lib-ease);
}
a.fr-item:hover, .fr-pick-btn:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px var(--c-line), inset 5px 0 0 var(--c-dot), 0 16px 30px -20px rgb(19 27 45 / .4) !important;
}
.fr-pick-btn::before { display: none !important; }
.fr-item { padding: 14px 44px 16px 18px; min-height: 96px; gap: 4px; }
.fr-title, .fr-pick-btn b { font-family: var(--font-display); font-size: 1.0625rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; color: var(--heading-ink) !important; }
.fr-desc, .fr-pick-btn span { font-size: 0.8125rem; line-height: 1.45; color: var(--c-soft) !important; }
/* the small tag on a card (PDF, Guide, Course, the members lock): the same flag as the guides' */
.fr-kind {
  height: 22px; padding: 0 8px; border-radius: 6px; gap: 5px;
  font-family: var(--font-body); font-size: 0.6875rem; font-weight: 600; letter-spacing: .02em; text-transform: none;
  color: var(--c-ink) !important; background: rgb(255 255 255 / .8) !important; box-shadow: inset 0 0 0 1px var(--c-line);
}
/* the DSM-5 chapters: the card's two buttons in the site's button style */
.dc-chapter :is(.dc-open, .dc-chapter-open, .dc-ch-open) { font-family: var(--font-body); }

/* the Q&A videos: the same frame and tags as the rest of the Library */
.qa-card { border: 0; border-radius: var(--lib-r, 14px); box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgb(19 27 45 / .04); }
.qa-card:hover { box-shadow: inset 0 0 0 1px var(--line-strong), 0 16px 30px -20px rgb(19 27 45 / .4); }
@supports (color: oklch(0.5 0.1 200)) {
  .qa-card-art { background-image: radial-gradient(120% 120% at 100% 0%, oklch(0.9 0.07 calc(var(--sh, 320) + 30) / .8), transparent 55%), linear-gradient(160deg, oklch(0.97 0.02 var(--sh, 320)), oklch(0.93 0.05 var(--sh, 320))); }
}
.qa-card-kind, .qa-tag {
  font-family: var(--font-body); font-size: 0.6875rem; font-weight: 600; letter-spacing: .02em; text-transform: none;
}
.qa-card-kind { padding: 4px 9px; color: var(--heading-ink); }
.qa-tag { padding: 3px 8px; border-radius: 6px; }
.qa-card-title { font-size: 1.25rem; letter-spacing: -0.015em; }
.qa-card-cta { color: var(--teal-deep); }

/* What We've Said: every topic as the Library's chip */
.ws-chips a {
  display: inline-flex; align-items: center; height: 30px; padding: 0 11px; border-radius: 999px;
  background: #fff; color: var(--heading-ink); text-decoration: none; font-size: 0.8125rem; font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--line); border: 0;
}
.ws-chips a:hover { box-shadow: inset 0 0 0 1px var(--c-dot); color: var(--c-ink); }
.ws-chips small { margin-left: 6px; }

/* ---------- 8. A page inside a shelf: the contents on the right, as in the guides ---------- */
@media (min-width: 901px) {
  .ws-grid { grid-template-columns: minmax(0, 1fr) 240px; gap: 48px; padding-top: 32px; }
  .ws-grid > .ws-toc { order: 2; }
  .ws-grid > .ws-article, .ws-grid > :not(.ws-toc) { order: 1; }
}
.ws-toc {
  top: calc(var(--header-h) + 24px); padding: 16px; border-radius: var(--r-lg, 18px);
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--line);
}
.ws-toc::before {
  content: 'On this page'; display: block; margin: 0 0 8px 10px;
  font-family: var(--font-body); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted-light);
}
.ws-toc a { font-size: 0.875rem; padding: 5px 10px; }
.ws-toc a:hover { background: #fff; }
@media (max-width: 900px) {
  .ws-toc { padding: 12px; }
  .ws-toc::before { flex-basis: 100%; }
}

/* ---------- Library home: the same header as a shelf ---------- */
.lib-home-band { padding: 32px 0 28px; }
.lib-home-band .lib-head-kicker::before { background: linear-gradient(90deg, #F84464, #6498EC); }
.lib-home-band .lib-head-sub { margin-bottom: 20px !important; }
.lib-home-band .lib-try { margin-top: 12px; }

@media (max-width: 640px) {
  body:has(.lib-tabs) :is(.lib-head, .calc-hero, .ws-controls, .ws-top, .page-hero) { padding-top: 24px; }
  .lib-head-sub, .ws-lede, .calc-hero .calc-full, .ws-top .ws-count, body:has(.lib-tabs) .page-hero h1 + p { font-size: 0.9375rem !important; }
}

@media print {
  .lib-tabs, .lib-head, .lib-band, .lib-home-band, .ws-controls { display: none !important; }
}

/* ---------- Fixes found in the side-by-side check ---------- */
/* DSM-5: the locked "One-page sheet" button was dark text on a dark pill; now the quiet outline button */
.dc-chapter .dc-btn.is-locked { color: var(--c-ink); background: rgb(255 255 255 / .75); border-color: var(--c-line); }
.dc-chapter .dc-btn.is-locked:hover { color: var(--heading-ink); background: #fff; border-color: var(--c-dot); }
/* Patient and Misc resources: the members lock sits where the guides' lock does, bottom right, icon only */
.fr-item .fr-kind:has(svg) { position: absolute; right: 10px; bottom: 10px; order: 0; padding: 0 6px; font-size: 0; gap: 0; }
.fr-item .fr-kind:has(svg) svg { width: 12px; height: 12px; }
/* What We've Said topic page: the kicker already says where you are, so the title is the topic alone
   (the words stay in the heading for screen readers) */
.ws-top .ws-h-kick { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Guide Builder: its access panel sits on the page, not in a second coloured band under the header */
body:has(.lib-tabs) .page-hero.gb-hero { background: none; border: 0; padding: 20px 0 0; }
/* What We've Said episode pages: the moments line up with the header's left edge */
.container.ws-ep-wrap { max-width: var(--container, 1160px); }
.ws-ep-wrap > .ws-article { max-width: 900px; }
