/* ============================================================
 * components-terms.css
 *
 * Part of the brandolini year-site stylesheet, split out from
 * the original monolithic components.css on 2026-05-04 V2.0
 * when the file crossed the 600-line hard threshold.
 *
 * Loaded by the <page-head> directive — see ~/brandolini-build/inject.py.
 * Adding new rules: add them here if they fit the existing section,
 * or split off a new components-<thing>.css file if a coherent new
 * concern emerges.
 * ============================================================ */

/* --- terms: tooltip (default) --- */
/* Screen-reader-accessible tooltip pattern: the tooltip text lives in a real
   DOM element (.term-tip) pointed to by aria-describedby. Visually hidden by
   default via the sr-only technique; CSS un-hides it on hover / focus so
   sighted users see the standard tooltip affordance. */

.term {
  /* Dotted (not dashed/solid) underline + help cursor = classic <dfn>
     affordance. Distinct from hyperlinks (which are solid/blue) so readers
     don't expect a click to navigate. Hover/focus solidifies to signal the
     tooltip-on-interaction state — that's the click affordance for the
     popover, not a link. */
  border-bottom: 1px dotted var(--accent-deep);
  text-underline-offset: 3px;
  cursor: help;
  position: relative;
  color: var(--ink);
  font-weight: 600;
  outline: none;
}
.term:hover, .term:focus, .term:focus-visible {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-bottom-style: solid;
}

/* Default state: visually hidden, still in the accessibility tree for
   screen readers via aria-describedby. */
.term-tip {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;

  /* Visual styling (activates when un-hidden below). */
  background: var(--ink);
  color: var(--bg);
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.45;
  border-radius: 6px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(43, 37, 24, 0.22);
  z-index: 10;
  transition: opacity 0.18s ease;
}

/* Shown state: positioned tooltip above the term, pointer-unreachable so it
   doesn't interfere with hover targeting. */
.term:hover .term-tip,
.term:focus .term-tip,
.term:focus-visible .term-tip,
.term:focus-within .term-tip {
  position: absolute;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  padding: 10px 14px;
  min-width: 200px;
  max-width: 280px;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  pointer-events: none;
}

/* Arrow below tooltip */
.term:hover::after,
.term:focus::after,
.term:focus-visible::after,
.term:focus-within::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--ink);
  z-index: 10;
  pointer-events: none;
}

@media (max-width: 600px) {
  .term:hover .term-tip,
  .term:focus .term-tip,
  .term:focus-visible .term-tip,
  .term:focus-within .term-tip {
    max-width: 240px;
    font-size: 13px;
  }
}



/* --- terms: inline short expansion --- */

.term-short {
  display: inline;
  padding: 2px 8px;
  margin: 0 2px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 4px 4px 0;
  font-style: italic;
}



/* --- terms: block long expansion --- */

.term-long {
  margin: 20px 0;
  padding: 20px 24px;
  background: var(--bg-tint);
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
}
.term-long p { margin-bottom: 12px; }
.term-long p:last-child { margin-bottom: 0; }
.term-long::before {
  content: attr(data-term);
  display: block;
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 12px;
}



/* --- embedded reading --- */

.reading {
  margin: 24px 0;
  padding: 32px 36px;
  background: var(--bg-tint);
  border-radius: 8px;
  border: 1px solid var(--rule);
}
.reading-header h2 {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 72, "SOFT" 40;
  font-weight: 420;
  font-size: 26px;
  margin-bottom: 6px;
  padding-bottom: 0;
  border-bottom: none;
  color: var(--ink);
}
.reading-header::after {
  content: 'reading';
  display: block;
  font-family: 'Atkinson Hyperlegible', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-quiet);
  margin-bottom: 20px;
}
.reading h2 {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 48, "SOFT" 40;
  font-weight: 420;
  font-size: 22px;
  margin-top: 24px;
  margin-bottom: 12px;
  color: var(--ink);
}
.reading > .reading-header + h2,
.reading > .reading-header ~ h2:first-of-type {
  margin-top: 4px;
}
.reading p { margin-bottom: 14px; line-height: 1.7; }
.reading p:last-child { margin-bottom: 0; }



