/* Glossary page - one reading column with a search box, a sticky row of
   category chips (the current one is marked as you scroll), and terms you can
   link to (the # beside a name). Search is client-side over content that is
   otherwise reorganised copy already written elsewhere on the site (tooltips,
   CHECK_EXPLAINERS, footnotes). The type follows the site: one sans, tight
   tracking on titles, a secondary grey for explanations. */

.glossary-page{ --glossary-gutter:24px; padding: clamp(36px, 6vw, 64px) 0 clamp(60px, 8vw, 96px); }
.glossary-page .wrap{ max-width:880px; }
.glossary-page h1{ font-size: clamp(32px, 5vw, 52px); margin:18px 0 16px; text-wrap:balance; }
.glossary-page .lede{ font-size: clamp(16px, 1.6vw, 18px); color: var(--ink-soft); max-width:680px; margin-bottom:10px; text-wrap:pretty; }
.glossary-page .updated-note{ font-size:13px; color: var(--ink-soft); margin-bottom:32px; }
.glossary-page .updated-note b{ color: var(--ink); }

/* ---------------- search ---------------- */
.glossary-search-wrap{ position:relative; margin-bottom:18px; }
.glossary-search-wrap input[type="search"]{
  width:100%; min-height:52px; padding:14px 18px 14px 48px; border-radius:16px; border:1px solid var(--line);
  background: rgba(255,255,255,0.05) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 16px 50% / 20px;
  font-size:16px; font-family:inherit; color: var(--ink);
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.glossary-search-wrap input[type="search"]:focus{ outline:none; border-color: var(--indigo); background-color: rgba(255,255,255,0.08); box-shadow: 0 0 0 4px rgba(139,127,255,0.2); }
.glossary-search-count{ position:absolute; right:48px; top:50%; transform:translateY(-50%); font-size:12.5px; color: var(--ink-soft); pointer-events:none; }

/* ---------------- category chips: sticky under the header ---------------- */
.glossary-jump{
  position:sticky; top:78px; z-index:30; display:flex; gap:8px; overflow-x:auto; scroll-snap-type:x proximity;
  margin: 0 calc(-1 * var(--glossary-gutter)) 36px; padding:10px var(--glossary-gutter);
  background: rgba(18,18,32,0.78); -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-bottom:1px solid var(--line);
}
.glossary-jump[hidden]{ display:none; }
.glossary-jump::-webkit-scrollbar{ height:4px; }
.glossary-jump::-webkit-scrollbar-track{ background:transparent; }
.glossary-jump::-webkit-scrollbar-thumb{ background: var(--line); border-radius:999px; }
.glossary-jump a{
  flex:none; scroll-snap-align:start; display:inline-flex; align-items:center; min-height:40px; padding:0 15px; border-radius:999px;
  border:1px solid var(--line); background: rgba(255,255,255,0.05);
  font-size:14px; font-weight:600; color: var(--ink-soft); white-space:nowrap;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.glossary-jump a:hover{ color: var(--ink); border-color: rgba(255,255,255,0.22); }
.glossary-jump a[aria-current="true"]{ background:#F5F5F7; border-color:#F5F5F7; color:#11161A; }
.glossary-jump a:focus-visible{ outline:2px solid var(--indigo); outline-offset:2px; }
.glossary-jump .n{ margin-left:7px; font-size:12px; font-weight:700; opacity:.55; font-variant-numeric: tabular-nums; }

.glossary-empty{ font-size:14px; color: var(--ink-soft); padding:24px 0; }

/* ---------------- categories and terms ---------------- */
.glossary-category{ margin-bottom:52px; scroll-margin-top:150px; }
.glossary-category h2{
  font-size: clamp(24px, 3vw, 30px); margin:0 0 6px; padding-bottom:12px; border-bottom:1px solid var(--line);
}
.glossary-term{
  position:relative; padding:20px 14px; margin:0 -14px; border-bottom:1px solid var(--line); border-radius:14px;
  scroll-margin-top:150px; transition: background .2s ease;
}
.glossary-term:last-child{ border-bottom-color:transparent; }
.glossary-term:hover{ background: rgba(255,255,255,0.03); }
.glossary-term:target{ background: rgba(139,127,255,0.12); box-shadow: inset 3px 0 0 var(--indigo); }
.glossary-term h3{ font-size:17px; font-weight:700; letter-spacing:-0.015em; margin:0 0 8px; color: var(--ink); line-height:1.3; }
.glossary-term p{ font-size:15px; line-height:1.7; color: var(--ink-soft); margin:0; max-width:70ch; text-wrap:pretty; }
.glossary-term p a{ color: var(--indigo-dark); font-weight:600; }
.glossary-term p a:hover{ text-decoration:underline; }
.glossary-term p b{ color: var(--ink); }

/* the # permalink: quiet until you point at the term (always shown, softly, where there is no hover) */
.term-link{
  display:inline-flex; align-items:center; justify-content:center; min-width:24px; min-height:24px; margin-left:4px; border-radius:6px;
  font-weight:700; color: var(--ink-soft); opacity:0; transition: opacity .15s ease, color .15s ease;
}
.glossary-term:hover .term-link, .term-link:focus-visible, .glossary-term:target .term-link{ opacity:1; }
.term-link:hover{ color: var(--indigo); }
.term-link:focus-visible{ outline:2px solid var(--indigo); outline-offset:2px; }
@media (hover: none){ .term-link{ opacity:.45; min-width:44px; min-height:44px; margin:-12px -8px -12px -4px; } }

@media (max-width: 620px){
  .glossary-page{ --glossary-gutter:18px; }
}
@media (max-width: 480px){
  .glossary-jump{ top:70px; }
  .glossary-category, .glossary-term{ scroll-margin-top:136px; }
}
@media (max-width: 720px){
  /* a finger scrolls the chip row; the scrollbar track under it read as a stray line */
  .glossary-jump::-webkit-scrollbar-thumb{ background:transparent; }
  .glossary-term{ margin:0 -8px; padding:18px 8px; }
}
@media (prefers-reduced-motion: reduce){
  .glossary-term, .term-link, .glossary-jump a, .glossary-search-wrap input[type="search"]{ transition:none; }
}

/* Firefox only: the thin scrollbar properties live here, behind a test that only Firefox fails (see css/style.css) */
@supports not selector(::-webkit-scrollbar){
  .glossary-jump{ scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
}
