/* Glossary (/glossary/ and /glossary/<slug>/), on top of style.css and, on
   term pages, articles.css (the reading column). Colors only through the
   theme variables, so paper, light, graphite and black all work. Classes:
   gl-* for the pages, gp-* for the explanatory pictures (site/glossary/svg). */

/* ---------- the A–Z index ---------- */
.gl-intro h1 { max-width: 18ch; }
.gl-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin: 26px 0 0; }
.gl-wait { visibility: hidden; }  /* shown by glossary.js: without it the box would do nothing */
.gl-q { flex: 0 1 340px; min-width: min(100%, 260px); -webkit-appearance: none; appearance: none; }
.gl-cats .gl-n { font: 500 11px var(--mono); color: var(--muted); margin-left: 3px; }
.gl-cats .chip[aria-pressed="true"] .gl-n { color: inherit; opacity: 0.7; }
.gl-az { display: flex; flex-wrap: wrap; gap: 4px; margin: 18px 0 0; }
.gl-az a, .gl-az span { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 9px; font: 600 14px var(--font); text-decoration: none; }
.gl-az a { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.gl-az a:hover { color: var(--accent-ink); }
.gl-az a.off { color: var(--muted); box-shadow: none; background: transparent; pointer-events: none; }
.gl-az span { color: var(--axis); }
@media (max-width: 560px) { /* phones: the chips scroll sideways in one row, the letters get smaller */
  .gl-cats { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .gl-cats::-webkit-scrollbar { display: none; }
  .gl-cats .chip { flex: none; }
  .gl-az { gap: 3px; }
  .gl-az a, .gl-az span { min-width: 27px; height: 28px; padding: 0 4px; font-size: 13px; border-radius: 8px; }
}
.gl-count { margin: 14px 0 0; font-size: 13px; color: var(--muted); min-height: 1.4em; }
.gl-letter { margin: 26px 0 0; scroll-margin-top: 80px; }
.gl-letter h2 { font: 700 30px/1 var(--display); color: var(--ink); margin: 0 0 12px; letter-spacing: -0.03em; }
.gl-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.gl-item { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow); transition: box-shadow 0.15s ease; }
.gl-item:hover { box-shadow: var(--shadow-lg); }
.gl-item[hidden] { display: none; }
.gl-item a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 16px 18px 6px; color: inherit; text-decoration: none; flex: 1; }
.gl-item a::after { content: ""; position: absolute; inset: 0; border-radius: 20px; } /* the whole card is the link */
.gl-item a:focus-visible { outline: none; }
.gl-item a:focus-visible::after { box-shadow: 0 0 0 2px var(--accent); }
.gl-name { font: 650 18px/1.25 var(--display); letter-spacing: -0.015em; color: var(--ink); }
.gl-live { font: 600 12px/1 var(--mono); color: var(--ink-2); background: var(--track); border-radius: 999px; padding: 5px 8px; }
.gl-def { flex-basis: 100%; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.gl-tag { padding: 0 18px 14px; font-size: 12px; color: var(--muted); }
.gl-empty { margin: 24px 0 0; padding: 22px; border-radius: var(--r); background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow); }
.gl-letter[hidden], .gl-empty[hidden] { display: none; }
.gl-method { margin-top: 48px; }

/* ---------- a term page (inside .art) ---------- */
.gl-head h1 { max-width: 20ch; }
.gl-aka { margin: 0; font-size: 14px; color: var(--ink-2); }
.gl-aka .label { margin-right: 2px; }
.gl-aka span + span::before { content: ""; }
.art .gl-now { margin-top: 26px; }
.gl-now .card.lead .big { font-size: clamp(40px, 6vw, 56px); }
@media (max-width: 560px) { /* two small tiles side by side under the lead one */
  .art .gl-now { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .gl-now .card.w4, .gl-now .card:only-child { grid-column: 1 / -1; }
  .gl-now .card:not(.lead) { padding: 16px; }
  .gl-now .card:not(.lead) .mid { font-size: 24px; }
  .gl-now .card.w2.lead { grid-column: 1 / -1; }
  .gl-now .card.w2:nth-child(2):last-child { grid-column: 1 / -1; }
}

/* links to other terms inside the text: quiet, dotted */
.art-sec a.gl-tl, .gl-example a.gl-tl, .gl-myth a.gl-tl { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--muted); text-underline-offset: 3px; }
.art-sec a.gl-tl:hover, .gl-example a.gl-tl:hover, .gl-myth a.gl-tl:hover { color: var(--accent-ink); text-decoration-color: currentColor; }

