/* glossary.css — the /glossary page, and the tooltips glossary.js draws on every page. */
.glossary { max-width: 980px; margin: 0 auto; padding: calc(var(--nav-height, 72px) + 48px) clamp(16px, 4vw, 40px) 60px; }
.glossary-hero { text-align: center; max-width: 720px; margin: 0 auto 30px; }
.glossary-hero h1 { font-size: clamp(42px, 7vw, 80px); line-height: 1; margin: 10px 0 18px; }
.glossary-hero p { font-size: 17px; line-height: 1.65; color: var(--text-secondary); }

.footing-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 0 0 26px; }
.footing-chip { padding: 14px 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); }
.footing-chip b { display: block; font: 600 13px var(--font-reading); letter-spacing: 0.04em; margin-bottom: 6px; }
.footing-chip span { font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.footing-astronomy b, .footing-badge.footing-astronomy { color: var(--pearl); }
.footing-measured b, .footing-badge.footing-measured { color: var(--gold); }
.footing-tradition b, .footing-badge.footing-tradition { color: var(--violet-bright, var(--violet)); }
.footing-model b, .footing-badge.footing-model { color: var(--lapis-bright, var(--lapis)); }
.footing-history b, .footing-badge.footing-history { color: var(--amber); }
.footing-set-aside b, .footing-badge.footing-set-aside { color: var(--text-muted); }

.glossary-tools { position: sticky; top: calc(var(--nav-height, 72px) + 6px); z-index: 5; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px; margin: 0 0 18px; border-radius: 18px; background: var(--nav-ground, rgba(12, 5, 18, 0.82)); border: 1px solid var(--border); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.glossary-search { flex: 1 1 200px; }
.glossary-search input { width: 100%; box-sizing: border-box; min-height: 42px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-primary); font: 400 16px var(--font-reading); }
.glossary-search input:focus { outline: none; border-color: var(--border-focus, var(--lapis)); }
.glossary-jump { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1 1 100%; }
.glossary-jump::-webkit-scrollbar { display: none; }
.glossary-jump a { white-space: nowrap; padding: 7px 12px; border-radius: 99px; color: var(--text-secondary); text-decoration: none; font: 500 13px var(--font-reading); }
.glossary-jump a:hover, .glossary-jump a:focus-visible { background: var(--surface-hover, var(--surface)); color: var(--text-primary); outline: none; }

.glossary-section { margin: 26px 0 10px; scroll-margin-top: calc(var(--nav-height, 72px) + 130px); }
.glossary-section > header h3 { font: 400 clamp(22px, 3.2vw, 28px) var(--font-display); margin: 0 0 4px; }
.glossary-section > header p { margin: 0 0 14px; color: var(--text-muted); font-size: 15px; }
.term { padding: 18px 20px; margin: 0 0 10px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); scroll-margin-top: calc(var(--nav-height, 72px) + 130px); transition: border-color 0.6s var(--ease, ease), box-shadow 0.6s var(--ease, ease); }
.term-lit { border-color: var(--gold-glow, var(--gold)); box-shadow: 0 0 0 1px var(--gold-glow, rgba(246, 201, 120, 0.4)), 0 20px 50px -30px var(--gold-glow, rgba(246, 201, 120, 0.5)); }
.term-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.term-head h4 { margin: 0; font: 400 22px var(--font-display); flex: 1 1 auto; min-width: 0; }
.term-head h4 a { color: var(--text-primary); text-decoration: none; }
.term.has-figure .term-head { align-items: center; justify-content: flex-start; gap: 14px; }
.term p { margin: 8px 0 0; font-size: 15px; line-height: 1.6; color: var(--text-secondary); }
.term .term-short { font-size: 16px; color: var(--text-primary); }
.term .term-why b { color: var(--text-primary); font-weight: 600; }
.term-sources { display: flex; flex-wrap: wrap; gap: 6px; }
.term-sources code { font: 400 11px var(--font-receipt, monospace); color: var(--text-muted); padding: 3px 7px; border-radius: 6px; border: 1px solid var(--hairline, var(--border)); overflow-wrap: anywhere; }
.footing-badge { flex: none; font: 600 11px var(--font-reading); letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 9px; border-radius: 99px; border: 1px solid currentColor; opacity: 0.9; }
/* ── the school: narrator, rooms, figures ── */
.narrator { max-width: 720px; margin: 0 auto 22px; padding: 18px 20px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); }
.narrator-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 8px; }
.narrator-name a { font: 400 20px var(--font-display); color: var(--text-primary); text-decoration: none; }
.narrator-name span { font: 600 11px var(--font-reading); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.narrator-line { margin: 0; font: italic 400 17px/1.6 var(--font-display); color: var(--text-secondary); }

.school-quote { max-width: 620px; margin: 0 auto 30px; text-align: center; }
.school-quote blockquote { margin: 0; font: italic 300 clamp(19px, 2.6vw, 23px)/1.5 var(--font-display); color: var(--text-primary); }
.school-quote figcaption { margin-top: 8px; font-size: 13px; color: var(--text-muted); letter-spacing: 0.02em; }

.room-index ol { list-style: none; margin: 0 0 26px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.room-index a { display: flex; flex-direction: column; height: 100%; box-sizing: border-box; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); text-decoration: none; transition: border-color 0.3s var(--ease, ease), background 0.3s var(--ease, ease); }
.room-index a:hover, .room-index a:focus-visible { border-color: var(--border-hover); background: var(--surface-hover, var(--surface)); outline: none; }
.room-index-name { font: 400 17px/1.25 var(--font-display); color: var(--text-primary); }
.room-index-name b { display: inline-block; min-width: 2.2em; margin-right: 0.3em; font-weight: 400; color: var(--gold); }
.room-index-line { font-size: 13px; line-height: 1.45; color: var(--text-muted); margin-top: 4px; flex: 1 1 auto; }
.room-index-count { font: 500 11px var(--font-reading); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint, var(--text-muted)); margin-top: 6px; }

