/* Glossary page additions — keep consistent with site.css/theme.css */

.glossary-page [hidden] { display: none !important; }

.glossary-page {
  padding: 48px 0 80px;
}

.glossary-content {
  max-width: var(--content-max);
  margin: 0 auto;
}

/* Anchor offsets: keep targets below sticky topbar */
#glossary-search-input {
  scroll-margin-top: 92px;
}
.glossary-controls {
  scroll-margin-top: 92px;
}

.glossary-topbar {
  position: sticky;
  top: 14px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  margin: 0 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 255, 0.18);
  background:
    radial-gradient(circle at 12% 8%, rgba(79, 140, 255, 0.16), transparent 55%),
    rgba(5, 7, 19, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.30);
}

.glossary-topbar__jump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: rgba(16, 21, 40, 0.35);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}
.glossary-topbar__jump:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 140, 255, 0.35);
  background: rgba(16, 21, 40, 0.58);
}

.glossary-back {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: rgba(16, 21, 40, 0.5);
  transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}
.glossary-back:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 140, 255, 0.35);
  background: rgba(16, 21, 40, 0.72);
}

.glossary-header {
  margin-top: 18px;
  margin-bottom: 22px;
}
.glossary-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 3.3vw, 40px);
  letter-spacing: 0.01em;
}
.glossary-lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

.glossary-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px 14px;
  align-items: end;
  margin: 18px 0 18px;
  padding: 14px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(16, 21, 40, 0.45);
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.28);
}

.glossary-search__label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.glossary-search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(5, 7, 19, 0.55);
  padding: 10px 12px;
}

.glossary-search__input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-size: 15px;
}
.glossary-search__input::placeholder {
  color: rgba(163, 173, 199, 0.75);
}

.glossary-search__clear {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast);
}
.glossary-search__clear:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.glossary-search__meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  padding-right: 2px;
}

.glossary-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 24px;
}
.glossary-toc__link {
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 8px 10px;
  background: rgba(16, 21, 40, 0.35);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}
.glossary-toc__link:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 140, 255, 0.35);
  background: rgba(16, 21, 40, 0.58);
}

.glossary-section {
  margin: 26px 0 32px;
}
.glossary-section__title {
  margin: 0 0 12px;
  font-size: clamp(18px, 2vw, 22px);
  letter-spacing: 0.02em;
}

.glossary-list {
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.glossary-item {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(16, 21, 40, 0.38);
  scroll-margin-top: 92px;
}

.glossary-item.is-term-highlight {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.25),
    0 18px 48px rgba(2, 6, 23, 0.12),
    0 0 26px rgba(34, 197, 94, 0.20);
}

.glossary-item.is-term-highlight .glossary-term {
  border-color: rgba(34, 197, 94, 0.38);
  background: rgba(34, 197, 94, 0.12);
}

html[data-theme="light"] .glossary-item.is-term-highlight {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow:
    0 0 0 1px rgba(37, 99, 235, 0.16),
    0 22px 50px rgba(2, 6, 23, 0.10),
    0 0 28px rgba(124, 58, 237, 0.12);
}

html[data-theme="light"] .glossary-item.is-term-highlight .glossary-term {
  border-color: rgba(37, 99, 235, 0.26);
  background:
    radial-gradient(ellipse 120% 90% at 20% 0%, rgba(37, 99, 235, 0.18), transparent 58%),
    rgba(37, 99, 235, 0.10);
}

.glossary-item dt {
  margin: 0;
}
.glossary-item dd {
  margin: 0;
}

.glossary-term {
  display: inline-block;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(79, 140, 255, 0.22);
  background: rgba(79, 140, 255, 0.10);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  line-height: 1.25;
  white-space: normal;
  word-break: break-word;
}

.glossary-def {
  color: rgba(245, 247, 255, 0.92);
  font-size: 14.5px;
}

