/* Layout: single centered column — hero countdown, milestone cards, full-width map. */
:root {
  --bg: #f4f3ee;          /* cool paper */
  --surface: #ffffff;
  --surface-2: #eceae2;
  --ink: #20242b;          /* blue-black */
  --ink-soft: #5c6370;
  --line: #d9d6cc;
  --rojo: #bf2b1f;         /* Spanish red — primary accent */
  --amarillo: #e3a008;     /* saffron — "next up" highlight only */
  --ok: #2e7d4f;
  --chip-flight: #28506e;
  --chip-food: #8a4b12;
  --chip-task: #6d2f82;
  --shadow: 0 1px 2px rgb(32 36 43 / .08), 0 8px 24px rgb(32 36 43 / .06);
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181d;
    --surface: #1d2127;
    --surface-2: #242933;
    --ink: #e9e7e0;
    --ink-soft: #9aa1ad;
    --line: #333a45;
    --rojo: #e05243;
    --amarillo: #e8b03a;
    --ok: #57b380;
    --chip-flight: #7aaacc;
    --chip-food: #d49558;
    --chip-task: #bf86d1;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15181d;
  --surface: #1d2127;
  --surface-2: #242933;
  --ink: #e9e7e0;
  --ink-soft: #9aa1ad;
  --line: #333a45;
  --rojo: #e05243;
  --amarillo: #e8b03a;
  --ok: #57b380;
  --chip-flight: #7aaacc;
  --chip-food: #d49558;
  --chip-task: #bf86d1;
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px rgb(0 0 0 / .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px);
  padding-inline: clamp(16px, 4vw, 40px);
}
main { max-width: 1060px; margin: 0 auto; display: grid; gap: clamp(28px, 5vw, 56px); padding-block: 8px 48px; }

/* ---------- Top bar ---------- */
.topbar {
  max-width: 1060px; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; padding-block: 18px 10px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px;
  background: var(--rojo); color: #fff; border-radius: 50%;
  font-size: 20px; transform: rotate(-20deg);
}
.brand h1 {
  margin: 0; font-family: var(--font-display);
  font-weight: 800; font-stretch: 115%; font-size: 24px; letter-spacing: .01em; line-height: 1.1;
}
.brand-sub { margin: 0; color: var(--ink-soft); font-size: 13px; }

.controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.unit-switch, .map-views {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px; gap: 2px;
}
.unit-switch button, .map-views button {
  appearance: none; border: 0; background: transparent; color: var(--ink-soft);
  font: 600 13px/1 var(--font-body); letter-spacing: .02em;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.unit-switch button[aria-pressed="true"], .map-views button[aria-pressed="true"] {
  background: var(--ink); color: var(--bg);
}
.unit-switch button:focus-visible, .map-views button:focus-visible,
.theme-toggle:focus-visible, .card:focus-visible {
  outline: 2px solid var(--rojo); outline-offset: 2px;
}
.theme-toggle {
  appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  width: 38px; height: 38px; border-radius: 50%; font-size: 17px; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: clamp(24px, 5vw, 44px);
  text-align: center;
  background-image: linear-gradient(to bottom, transparent 0, transparent calc(100% - 6px), var(--rojo) calc(100% - 6px));
}
.eyebrow {
  margin: 0 0 6px; color: var(--ink-soft);
  font: 600 12px/1.4 var(--font-body); text-transform: uppercase; letter-spacing: .14em;
}
.hero-count { display: flex; align-items: baseline; justify-content: center; gap: 12px; flex-wrap: wrap; }
.hero-value {
  font-family: var(--font-mono); font-weight: 600;
  font-size: clamp(56px, 12vw, 120px); line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.hero-unit { font: 500 clamp(18px, 3vw, 26px)/1 var(--font-body); color: var(--rojo); }
.hero-breakdown {
  margin: 14px 0 4px; font-family: var(--font-mono); font-size: 15px;
  font-variant-numeric: tabular-nums; color: var(--ink-soft);
}
.hero-when { margin: 0; font-size: 14px; color: var(--ink-soft); }

/* ---------- Milestone cards ---------- */
.section-title {
  margin: 0 0 16px; font-family: var(--font-display);
  font-weight: 800; font-stretch: 115%; font-size: 20px; text-wrap: balance;
}
.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 18px 18px 16px;
  display: grid; gap: 10px; align-content: start; min-width: 0;
  cursor: pointer; transition: border-color .15s ease;
}
.card:hover { border-color: var(--ink-soft); }
.card.is-next { border-color: var(--amarillo); box-shadow: 0 0 0 1px var(--amarillo), var(--shadow); }
.card.is-past { opacity: .65; }

.card-top { display: flex; align-items: center; gap: 10px; }
.card-n {
  display: grid; place-items: center; width: 26px; height: 26px; flex: none;
  border-radius: 50%; background: var(--rojo); color: #fff;
  font: 600 13px/1 var(--font-mono);
}
.card-emoji { font-size: 20px; line-height: 1; }
.chip {
  font: 600 11px/1 var(--font-body); text-transform: uppercase; letter-spacing: .1em;
  padding: 5px 9px; border-radius: 999px; border: 1px solid currentColor;
}
.chip-flight { color: var(--chip-flight); }
.chip-food   { color: var(--chip-food); }
.chip-task   { color: var(--chip-task); }
.badge-next {
  margin-left: auto; font: 700 11px/1 var(--font-body); letter-spacing: .1em;
  color: #442c00; background: var(--amarillo); padding: 5px 9px; border-radius: 999px;
}
:root[data-theme="dark"] .badge-next { color: #2a1d00; }

.card h3 { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.card-place, .card-when { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.card-when strong { color: var(--ink); font-weight: 600; }

.card-count {
  border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 2px;
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.card-value {
  font-family: var(--font-mono); font-weight: 600; font-size: 26px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.card-unit { font-size: 13px; color: var(--ink-soft); }
.card-sub {
  width: 100%; margin: 2px 0 0; font-family: var(--font-mono); font-size: 12.5px;
  font-variant-numeric: tabular-nums; color: var(--ink-soft);
}
.card.is-past .card-value { color: var(--ok); font-size: 20px; }
.card.is-booked { border-color: var(--ok); }
.card.is-booked .card-value { color: var(--ok); font-size: 20px; }
.book-toggle {
  appearance: none; justify-self: start; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
  color: var(--ink); font: 600 12.5px/1 var(--font-body); padding: 8px 14px;
}
.book-toggle:hover { border-color: var(--ok); color: var(--ok); }
.book-toggle:focus-visible { outline: 2px solid var(--rojo); outline-offset: 2px; }
.card-weather { margin: 0; font-size: 13.5px; color: var(--ink-soft); }

/* ---------- Map ---------- */
.map-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 20px; flex-wrap: wrap; margin-bottom: 14px;
}
.map-head .section-title { margin: 0; }
#map {
  height: clamp(340px, 55vh, 520px); border-radius: 16px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  background: var(--surface-2);
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
}
.pin {
  display: grid; place-items: center; width: 30px; height: 30px;
  background: var(--rojo); color: #fff; border: 2px solid #fff; border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg); box-shadow: 0 2px 6px rgb(0 0 0 / .35);
  font: 700 13px/1 var(--font-mono);
}
.pin span { transform: rotate(45deg); }
.pin-air { background: var(--chip-flight); border-radius: 50%; transform: none; }
.pin-air span { transform: none; }
.leaflet-popup-content { font: 400 13px/1.45 var(--font-body); }
.leaflet-popup-content strong { font-weight: 700; }

/* ---------- Footer ---------- */
.notes { color: var(--ink-soft); font-size: 13.5px; border-top: 1px solid var(--line); padding-top: 18px; }
.notes p { margin: 0 0 8px; max-width: 72ch; }
.mono { font-family: var(--font-mono); }

@media (max-width: 480px) {
  .unit-switch button, .map-views button { padding: 8px 10px; font-size: 12px; }
  .hero-breakdown { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
