.climate-atlas-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 36px;
  display: grid;
  gap: 16px;
}

.climate-atlas-top {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 24px;
  padding: 8px 0 0;
}

.climate-atlas-top h1 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  letter-spacing: 0;
}

.climate-atlas-top-heading {
  display: flex;
  flex-direction: column;
}

.atlas-explainer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  min-height: 40px;
  border: 1px solid rgba(30, 111, 175, 0.32);
  border-radius: 8px;
  padding: 8px 14px;
  background: rgba(30, 111, 175, 0.08);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.atlas-explainer-link:hover {
  background: rgba(30, 111, 175, 0.14);
  border-color: rgba(30, 111, 175, 0.5);
}

.atlas-explainer-link:focus-visible {
  outline: 2px solid rgba(30, 111, 175, 0.45);
  outline-offset: 2px;
}

.atlas-layer-select-control {
  display: grid;
  gap: 6px;
  margin: 0;
}

.atlas-layer-select-control label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
}

.atlas-layer-select-control select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.atlas-layer-select-control select:focus-visible {
  outline: 2px solid rgba(30, 111, 175, 0.45);
  outline-offset: 2px;
}

.atlas-layer-select-control {
  min-width: 176px;
}

.climate-atlas-timeline {
  width: 320px;
  flex-shrink: 0;
  margin-left: auto;
  display: grid;
  gap: 6px;
  align-items: center;
}

.climate-atlas-timeline label {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 700;
}

.climate-atlas-timeline input[type="range"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  accent-color: var(--accent);
  touch-action: pan-y;
}

.climate-atlas-timeline input[type="range"]:focus-visible {
  outline: 2px solid rgba(30, 111, 175, 0.45);
  outline-offset: 2px;
}

.climate-atlas-timeline output {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.climate-atlas-period-state {
  min-height: 2.6em; /* réserve 2 lignes pour éviter le décalage du slider */
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.3;
}

.climate-atlas-timeline[data-state="loading"] .climate-atlas-period-state,
.climate-atlas-timeline[data-state="transition"] .climate-atlas-period-state {
  color: #1f2937;
}

.climate-atlas-timeline[data-state="error"] .climate-atlas-period-state {
  color: var(--error);
  font-weight: 700;
}

.climate-atlas-timeline[data-temporal="false"] {
  opacity: 0.72;
}

.climate-atlas-timeline[data-temporal="false"] input[type="range"] {
  accent-color: #9ca3af;
}

.climate-atlas-timeline[data-temporal="false"] .climate-atlas-period-state {
  color: #334155;
  font-weight: 700;
}

.climate-atlas-map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  min-height: 620px;
}

.climate-atlas-map-frame {
  min-width: 0;
  position: relative;
}

.climate-atlas-map {
  width: 100%;
  min-height: 620px;
  height: 620px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #eff4f7;
}

.climate-atlas-panel,
.climate-atlas-legend {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  overflow-y: auto;
}

.climate-atlas-legend-body {
  display: grid;
  gap: 12px;
}

.atlas-status {
  min-height: 20px;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.atlas-status[data-state="error"] {
  color: var(--error);
  font-weight: 700;
}

.atlas-debug-state {
  margin: -2px 0 2px;
  color: var(--text-secondary);
  font-size: 0.76rem;
  line-height: 1.3;
}

.atlas-legend-list {
  display: grid;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.atlas-legend-item {
  min-height: 0;
}

.atlas-legend-button {
  width: 100%;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 30px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.atlas-legend-button:hover {
  background: rgba(30, 111, 175, 0.08);
  border-color: rgba(30, 111, 175, 0.18);
}

.atlas-legend-button:focus-visible {
  outline: 2px solid rgba(30, 111, 175, 0.45);
  outline-offset: 1px;
}

.atlas-legend-button[data-selected="true"] {
  background: rgba(30, 111, 175, 0.14);
  box-shadow: inset 3px 0 0 var(--accent);
}

.atlas-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.atlas-legend-label {
  color: var(--text);
  font-weight: 700;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.atlas-legend-button[data-selected="true"] .atlas-legend-label {
  font-weight: 800;
}

.climate-zone-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbfd;
  /* Calibrated to limit jumps between short and medium descriptions at 100%-125% zoom. */
  min-height: 124px;
}

.climate-zone-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.climate-zone-card-swatch {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.22);
}

.climate-zone-card-title {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.climate-zone-card-description {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.climate-zone-card-reference {
  margin: 0 0 4px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.45;
}

.climate-zone-card-subtitle {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.climate-zone-card-metrics {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 2px;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.climate-atlas-explainer {
  width: 100%;
  margin: 8px 0 0;
  display: grid;
  gap: 12px;
}

#atlas-climatique-explications {
  scroll-margin-top: 72px;
}

.climate-atlas-explainer h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  line-height: 1.25;
}

.climate-atlas-explainer p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
}

@media (max-width: 860px) {
  .climate-atlas-shell {
    width: min(100% - 16px, 760px);
  }

  .climate-atlas-top {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .climate-atlas-timeline {
    width: 100%;
    flex-shrink: 1;
    margin-left: 0;
  }

  .atlas-layer-select-control {
    width: 100%;
    min-width: 0;
  }

  .atlas-layer-select-control select {
    width: 100%;
  }

  .atlas-explainer-link {
    width: 100%;
    justify-content: center;
  }

  .climate-atlas-map-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: 0;
  }

  .climate-atlas-map-frame,
  .climate-atlas-map {
    min-height: clamp(360px, 58vh, 620px);
    min-height: clamp(360px, 58dvh, 620px);
  }

  .climate-atlas-map {
    height: clamp(360px, 58vh, 620px);
    height: clamp(360px, 58dvh, 620px);
  }

  .climate-atlas-panel,
  .climate-atlas-legend {
    position: static;
    transform: none;
    max-height: none;
    overflow: visible;
    align-self: auto;
  }

  .atlas-legend-list {
    max-height: min(36vh, 280px);
    overflow-y: auto;
    padding-right: 4px;
  }

  .climate-zone-card {
    min-height: 0;
  }
}

@media (max-width: 480px) {
  .climate-atlas-map-layout {
    min-height: 0;
  }

  .climate-atlas-map,
  .climate-atlas-map-frame {
    min-height: clamp(340px, 56vh, 560px);
    min-height: clamp(340px, 56dvh, 560px);
  }

  .climate-atlas-map {
    height: clamp(340px, 56vh, 560px);
    height: clamp(340px, 56dvh, 560px);
  }
}
