/* Weave Study Guides web edition, unified with the shared site design system.
   Scoped under .study so the shared site nav/footer keep their own styling. */
:root{
  --st-field:var(--thread-sage); --st-field-dk:var(--thread-sage);
  --st-coral:var(--thread-teal); --st-coral-dk:var(--thread-teal);
  --st-ink:var(--ink); --st-soft:var(--ink-2); --st-grey:var(--ink-3);
  --st-rule:var(--hairline); --st-tint:color-mix(in srgb, var(--thread-sage) 6%, var(--cloth));
  --st-petrol:var(--thread-teal);
}
.study{
  --disp:var(--font-display);
  --serif:var(--font-ui);
  max-width:760px; margin:0 auto; padding:42px 22px 90px;
  font-family:var(--serif); color:var(--st-ink); font-size:1.06rem; line-height:1.62;
  overflow-x:clip; /* safety net: no single element can scroll the whole page */
}
/* Wrap long, unbreakable medical terms everywhere text lives. */
.study :where(p,li,dt,dd,td,th,blockquote,figcaption,.lr-term,.device,.qa-q,.qa-a,
  .gc-name,.c-title,.g-title,.ma-chip,h3.sec,h4.sub,h5.subsub){
  overflow-wrap:anywhere; word-break:break-word;
}
.study :where(p,li,dd){ hyphens:auto; }
.study :where(img,svg,video){ max-width:100%; height:auto; }
.study strong{ color:var(--st-ink); }
.study em{ font-style:italic; }
.study a{ color:var(--st-coral-dk); }

/* Hub */
.study-hub{ max-width:980px; }
.hub-hero{ border-bottom:2px solid var(--st-field); padding-bottom:26px; margin-bottom:26px; }
.hub-eyebrow{ font-family:var(--disp); font-weight:700; letter-spacing:3px;
  text-transform:uppercase; color:var(--st-coral); font-size:.82rem; }
.hub-eyebrow::before, .g-eyebrow::before, .c-eyebrow::before{ content:""; display:inline-block;
  width:1.35em; height:1.35em; margin-right:.5em; vertical-align:-.3em;
  background:url("/img/sprig.svg") no-repeat center / contain; }
.hub-title{ font-family:var(--disp); font-weight:700; font-size:3.1rem; line-height:1.02;
  color:var(--st-ink); margin:.3rem 0 .5rem; }
.hub-title .c{ color:var(--st-coral); }
.hub-dek{ font-size:1.16rem; color:var(--st-soft); max-width:64ch; }
.hub-downloads{ margin-top:20px; display:grid; grid-template-columns:repeat(5,1fr); gap:11px; }
.dl-label{ font-family:var(--disp); font-weight:600; color:var(--st-soft); font-size:.9rem;
  grid-column:1/-1; margin-bottom:2px; }
/* Full-width download boxes */
.hub-downloads .dl-btn{ display:flex; align-items:center; justify-content:center; text-align:center;
  background:linear-gradient(165deg,var(--thread-teal),color-mix(in srgb,var(--thread-teal) 80%,#000)); color:var(--cloth); font-family:var(--disp);
  font-weight:700; letter-spacing:.3px; text-decoration:none; padding:16px 14px; border-radius:11px;
  font-size:1rem; border:1px solid var(--hairline);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08), 0 12px 22px -15px rgba(35,73,77,.65);
  transition:transform .15s ease, box-shadow .25s ease, border-color .2s ease, background .2s ease; }
.hub-downloads .dl-btn:hover{ background:linear-gradient(165deg,color-mix(in srgb,var(--thread-teal) 92%,#fff),color-mix(in srgb,var(--thread-teal) 72%,#000));
  transform:translateY(-3px); border-color:var(--hairline);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.1), 0 18px 30px -16px rgba(35,73,77,.75); }

.card-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(214px,1fr)); gap:14px; }
/* Guide cards match the Library tiles */
.g-card{ display:flex; flex-direction:column; gap:3px; text-decoration:none;
  border:1px solid var(--st-rule); border-radius:14px; padding:16px 18px;
  background:var(--cloth); box-shadow:var(--shadow-soft);
  transition:border-color .2s ease, transform .18s ease, box-shadow .25s ease; }
.g-card:hover{ border-color:var(--st-field); transform:translateY(-4px);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.7), 0 2px 6px rgba(42,34,24,.06), 0 22px 38px -18px rgba(42,34,24,.34); }
/* filter fix: .g-card sets display:flex, which beats the UA [hidden]{display:none};
   without this rule, filtered-out cards never hide and matched cards (appendChild'd
   to the grid end) appear to sort to the bottom. This repairs paper/high-yield/name filters. */
