:root {
  color-scheme: light;
  --bg: #f3f7f6;
  --surface: #ffffff;
  --surface-2: #e9f1ef;
  --ink: #142320;
  --muted: #60706b;
  --line: #d7e2df;
  --brand: #0f766e;
  --brand-2: #155e75;
  --green: #43b66a;
  --yellow: #f4c542;
  --orange: #ee8c2d;
  --red: #d94a45;
  --blue: #2f80c3;
  --shadow: 0 22px 70px rgba(22, 49, 57, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark {
  color-scheme: dark;
  --bg: #101716;
  --surface: #16201f;
  --surface-2: #1e2b29;
  --ink: #edf5f2;
  --muted: #a7bab4;
  --line: #2e4440;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(15, 118, 110, 0.1), transparent 32rem),
    linear-gradient(180deg, var(--bg), var(--surface-2));
  color: var(--ink);
  min-width: 320px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 4vw, 3rem);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand,
.main-nav,
.hero-actions,
.map-toolbar,
.status-band,
.timeline,
.footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.75rem;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-weight: 850;
}

.brand small,
.eyebrow,
.status-band small,
.source-note {
  color: var(--muted);
}

.brand span:last-child {
  display: grid;
  line-height: 1.1;
}

.main-nav {
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.main-nav a {
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.94rem;
}

.main-nav a:hover {
  color: var(--ink);
  background: var(--surface);
}

.icon-button,
.ghost-button,
.time-button,
.filter-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.icon-button {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 8px;
}

.hero {
  position: relative;
  min-height: min(760px, calc(100vh - 4.2rem));
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(20rem, 0.98fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(2rem, 7vw, 5.5rem) clamp(1rem, 5vw, 5rem) 3rem;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 7rem;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 45rem;
}

.eyebrow {
  margin: 0 0 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.76rem;
  font-weight: 800;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 6.2vw, 6.4rem);
  line-height: 0.96;
  letter-spacing: 0;
  max-width: 11ch;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 38rem;
  color: var(--muted);
  font-size: clamp(1.02rem, 1.7vw, 1.28rem);
  line-height: 1.6;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.7rem;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  font-weight: 800;
}

.primary-action {
  background: var(--ink);
  color: var(--surface);
}

.secondary-action {
  border: 1px solid var(--line);
  background: var(--surface);
}

.hero-map {
  position: relative;
  min-height: 27rem;
  filter: drop-shadow(0 28px 70px rgba(20, 35, 32, 0.2));
}

.hero-map svg {
  width: min(100%, 44rem);
  display: block;
  margin: auto;
}

.france-shape,
.map-base {
  fill: color-mix(in srgb, var(--surface) 82%, var(--brand));
  stroke: color-mix(in srgb, var(--brand) 50%, var(--line));
  stroke-width: 3;
}

.river-shape {
  fill: none;
  stroke: rgba(47, 128, 195, 0.5);
  stroke-width: 8;
  stroke-linecap: round;
}

.river-shape.alt {
  stroke-width: 5;
  opacity: 0.55;
}

.pulse {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: var(--orange);
  box-shadow: 0 0 0 0 rgba(238, 140, 45, 0.45);
  animation: pulse 2.6s infinite;
}

.p1 { left: 57%; top: 28%; }
.p2 { left: 37%; top: 54%; background: var(--yellow); animation-delay: .4s; }
.p3 { left: 66%; top: 66%; background: var(--red); animation-delay: .8s; }

@keyframes pulse {
  70% { box-shadow: 0 0 0 1.2rem transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.status-band {
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0 clamp(1rem, 5vw, 5rem) 2.5rem;
}

.status-band article {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.7rem;
  min-width: min(100%, 16rem);
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow: var(--shadow);
}

.status-dot {
  grid-row: span 2;
  width: 0.8rem;
  height: 0.8rem;
  margin-top: 0.35rem;
  border-radius: 999px;
}

.workspace {
  display: grid;
  grid-template-columns: 18rem minmax(0, 1fr) 21rem;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
}

.control-panel,
.detail-panel,
.map-panel,
.risk-grid > article,
.bulletin-feed article,
.watchlist,
.source-grid a {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-panel,
.detail-panel {
  align-self: start;
  position: sticky;
  top: 5rem;
  padding: 1rem;
}

.panel-heading h2,
.section-heading h2,
.map-toolbar h2,
.watchlist h3,
.advice h3 {
  margin: 0;
  line-height: 1.1;
}

.risk-filters {
  display: grid;
  gap: 0.55rem;
  margin: 1rem 0;
}

.filter-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.85rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  text-align: left;
}

.filter-chip.active {
  border-color: color-mix(in srgb, var(--chip-color) 70%, var(--line));
  background: color-mix(in srgb, var(--chip-color) 14%, var(--surface));
}

.chip-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.chip-icon {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 7px;
  background: color-mix(in srgb, var(--chip-color) 18%, var(--surface));
}

.chip-name {
  overflow-wrap: anywhere;
  font-weight: 750;
}

.chip-count {
  min-width: 2.1rem;
  text-align: center;
  color: var(--muted);
}

.search-box {
  display: grid;
  gap: 0.4rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.search-box input {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--surface-2);
  color: var(--ink);
}

.timeline {
  gap: 0.35rem;
  margin: 1rem 0;
}

.time-button {
  flex: 1;
  min-height: 2.5rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.time-button.active {
  background: var(--ink);
  color: var(--surface);
}

.legend {
  display: grid;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend i {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
}

.map-panel {
  min-width: 0;
  overflow: hidden;
}

.map-toolbar {
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.ghost-button {
  min-height: 2.6rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
}

.map-stage {
  min-height: 34rem;
  padding: clamp(1rem, 3vw, 2.5rem);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px),
    linear-gradient(0deg, color-mix(in srgb, var(--line) 55%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
}

.risk-map {
  width: 100%;
  max-height: 36rem;
  filter: url(#softShadow);
}

.zone {
  cursor: pointer;
}

.zone circle {
  fill: var(--zone-color);
  stroke: var(--surface);
  stroke-width: 4;
  transition: transform 0.18s ease, filter 0.18s ease;
  transform-origin: center;
}

.zone text {
  pointer-events: none;
  fill: #fff;
  font-weight: 850;
  font-size: 13px;
  text-anchor: middle;
  dominant-baseline: middle;
}

.zone:hover circle,
.zone.selected circle {
  transform: scale(1.16);
  filter: drop-shadow(0 10px 16px rgba(20, 35, 32, 0.28));
}

.zone.hidden {
  opacity: 0.12;
}

.selected-risks {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0;
}

.selected-risk {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.selected-risk strong {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.level-pill {
  padding: 0.22rem 0.48rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.75rem;
  white-space: nowrap;
}

.advice {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}

.advice p {
  color: var(--muted);
  line-height: 1.55;
}

.source-note {
  margin-top: 1rem;
  font-size: 0.85rem;
  line-height: 1.45;
}

.risk-grid-section,
.bulletins-section,
.sources-section {
  padding: 4rem clamp(1rem, 5vw, 5rem) 0;
}

.section-heading {
  max-width: 58rem;
  margin-bottom: 1.1rem;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.risk-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.risk-grid > article {
  padding: 1rem;
}

.risk-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.risk-card-icon {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 1.2rem;
}

.bar {
  height: 0.6rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar span {
  display: block;
  height: 100%;
  background: var(--risk-color);
}

.bulletin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1rem;
}

.bulletin-feed {
  display: grid;
  gap: 0.8rem;
}

.bulletin-feed article {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 1rem;
}

.bulletin-time {
  color: var(--muted);
  font-weight: 800;
}

.bulletin-feed p,
.watchlist p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.watchlist {
  padding: 1rem;
}

.watchlist ol {
  display: grid;
  gap: 0.7rem;
  margin: 1rem 0 0;
  padding-left: 1.3rem;
}

.watchlist li::marker {
  color: var(--brand);
  font-weight: 850;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.source-grid a {
  padding: 1rem;
  color: var(--brand-2);
  font-weight: 800;
}

.footer {
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem clamp(1rem, 5vw, 5rem);
  color: var(--muted);
}

.level-green { background: var(--green); }
.level-yellow { background: var(--yellow); }
.level-orange { background: var(--orange); }
.level-red { background: var(--red); }
.level-blue { background: var(--blue); }

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 17rem minmax(0, 1fr);
  }

  .detail-panel {
    grid-column: 1 / -1;
    position: static;
  }

  .risk-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .main-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero h1 {
    max-width: 12ch;
  }

  .hero-map {
    order: -1;
    min-height: 18rem;
  }

  .workspace,
  .bulletin-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .risk-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-stage {
    min-height: 25rem;
    padding: 0.5rem;
  }

  .source-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero {
    padding-top: 1.2rem;
  }

  .hero h1 {
    font-size: 2.55rem;
  }

  .status-band article,
  .risk-grid,
  .risk-filters {
    grid-template-columns: 1fr;
  }

  .bulletin-feed article {
    grid-template-columns: 1fr;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
