:root {
  --bg: #f8f7f4;
  --paper: #ffffff;
  --ink: #1f2a2b;
  --muted: #4a5d59;
  --accent: #0e7a6c;
  --accent-hover: #0a6057;
  --accent-soft: #d7efe9;
  --edge: #e0d9cc;
  --radius: 16px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.07);
  --shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.07), 0 20px 48px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

/* ── Top accent bar ─────────────────────────────────────── */
.page-accent-bar {
  height: 4px;
  background: linear-gradient(90deg, #0a6057 0%, #0e7a6c 35%, #14a892 70%, #8fc9bf 100%);
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  width: 100%;
  background: #ffffff;
  padding: 52px 4% 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 28px;
}

.hero-banner {
  width: min(680px, 92vw);
  height: auto;
  display: block;
}

/* ── Section shell ──────────────────────────────────────── */
.section {
  width: min(1100px, 92vw);
  margin: 0 auto 28px;
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Section head ───────────────────────────────────────── */
.section-head {
  padding: 24px 24px 12px;
}

.section-head h2 {
  margin: 0;
  font-family: "Newsreader", serif;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.section-head h2::after {
  content: '';
  display: block;
  width: 28px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 10px;
}

.section-head p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.65;
  max-width: 72ch;
}

/* Centred serif italic intro */
.flags-section .section-head {
  text-align: center;
}

.flags-section .section-head p {
  font-family: "Newsreader", serif;
  font-size: 1.07rem;
  font-style: italic;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
}

/* ── Section body ───────────────────────────────────────── */
.section-body {
  padding: 4px 24px 24px;
}

.section-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.section-body p + p {
  margin-top: 12px;
}

.section-body strong {
  color: var(--ink);
  font-weight: 600;
}

.section-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(14, 122, 108, 0.35);
  font-weight: 500;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.section-body a:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-hover);
}

/* ── Search bar ─────────────────────────────────────────── */
.flags-search-wrap {
  padding: 0 24px 16px;
}

.flags-search {
  width: 100%;
  padding: 10px 18px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
}

.flags-search::placeholder {
  color: #9eb3af;
}

.flags-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 122, 108, 0.14);
  background: var(--paper);
}

.flags-search-empty {
  padding: 32px 24px 36px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  display: none;
}

/* ── Flags grid ─────────────────────────────────────────── */
.flags-grid {
  padding: 0 24px 24px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
}

/* ── Flag card ──────────────────────────────────────────── */
.flag-card {
  border: 1px solid var(--edge);
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper);
  cursor: pointer;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  position: relative;
}

/* Accent ring on hover via outline */
.flag-card:hover,
.flag-card:focus-visible {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.flag-card:focus-visible {
  outline-offset: 2px;
}

/* Subtle background tints */
.flag-card:nth-child(5n + 1) { background: #fdfcf8; }
.flag-card:nth-child(5n + 2) { background: #f8fbf9; }
.flag-card:nth-child(5n + 3) { background: #f8fafc; }
.flag-card:nth-child(5n + 4) { background: #fbf8fb; }
.flag-card:nth-child(5n + 5) { background: #fdfaf7; }

/* ── Flag thumb ─────────────────────────────────────────── */
.flag-thumb-wrap {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: linear-gradient(140deg, #dce8e3 0%, #f1ead8 100%);
}

.flag-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: transform 0.4s ease;
}

.flag-card:hover .flag-thumb {
  transform: scale(1.06);
}

/* ── Flag meta ──────────────────────────────────────────── */
.flag-meta {
  padding: 10px 12px 12px;
  flex: 1;
  border-top: 1px solid var(--edge);
}

.flag-name {
  margin: 0;
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--ink);
}

/* ── Map section ────────────────────────────────────────── */
.map-section {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
}

.map-section .section-head {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
}

.map {
  width: 100%;
  height: min(72vh, 720px);
  min-height: 420px;
  border-top: 1px solid var(--edge);
}

/* ── Map popup ──────────────────────────────────────────── */
.popup {
  width: 230px;
}

.popup img {
  width: 100%;
  border-radius: 10px;
  margin-bottom: 8px;
}

.popup h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.popup p {
  margin: 6px 0 10px;
  font-size: 0.88rem;
  color: #2f3f3e;
  line-height: 1.5;
}

.popup a {
  display: inline-block;
  text-decoration: none;
  color: #fff;
  background: var(--accent);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.84rem;
  font-weight: 500;
  transition: background 0.15s ease;
}

.popup a:hover {
  background: var(--accent-hover);
}

.popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Credits ────────────────────────────────────────────── */
.credits-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 10px;
}

.team-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 22px;
}

.contributor-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0;
}

.name-pill {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.name-pill--team {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Closing / contact CTA ──────────────────────────────── */
.closing-section {
  background: linear-gradient(135deg, #edf8f5 0%, #f8f7f4 100%);
  border-color: #c0e0d8;
  margin-bottom: 40px;
}

a.contact-cta,
a.contact-cta:visited {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  margin-top: 18px;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 16px rgba(14, 122, 108, 0.28);
}

a.contact-cta:hover,
a.contact-cta:focus-visible {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(14, 122, 108, 0.35);
  color: #fff;
  text-decoration: none;
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 28px 20px 40px;
  color: var(--muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--edge);
  background: var(--paper);
}

.footer-credit a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--edge);
  font-weight: 500;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.footer-credit a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.footer-cookie-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--edge);
  transition: color 0.15s ease;
}

.footer-cookie-btn:hover {
  color: var(--accent);
}

/* ── Cookie banner ──────────────────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--ink);
  color: #f0ece0;
  padding: 18px 20px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
}

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

.cookie-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.cookie-text {
  flex: 1;
  min-width: 200px;
}

.cookie-title {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 1rem;
}

.cookie-body {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #c8c2b0;
}

.cookie-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.cookie-btn {
  border: none;
  border-radius: 999px;
  padding: 9px 22px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.cookie-btn:hover {
  opacity: 0.85;
}

.cookie-btn--accept {
  background: var(--accent);
  color: #fff;
}

.cookie-btn--decline {
  background: rgba(255, 255, 255, 0.12);
  color: #f0ece0;
}

.cookie-map-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  gap: 16px;
  padding: 24px;
  color: var(--muted);
  font-size: 0.95rem;
  text-align: center;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 980px) {
  .flags-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .hero {
    padding: 28px 4% 20px;
    margin: 0 0 20px;
  }

  .flags-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 0 14px 18px;
  }

  .flags-search-wrap {
    padding: 0 14px 14px;
  }

  .map {
    min-height: 360px;
    height: 60vh;
  }

  .section-head {
    padding: 18px 16px 10px;
  }

  .section-body {
    padding: 4px 16px 18px;
  }

  .section-head h2 {
    font-size: 1.3rem;
  }
}

@media (max-width: 420px) {
  .flags-grid {
    grid-template-columns: 1fr;
  }
}
