/* ============================================================
   components.css — nav, hero, chapters, content components
   ============================================================ */

/* ── Sticky navigation ── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: rgba(248, 247, 244, 0.88);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 300;
}
.nav__brand {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-deep);
  text-decoration: none;
  white-space: nowrap;
}
.nav__brand:hover { color: var(--accent-2); }
.nav__title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav__title-sep { color: var(--border-strong); margin: 0 0.6rem; }
.nav__spacer { flex: 1; }

/* Contents button + menu */
.nav__contents { position: relative; }
.nav__contents-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.nav__contents-btn:hover { background: var(--surface-elevated); border-color: var(--accent); }
.nav__contents-btn svg { transition: transform 0.2s var(--ease); }
.nav__contents-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.nav__menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(92vw, 24rem);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 50px rgba(20, 32, 43, 0.14);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}
.nav__menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.nav__menu a {
  display: flex;
  gap: 0.85rem;
  align-items: baseline;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  line-height: 1.35;
}
.nav__menu a:hover { background: var(--surface-elevated); }
.nav__menu a .n {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  min-width: 1.4rem;
}
.nav__menu a .t { font-size: 1rem; }

/* scroll progress bar */
.progress {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  z-index: 301;
  transition: width 0.1s linear;
}

/* ── Hero ── */
.hero {
  padding: calc(var(--nav-h) + clamp(3rem, 9vw, 6rem)) clamp(1.25rem, 5vw, 2.5rem) clamp(3rem, 7vw, 5rem);
  max-width: 60rem;
  margin: 0 auto;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 15% 0%, rgba(14, 124, 134, 0.06) 0%, transparent 55%),
              radial-gradient(ellipse at 90% 10%, rgba(139, 35, 70, 0.04) 0%, transparent 55%);
  pointer-events: none;
  z-index: -1;
}
.hero__eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent-deep);
  text-decoration: none;
  margin-bottom: 1.5rem;
}
.hero__eyebrow:hover { color: var(--accent-2); }
.hero h1 {
  font-size: clamp(2.6rem, 6.5vw, 4.5rem);
  line-height: 1.06;
  margin-bottom: 1.25rem;
  max-width: 18ch;
}
.hero__lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 34ch;
  margin-bottom: 2.5rem;
}
.hero__lead strong { color: var(--accent-2); font-weight: 600; }

/* the framing quote in the hero */
.hero__quote {
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  padding: 1.5rem 1.75rem;
  max-width: 42rem;
  margin-bottom: 3rem;
  box-shadow: 0 2px 10px rgba(20, 32, 43, 0.04);
}
.hero__quote p {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.4vw, 1.65rem);
  line-height: 1.4;
  color: var(--text);
  max-width: none;
  margin: 0;
}

/* Contents index in hero */
.contents {
  margin-bottom: 3rem;
}
.contents__label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}
.contents__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
.contents__item {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.contents__item:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(20, 32, 43, 0.07);
}
.contents__item .n {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
  min-width: 1.5rem;
}
.contents__item .t {
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.3;
}
.contents__item .d {
  display: block;
  font-size: 0.92rem;
  color: var(--text-tertiary);
  margin-top: 0.15rem;
}

/* scroll hint */
.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-tertiary);
  text-decoration: none;
}
.scroll-hint svg { animation: bob 1.6s var(--ease) infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ── Chapter ── */
.chapter {
  max-width: 52rem;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1.25rem, 5vw, 2.5rem);
  border-top: 1px solid var(--border);
}
.chapter__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}
.chapter__eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.chapter h2 { margin-bottom: 1.5rem; max-width: 20ch; }
.chapter__lede {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text);
  max-width: var(--measure);
  margin-bottom: 2rem;
}
.chapter h3 { margin: 2.5rem 0 1rem; }
.chapter h4 { margin: 2rem 0 0.75rem; }

/* ── "For the clinician" expandable ── */
.deeper {
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  margin: 1.75rem 0;
  overflow: hidden;
}
.deeper > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--accent-deep);
}
.deeper > summary::-webkit-details-marker { display: none; }
.deeper > summary .chev {
  transition: transform 0.2s var(--ease);
  color: var(--accent);
}
.deeper[open] > summary .chev { transform: rotate(90deg); }
.deeper > summary:hover { background: var(--surface-elevated); }
.deeper__body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}
.deeper__body p { margin-top: 1.1rem; }
.deeper__body p:first-child { margin-top: 1.1rem; }

/* ── Glossary term cards ── */
.terms { display: grid; gap: 1rem; margin: 1.75rem 0; }
.term {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}
.term__name {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--accent-2);
  margin-bottom: 0.4rem;
}
.term p { margin-bottom: 0; font-size: 1.15rem; }
.term .clinic {
  display: block;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-strong);
  font-size: 1.05rem;
  color: var(--text-tertiary);
}
.term .clinic b { color: var(--accent-deep); font-weight: 600; }