/* the picture: an inline SVG on a card, its colors from the gp-* classes below */
.art > .gl-pic { margin-top: 28px; padding: 22px 22px 14px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); max-width: 760px; }
.gl-pic-box { max-width: 600px; margin: 0 auto; }
.gl-svg { display: block; width: 100%; height: auto; overflow: visible; }
.gl-pic-n { display: none; }
.gl-pic-cap { margin: 12px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); text-align: center; }
@media (max-width: 560px) {
  .art > .gl-pic { padding: 14px 10px 10px; }
  .gl-pic-w { display: none; }
  .gl-pic-n { display: block; }
}

/* the worked example */
.gl-example { margin-top: 4px; padding: 22px 24px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); }
.gl-example p { margin: 0 0 12px; }
.gl-ex-title { font: 650 18px/1.35 var(--display); color: var(--ink); letter-spacing: -0.01em; }
.gl-steps { margin: 0 0 14px; padding-left: 22px; font-variant-numeric: tabular-nums; }
.gl-steps li { margin: 0 0 6px; padding-left: 2px; }
.gl-steps li::marker { color: var(--muted); font: 600 14px var(--mono); }
.gl-result { margin: 0 !important; padding-top: 12px; border-top: 1px solid var(--border); color: var(--ink); font-weight: 600; }
@media (max-width: 560px) { .gl-example { padding: 18px; } }

/* myth and fact: a mark and a word, never color alone */
.gl-myth { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: 4px 0 12px; }
.gl-myth p { display: flex; gap: 12px; margin: 0; padding: 18px 20px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); font-size: 16px; line-height: 1.55; }
.gl-mark { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; font: 700 15px/1 var(--font); }
.gl-myth-x .gl-mark { color: var(--bad); background: var(--bad-soft); }
.gl-myth-ok .gl-mark { color: var(--good); background: var(--good-soft); }

/* related terms */
.gl-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.gl-chip { display: inline-block; padding: 9px 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); font: 500 14px/1.2 var(--font); text-decoration: none; }
.art-sec a.gl-chip { color: var(--ink); }
.gl-chip:hover { box-shadow: var(--shadow-lg); color: var(--accent-ink) !important; }
.gl-more .eyebrow { font-size: 11px; }