.study .g-card[hidden]{ display:none; }
.gc-num{ font-family:var(--disp); font-weight:700; color:var(--st-coral); font-size:.92rem; }
.gc-name{ font-family:var(--disp); font-weight:700; color:var(--st-ink); font-size:1.06rem; line-height:1.2; }
.gc-meta{ color:var(--st-grey); font-size:.82rem; }
.gc-top{ display:flex; align-items:baseline; justify-content:space-between; gap:8px; }
.gc-paper{ font-family:var(--disp); font-size:.66rem; font-weight:700; letter-spacing:.5px;
  text-transform:uppercase; color:var(--st-grey); }
.gc-foot{ display:flex; align-items:center; justify-content:space-between; gap:6px 8px; margin-top:6px; flex-wrap:wrap; }
.gc-meta{ white-space:nowrap; }
.gc-badge{ font-family:var(--disp); font-weight:700; font-size:.64rem; letter-spacing:.4px;
  text-transform:uppercase; padding:2px 9px; border-radius:20px; white-space:nowrap; }
.gc-high{ background:var(--thread-sage); color:var(--cloth); }
.gc-moderate{ background:var(--st-tint); color:var(--thread-teal); }

/* Hub browse controls */
.hub-controls{ display:flex; flex-wrap:wrap; gap:12px 16px; align-items:center; min-height:44px;
  justify-content:space-between; margin:4px 0 10px; }
.paper-chips{ display:flex; flex-wrap:wrap; gap:7px; }
.paper-chips .chip{ font-family:var(--disp); font-weight:600; font-size:.85rem;
  color:var(--st-ink); background:var(--cloth); border:1px solid var(--st-rule);
  padding:6px 13px; border-radius:20px; cursor:pointer; transition:all .12s; }
.paper-chips .chip:hover{ border-color:var(--st-field); }
.paper-chips .chip.active{ background:var(--st-petrol); color:var(--cloth); border-color:var(--st-petrol); }
.hub-controls-r{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.hy-toggle{ font-family:var(--disp); font-size:.85rem; color:var(--st-soft);
  display:flex; align-items:center; gap:5px; cursor:pointer; }
.hy-toggle input{ accent-color:var(--st-coral); }
#sort-by,#filter-text{ font-family:var(--disp); font-size:.85rem; color:var(--st-ink);
  border:1px solid var(--st-rule); border-radius:7px; padding:6px 10px; background:var(--cloth); }
#filter-text{ min-width:150px; }
.hub-count{ font-family:var(--disp); font-size:.8rem; color:var(--st-grey); margin:0 0 14px; }
.hub-empty{ font-size:1rem; color:var(--st-soft); padding:28px 0; text-align:center; }

/* Most-asked callout on guide pages */
.most-asked{ display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin:13px 0 2px; }
.ma-label{ font-family:var(--disp); font-weight:700; font-size:.7rem; letter-spacing:.6px;
  text-transform:uppercase; color:var(--st-coral); }
.ma-chip{ font-size:.85rem; color:var(--st-ink); background:var(--st-tint);
  border:1px solid var(--st-rule); padding:3px 10px; border-radius:20px; }

/* Guide page */
.study-guide{ font-size:1.08rem; }
.back-hub{ display:inline-block; font-family:var(--disp); font-weight:600; font-size:.9rem;
  color:var(--st-coral-dk); text-decoration:none; margin:0 0 18px; }
.g-eyebrow{ font-family:var(--disp); font-weight:700; letter-spacing:2.5px;
  text-transform:uppercase; color:var(--st-coral); font-size:.82rem; }
.g-title{ font-family:var(--disp); font-weight:700; font-size:2.5rem; line-height:1.05;
  color:var(--st-ink); margin:.25rem 0 .4rem; }
.g-dek{ font-style:italic; color:var(--st-coral-dk); font-size:1.1rem;
  border-top:1.5px solid var(--st-rule); padding-top:12px; }
.chap-nav{ display:flex; flex-wrap:wrap; gap:8px; margin:18px 0 8px; }
.chap-nav a{ font-family:var(--disp); font-size:.85rem; font-weight:600; text-decoration:none;
  color:var(--st-ink); background:var(--st-tint); border:1px solid var(--st-rule);
  padding:5px 11px; border-radius:20px; }