.glossary-jump a b { font-weight: 600; color: var(--gold); margin-right: 3px; }

.room { margin: 56px 0 0; padding-top: 30px; border-top: 1px solid var(--hairline, var(--border)); scroll-margin-top: calc(var(--nav-height, 72px) + 120px); }
.room-head { max-width: 760px; margin: 0 0 8px; }
.room-numeral { margin: 0; font: 600 12px var(--font-reading); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.room-head h2 { font: 400 clamp(32px, 5vw, 48px)/1.05 var(--font-display); margin: 6px 0 6px; }
.room-threshold { margin: 0; font-size: 16px; color: var(--text-muted); }
.room-intro { margin-top: 16px; }
.room-scarlett { margin: 0; padding: 2px 0 2px 16px; border-left: 2px solid var(--accent, var(--lapis)); font: italic 400 18px/1.6 var(--font-display); color: var(--text-primary); }
.room-scarlett b { display: block; font: 600 11px var(--font-reading); font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.room-intro .school-quote { margin: 18px 0 6px; text-align: left; }
.room-intro .school-quote blockquote { font-size: clamp(17px, 2.2vw, 20px); }
.is-searching .room-intro, .is-searching .room-threshold { display: none; }
.is-searching .room { margin-top: 26px; padding-top: 18px; }

.term-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.term-grid > .term { margin: 0; }
@media (min-width: 820px) { .term-grid { grid-template-columns: 1fr 1fr; } }

.term-sense { margin: 12px 0 2px; padding: 12px 14px; display: grid; gap: 10px; border-radius: 12px; background: var(--surface-2, var(--surface)); border: 1px solid var(--hairline-soft, var(--border)); }
.term-sense dt { font: 600 11px var(--font-reading); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.term-sense dd { margin: 3px 0 0; font-size: 15px; line-height: 1.55; color: var(--text-primary); }

/* figures: the true geometry of each archetype (glossary_school.figure) */
.q-figure { flex: none; width: 54px; height: 54px; color: var(--text-secondary); overflow: visible; }
.q-figure-solo { width: 44px; height: 44px; }
.fg-ring { fill: none; stroke: currentColor; stroke-opacity: 0.38; stroke-width: 1.6; }
.fg-wedge { fill: var(--accent, var(--lapis)); fill-opacity: 0.38; stroke: var(--accent, var(--lapis)); stroke-width: 1.2; }
line.fg-faint { stroke: currentColor; stroke-opacity: 0.55; stroke-width: 1.5; }
line.fg-tick { stroke: currentColor; stroke-opacity: 0.4; stroke-width: 1.3; }
line.fg-key { stroke: var(--text-primary); stroke-width: 2.8; stroke-linecap: round; }
line.fg-flow { stroke: var(--flow, var(--gold)); stroke-width: 3; stroke-linecap: round; }
line.fg-push { stroke: var(--push, var(--violet, var(--lapis))); stroke-width: 3; stroke-linecap: round; }
line.fg-same { stroke: var(--same, var(--pearl, var(--text-primary))); stroke-width: 3; }
.fg-dot.fg-key { fill: var(--text-primary); }
.fg-dot.fg-tick { fill: currentColor; fill-opacity: 0.5; }
.fg-dot.fg-same { fill: var(--same, var(--pearl, var(--text-primary))); }
.fg-dot.fg-ring-dot { fill: none; stroke: var(--same, var(--pearl, var(--text-primary))); stroke-width: 2; }
.fg-text { fill: var(--text-primary); font: 400 30px 'Apple Symbols', 'Segoe UI Symbol', 'Noto Sans Symbols 2', 'Noto Sans Symbols', 'DejaVu Sans', var(--font-display), serif; }
.q-figure-solo .fg-text { font-size: 76px; fill: var(--gold); }
.fg-text.fg-text-small { font: 500 24px var(--font-display); }
.q-figure-solo .fg-text.fg-text-small { font-size: 46px; }

@media (max-width: 520px) {
  .room-index ol { grid-template-columns: 1fr 1fr; gap: 6px; }
  .room-index a { padding: 10px 12px; }
  .room-index-name { font-size: 16px; }
  .room-index-name b { display: block; min-width: 0; margin: 0 0 2px; }
  .room-index-line { display: none; }
  .term { padding: 16px; }
  .term-head h4 { font-size: 20px; }
  .q-figure { width: 46px; height: 46px; }
  .q-figure-solo { width: 38px; height: 38px; }
  .room-scarlett { font-size: 17px; }
}

.glossary-empty, .glossary-foot { text-align: center; color: var(--text-muted); margin-top: 30px; }
.glossary-foot a { color: var(--text-secondary); }

/* tooltips (glossary.js) */
.q-term { text-decoration: underline dotted; text-decoration-color: var(--gold-glow, rgba(246, 201, 120, 0.55)); text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: help; }
.q-term:focus-visible { outline: 1px solid var(--lapis); outline-offset: 2px; border-radius: 3px; }
.q-tip { position: fixed; z-index: 9999; max-width: min(320px, calc(100vw - 32px)); padding: 12px 14px; border-radius: 14px; background: var(--panel-ground, #1a0d24); border: 1px solid var(--border-hover, rgba(255, 190, 232, 0.28)); box-shadow: 0 18px 50px -18px rgba(0, 0, 0, 0.6); color: var(--text-primary); font: 400 14px/1.5 var(--font-reading); opacity: 0; transform: translateY(4px); transition: opacity 0.18s ease, transform 0.18s ease; pointer-events: auto; }
.q-tip.q-tip-on { opacity: 1; transform: none; }
.q-tip b { font: 400 16px var(--font-display); display: block; margin-bottom: 4px; }
.q-tip small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 12px; }
.q-tip a { color: var(--gold); text-decoration: none; font-weight: 500; }
@media (prefers-reduced-motion: reduce) { .q-tip { transition: none; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
