/* World Atlas — dual-view globe/map. Builds on shared.css (site vars, header,
   .card, .section, footer). Colours are theme-aware; dark is opt-in via
   [data-theme="dark"] (see theme-init.js). */

:root {
  --atlas-accent: #0e7490;
  --atlas-accent-rgb: 14, 116, 137;
  /* globe */
  --globe-ocean-hi: #d3ecff;
  --globe-ocean-lo: #86b9e8;
  --globe-grat: rgba(255, 255, 255, .38);
  --globe-border: rgba(255, 255, 255, .65);
  --globe-rim: rgba(30, 60, 90, .45);
  /* land / states */
  --land-fill: #e9e3d2;
  --hover-fill: #ffd583;
  --cont-fill: #9fd3a0;
  --dim-fill: #ded9c9;
  --sel-fill: #ff8a3d;
  --sel-stroke: #b3450b;
  /* flat map */
  --map-ocean: #d3ecff;
  --map-grat: rgba(70, 120, 160, .22);
  --map-border: rgba(101, 90, 66, .6); /* visible country outlines on parchment land */
  --stage-bg: linear-gradient(180deg, #eaf4ff 0%, #f5f7ff 100%);
}
[data-theme="dark"] {
  --globe-ocean-hi: #17395a;
  --globe-ocean-lo: #06131f;
  --globe-grat: rgba(160, 200, 240, .10);
  --globe-border: rgba(200, 220, 245, .16);
  --globe-rim: rgba(120, 180, 240, .40);
  --land-fill: #4c5b6e;
  --hover-fill: #e7a94e;
  --cont-fill: #4f7f5a;
  --dim-fill: #2a323e;
  --sel-fill: #ff8a3d;
  --sel-stroke: #ffbe8f;
  --map-ocean: #081a29;
  --map-grat: rgba(180, 210, 240, .08);
  --map-border: rgba(200, 220, 245, .22); /* night: keep the subtle light outlines */
  --stage-bg: linear-gradient(180deg, #0c1622 0%, #0a1119 100%);
}

/* ── Shared suite layout (hero, sub-nav, sections, steps, faq, card,
   trust-row) — mirrors the family CSS so Atlas matches the other tools.
   Colours use the shared tokens, so dark theme adapts automatically. ── */
.tool-hero { max-width: 940px; margin: 0 auto; padding: 36px 20px 4px; }
.tool-hero .hero-head { display: flex; align-items: center; gap: 16px; }
.tool-hero .hero-icon { flex-shrink: 0; width: 48px; height: 48px; border-radius: 14px; background: #0f0e1d; display: flex; align-items: center; justify-content: center; }
.tool-hero .hero-icon svg { width: 26px; height: 26px; stroke: var(--atlas-accent); fill: none; }
.tool-hero .subtitle { color: var(--muted); font-size: 1.02rem; margin-top: 12px; max-width: 720px; }
.tool-hero .subtitle a { color: var(--atlas-accent); text-decoration: none; }
.tool-hero .subtitle a:hover { text-decoration: underline; text-underline-offset: 2px; }

.sub-link { display: inline-flex; align-items: center; min-height: 38px; padding: 6px 16px; border-radius: 999px; font-size: .9rem; font-weight: 600; color: var(--muted); border: 1.5px solid var(--border); background: var(--surface); text-decoration: none; transition: background .15s, color .15s, border-color .15s; }
.sub-link:hover { color: #fff; background: var(--atlas-accent); border-color: var(--atlas-accent); text-decoration: none; }
.sub-link.active { background: var(--atlas-accent); border-color: var(--atlas-accent); color: #fff; }
.sub-link-home { margin-left: 10px; }
body.tool-page .site-header { height: auto; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
body.tool-page .site-nav .sub-link { display: none; }
@media (min-width: 720px) { body.tool-page .site-nav .sub-link { display: inline-flex; min-height: 36px; } }
/* Match the hazard pages: the nav flex-grows and right-aligns its pills so they
   sit next to the theme toggle at the same position on every Earth page — the
   menu doesn't shift when you move between Atlas and the trackers. */
@media (min-width: 720px) {
  body.tool-page .site-header { flex-wrap: nowrap; }
  body.tool-page .site-nav { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
  body.tool-page .theme-toggle { flex-shrink: 0; align-self: center; }
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 24px; margin-top: 24px; }
.card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 14px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.trust-item { display: inline-flex; align-items: center; gap: 7px; font-size: .88rem; font-weight: 600; color: var(--muted); }
.trust-item svg { width: 16px; height: 16px; stroke: var(--atlas-accent); fill: none; flex-shrink: 0; }

.section { max-width: 940px; margin: 16px auto; padding: 24px 20px; }
.section > h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.section > .section-sub { color: var(--muted); margin-bottom: 20px; }
.steps { display: grid; gap: 14px; }
.step { display: flex; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); }
.step-num { flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: rgba(var(--atlas-accent-rgb), .14); color: var(--atlas-accent); font-weight: 800; display: flex; align-items: center; justify-content: center; }
.step-body h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 4px; }
.step-body p { font-size: .92rem; color: var(--muted); line-height: 1.6; }
.step-body a { color: var(--atlas-accent); }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.faq summary { cursor: pointer; padding: 16px 18px; font-weight: 700; font-size: .98rem; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--atlas-accent); font-weight: 700; }
.faq details[open] summary::after { content: '\2013'; }
.faq .faq-body { padding: 0 18px 16px; font-size: .92rem; color: var(--muted); line-height: 1.7; }
.faq .faq-body a { color: var(--atlas-accent); }

.atlas-tools {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* toolbar: view toggle + search */
.atlas-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.view-toggle {
  display: inline-flex;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #cdd1f0);
  border-radius: 999px;
  padding: 3px;
  box-shadow: var(--shadow, 0 1px 3px rgba(20, 21, 46, .08));
}
.view-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted, #5a5f7a);
  font: 600 .9rem/1 'Outfit', system-ui, sans-serif;
  padding: 9px 18px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all .18s ease;
}
.view-toggle button svg { width: 16px; height: 16px; }
.view-toggle button.is-active {
  background: var(--atlas-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(var(--atlas-accent-rgb), .35);
}

.atlas-search {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.atlas-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px 11px 38px;
  border: 1px solid var(--border, #cdd1f0);
  border-radius: 10px;
  background: var(--surface, #fff) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235a5f7a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat 12px center;
  color: var(--text, #14152e);
  font: 500 .95rem 'Outfit', system-ui, sans-serif;
}
.atlas-search input:focus {
  outline: none;
  border-color: var(--atlas-accent);
  box-shadow: 0 0 0 3px rgba(var(--atlas-accent-rgb), .18);
}
.atlas-suggest {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #cdd1f0);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(20, 21, 46, .18);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}
.sg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text, #14152e);
  font: 500 .92rem 'Outfit', system-ui, sans-serif;
}
.sg-item:hover { background: rgba(var(--atlas-accent-rgb), .10); }
.sg-flag { font-size: 1.15rem; }

/* continent chips */
.continent-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.cont-chip {
  border: 1px solid var(--border, #cdd1f0);
  background: var(--surface, #fff);
  color: var(--muted, #5a5f7a);
  border-radius: 999px;
  padding: 6px 14px;
  font: 600 .82rem 'Outfit', system-ui, sans-serif;
  cursor: pointer;
  transition: all .16s ease;
}
.cont-chip:hover { border-color: var(--atlas-accent); color: var(--atlas-accent); }
.cont-chip.is-active {
  background: var(--atlas-accent);
  border-color: var(--atlas-accent);
  color: #fff;
}

/* main split: stage + facts */
.atlas-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 820px) {
  .atlas-grid { grid-template-columns: 1fr; }
}

.atlas-stage {
  position: relative;
  width: 100%;
  height: min(66vh, 600px);
  min-height: 380px;
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
  background: var(--stage-bg);
  border: 1px solid var(--border, #cdd1f0);
  touch-action: none;
}
#globeCanvas { position: absolute; inset: 0; cursor: grab; display: block; }
#globeCanvas.grabbing { cursor: grabbing; }
#mapSvg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* the inactive view is toggled off with [hidden] in atlas.js — the id-selector
   display:block above would otherwise beat the UA [hidden] rule, so restate it
   at id+attr specificity to actually hide the layer that isn't in use. */
#globeCanvas[hidden], #mapSvg[hidden] { display: none; }
.atlas-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  background: rgba(20, 21, 46, .62);
  color: #fff;
  font: 500 .78rem 'Outfit', system-ui, sans-serif;
  padding: 6px 12px;
  border-radius: 999px;
  pointer-events: none;
  backdrop-filter: blur(3px);
}

/* flat-map country styling */
/* ocean uses the same hi→lo shading as the globe so day contrast matches */
.ocean-hi { stop-color: var(--globe-ocean-hi); }
.ocean-lo { stop-color: var(--globe-ocean-lo); }
.map-ocean { fill: url(#atlasMapOcean); }
.map-grat { fill: none; stroke: var(--map-grat); stroke-width: .5; }
.map-country {
  fill: var(--land-fill);
  stroke: var(--map-border);
  stroke-width: .6;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill .12s ease;
}
.map-country.is-hover { fill: var(--hover-fill); }
.map-country.is-dim { fill: var(--dim-fill); }
.map-country.is-selected { fill: var(--sel-fill); stroke: var(--sel-stroke); stroke-width: 1; }

/* facts panel */
.facts-panel {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #cdd1f0);
  border-radius: var(--radius-lg, 14px);
  padding: 22px;
  box-shadow: var(--shadow, 0 1px 3px rgba(20, 21, 46, .08));
  min-height: 380px;
}
/* intro / no-selection state — a useful "explore" panel, not a dead placeholder */
.facts-intro { display: flex; flex-direction: column; height: 100%; }
.fi-title { font: 800 1.35rem/1.1 'Orbitron', 'Outfit', sans-serif; color: var(--text, #14152e); margin: 0 0 8px; }
.fi-sub { color: var(--muted, #5a5f7a); font-size: .9rem; line-height: 1.5; margin: 0 0 18px; }
.mini-map {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border, #cdd1f0);
  border-radius: 12px;
  background: var(--map-ocean);
  margin: 2px 0 8px;
  overflow: hidden;
}
.mini-ocean { fill: url(#atlasMiniOcean); }
.mini-country { fill: var(--land-fill); stroke: var(--map-border); stroke-width: .35; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .1s ease; }
.mini-country:hover { fill: var(--hover-fill); }
.mini-cap { text-align: center; font-size: .78rem; color: var(--muted, #5a5f7a); margin: 0 0 14px; }
.fi-random {
  margin-top: 4px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: var(--atlas-accent);
  color: #fff;
  font: 700 .9rem 'Outfit', sans-serif;
  cursor: pointer;
  transition: filter .16s ease;
}
.fi-random:hover { filter: brightness(1.08); }
.facts-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border, #cdd1f0);
}
.facts-flag { font-size: 2.6rem; line-height: 1; }
.facts-name { font: 800 1.4rem/1.1 'Orbitron', 'Outfit', sans-serif; margin: 0; color: var(--text, #14152e); }
.facts-sub { color: var(--muted, #5a5f7a); font-size: .85rem; margin-top: 4px; }
.facts-list { margin: 0; }
.facts-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border, #e3e6f5);
}
.facts-row dt { color: var(--muted, #5a5f7a); font-size: .85rem; font-weight: 600; flex-shrink: 0; }
.facts-row dd { margin: 0; text-align: right; color: var(--text, #14152e); font-size: .9rem; font-weight: 500; }
.facts-row dd a { color: var(--atlas-accent); text-decoration: none; font-weight: 700; }
.facts-row dd a:hover { text-decoration: underline; }
.pop-arrow { font-size: .78em; }
.facts-cta-group { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.facts-cta {
  display: flex;
  align-items: center;
  text-align: left;
  background: var(--atlas-accent);
  color: #fff;
  text-decoration: none;
  padding: 12px;
  border-radius: 10px;
  font: 700 .9rem 'Outfit', sans-serif;
  transition: filter .16s ease;
}
.facts-cta:hover { filter: brightness(1.08); }
.wiki-mark { width: 16px; height: 16px; margin-left: 8px; flex-shrink: 0; }
/* On wide but short screens, share one row so both fit above the fold. */
@media (min-width: 821px) and (max-height: 880px) {
  .facts-cta-group { flex-direction: row; }
  .facts-cta-group .facts-cta { flex: 1; min-width: 0; }
}

/* hover tooltip */
.atlas-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: rgba(20, 21, 46, .94);
  color: #fff;
  padding: 8px 11px;
  border-radius: 9px;
  font-family: 'Outfit', sans-serif;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 240px;
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .32);
}
.tt-flag { font-size: 1.15rem; line-height: 1; }
.tt-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tt-name { font-weight: 700; font-size: .85rem; }
.tt-sub { font-weight: 500; font-size: .74rem; opacity: .8; font-variant-numeric: tabular-nums; }

/* embed trim */
body.embed-page .site-header,
body.embed-page .page-footer { display: none; }
body.embed-page main { padding-top: 16px; }