.chap-nav a:hover{ border-color:var(--st-field); }
.g-chap{ margin:30px 0; scroll-margin-top:80px; }
.c-eyebrow{ font-family:var(--disp); font-weight:700; letter-spacing:2px;
  text-transform:uppercase; color:var(--st-coral); font-size:.78rem; }
.c-title{ font-family:var(--disp); font-weight:700; font-size:1.7rem; color:var(--st-ink);
  margin:.2rem 0 .6rem; padding-bottom:8px; border-bottom:2px solid var(--st-field); }

/* content headings (mapped from md) */
.study h3.sec{ font-family:var(--disp); font-weight:700; font-size:1.3rem; color:var(--st-ink); margin:1.4rem 0 .4rem; }
.study h4.sub{ font-family:var(--disp); font-weight:700; font-size:1.08rem; color:var(--st-coral-dk); margin:1.1rem 0 .3rem; }
.study h5.subsub{ font-family:var(--disp); font-weight:700; font-size:.92rem; text-transform:uppercase;
  letter-spacing:.5px; color:var(--st-soft); margin:.9rem 0 .3rem; }
.study hr{ border:none; border-top:1px solid var(--st-rule); margin:1.3rem 0; }
.study code{ font-family:"SF Mono",Menlo,Consolas,monospace; font-size:.86em;
  background:var(--st-tint); padding:1px 5px; border-radius:3px;
  overflow-wrap:anywhere; white-space:break-spaces; }
.dia-arrow{ color:var(--st-coral); font-weight:700; }

/* label-rows */
.study .lrows{ margin:1rem 0 1.2rem; }
.study .lr-head{ font-family:var(--disp); font-weight:700; letter-spacing:1.5px;
  text-transform:uppercase; color:var(--st-coral); font-size:.8rem; margin-bottom:5px; }
.study .lrow{ padding:9px 0; border-bottom:1px solid var(--st-rule); }
.study .lrow:last-child{ border-bottom:none; }
.study .lr-term{ color:var(--st-coral-dk); font-weight:700; }
.study .lr-term.disp{ font-family:var(--disp); }

/* matrix tables (scrollable on small screens) */
.tw{ overflow-x:auto; margin:1.1rem 0 1.3rem; -webkit-overflow-scrolling:touch; }
.tw-hint{ display:none; } /* Swipe affordance for wide tables, shown only on phones */
.study table.mx{ width:100%; border-collapse:collapse; font-size:.96rem; line-height:1.36; min-width:520px; }
.study table.mx th{ background:var(--st-petrol); color:var(--cloth); text-align:left; font-family:var(--disp);
  font-weight:700; font-size:.8rem; letter-spacing:.4px; text-transform:uppercase; padding:9px 11px;
  vertical-align:top; }
.study table.mx td{ padding:8px 11px; border-bottom:1px solid var(--st-rule); vertical-align:top; }
.study table.mx tbody tr:nth-child(even) td{ background:var(--st-tint); }
.study table.mx td:first-child{ font-weight:600; color:var(--st-coral-dk); }

/* boxes */
.study .box{ margin:1.1rem 0; padding:12px 16px; background:var(--st-tint);
  border-left:3px solid var(--st-coral); border-radius:0 5px 5px 0; }
.study .box .box-label{ font-family:var(--disp); font-weight:700; font-size:.76rem;
  letter-spacing:1.2px; text-transform:uppercase; color:var(--st-coral-dk); margin-bottom:3px; }
.study .box-clinical{ border-left-color:var(--st-petrol); }
.study .box-clinical .box-label{ color:var(--st-petrol); }
.study .box-mnemonic{ border-left:none; border:1.5px solid var(--st-field); background:var(--cloth); }
.study .box-mnemonic .device{ font-family:var(--disp); font-weight:700; font-size:1.12rem; margin:4px 0; }
.study .box-diagram{ background:var(--cloth); border:1px solid var(--st-rule); text-align:center; }
.study .qa{ margin:1rem 0; padding:9px 0; border-bottom:1px solid var(--st-rule); }
.study .qa-q{ font-weight:700; color:var(--st-coral-dk); }
.study .qa-a{ padding-left:14px; border-left:2px solid var(--st-field); }
.study .vignette{ background:var(--st-tint); border:1px solid var(--st-rule); border-radius:5px; padding:12px 16px; margin:1.1rem 0; }
.study .vignette .box-label{ font-family:var(--disp); font-weight:700; font-size:.76rem;
  letter-spacing:1.2px; text-transform:uppercase; color:var(--st-coral-dk); margin-bottom:4px; }