.glossary-footnote {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.glossary-note {
  padding: 14px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: rgba(16, 21, 40, 0.38);
}

.glossary-empty {
  margin: 18px 0 8px;
  padding: 12px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  background: rgba(5, 7, 19, 0.35);
}

.glossary-page mark {
  background: rgba(34, 197, 94, 0.58);
  color: inherit;
  padding: 0 0.15em;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25), 0 0 18px rgba(34, 197, 94, 0.35);
}

/* ===== Light theme — Glossary (premium) ===== */
html[data-theme="light"] .glossary-back {
  color: rgba(11, 18, 32, 0.70);
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.06);
}
html[data-theme="light"] .glossary-back:hover {
  border-color: rgba(37, 99, 235, 0.22);
  background: rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] .glossary-topbar {
  border-color: rgba(15, 23, 42, 0.10);
  background:
    radial-gradient(ellipse 70% 60% at 10% 0%, rgba(37, 99, 235, 0.10), transparent 55%),
    rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.08);
}
html[data-theme="light"] .glossary-topbar__jump {
  color: rgba(11, 18, 32, 0.72);
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.70);
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.05);
}
html[data-theme="light"] .glossary-topbar__jump:hover {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] .glossary-lead {
  color: rgba(11, 18, 32, 0.70);
}

html[data-theme="light"] .glossary-controls {
  border-color: rgba(15, 23, 42, 0.10);
  background:
    radial-gradient(ellipse 70% 60% at 10% 0%, rgba(37, 99, 235, 0.10), transparent 55%),
    radial-gradient(ellipse 60% 60% at 95% 110%, rgba(124, 58, 237, 0.08), transparent 60%),
    rgba(255, 255, 255, 0.78);
  box-shadow: 0 18px 44px rgba(2, 6, 23, 0.08);
}

html[data-theme="light"] .glossary-search__field {
  border-color: rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
html[data-theme="light"] .glossary-search__input {
  color: #0b1220;
}
html[data-theme="light"] .glossary-search__input::placeholder {
  color: rgba(11, 18, 32, 0.45);
}
html[data-theme="light"] .glossary-search__clear {
  background: rgba(2, 6, 23, 0.06);
  color: rgba(11, 18, 32, 0.85);
}
html[data-theme="light"] .glossary-search__clear:hover {
  background: rgba(37, 99, 235, 0.12);
}

html[data-theme="light"] .glossary-toc__link {
  color: rgba(11, 18, 32, 0.72);
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.70);
  box-shadow: 0 10px 22px rgba(2, 6, 23, 0.05);
}
html[data-theme="light"] .glossary-toc__link:hover {
  border-color: rgba(37, 99, 235, 0.24);
  background: rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] .glossary-item,
html[data-theme="light"] .glossary-note {
  border-color: rgba(15, 23, 42, 0.10);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.74));
  box-shadow:
    0 18px 48px rgba(2, 6, 23, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

html[data-theme="light"] .glossary-term {
  border-color: rgba(37, 99, 235, 0.18);
  background:
    radial-gradient(ellipse 100% 80% at 20% 0%, rgba(37, 99, 235, 0.16), transparent 55%),
    rgba(37, 99, 235, 0.08);
  color: #0b1220;
}

html[data-theme="light"] .glossary-def {
  color: rgba(11, 18, 32, 0.86);
}

html[data-theme="light"] .glossary-empty {
  border-color: rgba(15, 23, 42, 0.14);
  color: rgba(11, 18, 32, 0.68);
  background: rgba(255, 255, 255, 0.70);
}

html[data-theme="light"] .glossary-page mark {
  background: rgba(34, 197, 94, 0.42);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.28), 0 0 18px rgba(34, 197, 94, 0.24);
}

@media (max-width: 720px) {
  #glossary-search-input,
  .glossary-controls {
    scroll-margin-top: 110px;
  }
  .glossary-item { scroll-margin-top: 110px; }
  .glossary-topbar {
    top: 10px;
    border-radius: 18px;
    padding: 8px 8px;
  }
  .glossary-controls {
    grid-template-columns: 1fr;
  }
  .glossary-search__meta {
    text-align: left;
  }
  .glossary-item {
    grid-template-columns: 1fr;
  }
  .glossary-term {
    font-size: 13px;
  }
}

