/* ============================================================================
   Event Coverage — shared styles for the /events/ landing page and each event
   sub-page. Mirrors the SDGCounting design system (see index.html / mr / macenews):
   cream bg, terracotta accent, DM Serif Display titles + Source Sans 3 body,
   dark masthead + light content, 960px width.
   ========================================================================== */

:root {
  --bg: #f4f1ec;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-light: #5f5a52;
  --accent: #b34233;
  --accent-dark: #8f3126;
  --border: #d7d0c3;
  --radius-card: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --max-width: 960px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Source Sans 3", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: inherit; }

.inner {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Masthead (compact subpage header, matching Morning Report / MACE News) ── */
header.masthead {
  background: var(--text);
  color: var(--bg);
  padding: 1.5rem 0;
  border-bottom: 4px solid var(--accent);
}

.home-link {
  display: inline-block;
  margin-bottom: 0.5rem;
  color: var(--bg);
  opacity: 0.7;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: opacity 0.15s;
}
.home-link:hover,
.home-link:focus-visible { opacity: 1; }

/* Breadcrumb trail in the masthead — keeps the SDGCounting brand present and every
   level (home, Event Coverage, group) one click away, however deep you are. */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  margin-bottom: 0.65rem;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.crumbs a {
  color: var(--bg);
  opacity: 0.7;
  text-decoration: none;
  transition: opacity 0.15s;
}
.crumbs a:hover,
.crumbs a:focus-visible { opacity: 1; text-decoration: underline; }
.crumbs a.brand {
  font-weight: 700;
  letter-spacing: 0.05em;
  opacity: 0.85;
}
.crumb-sep {
  color: var(--accent);
  opacity: 0.85;
}

header.masthead h1 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin-top: 0.4rem;
  color: var(--bg);
  opacity: 0.62;
  font-size: 0.98rem;
}

/* ── Content ── */
main.inner {
  padding-top: 2.5rem;
  padding-bottom: 1rem;
}

.lead {
  max-width: 46rem;
  margin: 0 0 2.5rem;
  font-size: 1.12rem;
  color: var(--text-light);
}

/* ── Event group / section (a themed cluster of events, or a standalone one) ── */
.event-group { margin-bottom: 2.75rem; }

.group-header { margin-bottom: 1.25rem; }

.group-header h2 {
  position: relative;
  margin: 0 0 0.35rem;
  padding-bottom: 0.6rem;
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 1.2;
}
.group-header h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.5rem;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* A group whose title links to its own dedicated page. */
.group-header h2 a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  transition: color 0.15s ease;
}
.group-header h2 a .grp-arrow {
  color: var(--accent);
  font-size: 1.15rem;
  transition: transform 0.15s ease;
}
.group-header h2 a:hover,
.group-header h2 a:focus-visible { color: var(--accent); }
.group-header h2 a:hover .grp-arrow,
.group-header h2 a:focus-visible .grp-arrow { transform: translateX(4px); }

.group-meta {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.group-header p {
  margin: 0.35rem 0 0;
  color: var(--text-light);
  max-width: 46rem;
}
.group-header p a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.group-header p a:hover,
.group-header p a:focus-visible { text-decoration: underline; }

/* ── Card grid + event cards (same card language as the homepage) ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

/* Column count follows the number of cards (>= 701px): 1 -> full width,
   2 -> halves, 3 -> thirds, 4 -> 2x2, 5+ -> thirds. The rule for the largest
   matching count wins (source order). Browsers without :has() fall back to the
   auto-fit rule above. */
@media (min-width: 701px) {
  .card-grid:has(> .card:nth-child(2)) { grid-template-columns: repeat(2, 1fr); }
  .card-grid:has(> .card:nth-child(3)) { grid-template-columns: repeat(3, 1fr); }
  .card-grid:has(> .card:nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
  .card-grid:has(> .card:nth-child(5)) { grid-template-columns: repeat(3, 1fr); }
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1.5rem 1.6rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  border-color: rgba(179, 66, 51, 0.5);
}

.card-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-light);
}

.card h3 {
  margin: 0.5rem 0 0.55rem;
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 1.4rem;
  line-height: 1.15;
}

.card p {
  margin: 0;
  color: var(--text-light);
  font-size: 0.98rem;
}

.card-cta {
  margin-top: 1rem;
  color: var(--accent);
  font-weight: 700;
}
.card:hover .card-cta,
.card:focus-visible .card-cta { color: var(--accent-dark); }

/* ── Event sub-page: fact box + prose sections ── */
.event-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0 0 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}
.event-meta dt {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  padding-top: 0.15rem;
}
.event-meta dd { margin: 0; }

.event-section { margin-bottom: 2rem; }

.event-section h2 {
  position: relative;
  margin: 0 0 0.8rem;
  padding-bottom: 0.5rem;
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: 1.45rem;
}
.event-section h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.25rem;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
}

.event-section p { margin: 0 0 0.9rem; }
.event-section ul { margin: 0 0 0.9rem; padding-left: 1.2rem; }
.event-section li { margin-bottom: 0.35rem; }

.event-section a { color: var(--accent); font-weight: 600; }
.event-section a:hover,
.event-section a:focus-visible { color: var(--accent-dark); }

.callout {
  padding: 1rem 1.25rem;
  background: rgba(179, 66, 51, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  margin: 0 0 0.9rem;
  color: var(--text);
}

.note-muted {
  color: var(--text-light);
  font-style: italic;
}

/* ── Footer (shared) ── */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
  align-items: center;
  justify-content: space-between;
  color: var(--text-light);
  font-size: 0.95rem;
}
.footer-copy { margin: 0; }
.footer-copy a { color: var(--accent); font-weight: 700; text-decoration: none; }
.footer-copy a:hover,
.footer-copy a:focus-visible { text-decoration: underline; }

.social-icons { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.social-icons a {
  width: 2.4rem; height: 2.4rem;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.social-icons a:hover,
.social-icons a:focus-visible {
  background: rgba(179, 66, 51, 0.08);
  border-color: var(--accent);
}
.social-icons svg { width: 1rem; height: 1rem; fill: currentColor; }

@media (max-width: 700px) {
  header.masthead { padding: 1.1rem 0; }
  header.masthead h1 { font-size: 1.5rem; }
  .card-grid { grid-template-columns: 1fr; }
  .event-meta { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .event-meta dd { margin-bottom: 0.6rem; }
  footer { align-items: flex-start; }
}