/* ── Video embed (click-to-load facade) ── */
.video { margin: 2rem 0; }
.video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0d1117;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border-strong);
}
.video__frame img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.92;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease);
}
.video__frame:hover img { opacity: 1; transform: scale(1.02); }
.video__play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video__play span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 78px; height: 78px;
  border-radius: 50%;
  background: rgba(139, 35, 70, 0.92);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.video__frame:hover .video__play span { transform: scale(1.08); background: var(--accent-2); }
.video__play svg { margin-left: 4px; }
.video__frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.video__cap {
  margin-top: 0.85rem;
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: var(--measure);
}
.video__cap .meta {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 0.3rem;
}
.video__cap b { color: var(--text); font-weight: 600; }

/* ── Figure-quote / callout ── */
.figure-quote {
  margin: 2.5rem 0;
  padding: 1.75rem 2rem;
  background: var(--surface);
  border-left: 4px solid var(--accent-2);
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}
.figure-quote p {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.3vw, 1.6rem);
  line-height: 1.42;
  color: var(--text);
  max-width: none;
  margin: 0;
}
.figure-quote cite {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
}
/* a "what the AI would say" reasoning quote */
.figure-quote--reasoning { border-left-color: var(--accent); }
.figure-quote--reasoning p { font-family: var(--font-sans); font-size: 1.2rem; line-height: 1.55; }

/* ── Stat ── */
.stats { display: grid; gap: 1.25rem; margin: 2rem 0; }
.stat {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 1.1rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.stat__num {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1;
  color: var(--accent-2);
  white-space: nowrap;
}
.stat__label { font-size: 1.05rem; color: var(--text-secondary); }
.stat__label .src {
  display: block;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 0.3rem;
}

/* ── Note / caution ── */
.note {
  margin: 1.75rem 0;
  padding: 1.1rem 1.4rem;
  background: var(--amber-tint);
  border-left: 4px solid var(--accent-amber);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.note p { color: var(--text-secondary); margin-bottom: 0; }
.note .note__label {
  font-weight: 600;
  color: var(--accent-amber);
}

/* ── Discussion cards ── */
.discuss {
  margin: 1.75rem 0;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.discuss__head {
  padding: 1rem 1.5rem;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text);
}
.discuss__head .n { color: var(--accent); font-family: var(--font-mono); margin-right: 0.5rem; }
.discuss__body { padding: 1.25rem 1.5rem; }
.discuss__body p { margin-bottom: 0; }
.discuss__q {
  margin: 1.25rem 1.5rem 1.5rem;
  padding: 1.1rem 1.4rem;
  background: rgba(14, 124, 134, 0.06);
  border: 1px solid rgba(14, 124, 134, 0.25);
  border-radius: var(--radius);
}
.discuss__q .label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-deep);
  margin-bottom: 0.5rem;
}
.discuss__q p {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  line-height: 1.4;
  color: var(--text);
  margin: 0;
}

/* ── Table ── */
.table-wrap { overflow-x: auto; margin: 1.75rem 0; border: 1px solid var(--border); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 1.05rem; min-width: 34rem; }
thead th {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  text-align: left;
  padding: 0.9rem 1.1rem;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border-strong);
}
tbody td {
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface); }
tbody td:first-child { color: var(--text); font-weight: 600; }

/* ── Sources library ── */
.sources { display: grid; gap: 2rem; margin-top: 1rem; }
.sources__group h3 { margin-bottom: 1rem; font-size: 1.5rem; }
.source-list { list-style: none; display: grid; gap: 0.6rem; padding: 0; }
.source-list li {
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0;
}
.source-list li::before { display: none; }
.source-list a { font-size: 1.08rem; font-weight: 500; }
.source-list .src-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.92rem;
  color: var(--text-tertiary);
}
.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.12em 0.55em;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: 0.1em;
}
.tag--oa     { background: rgba(14,124,134,0.12);  color: var(--accent-deep); }
.tag--abs    { background: var(--surface-elevated); color: var(--text-tertiary); }
.tag--video  { background: rgba(139,35,70,0.10);   color: var(--accent-2); }
.tag--tool   { background: var(--amber-tint);       color: var(--accent-amber); }
.tag--pdf    { background: rgba(14,124,134,0.12);   color: var(--accent-deep); }

/* ── Back to top ── */
.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 52px; height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-2);
  color: #fff;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(20, 32, 43, 0.22);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s, background 0.2s;
  z-index: 250;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--accent-deep); }
.to-top:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 3rem clamp(1.25rem, 5vw, 2.5rem);
  margin-top: 2rem;
}
.footer-inner {
  max-width: 52rem;
  margin: 0 auto;
}
.footer-inner .links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  margin-bottom: 1rem;
}
.footer-inner a { color: var(--accent-deep); }
.footer-sep { color: var(--border-strong); }
.footer-note { font-size: 0.95rem; color: var(--text-tertiary); max-width: 46rem; }
