/* Shared bilingual layout. Loaded after the earlier page-specific styles. */
:root {
  --atlas-header-offset: 132px;
  --atlas-reading-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}
html { scroll-padding-top: var(--atlas-header-offset); }
.timeline-filters, .content-layout > aside, .case-toc, .disclaimer-toc {
  top: var(--atlas-header-offset);
}
@media (min-width: 1101px) {
  .biblio-filter-panel { top: var(--atlas-header-offset); }
}
main [id], .prose > section, .timeline-period, .organization-record,
.disclaimer-prose section, .news-page .news-method, #layer-catalogue {
  scroll-margin-top: var(--atlas-header-offset);
}
html[lang="en"] body { font-family: var(--atlas-reading-font); line-height: 1.75; }
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3,
html[lang="en"] .brand-name { letter-spacing: 0; font-feature-settings: normal; }
.header-inner, .brand, .brand > span:last-child, .site-header nav,
.case-card, .news-card, .metric-card, .force-metric { min-width: 0; }
/* The brand and navigation use separate grid rows at every desktop width.
   The navigation can wrap within its own row without entering the brand row. */
.site-header .header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand language" "navigation navigation";
  align-items: center;
  min-height: 0;
  gap: 8px 24px;
  padding-block: 16px 0;
}
.site-header .brand {
  grid-area: brand;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  margin: 0;
}
.site-header .brand-mark { flex: 0 0 auto; }
.site-header .brand > span:last-child { min-width: 0; }
.brand-name { display: block; overflow-wrap: anywhere; }
html[lang="en"] .brand-name { max-width: 26ch; font-size: 20px; line-height: 1.3; }
html[lang="en"] .site-header .brand-name { max-width: none; }
.site-header .menu-button { display: none; }
.site-header #main-nav {
  grid-area: navigation;
  display: flex;
  align-items: stretch;
  align-self: stretch;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0 clamp(16px, 2vw, 28px);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 6px 0 0;
  border-top: 1px solid var(--line);
  overflow: visible;
}
.site-header #main-nav > a {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  padding: 10px 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.site-header #main-nav .nav-link.active::after { bottom: 0; }
.site-header #main-nav .nav-disclaimer { border-left: 0; }
.header-language, .site-language-switch, .language-switch, [data-site-language-switch] {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  flex: 0 0 auto; max-width: 100%;
}
.site-header .site-language-switch {
  grid-area: language;
  justify-self: end;
  align-self: center;
  flex-wrap: nowrap;
  min-width: 0;
  margin: 0;
}
.header-language a, .site-language-switch a, .language-switch a,
[data-site-language-switch] a, [data-site-language-switch] button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 7px 10px; white-space: nowrap; font-size: 14px;
}
.button, .chip, .badge { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.button { text-align: center; }
.case-card h3, .news-card h3, .metric-label, .force-metric h4,
.layer-name, .map-popup, .source-title { overflow-wrap: anywhere; }
.case-card, .news-card { height: 100%; }
.table-wrap { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }
.data-table th, .data-table td { overflow-wrap: anywhere; }

/* Keep the geographic plate unobstructed. The news lives in its own section. */
.home-atlas .map-wrap { display: block; }
.map-surface-host { position: relative; min-width: 0; }
.map-overlay-legend {
  position: absolute; z-index: 600; right: 14px; bottom: 46px;
  width: min(300px, calc(100% - 68px)); max-width: 300px;
  max-height: 250px; overflow-y: auto; padding: 10px 13px;
  background: #fffefaF5; border: 1px solid #a8b5b1;
  box-shadow: 0 3px 16px #142d3a0d; font-size: 14px;
}
.map-overlay-legend:not([open]) { width: auto; max-height: none; }
.map-overlay-legend summary { min-height: 32px; line-height: 1.5; cursor: pointer; }
.map-overlay-legend .map-legend { position: static; padding: 0; margin: 0; border: 0; box-shadow: none; }
.map-overlay-legend .country-legend { gap: 8px 13px; margin: 10px 0; }
.map-overlay-legend .country-key { white-space: normal; }
.legend-active-layers { margin-top: 12px; padding-top: 10px; border-top: 1px solid #c7d3cb; }
.legend-active-layers h3 { margin: 0 0 5px; font: 600 14px/1.5 var(--sans); }
.legend-active-layers ul { margin: 0; padding-left: 19px; font-size: 13px; }
.legend-active-layers li { margin: 6px 0; line-height: 1.6; overflow-wrap: anywhere; }
.legend-active-layers a { display: inline-block; padding-block: 3px; }
.map-reading-links { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 12px; }
.map-reading-links .text-link { margin: 0; padding-block: 7px; }
.leaflet-control-attribution { max-width: 100%; overflow-wrap: anywhere; line-height: 1.5; }
.map-tooltip { max-width: min(300px, 80vw); white-space: normal; line-height: 1.55; }
.map-cluster-shell { background: transparent; border: 0; }
.map-cluster-count {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fffefa;
  background: #274f5b; box-shadow: 0 0 0 2px #274f5b70;
  color: #fff; font: 700 15px/1 var(--sans); font-variant-numeric: tabular-nums;
}
.map-cluster-shell:focus-visible { outline: 3px solid #b67b35; outline-offset: 4px; border-radius: 50%; }
.country-label { font-size: 12px; line-height: 1.4; }
.sea-label { font-size: 12px !important; letter-spacing: .04em; }

/* Five-year panels avoid tiny year labels and horizontal scrolling. */
.heatmap-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
.heatmap-panel { min-width: 0; padding: 17px 14px; border: 1px solid var(--line); background: #fffefa; }
.heatmap-panel h3 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 15px; margin: 0 0 15px; font-size: 20px; }
.heatmap-panel h3 span { font-size: 13px; font-weight: 400; color: var(--muted); }
.case-heatmap {
  display: grid; grid-template-columns: minmax(105px, 1.6fr) repeat(var(--heat-cols), minmax(0, 1fr));
  width: 100%; min-width: 0; gap: 4px;
}
.heat-corner, .heat-row-label { position: static; padding: 6px 5px 6px 0; background: transparent; font-size: 13px; }
.heat-row-label { min-width: 0; overflow-wrap: anywhere; line-height: 1.4; }
.heat-year { min-width: 0; font-size: 13px; font-weight: 400; }
.heat-year.is-latest { font-weight: 700; color: var(--teal-dark); }
.heat-cell { min-width: 0; min-height: 34px; padding: 2px; font-size: 13px; }
.heatmap-history { margin: 28px 0; padding: 22px; background: #f0eee5; border: 1px solid #c8c4af; }
.heatmap-history h3 { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 10px; font-size: 21px; }
.heatmap-history h3 span { font-size: 16px; font-variant-numeric: tabular-nums; }
.heat-history-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; }
.heat-history-value { display: flex; align-items: center; gap: 12px; justify-content: space-between; min-height: 44px; padding: 8px 10px; background: #fffefa; color: var(--ink); font-size: 14px; text-decoration: none; }
.heat-history-value span { min-width: 0; overflow-wrap: anywhere; }
.heat-history-value strong { flex: 0 0 auto; }
.heat-history-value:hover { background: #e8ede6; }

/* Values are indivisible; source qualifications have their own line. */
.force-bar-row { grid-template-columns: 100px minmax(24px, 1fr) max-content; gap: 12px; }
.force-bar-value { max-width: 220px; }
.force-quantity { display: inline-flex; align-items: baseline; gap: .25em; white-space: nowrap; }
.force-unit { font-size: 14px; font-weight: 400; }
.force-value-note { display: block; margin-top: 3px; font: 400 12px/1.5 var(--sans); white-space: normal; color: var(--muted); }
.force-metric p.force-number { font-size: clamp(26px, 3vw, 40px); }
.force-metric p.force-number.is-unconfirmed, .force-bar-value.is-unconfirmed {
  font: 400 16px/1.7 var(--sans); color: var(--muted);
}
.force-quantity .force-unit { font: 400 14px/1.5 var(--sans); }
.force-bar-figure figcaption { overflow-wrap: anywhere; }

@media (max-width: 1000px) {
  .heatmap-panels { grid-template-columns: 1fr; }
  .heat-history-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  :root { --atlas-header-offset: 142px; }
  .site-header .header-inner {
    grid-template-areas: "brand menu" "language language" "navigation navigation";
    gap: 6px 12px;
    padding-block: 12px;
  }
  .site-header .menu-button {
    grid-area: menu;
    display: inline-flex;
    align-self: center;
    justify-self: end;
    margin: 0;
  }
  .site-header .site-language-switch { justify-self: end; margin: 0; }
  html[lang="en"] .site-header .brand-name { max-width: 25ch; font-size: 18px; }
  .site-header #main-nav { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
  .site-header #main-nav.open, .site-header #main-nav.is-open,
  .site-header #main-nav[aria-expanded="true"] { display: grid; }
  .site-header #main-nav > a { min-height: 48px; }
  .force-bar-row { grid-template-columns: 90px minmax(24px, 1fr) max-content; }
}
@media (max-width: 768px) {
  .map-overlay-legend, .map-overlay-legend:not([open]) {
    position: static; width: 100%; max-width: none; max-height: none; overflow: visible;
    margin: 0; padding: 13px 16px; box-shadow: none; border: 0; border-top: 1px solid #a8b5b1;
    font-size: 14px;
  }
  .map-overlay-legend summary { min-height: 36px; }
  .map-overlay-legend .map-legend { position: static; }
  .map-overlay-legend .line-legend, .map-overlay-legend .country-key,
  .map-overlay-legend .map-shape-legend { font-size: 13px; }
}
@media (max-width: 560px) {
  :root { --atlas-header-offset: 164px; }
  html[lang="en"] .site-header .brand-name { font-size: 17px; max-width: 27ch; }
  .brand-sub { white-space: normal; }
  .heatmap-panel { padding: 15px 9px; }
  .case-heatmap { grid-template-columns: minmax(88px, 1.9fr) repeat(var(--heat-cols), minmax(0, 1fr)); gap: 3px; }
  .heat-corner, .heat-row-label { font-size: 12px; }
  .heat-year { font-size: 12px; }
  .heatmap-history { padding: 17px 13px; }
  .heat-history-values { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .heat-history-value { padding: 8px; font-size: 12px; }
  .force-bar-row { grid-template-columns: 70px minmax(24px, 1fr) max-content; gap: 8px; }
  .force-bar-value { max-width: 170px; }
  .force-bar-row .country-tag { white-space: normal; font-size: 12px; }
  .force-bar-row > strong { font-size: 15px; }
  .force-metric p.force-number { font-size: 27px; }
}
@media print {
  .map-overlay-legend { position: static; width: 100%; max-width: none; max-height: none; overflow: visible; }
  .map-overlay-legend > :not(summary) { display: block; }
  .heatmap-panel { break-inside: avoid; }
}
.translation-pending { display:block; font:500 14px/1.6 var(--atlas-reading-font); color:#704b18; padding:6px 10px; margin:8px 0; background:#faf1de; border-left:3px solid #b78d46; }
.page-localization-meta { font-size:14px; color:var(--muted); margin-block:28px; }
.source-language-tag { font:400 14px/1.5 var(--atlas-reading-font); white-space:normal; }
.site-language-switch a[aria-current] { font-weight:700; text-decoration-thickness:2px; }
.country-label, .sea-label { text-shadow:0 0 3px #fffefa, 0 0 3px #fffefa, 1px 1px 2px #fffefa; }

/* The phase-two record diagram uses readable HTML at phone widths. */
.phase2-plan .phase2-mobile-flow { display: none; }
@media (max-width: 620px) {
  .phase2-plan .concept-figure .phase2-desktop-flow { display: none; }
  .phase2-plan .phase2-mobile-flow {
    display: block; padding: 18px; border: 1px solid var(--line);
    background: #edf1e9; color: var(--ink); font: 400 14px/1.7 var(--sans);
  }
  .phase2-plan .phase2-mobile-organizations {
    display: grid; gap: 8px; margin: 0; padding: 0; list-style: none;
  }
  .phase2-plan .phase2-mobile-organizations li {
    min-width: 0; padding: 13px 16px; background: var(--phase2-node-color);
    color: #fffefa; font-size: 16px; line-height: 1.6; text-align: center;
    overflow-wrap: anywhere;
  }
  .phase2-plan .phase2-mobile-arrow {
    display: block; margin: 8px 0; color: #697d6d; font: 400 26px/1.2 var(--sans);
    text-align: center;
  }
  .phase2-plan .phase2-mobile-node {
    min-width: 0; padding: 16px; border: 1px solid #9aaea3;
    background: #e1e9df; overflow-wrap: anywhere;
  }
  .phase2-plan .phase2-mobile-sources { background: #f7f6f1; }
  .phase2-plan .phase2-mobile-node strong {
    display: block; margin-bottom: 9px; font-size: 16px; line-height: 1.6;
  }
  .phase2-plan .phase2-mobile-node p {
    margin: 0; font-size: 14px; line-height: 1.7;
  }
  .phase2-plan .phase2-mobile-node p + p { margin-top: 6px; }
}