/* Pagefind UI theming */
/* hidden-but-indexable filter tokens (Pagefind reads them; users never see them) */
.pf-filter{ position:absolute !important; width:1px; height:1px; overflow:hidden;
  clip:rect(0 0 0 0); white-space:nowrap; border:0; padding:0; margin:-1px; }
/* search affordance (modal trigger sits top-right; Ctrl+K also opens it) */
.study-searchbar{ max-width:980px; min-height:48px; margin:96px auto 0; padding:0 22px;
  display:flex; justify-content:flex-end; }
.hub-searchbox{ display:block; width:100%; min-height:64px; margin:6px 0 30px; }
/* Stretch the inline Pagefind search to the full content width.
   Pagefind's component CSS pins .pf-searchbox to max-width:480px + inline-block, so override hard. */
.hub-searchbox .pf-searchbox{ width:100% !important; max-width:none !important; display:block !important; }
.hub-searchbox .pf-searchbox-input-wrapper{ width:100% !important; max-width:none !important; }
.hub-searchbox .pf-searchbox-input{ width:100% !important; max-width:none !important; box-sizing:border-box;
  font-size:1.06rem; padding:15px 18px; border-radius:12px; }

/* Pagefind Component UI theming (these --pf-* vars pierce the shadow DOM) */
:root{
  --pf-font:var(--font-ui);
  --pf-text:var(--ink); --pf-text-secondary:var(--ink-2); --pf-text-muted:var(--ink-3);
  --pf-background:var(--cloth); --pf-border:var(--hairline); --pf-border-focus:#0F766E;
  --pf-hover:color-mix(in srgb, var(--thread-sage) 6%, var(--cloth)); --pf-mark:#0F766E; --pf-border-radius:10px;
  --pf-modal-backdrop:rgba(42,34,24,.45); --pf-modal-top:8vh;
  --pf-result-title-font-size:1.05rem;
  --pf-outline-focus:#0F766E; --pf-outline-width:2px;
}

/* In-guide jump menu */
.jump-toc{ margin:4px 0 22px; border:1px solid var(--st-rule); border-radius:10px;
  background:var(--cloth); overflow:hidden; }
.jump-toc>summary{ cursor:pointer; list-style:none; padding:11px 16px;
  font-family:var(--disp); font-weight:700; font-size:.95rem; color:var(--st-coral-dk);
  background:var(--st-tint); display:flex; align-items:center; gap:9px; }
.jump-toc>summary::-webkit-details-marker{ display:none; }
.jump-toc>summary::before{ content:"\2630"; color:var(--st-coral); font-size:.95rem; }
.jump-toc[open]>summary{ border-bottom:1px solid var(--st-rule); }
.jt-body{ padding:12px 16px 14px; columns:2; column-gap:26px; }
.jt-group{ break-inside:avoid; margin-bottom:11px; }
.jt-chap{ display:block; font-family:var(--disp); font-weight:700; font-size:.7rem;
  letter-spacing:.7px; text-transform:uppercase; color:var(--st-grey); margin-bottom:3px; }
.jt-group a{ display:block; font-size:.92rem; color:var(--st-ink); text-decoration:none;
  padding:2px 0; line-height:1.35; }
