/* ============================================================
   Guides — the twenty worldwide topic hubs and their index.
   Loaded per-page by scripts/theme_v2/build_guides.py, not
   imported into theme.css (see theme.css's header).

   The hard problem here is density: a topic page carries up to
   ~620 destination links. Grouping them by country and setting
   the groups in columns keeps the page scannable instead of
   presenting one enormous undifferentiated list.
   ============================================================ */

.otg-guides {
  padding: var(--otg-space-6) 0 var(--otg-space-9);
}

/* ---------- Page head ---------- */
.otg-guides__head {
  max-width: 62ch;
  margin: var(--otg-space-5) 0 var(--otg-space-6);
}

.otg-guides__title {
  font-family: var(--otg-font-display);
  font-size: var(--otg-text-display-lg);
  line-height: 1.1;
  font-weight: var(--otg-weight-medium);
  color: var(--otg-text-primary);
  text-wrap: balance;
  margin: var(--otg-space-2) 0 var(--otg-space-4);
}

.otg-guides__lede {
  font-size: var(--otg-text-body-lg);
  line-height: var(--otg-leading-body);
  color: var(--otg-text-secondary);
  margin: 0;
}

/* ---------- Intro prose ----------
   Held to a reading measure. This copy is what distinguishes the page from a
   doorway page, so it is set as body copy and not as a caption. */
.otg-guides__intro {
  max-width: 65ch;
  margin: 0 0 var(--otg-space-7);
}

.otg-guides__intro p {
  font-size: var(--otg-text-body);
  line-height: var(--otg-leading-body);
  color: var(--otg-text-primary);
  margin: 0 0 var(--otg-space-4);
}

.otg-guides__intro p:last-child {
  margin-bottom: 0;
}

/* ---------- Index ---------- */
.otg-guides__index {
  border-top: 1px solid var(--otg-border);
  padding-top: var(--otg-space-6);
}

.otg-guides__index-heading {
  font-size: var(--otg-text-h3);
  font-weight: var(--otg-weight-medium);
  color: var(--otg-text-primary);
  margin: 0 0 var(--otg-space-5);
}

/* Country groups flow into as many columns as fit. `break-inside: avoid` keeps a
   country's heading with its links instead of splitting them across a column
   boundary, which is the whole point of grouping. */
.otg-guides__groups {
  column-width: 260px;
  column-gap: var(--otg-space-6);
}

.otg-guides__group {
  break-inside: avoid;
  page-break-inside: avoid;
  margin: 0 0 var(--otg-space-5);
}

.otg-guides__group-heading {
  font-size: var(--otg-text-micro);
  line-height: var(--otg-leading-micro);
  font-weight: var(--otg-weight-medium);
  text-transform: uppercase;
  letter-spacing: var(--otg-tracking-wide);
  color: var(--otg-text-muted);
  padding-bottom: var(--otg-space-2);
  border-bottom: 1px solid var(--otg-border);
  margin: 0 0 var(--otg-space-2);
}

.otg-guides__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.otg-guides__list li {
  margin: 0;
}

.otg-guides__link {
  display: block;
  padding: 3px 0;
  font-size: var(--otg-text-small);
  line-height: 1.5;
  color: var(--otg-text-primary);
  text-decoration: none;
  border-bottom: 0;
}

.otg-guides__link:hover,
.otg-guides__link:focus-visible {
  color: var(--otg-accent);
  text-decoration: underline;
}

/* ---------- Topic cards (the /guides/ index) ---------- */
.otg-guides__cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--otg-space-5);
}

.otg-guides__card {
  border-top: 2px solid var(--otg-border-strong);
  padding-top: var(--otg-space-3);
}

.otg-guides__card-title {
  font-size: var(--otg-text-h4);
  font-weight: var(--otg-weight-medium);
  margin: 0 0 var(--otg-space-2);
}

.otg-guides__card-title a {
  color: var(--otg-text-primary);
  text-decoration: none;
}

.otg-guides__card-title a:hover,
.otg-guides__card-title a:focus-visible {
  color: var(--otg-accent);
  text-decoration: underline;
}

.otg-guides__card-lede {
  font-size: var(--otg-text-small);
  line-height: var(--otg-leading-body);
  color: var(--otg-text-secondary);
  margin: 0 0 var(--otg-space-3);
}

.otg-guides__card-meta {
  font-size: var(--otg-text-micro);
  letter-spacing: var(--otg-tracking-wide);
  text-transform: uppercase;
  color: var(--otg-text-muted);
  font-variant-numeric: tabular-nums;
  margin: 0;
}

/* ---------- Footnote ---------- */
.otg-guides__footnote {
  margin: var(--otg-space-7) 0 0;
  padding-top: var(--otg-space-5);
  border-top: 1px solid var(--otg-border);
  font-size: var(--otg-text-small);
  color: var(--otg-text-muted);
}

@media (max-width: 640px) {
  .otg-guides__groups {
    column-width: auto;
    columns: 1;
  }
}
