:root {
  --bg: #f3ecdc;
  --bg-strong: #e6d7b8;
  --surface: rgba(255, 251, 242, 0.92);
  --surface-strong: #fffaf0;
  --text: #2f2419;
  --muted: #6a5a49;
  --line: rgba(81, 58, 34, 0.18);
  --accent: #8f2f22;
  --accent-dark: #5f1c13;
  --accent-soft: #d8a35d;
  --shadow: 0 18px 50px rgba(57, 38, 20, 0.14);
  --radius: 24px;
  --radius-sm: 16px;
  --content: 1180px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(214, 158, 82, 0.35), transparent 28%),
    radial-gradient(circle at top right, rgba(143, 47, 34, 0.12), transparent 24%),
    linear-gradient(180deg, #f7f1e5 0%, var(--bg) 46%, #efe6d4 100%);
  font-family: Baskerville, "Palatino Linotype", "Book Antiqua", serif;
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

.site-shell {
  width: min(calc(100% - 2rem), var(--content));
  margin: 0 auto;
}

.site-header {
  padding: 1.2rem 0 0;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 248, 235, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 35px rgba(69, 45, 20, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(95, 28, 19, 0.18);
  object-fit: cover;
}

.brand-title {
  margin: 0;
  font-size: clamp(1.1rem, 1rem + 0.6vw, 1.5rem);
  line-height: 1.1;
}

.brand-subtitle {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-links a,
.button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.6rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-links a,
.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.button {
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff6ef;
  box-shadow: 0 12px 24px rgba(143, 47, 34, 0.18);
}

.button:hover,
.button:focus-visible {
  color: #ffffff;
  background: #a63c2e;
}

.button.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
  box-shadow: none;
}

.hero {
  position: relative;
  overflow: hidden;
  margin: 1.4rem 0 2rem;
  padding: clamp(2rem, 4vw, 4rem);
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid rgba(98, 69, 38, 0.14);
  background:
    linear-gradient(135deg, rgba(255, 251, 241, 0.96), rgba(236, 219, 190, 0.92)),
    url("../rainbow-background.jpg") center/cover no-repeat;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -5% -22% auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(143, 47, 34, 0.2) 0%, rgba(143, 47, 34, 0) 70%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 1.5rem;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(95, 28, 19, 0.08);
  color: var(--accent-dark);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1,
.page-hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 1.5rem + 3vw, 4.5rem);
  line-height: 0.94;
}

.hero p,
.page-hero p,
.lede {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.08rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 1.4rem;
}

.hero-card,
.panel,
.feature-card,
.country-card,
.archive-card,
.note-card,
.listing-sample,
.letter-grid,
.timeline-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 1.2rem;
}

.hero-card img {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) - 10px);
}

.hero-card-caption {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.6rem 0 0;
}

.stat {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(81, 58, 34, 0.1);
}

.stat strong {
  display: block;
  font-size: clamp(1.4rem, 1rem + 1.2vw, 2.2rem);
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 0.92rem;
}

.section {
  margin: 2rem 0;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.6rem, 1.3rem + 1vw, 2.4rem);
}

.section-heading p {
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 1rem;
}

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

.grid.columns-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feature-card,
.country-card,
.archive-card,
.note-card,
.timeline-card {
  padding: 1.3rem;
}

.feature-card h3,
.country-card h3,
.archive-card h3,
.note-card h3,
.timeline-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.kicker {
  margin: 0 0 0.45rem;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.country-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: calc(var(--radius-sm) - 2px);
  margin-bottom: 1rem;
  border: 1px solid rgba(81, 58, 34, 0.12);
}

.letter-grid {
  padding: 1.2rem;
}

.letters {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 0.55rem;
}

.letters a {
  display: grid;
  place-items: center;
  min-height: 3rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  font-size: 1.02rem;
  font-weight: 700;
  text-decoration: none;
}

.letters a:hover,
.letters a:focus-visible {
  background: rgba(143, 47, 34, 0.08);
}

.listing-sample {
  padding: 1.25rem;
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 18px;
}

.record-table td,
.record-table th {
  padding: 0.85rem;
  vertical-align: top;
  border: 1px solid rgba(81, 58, 34, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.record-table th {
  text-align: left;
  background: rgba(230, 215, 184, 0.58);
}

.record-split {
  display: grid;
  gap: 0.35rem;
}

.divider {
  height: 1px;
  background: rgba(81, 58, 34, 0.18);
}

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.legend-item {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(81, 58, 34, 0.1);
}

.swatch {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 0.45rem;
  border: 1px solid rgba(81, 58, 34, 0.16);
  flex: 0 0 auto;
}

.bg-blue { background: #ccffff; }
.bg-pink { background: #ffcccc; }
.bg-yellow { background: #ffffcc; }
.bg-white { background: #ffffff; }
.bg-orange { background: #ffcb99; }
.bg-green { background: #99ff98; }
.bg-purple { background: #ccbbff; }

.page-hero {
  margin: 1.4rem 0 1.6rem;
  padding: clamp(1.8rem, 3vw, 3rem);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: linear-gradient(135deg, rgba(255, 251, 242, 0.95), rgba(230, 215, 184, 0.88));
  box-shadow: var(--shadow);
}

.two-up {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
}

.site-footer {
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.site-footer .panel {
  padding: 1.2rem;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.94rem;
}

.tight {
  margin: 0;
}

@media (max-width: 980px) {
  .hero-grid,
  .two-up,
  .grid.columns-3,
  .grid.columns-2 {
    grid-template-columns: 1fr;
  }

  .letters {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(calc(100% - 1rem), var(--content));
  }

  .topbar,
  .hero,
  .page-hero,
  .feature-card,
  .country-card,
  .archive-card,
  .note-card,
  .timeline-card,
  .listing-sample,
  .letter-grid,
  .hero-card {
    border-radius: 20px;
  }

  .stats,
  .legend {
    grid-template-columns: 1fr;
  }

  .letters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
