:root {
  --forest: #123f35;
  --forest-2: #1f5a49;
  --cream: #f6f1e6;
  --paper: #fffdf8;
  --ink: #15211d;
  --muted: #65726d;
  --line: #d9ddd6;
  --red: #c5322f;
  --red-soft: #f8e9e6;
  --yellow: #e2ad18;
  --yellow-soft: #fff3c9;
  --orange: #d66a25;
  --green: #2f7a5e;
  --shadow: 0 16px 38px rgba(18, 63, 53, 0.09);
  --radius: 12px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--cream);
}

body {
  margin: 0;
  overflow-x: clip;
  color: var(--ink);
  background:
    linear-gradient(rgba(18, 63, 53, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 63, 53, 0.035) 1px, transparent 1px),
    var(--cream);
  background-size: 32px 32px;
  font-family: "Avenir Next", Avenir, "Gill Sans", sans-serif;
  line-height: 1.5;
}

a { color: var(--forest-2); }
a:hover { color: var(--red); }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 3000;
  padding: 9px 12px;
  color: white;
  background: var(--forest);
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.atiemppo-nav-wrap {
  position: sticky;
  top: 0;
  z-index: 1200;
  border-bottom: 1px solid rgba(18, 63, 53, 0.15);
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(12px);
}

.atiemppo-nav {
  display: flex;
  width: min(1180px, calc(100% - 40px));
  min-width: 0;
  min-height: 68px;
  margin-inline: auto;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.atiemppo-logo {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
}

.atiemppo-logo img {
  display: block;
  width: auto;
  height: 29px;
}

.atiemppo-links {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: stretch;
  align-self: stretch;
  gap: 24px;
}

.atiemppo-links a {
  display: inline-flex;
  align-items: center;
  border-bottom: 3px solid transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.atiemppo-links a:hover,
.atiemppo-links a:focus-visible {
  color: var(--forest-2);
  border-bottom-color: rgba(226, 173, 24, 0.45);
}

.atiemppo-links a.active {
  color: var(--forest);
  border-bottom-color: var(--yellow);
}

.site-header {
  color: white;
  background:
    radial-gradient(circle at 82% 20%, rgba(226, 173, 24, 0.18), transparent 30%),
    linear-gradient(125deg, #0b3028, var(--forest) 58%, #1b5847);
  border-bottom: 6px solid var(--yellow);
}

.header-grid,
main,
.load-status,
footer {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.header-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.55fr);
  gap: 40px;
  align-items: end;
  padding-block: 46px 38px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.site-header .eyebrow { color: #f0c94f; }

h1,
h2,
h3,
p { overflow-wrap: anywhere; }

h1 {
  max-width: 760px;
  margin: 0;
  font-family: Rockwell, "Roboto Slab", Georgia, serif;
  font-size: clamp(42px, 7vw, 82px);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.94;
}

.lede {
  max-width: 690px;
  margin: 18px 0 0;
  color: #dcebe5;
  font-size: 17px;
}

.cut-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.cut-card div { padding: 13px 15px; }
.cut-card div:nth-child(odd) { border-right: 1px solid rgba(255, 255, 255, 0.18); }
.cut-card div:nth-child(-n + 2) { border-bottom: 1px solid rgba(255, 255, 255, 0.18); }
.cut-card dt { color: #b7d0c6; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.cut-card dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; font-weight: 750; }

.load-status {
  margin-top: 18px;
  padding: 11px 14px;
  border: 1px solid #d1b13b;
  background: var(--yellow-soft);
  font-size: 13px;
}

.load-status.ready { border-color: #82aa98; background: #e8f1ed; }
.load-status.error { border-color: #d99a94; background: var(--red-soft); color: #79211f; }

main { padding-block: 18px 60px; }

.section {
  margin-top: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
}

.section-alert { border-top: 7px solid var(--red); }
.section-corridors { border-top: 7px solid var(--forest-2); }

.section-heading {
  display: flex;
  gap: 17px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.section-number {
  min-width: 42px;
  margin: 0;
  color: var(--yellow);
  font-family: Rockwell, Georgia, serif;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
}

h2 {
  margin: 0;
  color: var(--forest);
  font-family: Rockwell, "Roboto Slab", Georgia, serif;
  font-size: clamp(26px, 3vw, 38px);
  letter-spacing: -0.025em;
  line-height: 1.05;
}

h3 { margin: 0; color: var(--forest); line-height: 1.2; }

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed #acb7b1;
  color: var(--muted);
  background: #f7f7f2;
}

.alert-list { display: grid; gap: 10px; }

.alert-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border: 1px solid #e5b5b1;
  border-left: 6px solid var(--red);
  background: var(--red-soft);
}

.alert-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--red);
  font-weight: 900;
}

.alert-card p { margin: 5px 0 0; }
.alert-card small { display: block; margin-top: 8px; color: #6d4c49; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  background: #f8f7f1;
}

.kpi strong {
  display: block;
  color: var(--forest);
  font-family: Rockwell, Georgia, serif;
  font-size: 29px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.kpi span { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.kpi small { display: block; margin-top: 4px; color: var(--muted); }

.health-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.health-card,
.source-card {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.status-line { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.status-badge {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  color: #194735;
  background: #dcece4;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.status-badge.degraded,
.status-badge.sin_url { color: #7e4e00; background: var(--yellow-soft); }
.health-card p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.action-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: action;
}

.action-list li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  counter-increment: action;
}

.action-list li::before {
  content: counter(action, decimal-leading-zero);
  color: var(--orange);
  font-family: Rockwell, Georgia, serif;
  font-size: 22px;
  font-weight: 800;
}

.action-list li:first-child { border-top: 0; }
.action-list p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.priority {
  padding: 4px 7px;
  border: 1px solid currentColor;
  color: var(--red);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.corridor-intro {
  max-width: 780px;
  margin: -4px 0 20px 59px;
  color: var(--muted);
  font-size: 13px;
}

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

.corridor-card {
  position: relative;
  min-width: 0;
  padding: 17px;
  overflow: hidden;
  border: 1px solid #cbd3ce;
  background:
    linear-gradient(145deg, rgba(18, 63, 53, 0.035), transparent 45%),
    white;
}

.corridor-card::after {
  content: "";
  position: absolute;
  inset: auto -28px -34px auto;
  width: 92px;
  height: 92px;
  border: 18px solid rgba(197, 50, 47, 0.07);
  border-radius: 50%;
}

.corridor-card.watch::after { border-color: rgba(226, 173, 24, 0.12); }

.corridor-card-top,
.corridor-card-footer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.corridor-card-top { justify-content: space-between; }

.corridor-status,
.corridor-severity {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.corridor-status { color: var(--red); }
.corridor-card.watch .corridor-status { color: #806000; }
.corridor-severity { color: var(--muted); }

.corridor-route {
  display: grid;
  grid-template-columns: 12px 1fr 8px 1fr 12px;
  align-items: center;
  margin: 20px 0 13px;
}

.corridor-route span { height: 3px; background: var(--red); }
.corridor-card.watch .corridor-route span { background: var(--yellow); }
.corridor-route i,
.corridor-route b {
  display: block;
  aspect-ratio: 1;
  border: 3px solid var(--red);
  border-radius: 50%;
  background: white;
}
.corridor-card.watch .corridor-route i,
.corridor-card.watch .corridor-route b { border-color: var(--yellow); }
.corridor-route b { border-width: 2px; background: var(--forest); }

.corridor-tramo {
  margin: 0;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.corridor-card h3 { position: relative; z-index: 1; margin-top: 6px; font-size: 19px; }
.corridor-summary { position: relative; z-index: 1; min-height: 66px; margin: 10px 0 16px; font-size: 13px; }
.corridor-card-footer { padding-top: 11px; border-top: 1px solid var(--line); font-size: 10px; }
.corridor-card-footer span { color: var(--muted); }
.corridor-card-footer a { margin-left: auto; font-weight: 800; }

.corridor-explorer-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.corridor-explorer-controls label { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
select {
  min-width: 210px;
  padding: 9px 11px;
  border: 1px solid #9ba8a2;
  border-radius: 4px;
  color: var(--ink);
  background: white;
  font: inherit;
}

.corridor-analysis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.corridor-analysis article {
  padding: 13px;
  border: 1px solid var(--line);
  background: #f7f7f2;
}

.corridor-analysis strong {
  display: block;
  color: var(--forest);
  font-family: Rockwell, Georgia, serif;
  font-size: 25px;
  line-height: 1;
}

.corridor-analysis span { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }

.corridor-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0 24px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #f3f1e8;
}

.corridor-day { min-width: 0; text-align: center; }
.corridor-day > span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.corridor-day > div { display: flex; height: 66px; margin: 5px 0; align-items: end; justify-content: center; }
.corridor-day i { display: block; width: min(34px, 70%); min-height: 8px; background: #c6ccc8; }
.corridor-day.confirmed i { background: var(--red); }
.corridor-day.watch i { background: var(--yellow); }
.corridor-day strong { color: var(--forest); font-size: 12px; }
.corridor-day small { display: block; color: var(--muted); font-size: 9px; }

.corridor-history-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.corridor-history-list {
  margin: 10px 0 0 7px;
  padding: 0 0 0 22px;
  border-left: 2px solid #b7c3bd;
  list-style: none;
}

.corridor-history-list li { position: relative; padding: 0 0 18px; }
.corridor-history-list li:last-child { padding-bottom: 0; }
.corridor-history-list li::before {
  content: "";
  position: absolute;
  top: 4px;
  left: -29px;
  width: 11px;
  height: 11px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 1px var(--red);
}
.corridor-history-list li.watch::before { background: var(--yellow); box-shadow: 0 0 0 1px #a67e0b; }
.corridor-history-list time { color: var(--orange); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.corridor-history-list h3 { margin-top: 3px; font-size: 15px; }
.corridor-history-list p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.corridor-method { margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }

.event-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.event-grid-selected { grid-template-columns: 1fr; margin-top: 10px; }

.event-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-left: 6px solid var(--red);
  background: white;
}

.event-card.watch { border-left-color: var(--yellow); }
.event-top { display: flex; justify-content: space-between; gap: 10px; }
.event-kind { color: var(--red); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.event-card.watch .event-kind { color: #806000; }
.event-card h3 { margin-top: 8px; }
.event-tramo { margin: 3px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.event-summary { margin: 13px 0 0; }
.event-impact { margin: 8px 0 0; color: #3f4c47; font-size: 13px; }
.event-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.event-meta span { padding: 4px 6px; border: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.event-sources { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid #edf0eb; font-size: 11px; }

.timeline { margin: 0; padding: 0 0 0 18px; list-style: none; border-left: 2px solid #b7c3bd; }
.timeline li { position: relative; padding: 0 0 18px 24px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: -25px;
  width: 12px;
  height: 12px;
  border: 3px solid var(--paper);
  border-radius: 50%;
  background: var(--forest-2);
  box-shadow: 0 0 0 1px var(--forest-2);
}
.timeline time { color: var(--orange); font-size: 12px; font-weight: 850; }
.timeline p { margin: 3px 0 0; }

.trace-summary {
  margin-bottom: 12px;
  padding: 13px;
  border-left: 5px solid var(--yellow);
  background: #f7f3e6;
  font-size: 13px;
}

.source-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.source-card p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.source-card a { display: inline-block; margin-top: 7px; font-size: 12px; font-weight: 750; }

footer {
  padding-block: 0 40px;
  color: var(--muted);
  font-size: 12px;
}

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

@media (max-width: 900px) {
  .header-grid { grid-template-columns: 1fr; gap: 24px; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .corridor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .corridor-history-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .atiemppo-nav {
    width: min(100% - 28px, 1180px);
    min-height: auto;
    padding-block: 12px 8px;
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .atiemppo-logo img { height: 25px; }

  .atiemppo-links {
    width: 100%;
    flex: 0 1 auto;
    padding-bottom: 3px;
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .atiemppo-links a {
    min-height: 35px;
    white-space: nowrap;
  }

  .header-grid,
  main,
  .load-status,
  footer { width: min(100% - 24px, 1180px); }

  .header-grid { padding-block: 32px 28px; }
  .section { padding: 20px 16px; border-radius: 8px; }
  .section-heading { gap: 10px; }
  .section-number { min-width: 34px; font-size: 20px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .health-grid,
  .corridor-grid,
  .event-grid,
  .source-list { grid-template-columns: 1fr; }
  .action-list li { grid-template-columns: 38px minmax(0, 1fr); }
  .action-list .priority { grid-column: 2; justify-self: start; }
  .corridor-explorer-controls { align-items: stretch; flex-direction: column; }
  .corridor-analysis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .corridor-week { gap: 3px; padding-inline: 8px; }
  select { width: 100%; min-width: 0; }
  .corridor-intro { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .section { break-inside: avoid; box-shadow: none; }
  #map { min-height: 400px; }
}
