/*
 * Encyclopedia pages reuse the research stylesheet for typography, the top
 * bar, the reading shell, prose sections, FAQ, sources and related links.
 * This file only adds what the encyclopedia needs on top: the hub grid, the
 * quick-answer treatment and a few density adjustments for shorter pages.
 */

.encyclopedia-article .research-hero {
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: 48px;
}

.encyclopedia-article .research-hero h1 {
  font-size: clamp(2.5rem, 5.2vw, 5rem);
}

.encyclopedia-article .research-dek {
  margin-top: 28px;
}

.encyclopedia-quick-answer {
  position: relative;
  max-width: 800px;
  margin: 30px 0 36px;
  padding: 22px 26px 22px 30px;
  border-left: 3px solid var(--research-amber);
  background: linear-gradient(90deg, rgba(247, 147, 26, 0.08), transparent 70%);
}

.encyclopedia-quick-answer > span {
  display: block;
  margin-bottom: 10px;
  color: var(--research-amber);
  font-family: var(--research-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.encyclopedia-quick-answer > p {
  margin: 0;
  color: var(--research-ink);
  font-size: clamp(1.08rem, 1.55vw, 1.32rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.encyclopedia-article .research-prose a,
.encyclopedia-quick-answer a,
.encyclopedia-article .research-faq details p a {
  color: var(--research-cyan);
  text-decoration-color: var(--research-rule-strong);
}

.encyclopedia-article .research-prose a:hover,
.encyclopedia-quick-answer a:hover,
.encyclopedia-article .research-faq details p a:hover {
  color: var(--research-amber);
}

.encyclopedia-article .verified-record {
  margin-top: 34px;
}

.encyclopedia-article .research-table th[scope="row"] {
  white-space: nowrap;
}

.encyclopedia-keep-reading {
  display: grid;
  gap: 0;
  margin: 56px 0 0;
}

/* The research stylesheet gives each related-links block a full section's
 * worth of vertical padding. Three of them in a row need far less. */
.encyclopedia-keep-reading .related-research {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  padding: 40px 0 28px;
}

.encyclopedia-keep-reading .related-research > p {
  grid-column: 1 / -1;
  grid-row: auto;
}

@media (max-width: 760px) {
  .encyclopedia-keep-reading .related-research {
    grid-template-columns: minmax(0, 1fr);
  }
}

.encyclopedia-key-facts td:last-child {
  white-space: nowrap;
}

.encyclopedia-key-facts .source-ref {
  color: var(--research-cyan);
  font-family: var(--research-mono);
  font-size: 12px;
  text-decoration-color: var(--research-rule-strong);
}

/* Top bar: five links plus the brand must survive a phone width without the
 * brand name wrapping onto three lines. */
@media (max-width: 720px) {
  .encyclopedia-page .research-topbar {
    flex-wrap: wrap;
    gap: 6px 16px;
    padding-block: 12px;
    min-height: 0;
  }

  .encyclopedia-page .research-brand-group {
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .encyclopedia-page .research-topbar nav {
    flex-wrap: wrap;
    gap: 8px 16px;
    width: 100%;
  }

  /* The research stylesheet hides the second nav link on phones (it is the
   * dossier "Publication index" there). Here the second link is History. */
  .encyclopedia-page .research-topbar nav a:nth-child(2) {
    display: inline;
  }

  .encyclopedia-page .research-topbar nav a[aria-current]::after {
    bottom: -4px;
  }
}

/* Hub */

.encyclopedia-hub .research-hero {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 0.3fr);
}

.encyclopedia-hub-stats {
  display: grid;
  gap: 18px;
  align-self: end;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--research-rule);
  background: var(--research-surface);
}

.encyclopedia-hub-stats div {
  display: grid;
  gap: 4px;
}

.encyclopedia-hub-stats dt {
  color: var(--research-muted);
  font-family: var(--research-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.encyclopedia-hub-stats dd {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}

.encyclopedia-theme {
  padding: 56px 0 8px;
  border-bottom: 1px solid var(--research-rule);
}

.encyclopedia-theme:last-of-type {
  border-bottom: 0;
}

.encyclopedia-theme > header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 24px 48px;
  align-items: end;
  margin-bottom: 30px;
}

.encyclopedia-theme > header p:first-child {
  margin: 0 0 12px;
  color: var(--research-amber);
  font-family: var(--research-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.encyclopedia-theme > header h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.encyclopedia-theme > header > p:last-child {
  margin: 0;
  color: var(--research-muted);
  font-size: 1rem;
  line-height: 1.6;
  text-wrap: pretty;
}

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

.encyclopedia-grid a {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
  height: 100%;
  padding: 22px 22px 18px;
  border: 1px solid var(--research-rule);
  background: var(--research-surface);
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}

.encyclopedia-grid a:hover,
.encyclopedia-grid a:focus-visible {
  border-color: var(--research-amber);
  color: inherit;
  transform: translateY(-2px);
}

.encyclopedia-grid strong {
  font-size: 1.12rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: balance;
}

.encyclopedia-grid small {
  color: var(--research-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.encyclopedia-grid em {
  color: var(--research-faint);
  font-family: var(--research-mono);
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 820px) {
  .encyclopedia-hub .research-hero,
  .encyclopedia-theme > header {
    grid-template-columns: minmax(0, 1fr);
  }

  .encyclopedia-hub-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .encyclopedia-quick-answer {
    padding: 18px 18px 18px 20px;
  }

  .encyclopedia-hub-stats {
    grid-template-columns: minmax(0, 1fr);
  }
}
