/* atlas.css — page /atlas (carte mondiale, public)
   Pas d'index.css importé : on definit nos propres bases pour éviter les
   overflow:hidden hérités du cockpit qui cassent le scroll. */

html, body {
  margin: 0;
  padding: 0;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}

body.atlas-page,
body.atlas-country-page {
  background: #0a0a0a;
  color: #e8e6e0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Lien retour discret en haut a gauche (utilisé sur /atlas/{slug}) */
.atlas-back {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 5;
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  color: #b8b3a8;
  text-decoration: none;
  background: rgba(10, 10, 10, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  border: 1px solid #1f1d1a;
  letter-spacing: 0.02em;
  transition: color 0.15s, border-color 0.15s;
}
.atlas-back:hover {
  color: #c9a961;
  border-color: #c9a961;
}

/* ─── Hero ──────────────────────────────────────────────────────────────── */

.atlas-hero {
  padding: 4rem 5vw 2rem;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
}

.atlas-title {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  color: #f3f1ea;
  margin: 0 0 1rem;
  line-height: 1.05;
}

.atlas-subtitle {
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  color: #b8b3a8;
  line-height: 1.5;
  max-width: 600px;
  margin: 0 auto;
}

/* ─── Carte 2D D3 ──────────────────────────────────────────────────────── */

.atlas-map-section {
  padding: 1.5rem 3vw 0;
  margin: 0 auto;
  position: relative;
}

.atlas-map {
  width: 100%;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  min-height: 540px;
  cursor: grab;
}
.atlas-map:active {
  cursor: grabbing;
}
.atlas-map svg {
  display: block;
}
/* Indication zoom subtile en haut a droite de la carte */
.atlas-map::after {
  content: 'Molette pour zoomer · Drag pour deplacer';
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: #555049;
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 2;
}

.atlas-map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #777067;
  font-size: 0.95rem;
}

/* Pays sur la carte */
.atlas-country {
  fill: #18171a;
  stroke: #0a0a0a;
  stroke-width: 0.4;
  transition: fill 0.12s ease;
  cursor: default;
}

.atlas-country.covered {
  fill: #c9a961;
  cursor: pointer;
}

.atlas-country.covered:hover {
  fill: #e0c479;
}

/* Tooltip */
.atlas-map-tooltip {
  position: absolute;
  background: rgba(20, 18, 16, 0.96);
  border: 1px solid #c9a961;
  border-radius: 5px;
  padding: 0.7rem 0.95rem;
  font-size: 0.85rem;
  color: #f3f1ea;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  min-width: 200px;
  max-width: 280px;
  font-family: 'DM Sans', sans-serif;
}

.atlas-map-tooltip .t-flag {
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.atlas-map-tooltip .t-flag strong {
  color: #f3f1ea;
  font-weight: 500;
  margin-left: 0.25rem;
}

.atlas-map-tooltip .t-stats {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: #b8b3a8;
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.atlas-map-tooltip .t-sep {
  color: #555049;
}

.atlas-map-tooltip .t-fhs-wrap {
  margin-top: 0.4rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: #c9a961;
}

/* Légende sous la carte */
.atlas-map-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.75rem;
  color: #777067;
  letter-spacing: 0.04em;
  padding: 0.85rem 0.25rem 0;
}

.atlas-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.15rem;
  vertical-align: middle;
}

.atlas-legend-dot.covered { background: #c9a961; }
.atlas-legend-dot.uncovered { background: #18171a; border: 1px solid #2a2823; }

.atlas-legend-sep {
  color: #3a3733;
  margin: 0 0.25rem;
}

/* Titre de la liste sous la carte */
.atlas-list-title {
  font-family: 'Instrument Serif', serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: #b8b3a8;
  letter-spacing: -0.005em;
  max-width: 1400px;
  margin: 2.5rem auto 0;
  padding: 0 4vw;
}

/* ─── Grille pays ───────────────────────────────────────────────────────── */

.atlas-countries {
  padding: 1.25rem 4vw 5rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.atlas-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #777067;
  padding: 4rem 0;
  font-size: 0.95rem;
}

.atlas-card {
  background: #131211;
  border: 1px solid #1f1d1a;
  border-radius: 6px;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 180px;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.atlas-card:hover {
  border-color: #c9a961;
  transform: translateY(-2px);
  background: #181715;
}

.atlas-card-flag {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 0.75rem;
  filter: saturate(1.1);
}

.atlas-card-name {
  font-family: 'Instrument Serif', serif;
  font-size: 1.5rem;
  color: #f3f1ea;
  margin: 0 0 0.25rem;
  letter-spacing: -0.01em;
}

.atlas-card-rank {
  font-size: 0.78rem;
  color: #777067;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.atlas-card-stats {
  margin-top: auto;
  display: flex;
  gap: 1.5rem;
  border-top: 1px solid #1f1d1a;
  padding-top: 0.85rem;
}

.atlas-card-stat {
  display: flex;
  flex-direction: column;
}

.atlas-card-stat-num {
  font-family: 'DM Mono', monospace;
  font-size: 1.05rem;
  color: #c9a961;
  font-weight: 500;
}

.atlas-card-stat-label {
  font-size: 0.7rem;
  color: #777067;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

.atlas-card-fhs {
  font-size: 0.78rem;
  color: #8a8378;
  margin-top: 0.5rem;
  font-family: 'DM Mono', monospace;
}

.atlas-card-fhs strong {
  color: #c9a961;
  font-weight: 500;
}

/* ─── Footer ────────────────────────────────────────────────────────────── */

.atlas-footer {
  border-top: 1px solid #1a1a1a;
  padding: 2rem 5vw;
  text-align: center;
  color: #777067;
  font-size: 0.82rem;
  line-height: 1.7;
}

.atlas-footer a {
  color: #c9a961;
  text-decoration: none;
}

.atlas-footer a:hover {
  text-decoration: underline;
}

.atlas-footer-meta {
  margin-top: 0.5rem;
  font-family: 'DM Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  opacity: 0.6;
}

/* ─── Mobile ────────────────────────────────────────────────────────────── */

@media (max-width: 700px) {
  .atlas-header {
    padding: 1rem 4vw;
  }
  .atlas-hero {
    padding: 2.5rem 5vw 1.5rem;
  }
  /* Carte cachée sur mobile : trop petite pour cliquer sur HK/SG/CH précisément.
     L'utilisateur tombe directement sur la grille de cards. */
  .atlas-map-section {
    display: none;
  }
  .atlas-list-title {
    margin-top: 0.5rem;
    padding-top: 0;
    font-size: 1.3rem;
    color: #777067;
  }
  .atlas-countries {
    padding: 1rem 4vw 4rem;
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .atlas-card {
    min-height: 0;
  }
}