/* --- embedded diagram --- */

.diagram {
  margin: 24px 0;
  padding: 28px 24px 20px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  text-align: center;
}
.diagram svg {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  color: var(--ink-dim);
}
.diagram figcaption {
  margin-top: 16px;
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 24, "SOFT" 60;
  font-style: italic;
  font-size: 15px;
  color: var(--ink-quiet);
}



/* --- links in prose --- */

main a:not(.mark) {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}
main a:not(.mark):hover {
  color: var(--accent);
  text-decoration-color: var(--accent-deep);
}

/* ============================================================
   --- WIDA language-level toggle: tooltip variant show/hide ---

   When the library has multiple WIDA variants for a term (e.g.
   tooltip :: sheltered AND tooltip :: entering), the builder emits
   both as siblings inside .term-multi. Only ONE should ever be
   visible at a time; the inactive one is hidden via display:none.

   These rules live HERE in components-terms.css (not site.css)
   because they need to override the .term:hover/focus .term-tip
   un-hide rules above. Tied specificity (both 0,3,1) means cascade
   order decides — same-file later-defined rules win. !important is
   added belt-and-suspenders so the hide stays even if a future
   refactor moves these rules elsewhere.

   The visible-DOM variants are siblings inside .term-multi:
     <span class="term term-multi">word
       <span class="term-tip" data-wida-variant="L3">L3 text...</span>
       <span class="term-tip" data-wida-variant="L1">L1 text...</span>
     </span>

   In default L3 mode, hide L1.
   In L1 mode (:root[data-wida="L1"]), show L1 and hide L3.
   ============================================================ */

.term-multi .term-tip[data-wida-variant="L1"],
.term-multi .term-short-variant[data-wida-variant="L1"],
.term-multi .term-long-variant[data-wida-variant="L1"] {
  display: none !important;
}

:root[data-wida="L1"] .term-multi .term-tip[data-wida-variant="L1"],
:root[data-wida="L1"] .term-multi .term-short-variant[data-wida-variant="L1"],
:root[data-wida="L1"] .term-multi .term-long-variant[data-wida-variant="L1"] {
  display: revert !important;
}

:root[data-wida="L1"] .term-multi .term-tip[data-wida-variant="L3"],
:root[data-wida="L1"] .term-multi .term-short-variant[data-wida-variant="L3"],
:root[data-wida="L1"] .term-multi .term-long-variant[data-wida-variant="L3"] {
  display: none !important;
}

/* ============================================================
   --- Notes scaffolds (Phase 1a — vocab + meaning) ---

   Two-column note-taking template. Auto-populated by the builder
   from the page's <term> tags. Skill being scaffolded: copy each
   key word, then write what it means in your own words.

   Print stylesheet expands the textareas into ruled lines for
   pen-on-paper note-taking. On screen, students type into them
   directly (no localStorage — these are training-wheel notes,
   not durable storage).
   ============================================================ */

