:root {
  --ink: #0c1a24;
  --ink-soft: #243746;
  --sea: #0e4d5c;
  --sea-mid: #176b7a;
  --foam: #e8f2f4;
  --sand: #f3ebe0;
  --amber: #c47a2c;
  --amber-soft: #e8b86d;
  --border: rgba(12, 26, 36, 0.12);
  --shadow: 0 18px 50px rgba(12, 26, 36, 0.18);
  --nav-h: 58px;
  --radius: 16px;
  --font-ui: "Outfit", system-ui, sans-serif;
  --font-display: "Source Serif 4", Georgia, serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--ink);
}

/* ---------- Preloader ---------- */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(23, 107, 122, 0.45), transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 80%, rgba(196, 122, 44, 0.25), transparent 50%),
    linear-gradient(160deg, #07141c 0%, #0e4d5c 55%, #0c1a24 100%);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner {
  text-align: center;
  color: var(--foam);
}

.loader-orb {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  border: 3px solid rgba(232, 242, 244, 0.2);
  border-top-color: var(--amber-soft);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-brand {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.loader-copy {
  margin: 0;
  opacity: 0.7;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

/* ---------- Nav ---------- */
.gazetteer-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--nav-h);
  padding: 0;
  background: rgba(243, 235, 224, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(12, 26, 36, 0.08);
}

.gazetteer-nav .container-fluid {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, var(--amber-soft), var(--amber) 45%, var(--sea) 70%);
  box-shadow: 0 0 0 3px rgba(196, 122, 44, 0.2);
}

.brand-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  line-height: 1;
}

.country-select-wrap {
  flex: 1;
  max-width: 280px;
}

#countrySelect {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
  font-weight: 500;
  padding-left: 1rem;
  box-shadow: inset 0 1px 2px rgba(12, 26, 36, 0.04);
}

#countrySelect:focus {
  border-color: var(--sea-mid);
  box-shadow: 0 0 0 0.2rem rgba(14, 77, 92, 0.18);
}

/* ---------- Map ---------- */
#map {
  height: 500px;
  width: 100%;
}

#map {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  background: #9db8c4;
}

.leaflet-container {
  font-family: var(--font-ui);
  background: #9db8c4;
}

.country-border {
  fill: rgba(196, 122, 44, 0.18);
  fill-opacity: 1;
  stroke: var(--amber);
  stroke-width: 2.5;
  stroke-opacity: 0.95;
}

/* EasyButton overrides */
.easy-button-container {
  margin-top: 8px !important;
}

.easy-button-button {
  width: 42px !important;
  height: 42px !important;
  border-radius: 12px !important;
  background: rgba(243, 235, 224, 0.95) !important;
  border: 1px solid var(--border) !important;
  color: var(--ink) !important;
  box-shadow: 0 8px 20px rgba(12, 26, 36, 0.12) !important;
  transition: transform 0.15s ease, background 0.15s ease !important;
}

.easy-button-button:hover {
  background: #fff !important;
  transform: translateY(-1px);
}

.easy-button-button .fa-solid,
.easy-button-button .fa-brands {
  font-size: 1rem;
  line-height: 42px;
}

.leaflet-control-layers {
  border-radius: 12px !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
  overflow: hidden;
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-family: var(--font-ui);
}

.leaflet-popup-content {
  margin: 0.85rem 1rem;
  line-height: 1.4;
}

.gaz-marker {
  background: transparent;
  border: none;
}

.gaz-pin {
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 0;
  background: var(--pin, #176b7a);
  transform: rotate(-45deg);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px rgba(12, 26, 36, 0.28);
  border: 2px solid rgba(255, 255, 255, 0.85);
}

.gaz-pin i {
  transform: rotate(45deg);
  color: #fff;
  font-size: 0.85rem;
}

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background-color: rgba(14, 77, 92, 0.25);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background-color: var(--sea);
  color: #fff;
  font-weight: 600;
}

/* ---------- Modals ---------- */
.gazetteer-modal {
  border: none;
  border-radius: var(--radius);
  background: var(--sand);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.gazetteer-modal .modal-header {
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(14, 77, 92, 0.08), transparent 60%),
    var(--sand);
  padding: 1.1rem 1.25rem;
}

.gazetteer-modal .modal-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
  margin: 0;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.85;
}

.gazetteer-modal .modal-body {
  padding: 1.25rem;
}

.country-flag {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(12, 26, 36, 0.15);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.info-item {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.info-item.span-2 {
  grid-column: span 2;
}

.info-item .label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sea);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.info-item .value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.info-item a {
  color: var(--sea-mid);
  font-weight: 600;
  text-decoration: none;
}

.info-item a:hover {
  text-decoration: underline;
}

/* Weather */
.weather-now {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(14, 77, 92, 0.12), rgba(196, 122, 44, 0.1)),
    rgba(255, 255, 255, 0.5);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}

.weather-temp {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
}

.weather-desc {
  text-transform: capitalize;
  color: var(--ink-soft);
  margin: 0.2rem 0 0;
}

.forecast-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.65rem;
}

.forecast-day {
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
}

.forecast-day .day-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--sea);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.forecast-day .day-temp {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0.2rem 0;
}

.forecast-day .day-desc {
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-transform: capitalize;
  line-height: 1.25;
}

/* Currency */
.rate-table {
  width: 100%;
  border-collapse: collapse;
}

.rate-table th,
.rate-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.rate-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--sea);
}

.rate-table td {
  font-weight: 600;
}

.currency-hero {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
}

.currency-symbol {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sea);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

/* Wiki list */
.wiki-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wiki-card {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wiki-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(12, 26, 36, 0.1);
  color: inherit;
}

.wiki-thumb {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(14, 77, 92, 0.1);
}

.wiki-card h6 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.wiki-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.modal-empty,
.modal-error {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--ink-soft);
}

.modal-error {
  color: #9b3b2e;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.75rem;
}

.meta-row i {
  color: var(--sea-mid);
  margin-right: 0.3rem;
}

/* Mobile */
@media (max-width: 576px) {
  :root {
    --nav-h: 54px;
  }

  .brand-text {
    font-size: 1.15rem;
  }

  .country-select-wrap {
    max-width: min(58vw, 200px);
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .info-item.span-2 {
    grid-column: span 1;
  }

  .weather-temp {
    font-size: 2.2rem;
  }

  .wiki-card {
    flex-direction: column;
  }

  .wiki-thumb {
    width: 100%;
    height: 120px;
  }
}

/* Subtle map fade-in */
#map.is-ready {
  animation: mapIn 0.6s ease both;
}

@keyframes mapIn {
  from { opacity: 0.4; }
  to { opacity: 1; }
}