/* ═══════════════════════════════════════════════════════════════
   LUNAR — GLOSSARY LAYER
   Extends site-core.css. NACHI-inspired layout: A–Z letter browser
   at the top, per-letter sections below, plus a client-side search
   with "terms only" / "terms + definitions" toggle. All definitions
   are Lunar-original, scoped to services we actually perform.
   ═══════════════════════════════════════════════════════════════ */

.glo-hero {
  padding: clamp(48px, 6vw, 88px) 0 clamp(28px, 3vw, 40px);
  border-bottom: 1px solid var(--border-subtle);
}
.glo-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 8px 0 12px;
}
.glo-hero p {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0;
}

/* Controls: search field + toggle + A–Z rail */
.glo-controls {
  padding: clamp(28px, 4vw, 44px) 0 clamp(20px, 3vw, 30px);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-mid);
  position: sticky;
  top: var(--header-height);
  z-index: 10;
}
.glo-search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 20px;
}
@media (max-width: 720px) {
  .glo-search-row { grid-template-columns: 1fr; }
}
.glo-search-field {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 0 18px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.glo-search-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.glo-search-field i { color: var(--text-tertiary); font-size: 15px; }
.glo-search-field input {
  flex: 1;
  background: transparent; border: 0; outline: none;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 15px;
  padding: 14px 0;
}
.glo-search-field input::placeholder { color: var(--text-muted); }
.glo-search-clear { background: transparent; border: 0; cursor: pointer; color: var(--text-tertiary); font-size: 15px; padding: 6px; display: none; }
.glo-search-clear.is-visible { display: inline-flex; }

.glo-toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); user-select: none; cursor: pointer; }
.glo-toggle input { accent-color: var(--accent); width: 16px; height: 16px; }

/* A–Z rail */
.glo-az {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.glo-az a, .glo-az span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.glo-az a:hover, .glo-az a.is-active {
  color: var(--text-primary); border-color: var(--accent); background: var(--bg-card-hover);
}
.glo-az a.is-empty { opacity: 0.35; pointer-events: none; }
.glo-az span.is-empty { cursor: default; }

/* Search results status line */
.glo-status {
  padding: 10px 0 0;
  font-size: 13px; color: var(--text-tertiary);
}
.glo-status .n { color: var(--text-primary); font-weight: 600; }

/* Body */
.glo-body { padding: clamp(36px, 5vw, 60px) 0 clamp(48px, 6vw, 84px); }

.glo-letter {
  margin-bottom: 44px;
  scroll-margin-top: calc(var(--header-height) + 200px);
}
.glo-letter[hidden] { display: none; }
.glo-letter-head {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}
.glo-letter-head .l {
  font-family: var(--font-display);
  font-size: 44px; font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--accent-light);
}
.glo-letter-head h2 {
  font-family: var(--font-primary);
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-tertiary);
  margin: 0;
}

.glo-term {
  padding: 18px 0;
  border-bottom: 1px solid var(--border-subtle);
  scroll-margin-top: calc(var(--header-height) + 200px);
}
.glo-term:last-child { border-bottom: 0; }
.glo-term[hidden] { display: none; }
.glo-term h3 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0 0 6px;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.glo-term .also {
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  font-family: var(--font-primary);
}
.glo-term p {
  color: var(--text-secondary);
  font-size: 15px; line-height: 1.65;
  margin: 0;
  max-width: 780px;
}
.glo-term p a { color: var(--accent-light); text-decoration: underline; text-underline-offset: 3px; }
.glo-term p a:hover { color: var(--text-primary); }
.glo-term mark { background: rgba(66,133,244,0.28); color: #fff; border-radius: 3px; padding: 0 2px; }
.glo-term .see-also {
  margin-top: 10px;
  font-size: 13px; color: var(--text-tertiary);
}
.glo-term .see-also a { color: var(--accent-light); text-decoration: none; margin-right: 8px; }
.glo-term .see-also a:hover { text-decoration: underline; }

.glo-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-tertiary);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
}
.glo-empty[hidden] { display: none; }
.glo-empty a { color: var(--accent-light); }

/* WCAG 2.2 AA link-state hardening (R19 remediation pass):
   visited keeps the accessible link color; focus is always visible. */
.glo-term p a:visited, .glo-term .see-also a:visited { color: var(--accent-light); }
.glo-term p a:focus-visible, .glo-term .see-also a:focus-visible,
.glo-az a:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; border-radius: 3px; }
.glo-term .see-also a { text-decoration: underline; text-underline-offset: 3px; }
.glo-az a.is-empty { opacity: 0.45; }
