/* Europe 2026 trip tracker — mobile-first, light/dark theme aware.
   Chart + status colors follow the validated dataviz reference palette. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;        /* series slot 1 */
  --accent-soft: #86b6ef;   /* blue step 250 — budget track (ordinal-safe on light) */
  --accent-wash: rgba(42, 120, 214, 0.10);
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-text: #006300;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 8px 24px -12px rgba(11, 11, 11, 0.12);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-soft: #184f95;  /* blue step 600 — ordinal-safe on dark */
    --accent-wash: rgba(57, 135, 229, 0.12);
    --good-text: #0ca30c;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-soft: #184f95;
  --accent-wash: rgba(57, 135, 229, 0.12);
  --good-text: #0ca30c;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 10px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff; font-size: 20px;
}
.brand-title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(20px, 4.5vw, 28px);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-title em { font-style: italic; color: var(--accent); }
.brand-sub { margin: 0; font-size: 13px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.countdown-chip {
  background: var(--accent-wash);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  white-space: nowrap;
}
.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 18px;
  cursor: pointer;
}

/* ---------- Tabs (horizontal scroll on phones) ---------- */
.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 0;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-bottom: 1px solid var(--border);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}
.tabs a:hover { text-decoration: none; background: var(--accent-wash); }
.tabs a.active { background: var(--accent); color: #fff; }
.tab-icon { font-size: 14px; }

/* ---------- Layout primitives ---------- */
.view { padding-top: 20px; outline: none; }
.section-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  margin: 4px 0 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .sub { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid-tiles { grid-template-columns: repeat(2, 1fr); }
.grid-main { grid-template-columns: 1fr; }

/* iPad and up */
@media (min-width: 700px) {
  .grid-tiles { grid-template-columns: repeat(4, 1fr); }
}
/* Desktop / iPad landscape */
@media (min-width: 1024px) {
  .grid-main { grid-template-columns: 3fr 2fr; align-items: start; }
}

/* ---------- Stat tiles ---------- */
.tile { padding: 14px 16px; }
.tile .label { font-size: 13px; color: var(--ink-2); }
.tile .value { font-size: clamp(24px, 5vw, 32px); font-weight: 600; line-height: 1.15; margin-top: 2px; }
.tile .delta { font-size: 13px; margin-top: 2px; color: var(--muted); }
.tile .delta.good { color: var(--good-text); }
.tile .delta.bad { color: var(--critical); }

/* ---------- Meter ---------- */
.meter { height: 10px; border-radius: 999px; background: var(--accent-wash); overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* ---------- Chart ---------- */
.chart-wrap { overflow-x: auto; }
.chart-svg { display: block; width: 100%; height: auto; font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 10px; font-size: 13px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px 11px;
  font-size: 13px;
  max-width: 260px;
}
.tooltip.show { opacity: 1; }
.tooltip .t-title { font-weight: 600; margin-bottom: 2px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); }
.tooltip .t-row b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Timeline (itinerary) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--grid);
  border-radius: 2px;
}
.timeline li { position: relative; padding: 0 0 18px 30px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .dot {
  position: absolute; left: 0; top: 5px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline .when { font-size: 12.5px; color: var(--muted); }
.timeline .what { font-weight: 600; }
.timeline .where { font-size: 14px; color: var(--ink-2); }

/* ---------- Data tables → cards on phones ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--baseline);
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--grid);
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }

/* Phone: rows become stacked cards */
@media (max-width: 599px) {
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 6px 2px;
    background: var(--surface);
  }
  table.data td { border-bottom: none; padding: 5px 12px; }
  table.data td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
  }
  table.data .num { text-align: left; }
}

/* ---------- Status chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip::before { font-size: 11px; }
.chip.confirmed { color: var(--good-text); }
.chip.confirmed::before { content: "✓"; }
.chip.pending { color: var(--ink-2); }
.chip.pending::before { content: "…"; }
.chip.action { color: var(--critical); }
.chip.action::before { content: "!"; }
.chip.email { color: var(--accent); }
.chip.email::before { content: "✉"; }

/* ---------- City header cards ---------- */
.city-band {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.city-band h3 { font-family: "Fraunces", Georgia, serif; font-size: 19px; }
.city-band .nights { font-size: 13px; color: var(--muted); }

.footer { margin-top: 36px; padding: 16px 4px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* Larger touch targets & no hover-dependence on touch devices */
@media (pointer: coarse) {
  .tabs a { padding: 11px 16px; }
}