.ck-notes-scaffold {
  border: 2px solid color-mix(in srgb, var(--accent, #b8431f) 35%, transparent);
  border-radius: 10px;
  padding: 1.25em 1.5em 1.5em;
  background: color-mix(in srgb, var(--accent, #b8431f) 3%, transparent);
}

.ck-notes-howto {
  margin: 0 0 1em 0;
  border-radius: 6px;
}
.ck-notes-howto > summary {
  cursor: pointer;
  padding: 0.6em 0.9em;
  background: color-mix(in srgb, var(--accent, #b8431f) 12%, transparent);
  border-radius: 6px;
  font-weight: 600;
  list-style: none;
}
.ck-notes-howto > summary::-webkit-details-marker { display: none; }
.ck-notes-howto > summary::after {
  content: " ▾"; font-size: 0.8em; opacity: 0.6;
}
.ck-notes-howto[open] > summary::after { content: " ▴"; }
.ck-notes-howto-body {
  padding: 0.8em 0.9em 0.4em;
  border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  border-top: none;
  border-radius: 0 0 6px 6px;
}
.ck-notes-howto-body p { margin: 0.6em 0; }
.ck-notes-howto-footer { font-size: 0.9em; opacity: 0.8; margin-top: 0.8em; }

.ck-notes-toolbar {
  display: flex;
  gap: 0.6em;
  align-items: center;
  margin: 0.8em 0;
  flex-wrap: wrap;
}
.ck-notes-toolbar button {
  padding: 0.45em 0.9em;
  border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
  background: transparent;
  color: inherit;
  border-radius: 5px;
  cursor: pointer;
  font: inherit;
  font-size: 0.9em;
}
.ck-notes-toolbar button:hover {
  background: color-mix(in srgb, var(--accent, #b8431f) 10%, transparent);
}
.ck-notes-status { font-size: 0.85em; opacity: 0.75; font-style: italic; }

.ck-notes-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8em 0;
  table-layout: fixed;
}
.ck-notes-table th,
.ck-notes-table td {
  padding: 0.6em 0.8em;
  border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
  vertical-align: top;
  text-align: left;
}
.ck-notes-th-term {
  width: 30%;
  background: color-mix(in srgb, var(--accent, #b8431f) 7%, transparent);
}
.ck-notes-th-meaning {
  background: color-mix(in srgb, var(--accent, #b8431f) 7%, transparent);
}
.ck-notes-cell-term {
  font-weight: 600;
  font-family: 'Atkinson Hyperlegible', sans-serif;
  background: color-mix(in srgb, currentColor 3%, transparent);
}
.ck-notes-input {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  resize: vertical;
  min-height: 2.5em;
  color: inherit;
  padding: 0;
}
.ck-notes-input:focus {
  outline: 2px solid var(--accent, #b8431f);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--accent, #b8431f) 4%, transparent);
}
.ck-notes-print-hint { display: none; } /* visible only when printed */

.ck-notes-summary {
  margin-top: 1.2em;
  padding: 0.9em 1.1em;
  background: color-mix(in srgb, currentColor 4%, transparent);
  border-radius: 6px;
  border-left: 3px solid color-mix(in srgb, var(--accent, #b8431f) 50%, transparent);
}
.ck-notes-summary > h4 { margin: 0 0 0.3em; }
.ck-notes-summary-prompt { margin: 0.3em 0; font-style: italic; opacity: 0.85; }
.ck-notes-summary-frame { margin: 0.6em 0 0; line-height: 2.3; }
.ck-notes-blank-line {
  display: inline-block;
  width: 100%;
  border-bottom: 1.5px solid color-mix(in srgb, currentColor 35%, transparent);
  margin: 0.4em 0 0;
  vertical-align: middle;
}

/* Print stylesheet — paper-and-toner-friendly.
   Targets: small B&W laser printer in a public school. Constraints:
   - No background fills (waste toner)
   - No tinted borders or accent-color highlights
   - Pure black ink for text, light grey for ruled lines only
   - Compact vertical rhythm so a single checkpoint scaffold fits
     on as few pages as possible (3-page max for ~13 vocab terms)
   - "Hint:" label dropped — students recognize the indented italic
     definition as a hint, no label needed */
@media print {
  /* Hide everything that isn't the scaffold itself */
  .skip-link,
  .page-header,
  .site-footer,
  .page-title,
  .page-section:not(.ck-notes-scaffold),
  script {
    display: none !important;
  }
  .ck-notes-howto,
  .ck-notes-toolbar { display: none !important; }

  /* Scaffold container — no background, no border */
  .ck-notes-scaffold {
    border: none !important;
    padding: 0 !important;
    background: white !important;
    margin: 0 !important;
    color: black;
  }
  .ck-notes-scaffold * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
  }

  /* Force every glyph (including color emoji) to greyscale, and tell the
     browser to be conservative about ink usage. */
  .ck-notes-scaffold,
  .ck-notes-scaffold * {
    filter: grayscale(100%) !important;
    -webkit-print-color-adjust: economy !important;
    print-color-adjust: economy !important;
  }

  /* Scaffold heading + name/date row */
  .ck-notes-scaffold > h2 {
    margin: 0 0 0.4em !important;
    font-size: 1.3em !important;
    border-bottom: 1px solid black !important;
    padding-bottom: 0.2em !important;
    page-break-after: avoid;
  }
  .ck-notes-scaffold > h2::after {
    content: "  Name: ___________________________   Date: __________";
    font-family: 'Atkinson Hyperlegible', sans-serif;
    font-weight: 400;
    font-size: 0.7em;
    margin-left: 1em;
    color: #333 !important;
  }

  /* Vocab table — no fills, no borders except thin row separators */
  .ck-notes-table {
    border: none !important;
    border-collapse: collapse !important;
    margin: 0 !important;
  }
  .ck-notes-table thead th {
    background: white !important;
    border: none !important;
    border-bottom: 1px solid black !important;
    padding: 0.3em 0.5em !important;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #333 !important;
  }
  .ck-notes-table td {
    border: none !important;
    border-bottom: 1px solid #999 !important;
    padding: 0.4em 0.5em !important;
    vertical-align: top !important;
  }
  .ck-notes-cell-term {
    font-weight: 700 !important;
    width: 26% !important;
    background: white !important;
  }
  .ck-notes-table tr { page-break-inside: avoid; }

  /* Textareas: render as ruled-line area, hide placeholder */
  .ck-notes-input {
    min-height: 4em !important;
    border: none !important;
    background: repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 1.4em,
      #888 1.4em,
      #888 calc(1.4em + 1px)
    ) !important;
    color: black !important;
    padding: 0 !important;
    font: inherit !important;
  }
  .ck-notes-input::placeholder { color: transparent !important; }

  /* Hint: just an indented italic line, no "Hint:" label, no print-only label */
  .ck-notes-print-hint {
    display: block !important;
    font-size: 0.8em !important;
    font-style: italic;
    color: #555 !important;
    margin: 0.3em 0 0 1em !important;
    line-height: 1.3 !important;
  }
  /* Strip the "<em>Hint (visible on print only):</em>" prefix via CSS:
     the source HTML has it, but we can hide just the <em> child. */
  .ck-notes-print-hint > em { display: none !important; }

  /* Summary box at the end */
  .ck-notes-summary {
    border: none !important;
    border-top: 1px solid black !important;
    border-radius: 0 !important;
    background: white !important;
    margin-top: 0.8em !important;
    padding: 0.4em 0 0 !important;
    page-break-inside: avoid;
  }
  .ck-notes-summary > h4 {
    margin: 0 0 0.2em !important;
    font-size: 1em !important;
  }
  .ck-notes-summary-prompt {
    margin: 0.2em 0 !important;
    font-size: 0.9em !important;
    font-style: italic;
    color: #333 !important;
  }
  .ck-notes-summary-frame {
    margin: 0.4em 0 0 !important;
    line-height: 2.0 !important;
  }
  .ck-notes-blank-line {
    border-bottom: 1px solid #555 !important;
    margin: 0.4em 0 0 !important;
  }

  /* Page setup — half-inch margins, no browser-supplied header/footer.
     Browser print dialog can override but this is the suggested default. */
  @page { margin: 0.5in; }
}



/* ============================================================
 * --- terms: icons + click-to-expand (2026-05-13)
 *
 * Adds visual icon + diagram-popover affordances on top of the
 * existing tooltip pattern. Terms with `image:` frontmatter get
 * an inline icon in the tooltip. Terms with both an icon AND a
 * sibling diagram SVG (data-has-diagram="true") become clickable
 * to open a full popover showing the diagram.
 *
 * The base tooltip styles above are untouched — this extends them.
 * ============================================================ */

/* Tooltip now contains only <span class="term-tip-body"> with the definition.
   The icon moved out — it sits inline next to the term name instead. */

.term-tip-body {
  display: block;
}

/* Click-to-expand affordance: the inline icon next to the term name IS the
   visual cue. Hover/focus enlarges it slightly. */

.term[data-has-diagram="true"] {
  cursor: pointer;
}

/* Small icon shown inline next to the term name, on EVERY term that has an
   image — not only on hover. Helps students associate concept with visual
   even while reading. */
.term-inline-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.22em;
  margin-right: 0.18em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--accent, #b8431f) 6%, transparent);
  padding: 1px;
  transition: transform 0.12s ease, background 0.12s ease;
}

.term:hover .term-inline-icon,
.term:focus .term-inline-icon,
.term:focus-visible .term-inline-icon {
  transform: scale(1.15);
  background: color-mix(in srgb, var(--accent, #b8431f) 14%, transparent);
}

/* On glossary cards we use the larger .glossary-card-icon instead; suppress
   any accidental inline icon emission inside cards. */
.glossary-card .term-inline-icon {
  display: none;
}


/* --- Diagram popover (opened by JS on click of a data-has-diagram term) --- */

.term-popover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 37, 24, 0.55);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}
.term-popover-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  cursor: zoom-out;
  transition: opacity 0.18s ease, visibility 0s linear 0s;
}

.term-popover {
  position: fixed;
  z-index: 999;
  background: var(--bg, #fafaf7);
  color: var(--ink, #2b2518);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(43, 37, 24, 0.35);
  padding: 20px 24px 22px;
  width: min(92vw, 720px);
  max-width: min(92vw, 720px);
  /* Use dvh where supported (better mobile behavior with URL bar) and
     leave generous breathing room around the card so it never crowds the
     viewport edges. */
  max-height: min(86vh, 86dvh);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease,
              visibility 0s linear 0.18s;
  font-family: 'Atkinson Hyperlegible', sans-serif;
  /* Flex column so header/footer stay pinned and diagram region scrolls
     when content exceeds available height. */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.term-popover.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 0.18s ease, transform 0.18s ease,
              visibility 0s linear 0s;
}

.term-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule, #d8d2c4);
  flex-shrink: 0;
}

.term-popover-title {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 36, "SOFT" 40;
  font-size: 24px;
  font-weight: 460;
  color: var(--ink, #2b2518);
  margin: 0;
  text-transform: capitalize;
}

.term-popover-close {
  background: transparent;
  border: 1px solid var(--rule, #d8d2c4);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-quiet, #6b6457);
  flex-shrink: 0;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.term-popover-close:hover,
.term-popover-close:focus-visible {
  border-color: var(--accent, #b8431f);
  color: var(--accent, #b8431f);
  background: var(--accent-soft, color-mix(in srgb, var(--accent, #b8431f) 7%, transparent));
  outline: none;
}

.term-popover-definition {
  font-size: 16px;
  line-height: 1.55;
  margin: 0 0 14px;
  color: var(--ink, #2b2518);
  flex-shrink: 0;
}

.term-popover-diagram {
  background: var(--bg-tint, #f1ece0);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  flex: 1 1 auto;
  min-height: 120px;     /* don't collapse for very-flat diagrams */
  min-width: 0;          /* let the flex child actually shrink */
  display: flex;
  align-items: center;
  justify-content: center;
  /* no overflow:auto — we scale the image to fit instead of scrolling */
}
.term-popover-diagram img {
  /* Bound BOTH dimensions so the image fits inside the flex region
     regardless of which dimension is the binding constraint. */
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.term-popover-diagram svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}

.term-popover-footer {
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-quiet, #6b6457);
  font-style: italic;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .term-popover {
    padding: 16px 18px 18px;
    width: 96vw;
    max-width: 96vw;
    max-height: min(90vh, 90dvh);
  }
  .term-popover-title {
    font-size: 20px;
  }
  .term-popover-definition {
    font-size: 15px;
    margin: 0 0 10px;
  }
}

/* Short-viewport landscape (laptops on low resolution, phones in landscape):
   the diagram dominates, so compress chrome aggressively. */
@media (max-height: 600px) {
  .term-popover {
    padding: 14px 18px 14px;
    max-height: 94vh;
  }
  .term-popover-header { margin-bottom: 8px; padding-bottom: 8px; }
  .term-popover-title { font-size: 18px; }
  .term-popover-definition { font-size: 14px; margin: 0 0 8px; line-height: 1.4; }
  .term-popover-footer { display: none; }
  .term-popover-diagram { padding: 8px; }
}

/* Honor reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  .term-popover-backdrop,
  .term-popover {
    transition: none;
  }
  .term-popover {
    transform: translate(-50%, -50%);
  }
}



/* ============================================================
 * --- glossary-index (auto-generated subject glossary)
 *
 * Rendered by <glossary-index subject="biology"/> directive in
 * inject.py — a responsive grid of icon+name+definition cards.
 * Each card is a real .term span so it reuses the click-popover
 * affordance (and the hover tooltip, though we hide it on cards
 * since the definition is already inline).
 * ============================================================ */

.glossary-index {
  margin: 24px 0;
}

.glossary-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.glossary-card {
  margin: 0;
  padding: 0;
}

/* On glossary cards, the .term becomes a block-style card */
.glossary-card .term {
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 4px;
  align-items: start;
  padding: 14px 16px;
  background: var(--bg, #fafaf7);
  border: 1px solid var(--rule, #d8d2c4);
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  font-weight: 400;
  border-bottom-style: solid;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}
.glossary-card .term:hover,
.glossary-card .term:focus-visible {
  border-color: var(--accent, #b8431f);
  background: var(--accent-soft, color-mix(in srgb, var(--accent, #b8431f) 6%, transparent));
  transform: translateY(-1px);
  outline: none;
}

/* Hide the floating tooltip on glossary cards — definition is inline */
.glossary-card .term:hover .term-tip,
.glossary-card .term:focus .term-tip,
.glossary-card .term:focus-visible .term-tip,
.glossary-card .term:focus-within .term-tip {
  display: none;
}
/* Also suppress the dot indicator inside cards — the whole card is the affordance */
.glossary-card .term[data-has-diagram="true"]::before {
  display: none;
}
/* And no arrow under cards */
.glossary-card .term:hover::after,
.glossary-card .term:focus::after,
.glossary-card .term:focus-within::after {
  display: none;
}

.glossary-card-icon {
  grid-row: 1 / span 2;
  width: 44px;
  height: 44px;
  background: color-mix(in srgb, var(--accent, #b8431f) 6%, var(--bg, #fafaf7));
  border-radius: 6px;
  padding: 4px;
  align-self: center;
}
.glossary-card-icon-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--ink-quiet, #6b6457);
}

.glossary-card-name {
  font-family: 'Fraunces', serif;
  font-variation-settings: "opsz" 18, "SOFT" 40;
  font-size: 17px;
  font-weight: 460;
  color: var(--ink, #2b2518);
  text-transform: capitalize;
  line-height: 1.2;
}

.glossary-card-def {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-quiet, #6b6457);
}

.glossary-empty {
  font-style: italic;
  color: var(--ink-quiet, #6b6457);
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--rule, #d8d2c4);
  border-radius: 8px;
}

@media (max-width: 600px) {
  .glossary-grid {
    grid-template-columns: 1fr;
  }
}