.jt-group a:hover{ color:var(--st-coral-dk); }
@media(max-width:640px){ .jt-body{ columns:1; } .study-searchbar{ margin-top:80px; padding:0 16px; }
  .hub-controls{ gap:9px; } .hub-controls-r{ width:100%; }
  #filter-text{ flex:1; min-width:0; } }

/* Tactile feedback stays subtle for study material */
.g-card, .dl-btn, .chap-nav a, .hub-cta{ transition:transform .12s ease, border-color .15s ease, background .15s ease; }
.g-card:active, .dl-btn:active, .chap-nav a:active{ transform:scale(.98); }

/* Phone, <= 640px */
@media (max-width:640px){
  .hub-title{ font-size:2.35rem; }
  .g-title{ font-size:1.95rem; line-height:1.08; }
  .study{ padding:28px 16px 72px; font-size:1.05rem; }
  .study-guide{ font-size:1.06rem; line-height:1.66; }
  .hub-dek{ font-size:1.06rem; }

  /* download buttons: two-up on phones, easy to tap */
  .hub-downloads{ grid-template-columns:repeat(2,1fr); gap:9px; }
  .hub-downloads .dl-btn{ padding:14px 12px; font-size:.95rem; }

  /* chapter nav: short labels wrap to show all six, nothing scrolls off-edge */
  .chap-nav{ flex-wrap:wrap; gap:7px; margin:16px 0 12px; }
  .chap-nav a{ padding:7px 13px; font-size:.86rem; }

  .c-title{ font-size:1.5rem; }
  .study h3.sec{ font-size:1.24rem; }

  /* Narrow two-column tables dissolve into labeled cards */
  .study .tw:not(.tw-wide){ overflow:visible; margin:1rem 0 1.3rem; }
  .study .tw:not(.tw-wide) table.mx{ display:block; width:100%; min-width:0; border-collapse:separate; font-size:1rem; }
  .study .tw:not(.tw-wide) table.mx thead{ display:none; }
  .study .tw:not(.tw-wide) table.mx tbody{ display:block; }
  .study .tw:not(.tw-wide) table.mx tr{
    display:block; margin:0 0 13px; background:var(--cloth);
    border:1px solid var(--st-rule); border-radius:13px; overflow:hidden;
    box-shadow:0 1px 2px rgba(42,34,24,.04);
  }
  .study .tw:not(.tw-wide) table.mx tbody tr:nth-child(even) td{ background:transparent; }
  .study .tw:not(.tw-wide) table.mx td{
    display:block; text-align:left; padding:8px 16px;
    border-bottom:1px solid var(--st-rule); border-radius:0;
    background:transparent; color:var(--st-ink); font-weight:400;
    overflow-wrap:anywhere; word-break:break-word;
  }
  .study .tw:not(.tw-wide) table.mx td:last-child{ border-bottom:none; }
  .study .tw:not(.tw-wide) table.mx td::before{
    content:attr(data-th); display:block;
    font-family:var(--disp); font-weight:700; font-size:.64rem; letter-spacing:.7px;
    text-transform:uppercase; color:var(--st-grey); margin-bottom:1px;
  }
  /* First cell becomes the card title bar with the knowledge accent */
  .study .tw:not(.tw-wide) table.mx td:first-child{
    display:block; padding:11px 15px 10px 18px;
    background:var(--st-tint); border-bottom:1px solid var(--st-rule);
    border-left:3px solid var(--st-coral);
    font-family:var(--disp); font-weight:700; font-size:1.05rem; color:var(--st-coral-dk);
  }
  .study .tw:not(.tw-wide) table.mx td:first-child::before{ display:none; }
  /* if a cell has no label (rare), do not show an empty tag */
  .study .tw:not(.tw-wide) table.mx td[data-th=""]::before{ display:none; }

  /* Wide comparison tables stay tabular and scroll horizontally */
  .study .tw-hint{ display:block; font-family:var(--disp); font-weight:700;
    font-size:.62rem; letter-spacing:.7px; text-transform:uppercase;
    color:var(--st-grey); margin:1rem 0 -.2rem; }
  .study .tw-wide{ overflow-x:auto; -webkit-overflow-scrolling:touch; margin:.2rem 0 1.3rem; }
  .study .tw-wide table.mx{ width:max-content; min-width:100%; font-size:.9rem; }
  .study .tw-wide table.mx td{ max-width:72vw; } /* verbose cells wrap, not one giant column */
  .study .tw-wide table.mx th:first-child,
  .study .tw-wide table.mx td:first-child{ position:sticky; left:0; z-index:1; }
  .study .tw-wide table.mx td:first-child{
    background:var(--cloth); color:var(--st-coral-dk); font-weight:700;
    box-shadow:1px 0 0 var(--st-rule);
  }
  .study .tw-wide table.mx tbody tr:nth-child(even) td:first-child{ background:var(--st-tint); }
}

.hub-eyebrow, .g-eyebrow, .c-eyebrow, .gc-num, .gc-paper, .gc-badge,
.paper-chips .chip, .ma-label, .ma-chip, .dl-label, .back-hub, .chap-nav a,
.hub-count, .jt-chap, .lr-head, .box-label, .study table.mx th, #sort-by,
#filter-text, .hy-toggle{ font-family:var(--font-ui); }

.crisis-block{ display:grid; grid-template-columns:minmax(0,3fr) minmax(14rem,2fr);
  gap:clamp(1.5rem,5vw,4rem); align-items:center; }
.crisis-block__art{ width:min(100%,20rem); max-height:25rem; object-fit:contain; justify-self:center; }
@media(max-width:767px){
  .crisis-block{ grid-template-columns:1fr; }
  .crisis-block__art{ grid-row:1; width:min(58%,14rem); max-height:17rem; }
}

@media (prefers-reduced-motion:reduce){
  .g-card, .dl-btn, .chap-nav a, .hub-cta{ transition:none; }
  .g-card:active, .dl-btn:active, .chap-nav a:active{ transform:none; }
}