/* previous / all / next */
.art > .gl-pn { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 12px; margin-top: 40px; }
.gl-pn a { display: flex; flex-direction: column; gap: 4px; padding: 14px 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.gl-pn a:hover { box-shadow: var(--shadow-lg); }
.gl-pn-name { font-weight: 600; }
.gl-pn-all { justify-content: center; align-self: center; font: 600 14px var(--font); color: var(--accent-ink) !important; background: transparent !important; box-shadow: none !important; }
.gl-pn-prev { grid-column: 1; }
.gl-pn-next { grid-column: 3; text-align: right; }
@media (max-width: 560px) {
  .art > .gl-pn { grid-template-columns: 1fr 1fr; }
  .gl-pn-all { grid-column: 1 / -1; grid-row: 2; }
  .gl-pn-next { grid-column: 2; }
}

/* ---------- mini charts (js/glossary.js) ---------- */
.gl-plot { min-height: 280px; }
.gl-plot.gl-hb { min-height: 0; margin-top: 26px; } /* room for the full-screen button */
.gl-band { fill: var(--ink); fill-opacity: 0.07; }
.sw-sq.gl-band-sw { background: var(--ink); opacity: 0.16; }
.gl-ref { stroke: var(--ink-2); stroke-width: 1.4; stroke-dasharray: 5 4; opacity: 0.75; }
.gl-ref-label { fill: var(--ink-2); font: 600 11px var(--font); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.gl-zero { stroke: var(--axis); stroke-width: 1.2; }
.bar.on { opacity: 1; stroke: var(--ink); stroke-width: 1.5; }
.gl-hb-label { fill: var(--ink-2); font: 500 13px var(--font); }
.gl-hb-val { fill: var(--ink); font: 600 12px var(--mono); font-variant-numeric: tabular-nums; }
.gl-dot { stroke: var(--surface); stroke-width: 2; }
.gl-details summary { font-size: 14px; }

/* ---------- pictures: site/glossary/svg/<slug>.svg (no colors in the files) ---------- */
/* shapes */
.gp-box { fill: var(--surface-2); stroke: var(--axis); stroke-width: 1.5; }
.gp-card { fill: var(--surface); stroke: var(--axis); stroke-width: 1.5; }
.gp-soft { fill: var(--track); }
.gp-solid { fill: var(--solid); }
.gp-ink { fill: var(--ink); }
.gp-ink2 { fill: var(--ink-2); }
.gp-muted { fill: var(--muted); }
.gp-none { fill: none; }
.gp-line { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gp-line-m { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.gp-line-b { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gp-grid { fill: none; stroke: var(--grid); stroke-width: 1; }
.gp-axis { fill: none; stroke: var(--axis); stroke-width: 1.5; }
.gp-dash { stroke-dasharray: 5 5; }
.gp-coin { fill: var(--track); stroke: var(--muted); stroke-width: 1.2; }
.gp-coin-a { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; }
.gp-good { fill: var(--good); } .gp-good-soft { fill: var(--good-soft); }
.gp-bad { fill: var(--bad); } .gp-bad-soft { fill: var(--bad-soft); }
.gp-accent { fill: var(--accent); } .gp-accent-soft { fill: var(--accent-soft); }
/* asset colors (the site's one-color-per-asset table) and the generic series order */
.gp-spx { fill: var(--spx); } .gp-bond { fill: var(--bond); } .gp-cash { fill: var(--cash); }
.gp-gold { fill: var(--gold); } .gp-home { fill: var(--home); } .gp-btc { fill: var(--btc); } .gp-ndq { fill: var(--ndq); }
.gp-s1 { fill: var(--s1); } .gp-s2 { fill: var(--s2); } .gp-s3 { fill: var(--s3); }
.gp-s4 { fill: var(--s4); } .gp-s5 { fill: var(--s5); } .gp-s6 { fill: var(--s6); }
/* strokes in the same colors */
.gp-l-spx { fill: none; stroke: var(--spx); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gp-l-bond { fill: none; stroke: var(--bond); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gp-l-cash { fill: none; stroke: var(--cash); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gp-l-gold { fill: none; stroke: var(--gold); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gp-l-good { fill: none; stroke: var(--good); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gp-l-bad { fill: none; stroke: var(--bad); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.gp-l-accent { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
/* lighter fills of the same shapes */
.gp-o15 { fill-opacity: 0.15; } .gp-o30 { fill-opacity: 0.3; } .gp-o60 { fill-opacity: 0.6; }
/* text (sizes in SVG units: the picture is drawn 480 wide, so 18 reads as about 12px on a phone) */
.gp-t { fill: var(--ink); font: 500 18px var(--font); }
.gp-tb { fill: var(--ink); font: 700 19px var(--display); letter-spacing: -0.01em; }
.gp-ts { fill: var(--ink-2); font: 500 16px var(--font); }
.gp-tm { fill: var(--muted); font: 500 16px var(--font); }
.gp-tn { fill: var(--ink); font: 600 18px var(--mono); font-variant-numeric: tabular-nums; }
.gp-tx { fill: var(--ink); font: 700 30px var(--mono); letter-spacing: -0.04em; }
.gp-ton { fill: var(--solid-ink); } /* text on .gp-solid */
.gp-tw { fill: #fff; }               /* text on --spx, --bond, --cash, --accent fills */
.gp-tgood { fill: var(--good); } .gp-tbad { fill: var(--bad); }
.gp-halo { paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
/* sizes and weight on top of a text class (the classes set the font, so attributes would lose) */
.gp-sm { font-size: 14px; } .gp-md { font-size: 16px; } .gp-lg { font-size: 22px; } .gp-xl { font-size: 26px; }
.gp-w6 { font-weight: 600; } .gp-w7 { font-weight: 700; }
