/* ── Shared header component — used by all pages ── */

:root {
  --bg: #f2f8fd;
  --bg-warm: #e4f0f8;
  --ink: #1a3a5c;
  --ink-soft: #3d6180;
  --ink-faint: #7ca5c0;
  --accent: #e8634a;
  --paper: #ffffff;
  --rule: #bfd6e8;
  --map-base: #8ec4d8;
  --map-hi: #e8634a;
}

html[data-theme="dark"] {
  --bg: #0b1d2e;
  --bg-warm: #0f2640;
  --ink: #e4f2fa;
  --ink-soft: #7ab4d0;
  --ink-faint: #3d6888;
  --accent: #f07460;
  --paper: #112238;
  --rule: #1c3d58;
  --map-base: #1c3d58;
  --map-hi: #f07460;
}

/* ── Header shell ── */
header {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 14px 40px;
  background: var(--paper);
  border-top: 5px solid var(--accent);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 4px 20px -4px color-mix(in srgb, var(--ink) 10%, transparent);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}

/* ── Brand ── */
.brand {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 32px;
  font-weight: 800;
  font-style: normal;
  letter-spacing: -0.03em;
  line-height: 1;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  opacity: 0;
  flex-shrink: 0;
}
.brand.fonts-loaded {
  opacity: 1;
  transition: opacity 0.25s ease;
}
.brand-l { display: inline-block; }
.brand-tld {
  font-size: 0.38em;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
  vertical-align: 0.26em;
  margin-left: 2px;
  display: inline-block;
}

/* ── Info nav ── */
.app-infonav {
  display: flex;
  align-items: center;
  gap: 20px;
}
.app-infonav-link {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: color 0.18s;
}
.app-infonav-link:hover { color: var(--ink); }
.app-infonav-link--active { color: var(--ink); font-weight: 800; }

/* ── Mode nav — absolutely centered ── */
.app-modenav {
  display: flex;
  align-items: center;
  gap: 6px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.app-modenav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 24px;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.app-modenav-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.app-modenav-link:hover {
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
  color: var(--ink);
}
.app-modenav-link--active {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
  border-color: var(--rule);
}
html[data-ambient] .app-modenav-link--active {
  background: transparent;
  color: var(--ink-soft);
  border-color: transparent;
}
html[data-ambient] .app-modenav-link--ambient {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
  border-color: var(--rule);
}
html[data-ambient] .app-modenav-link--ambient:hover {
  background: color-mix(in srgb, var(--ink) 12%, var(--paper));
}

/* ── Nav search ── */
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
}
.hsearch-icon {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
  pointer-events: none;
  flex-shrink: 0;
  transition: color 0.2s;
}
.hsearch-input {
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--rule);
  border-radius: 22px;
  padding: 8px 16px 8px 34px;
  width: 260px;
  outline: none;
  transition: width 0.25s ease, border-color 0.2s, box-shadow 0.2s;
  letter-spacing: 0.01em;
}
.hsearch-input::placeholder { color: var(--ink-faint); }
.hsearch-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.nav-search:focus-within .hsearch-icon { color: var(--accent); }
.hsearch-results {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 16px;
  box-shadow: 0 8px 36px -4px rgba(26,58,92,0.14);
  list-style: none;
  overflow: hidden;
  z-index: 300;
  max-height: 380px;
  overflow-y: auto;
}
.hsearch-results.open { display: block; }
.hsearch-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 40%, transparent);
}
.hsearch-item:last-child { border-bottom: none; }
.hsearch-item:hover { background: var(--bg); }
.hsearch-badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.hsearch-badge--language {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.hsearch-badge--country {
  background: color-mix(in srgb, var(--map-base) 22%, transparent);
  color: var(--ink-soft);
}
.hsearch-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.hsearch-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--ink-faint);
  white-space: nowrap;
  flex-shrink: 0;
}
.hsearch-empty {
  padding: 16px 14px;
  font-size: 13px;
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
}
.hsearch-results mark {
  background: none;
  color: var(--accent);
  font-weight: 800;
}

/* ── Header right ── */
.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}
.theme-toggle {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s;
  padding: 0;
  flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--ink); color: var(--ink); }
.theme-toggle svg { width: 14px; height: 14px; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
html[data-theme="dark"] .theme-toggle .sun { display: block; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ── Hamburger menu button ────────────────────────────────────────── */
.nav-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 6px;
  flex-shrink: 0;
  border-radius: 8px;
  transition: background 0.18s, color 0.18s;
  align-items: center;
  justify-content: center;
}
.nav-menu-btn:hover { background: color-mix(in srgb, var(--ink) 8%, var(--paper)); color: var(--ink); }
.nav-menu-btn svg { width: 20px; height: 20px; display: block; }

/* ── Nav menu dropdown panel ─────────────────────────────────────── */
.nav-menu-panel {
  display: none;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 8px 28px -4px rgba(26,58,92,0.14);
  z-index: 99;
  flex-direction: column;
}
.nav-menu-panel.open { display: flex; }
.nav-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 60%, transparent);
  transition: color 0.18s, background 0.18s;
}
.nav-menu-item:last-child { border-bottom: none; }
.nav-menu-item:hover { color: var(--ink); background: var(--bg); }
.nav-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--accent); }

/* Mobile search button — hidden on desktop */
.mobile-search-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}
.mobile-search-btn:hover { border-color: var(--ink); color: var(--ink); }
.mobile-search-btn svg { width: 13px; height: 13px; }

/* Mobile search overlay */
.nav-search.mobile-open {
  display: flex !important;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  padding: 10px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 8px 24px -4px rgba(26,58,92,0.12);
  z-index: 150;
  align-items: center;
}
.nav-search.mobile-open .hsearch-input {
  width: 100%;
  border-radius: 22px;
  color: var(--ink);
}
.nav-search.mobile-open .hsearch-results {
  width: 100%;
  right: 0;
  left: 0;
}

/* ── Mobile header ────────────────────────────────────────────────── */
@media (max-width: 820px) {
  header { padding: 0 12px; height: 52px; gap: 8px; }
  .brand { font-size: 22px; }
  .brand-tld { font-size: 0.4em; }
  .app-infonav { display: none; }
  .app-modenav { display: none; }
  .nav-search { display: none; }
  .nav-menu-btn { display: flex; }
  .mobile-search-btn { display: flex; }
  .header-right { gap: 8px; }
}

/* ── Cookie consent banner ────────────────────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  width: min(560px, calc(100vw - 32px));
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 18px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 8px 40px rgba(26, 58, 92, 0.14);
}
.cookie-banner[hidden] { display: none; }

.cookie-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.cookie-banner-text {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.cookie-banner-settings {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.cookie-banner-settings:hover { text-decoration: underline; }

.cookie-banner-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cookie-btn-deny {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 16px;
  border: 1px solid var(--rule);
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  text-align: center;
}
.cookie-btn-deny:hover { border-color: var(--ink-faint); color: var(--ink); }
.cookie-btn-accept {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s;
  text-align: center;
}
.cookie-btn-accept:hover { opacity: 0.86; }

