/* Page-specific styles for /atlas. Layers on top of /assets/styles.css. */

:root {
  --v-green:        #2eaa4a;
  --v-green-soft:   color-mix(in srgb, #2eaa4a 16%, transparent);
  --v-yellow:       #d99619;
  --v-yellow-soft:  color-mix(in srgb, #d99619 16%, transparent);
  --v-red:          #c8404f;
  --v-red-soft:     color-mix(in srgb, #c8404f 14%, transparent);
  --v-tbd:          #94a3b8;     /* researched, no rating yet */
  --v-tbd-soft:     color-mix(in srgb, #94a3b8 14%, transparent);
  --v-untracked:    #cbd5e0;     /* not in STATE.yaml — visible against bg-sunken */
  --map-bg:         #eaf1f7;     /* map "ocean" — slightly cool */
}

@media (prefers-color-scheme: dark) {
  :root {
    --v-green:       #4dc46a;
    --v-yellow:      #f0b35a;
    --v-red:         #ef7a86;
    --v-tbd:         #6b7991;
    --v-untracked:   #3a4555;
    --map-bg:        #1a2230;
  }
}

/* ─── Hero (map-first) ─────────────────────────────────────────────── */

.atlas-hero-section { padding-top: 2.5rem; padding-bottom: 3rem; }

.atlas-hero-strip {
  max-width: 800px;
  margin: 0 0 1.5rem;
}
.atlas-hero-strip h1 {
  margin: 0.4rem 0 0.9rem;
  font-size: clamp(2.2rem, 2.6vw + 1.2rem, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.atlas-hero-strip .lede {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text);
  max-width: 60ch;
}

.atlas-meta-line {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.atlas-meta-line a {
  border-bottom: 1px dotted color-mix(in srgb, var(--text-muted) 50%, transparent);
}

/* ─── Legend (horizontal strip below map) ──────────────────────────── */

.atlas-legend {
  margin-top: 1rem;
  display: flex; flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  font-size: 0.85rem;
}
.atlas-legend-row {
  display: inline-flex; align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}
.atlas-legend-row strong { white-space: nowrap; }
.atlas-legend-desc { color: var(--text-muted); font-size: 0.8rem; }
.atlas-legend-swatch {
  display: inline-block; width: 12px; height: 12px;
  border-radius: 3px;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  flex-shrink: 0;
}
.atlas-legend-row[data-rating-family="green"]     .atlas-legend-swatch { background: var(--v-green);     }
.atlas-legend-row[data-rating-family="yellow"]    .atlas-legend-swatch { background: var(--v-yellow);    }
.atlas-legend-row[data-rating-family="red"]       .atlas-legend-swatch { background: var(--v-red);       }
.atlas-legend-row[data-rating-family="tbd"]       .atlas-legend-swatch { background: var(--v-tbd);       }
.atlas-legend-row[data-rating-family="untracked"] .atlas-legend-swatch { background: var(--v-untracked); }

/* ─── Map ──────────────────────────────────────────────────────────── */

.atlas-map {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--map-bg);
  min-height: 380px;
  overflow: hidden;
}
.atlas-map--hero { min-height: 560px; }
@media (max-width: 880px) {
  .atlas-map--hero { min-height: 380px; }
}
.atlas-map svg { width: 100%; height: auto; display: block; }
.atlas-map .country {
  stroke: var(--map-bg);
  stroke-width: 0.4px;
  cursor: pointer;
  transition: fill 0.18s ease, opacity 0.18s ease;
}
.atlas-map .country[data-rating-family="green"]     { fill: var(--v-green);  }
.atlas-map .country[data-rating-family="yellow"]    { fill: var(--v-yellow); }
.atlas-map .country[data-rating-family="red"]       { fill: var(--v-red);    }
.atlas-map .country[data-rating-family="tbd"]       { fill: var(--v-tbd);    }
.atlas-map .country[data-rating-family="untracked"] { fill: var(--v-untracked); }
.atlas-map .country:hover { opacity: 0.78; }

.atlas-map-loading {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--text-muted);
  transition: opacity 0.3s ease;
}
.atlas-map.is-rendered .atlas-map-loading { opacity: 0; pointer-events: none; }

.atlas-map-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.65rem;
  font-size: 0.85rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 10;
}
.atlas-map-tooltip.is-visible { opacity: 1; }

/* ─── Facet filters ────────────────────────────────────────────────── */

.atlas-filters {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.atlas-facet {
  display: flex; align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.atlas-facet h4 {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
}
.atlas-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.atlas-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  font: inherit; font-size: 0.82rem;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.atlas-chip-count {
  display: inline-block;
  min-width: 1.4rem;
  padding: 0 0.4rem;
  background: var(--bg-sunken);
  border-radius: 999px;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
}
.atlas-chip:hover { background: var(--bg-sunken); }
.atlas-chip.is-active {
  background: var(--cobalt);
  color: white;
  border-color: var(--cobalt);
}
.atlas-chip.is-active .atlas-chip-count {
  background: rgba(255, 255, 255, 0.22);
  color: white;
}
.atlas-chip[data-rating-family="green"].is-active  { background: var(--v-green);  border-color: var(--v-green);  }
.atlas-chip[data-rating-family="yellow"].is-active { background: var(--v-yellow); border-color: var(--v-yellow); color: #1a1a1a; }
.atlas-chip[data-rating-family="red"].is-active    { background: var(--v-red);    border-color: var(--v-red);    }
.atlas-chip[data-rating-family="tbd"].is-active    { background: var(--v-tbd);    border-color: var(--v-tbd);    }
.atlas-filters-clear {
  margin-left: auto;
  padding: 0.3rem 0.75rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font: inherit; font-size: 0.78rem;
  cursor: pointer;
}
.atlas-filters-clear:hover { color: var(--text); }

.atlas-cards-count {
  margin: 1rem 0 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ─── Card grid (compact rows) ─────────────────────────────────────── */

.atlas-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.55rem;
}
.atlas-cards-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
}
.atlas-card {
  display: flex; flex-direction: column;
  gap: 0.3rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.atlas-card:hover {
  border-color: color-mix(in srgb, var(--cobalt) 60%, var(--border));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.atlas-card[data-rating-family="green"]     { border-left: 3px solid var(--v-green);     }
.atlas-card[data-rating-family="yellow"]    { border-left: 3px solid var(--v-yellow);    }
.atlas-card[data-rating-family="red"]       { border-left: 3px solid var(--v-red);       }
.atlas-card[data-rating-family="tbd"]       { border-left: 3px solid var(--v-tbd);       }
.atlas-card[data-rating-family="untracked"] { border-left: 3px solid var(--v-untracked); }

.atlas-card-row1 {
  display: flex; align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
}
.atlas-card-rating-dot { font-size: 0.85rem; flex-shrink: 0; line-height: 1; }
.atlas-card-name {
  margin: 0;
  font-size: 0.98rem; line-height: 1.25;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1 1 auto; min-width: 0;
}
.atlas-card-iso {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-weight: normal;
  flex-shrink: 0;
}
.atlas-card-status {
  font-size: 0.85rem;
  flex-shrink: 0;
  line-height: 1;
}
.atlas-card-row2 {
  display: flex; align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
  font-size: 0.78rem;
}
.atlas-card-rights {
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1 1 auto; min-width: 0;
}
.atlas-card-deep {
  flex-shrink: 0;
  color: var(--cobalt);
  font-weight: 500;
  border-bottom: 1px solid transparent;
}
.atlas-card-deep:hover { border-bottom-color: currentColor; }


/* ─── Drawer ───────────────────────────────────────────────────────── */

.atlas-drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 90;
}
.atlas-drawer-scrim.is-open { opacity: 1; pointer-events: auto; }

.atlas-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(480px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 100;
  display: flex; flex-direction: column;
}
.atlas-drawer.is-open { transform: translateX(0); }
.atlas-drawer-inner {
  display: flex; flex-direction: column;
  height: 100%;
  padding: 1.5rem;
  overflow: auto;
}
.atlas-drawer-close {
  align-self: flex-end;
  background: transparent;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.atlas-drawer-close:hover { color: var(--text); }
.atlas-drawer-head[data-rating-family="green"]  { border-left: 4px solid var(--v-green);  padding-left: 0.9rem; }
.atlas-drawer-head[data-rating-family="yellow"] { border-left: 4px solid var(--v-yellow); padding-left: 0.9rem; }
.atlas-drawer-head[data-rating-family="red"]    { border-left: 4px solid var(--v-red);    padding-left: 0.9rem; }
.atlas-drawer-head[data-rating-family="tbd"]    { border-left: 4px solid var(--v-tbd);    padding-left: 0.9rem; }
.atlas-drawer-head h2 { margin: 0 0 0.4rem; font-size: 1.4rem; }
.atlas-drawer-iso {
  font-size: 0.85rem; color: var(--text-muted); font-weight: normal;
}
.atlas-drawer-rating { margin: 0.1rem 0 0.3rem; }
.atlas-drawer-basis {
  margin: 0;
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.5;
}
.atlas-drawer-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.atlas-drawer-section h3 {
  font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  margin: 0 0 0.5rem;
}
.atlas-drawer-sources { list-style: none; padding: 0; margin: 0; }
.atlas-drawer-source {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.atlas-drawer-source:last-child { border-bottom: none; }
.atlas-drawer-source-meta {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.atlas-drawer-meta p { margin: 0.2rem 0; font-size: 0.88rem; }
.atlas-drawer-foot {
  margin-top: 1.5rem;
  display: flex; gap: 0.6rem; flex-wrap: wrap;
}
.atlas-drawer-footnote {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.55;
}
