/* Glossary page — agenticgovernance.digital */

.glossary-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.glossary-header {
  border-bottom: 2px solid var(--border-color, #e2e8f0);
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
}

.glossary-header h1 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem 0;
  color: var(--text-primary, #1e293b);
}

.glossary-header .subtitle {
  font-size: 1rem;
  color: var(--text-secondary, #475569);
  margin: 0 0 0.5rem 0;
}

.glossary-header .meta {
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
  margin: 0.5rem 0;
}

.glossary-header .audience-note,
.glossary-header .translation-note {
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
  margin: 0.4rem 0;
  line-height: 1.5;
}

.machine-key {
  display: inline-block;
  margin-left: 0.4rem;
  font-style: italic;
}

.mi-machine-note {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: #fef3c7;
  color: #92400e;
  padding: 0.05rem 0.35rem;
  border-radius: 0.25rem;
  vertical-align: middle;
}

.glossary-filter {
  position: sticky;
  top: 60px;
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.filter-input {
  flex: 1 1 320px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 0.375rem;
  font-size: 0.95rem;
  background: var(--bg-primary, #ffffff);
}

.filter-input:focus {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 1px;
}

.filter-stats {
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
}

.search-cat-banner {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 0.4rem;
  padding: 0.6rem 0.85rem;
  margin: -0.5rem 0 1.25rem 0;
  font-size: 0.88rem;
  color: #78350f;
  line-height: 1.5;
}

.search-cat-banner[hidden] {
  display: none;
}

.search-cat-banner .banner-clear {
  color: #b45309;
  font-weight: 600;
  text-decoration: underline;
  margin-left: 0.2rem;
}

.search-cat-banner .banner-clear:hover {
  color: #92400e;
}

.glossary-toc {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
}

.glossary-toc .toc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.glossary-toc h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary, #64748b);
  margin: 0;
}

.glossary-toc .toc-help {
  font-size: 0.78rem;
  color: var(--text-secondary, #64748b);
  margin: 0 0 0.6rem 0;
  font-style: italic;
}

.glossary-toc .toc-clear {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 0.3rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  font-weight: 600;
}

.glossary-toc .toc-clear:hover {
  background: #1d4ed8;
}

.glossary-toc .toc-clear[hidden] {
  display: none;
}

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

.glossary-toc a {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: 0.25rem;
  color: var(--text-primary, #1e293b);
  text-decoration: none;
  font-size: 0.9rem;
}

.glossary-toc a:hover {
  background: var(--bg-tertiary, #e2e8f0);
}

.glossary-toc a.active {
  background: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

.glossary-toc a.active .toc-count {
  color: rgba(255, 255, 255, 0.85);
}

.toc-count {
  color: var(--text-secondary, #64748b);
  font-size: 0.8rem;
  margin-left: 0.25rem;
}

.category-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 100px;
}

.category-heading {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 1.25rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  padding-bottom: 0.5rem;
  margin: 0 0 1rem 0;
  color: var(--text-primary, #1e293b);
  flex-wrap: wrap;
}

.category-heading .label-mi {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary, #475569);
  font-style: italic;
}

.category-heading .entry-count {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary, #64748b);
}

.glossary-entry {
  background: var(--card-bg, #ffffff);
  border-left: 3px solid var(--border-accent, #cbd5e1);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border-radius: 0 0.25rem 0.25rem 0;
  scroll-margin-top: 80px;
}

.glossary-entry:target {
  border-left-color: #2563eb;
  border-left-width: 5px;
  background: #dbeafe;
  box-shadow: 0 0 0 2px #2563eb, 0 4px 12px rgba(37, 99, 235, 0.2);
  animation: glossary-target-flash 1.4s ease-out;
}

@keyframes glossary-target-flash {
  0% {
    background: #fef3c7;
    box-shadow: 0 0 0 4px #f59e0b, 0 4px 12px rgba(245, 158, 11, 0.4);
  }
  100% {
    background: #dbeafe;
    box-shadow: 0 0 0 2px #2563eb, 0 4px 12px rgba(37, 99, 235, 0.2);
  }
}

.glossary-entry .term {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  color: var(--text-primary, #1e293b);
  line-height: 1.3;
}

.glossary-entry .term-mi {
  font-weight: 500;
  color: var(--text-secondary, #475569);
  font-style: italic;
  font-size: 0.95rem;
}

.glossary-entry .def {
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0.4rem 0;
  color: var(--text-primary, #334155);
}

.glossary-entry .def-mi {
  background: rgba(15, 118, 110, 0.04);
  border-left: 2px solid rgba(15, 118, 110, 0.3);
  padding: 0.4rem 0.65rem;
  border-radius: 0 0.25rem 0.25rem 0;
  margin-top: 0.35rem;
}

.glossary-entry .def-mi-machine {
  border-left-color: rgba(217, 119, 6, 0.5);
  background: rgba(254, 243, 199, 0.3);
}

.glossary-entry .def-mi-pending {
  font-style: italic;
  color: var(--text-secondary, #64748b);
  font-size: 0.85rem;
  background: rgba(100, 116, 139, 0.04);
  border-left-color: rgba(100, 116, 139, 0.3);
}

.glossary-entry .see-also,
.glossary-entry .source-cite,
.glossary-entry .citations {
  font-size: 0.82rem;
  color: var(--text-secondary, #64748b);
  margin: 0.35rem 0 0 0;
}

.glossary-entry .citations {
  border-top: 1px dashed var(--border-color, #e2e8f0);
  padding-top: 0.45rem;
  margin-top: 0.55rem;
  line-height: 1.7;
}

.glossary-entry .citations .label {
  display: inline-block;
  margin-right: 0.4rem;
}

.cite {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  text-decoration: none;
  background: #f1f5f9;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  font-size: 0.78rem;
  margin: 0.15rem 0;
  transition: background 0.12s ease, color 0.12s ease;
}

.cite:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

.cite-primary {
  background: #dbeafe;
  border-color: #93c5fd;
  font-weight: 700;
  color: #1e40af;
}

.cite-applied {
  background: #f8fafc;
  border-color: #cbd5e1;
  font-weight: 500;
}

.cite-mentioned {
  background: #ffffff;
  color: #64748b;
  font-weight: 400;
}

.cite-section {
  font-weight: 600;
  margin-left: 0.15rem;
  opacity: 0.85;
}

.citations-legacy .legacy-text {
  font-style: italic;
}

.glossary-entry .see-also a {
  color: var(--accent, #2563eb);
  text-decoration: none;
}

.glossary-entry .see-also a:hover {
  text-decoration: underline;
}

.glossary-entry .label {
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.72rem;
  margin-right: 0.25rem;
}

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

.category-section[data-empty="true"] {
  display: none;
}

/* ===== Update-provenance badge ===== */

.updated-badge {
  font-size: 0.78rem;
  color: var(--text-secondary, #64748b);
  font-style: italic;
  margin: 0.4rem 0 0 0;
  padding: 0.25rem 0.6rem;
  background: #f8fafc;
  border-left: 2px solid #cbd5e1;
  border-radius: 0 0.25rem 0.25rem 0;
  display: inline-block;
}

.updated-badge.updated-feedback {
  background: #dbeafe;
  border-left-color: #2563eb;
  color: #1e40af;
  font-style: normal;
  font-weight: 500;
}

/* ===== Engagement: per-entry feedback ===== */

.entry-feedback {
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color, #e2e8f0);
  font-size: 0.82rem;
  color: var(--text-secondary, #64748b);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.entry-feedback .fb-prompt {
  margin-right: 0.2rem;
}

.entry-feedback .fb-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 0.3rem;
  padding: 0.15rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.12s ease, transform 0.12s ease;
}

.entry-feedback .fb-btn:hover:not(:disabled) {
  background: #e2e8f0;
  transform: scale(1.1);
}

.entry-feedback .fb-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.entry-feedback .fb-down.active {
  background: #fee2e2;
  border-color: #f87171;
}

.entry-feedback .fb-thanks {
  color: #15803d;
  font-weight: 600;
}

.entry-feedback .fb-counts {
  color: var(--text-secondary, #64748b);
  font-size: 0.78rem;
}

.entry-feedback .fb-reason {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.entry-feedback .fb-reason-label {
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  font-size: 0.82rem;
}

.entry-feedback .fb-reason-text {
  width: 100%;
  font-family: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.3rem;
  font-size: 0.85rem;
  resize: vertical;
}

.entry-feedback .fb-honey {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.entry-feedback .fb-reason-actions {
  display: flex;
  gap: 0.4rem;
}

.entry-feedback .fb-submit,
.entry-feedback .fb-cancel,
.entry-feedback .fb-cancel {
  padding: 0.3rem 0.7rem;
  border-radius: 0.3rem;
  font-size: 0.82rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.entry-feedback .fb-submit {
  background: #2563eb;
  color: #ffffff;
}

.entry-feedback .fb-submit:hover {
  background: #1d4ed8;
}

.entry-feedback .fb-cancel {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.entry-feedback .fb-cancel:hover {
  background: #e2e8f0;
}

/* ===== Suggest-a-term CTA + modal ===== */

.glossary-header .header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.suggest-cta {
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 0.4rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.suggest-cta:hover {
  background: #1d4ed8;
}

/* On mobile the header CTA wraps awkwardly; hide it. The floating
 * "Ask the Glossary" widget (loaded on every page) provides the
 * suggest-a-term entry point via its "Don't see what you need?" link. */
@media (max-width: 640px) {
  .suggest-cta {
    display: none;
  }
}

.suggest-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.suggest-modal[hidden] { display: none; }

.suggest-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.suggest-modal-panel {
  position: relative;
  background: #ffffff;
  border-radius: 0.5rem;
  padding: 1.5rem;
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.suggest-modal-panel h2 {
  margin: 0 0 0.4rem 0;
  font-size: 1.25rem;
}

.suggest-modal-help {
  font-size: 0.88rem;
  color: var(--text-secondary, #475569);
  margin: 0 0 1rem 0;
}

.suggest-modal-panel form label {
  display: block;
  font-weight: 600;
  margin: 0.6rem 0 0.25rem 0;
  font-size: 0.85rem;
  color: var(--text-primary, #1e293b);
}

.suggest-modal-panel form input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.3rem;
  font-size: 0.92rem;
}

.suggest-modal-panel form input:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.suggest-honey {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.suggest-dedup-hint {
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  background: #fef3c7;
  border-radius: 0.3rem;
  font-size: 0.85rem;
  color: #78350f;
}

.suggest-dedup-hint a {
  color: #b45309;
  font-weight: 600;
  text-decoration: underline;
  margin-right: 0.3rem;
}

.suggest-modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.suggest-submit,
.suggest-cancel {
  padding: 0.5rem 1rem;
  border-radius: 0.3rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.suggest-submit {
  background: #2563eb;
  color: #ffffff;
}

.suggest-submit:hover {
  background: #1d4ed8;
}

.suggest-cancel {
  background: #f1f5f9;
  color: #1e293b;
  border-color: #cbd5e1;
}

.suggest-cancel:hover {
  background: #e2e8f0;
}

.suggest-status {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #dcfce7;
  color: #15803d;
  border-radius: 0.3rem;
  font-size: 0.88rem;
}

.back-to-top {
  text-align: center;
  margin-top: 2rem;
}

.back-to-top a {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-primary, #1e293b);
  text-decoration: none;
  border-radius: 0.375rem;
  font-size: 0.85rem;
}

.back-to-top a:hover {
  background: var(--bg-tertiary, #e2e8f0);
}

@media (max-width: 600px) {
  .glossary-toc ol {
    grid-template-columns: 1fr;
  }
  .category-heading {
    font-size: 1.1rem;
  }
}
