/* ── Tokens ───────────────────────────────────────────────── */
:root {
  --cream:       #f4efe4;
  --paper:       #faf6ec;
  --ink:         #1f2a3d;
  --ink-soft:    #3a4863;
  --muted:       #8a93a6;
  --faint:       #b8bdc9;
  --rule:        #e3ddcd;
  --rule-soft:   #ece6d6;
  --accent:      #3d5a9c;
  --accent-soft: #e6ecf6;
  --today:       #c2552e;
  --today-soft:  #f6e6dc;
  --today-edge:  #eed4c0;

  --serif: 'Newsreader', Georgia, serif;
  --sans:  'Inter Tight', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, p { margin: 0; }

/* ── Page shell ───────────────────────────────────────────── */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 64px 72px 48px;
}

/* ── Header ───────────────────────────────────────────────── */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 56px;
}
.page-head h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 40px;
  letter-spacing: -0.01em;
  line-height: 1;
  color: var(--ink);
}
.tagline {
  margin-top: 12px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.meta {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-align: right;
  line-height: 1.7;
  white-space: nowrap;
}
.meta-counts { color: var(--faint); }

/* ── Body grid ────────────────────────────────────────────── */
.body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 56px;
  align-items: start;
}
.clusters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 56px;
  row-gap: 36px;
}
.empty {
  grid-column: 1 / -1;
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  padding: 48px 0;
}

/* ── Cluster ──────────────────────────────────────────────── */
.cluster { padding-bottom: 12px; }
.cluster-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.cluster-name {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.cluster-time {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--mono);
  color: var(--ink);
  flex-shrink: 0;
}
.cluster-time .t {
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
}
.cluster-time .meta {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.04em;
  font-family: var(--mono);
  text-align: left;
}
.cluster-time .dot {
  color: var(--faint);
  margin: 0 2px;
}

/* "Next [HOL], date" line under the cluster name (header) */
.cluster-holiday {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.next-line {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.5;
}
.next-line .lbl   { color: var(--muted); }
.next-line .codes { font-family: var(--mono); font-size: 13px; margin-right: 6px; letter-spacing: 0.04em; }
.next-line .name  { color: var(--ink-soft); }
.next-line .when  { color: var(--faint); }
.next-line .sep   { color: var(--faint); margin: 0 8px; }

/* Today-pill — moved below the city rows so the celebrated holiday
   reads as a footer to the cluster, not as a banner over it. */
.cluster-today {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.today-pill {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  background: var(--today-soft);
  color: var(--today);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.today-pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--today);
  display: inline-block;
}

/* ── City row ─────────────────────────────────────────────── */
.city-row {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 12px 0;
}
.city-row + .city-row { border-top: 1px dashed var(--rule-soft); }
.city-icon { color: var(--ink-soft); opacity: 0.85; line-height: 0; }
.city-icon svg { width: 44px; height: 44px; }
.city-name {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--ink);
}
.city-temp {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}
.city-temp .slash { color: var(--faint); }
.city-temp .c     { color: var(--muted); }
.city-temp.stale  { color: var(--muted); }
.city-wx {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--muted);
  font-style: italic;
  min-width: 100px;
}
.city-wx .glyph { color: var(--faint); line-height: 0; }
.city-wx .glyph svg { width: 22px; height: 22px; }

/* ── Sidebar (desktop) ────────────────────────────────────── */
.sidebar { display: block; }
.sidebar-card {
  background: var(--paper);
  border-radius: 6px;
  border: 1px solid var(--rule);
  padding: 22px 24px 24px;
}
.sidebar-h {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 4px;
}
.sidebar-tag {
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 18px;
}
.week-group + .week-group { margin-top: 18px; }
.week-label {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.holiday-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  padding: 8px 0;
  align-items: baseline;
}
.holiday-row + .holiday-row { border-top: 1px solid var(--rule-soft); }
.holiday-when {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.holiday-name {
  font-size: 15px;
  color: var(--ink);
  line-height: 1.3;
}
.holiday-chips {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* ── Country chip ─────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
.chip-swatch {
  width: 16px;
  height: 10px;
  border-radius: 1.5px;
  opacity: 0.7;
  display: inline-block;
  flex-shrink: 0;
}

/* ── Mobile sidebar (accordion) — hidden on desktop ───────── */
.sidebar-mobile { display: none; }

/* ── Mobile today-strip — superseded by per-cluster .cluster-today ─ */
.today-strip { display: none !important; }

/* ── Footer ───────────────────────────────────────────────── */
.page-foot {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}
.footer-fetched { color: var(--ink-soft); font-family: var(--mono); }
.footer-brand   { font-style: italic; }

/* ── Mobile (≤ 720px) ─────────────────────────────────────── */
@media (max-width: 720px) {
  .page {
    padding: 40px 24px 32px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 24px;
  }
  .page-head h1 { font-size: 32px; }
  .tagline { font-size: 15px; }
  .meta { text-align: left; font-size: 12px; }

  .body {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .clusters {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
  }

  /* Hide the desktop sidebar, show the <details> accordion below clusters */
  .sidebar { display: none; }
  .sidebar-mobile {
    display: block;
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: 6px;
    padding: 16px 18px;
  }
  .sidebar-mobile > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--accent);
  }
  .sidebar-mobile > summary::-webkit-details-marker { display: none; }
  .sidebar-mobile-count {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--muted);
    letter-spacing: 0;
    font-weight: 400;
  }
  .sidebar-mobile #sidebarMobileList { margin-top: 14px; }
  .sidebar-mobile .holiday-row { grid-template-columns: 56px 1fr; padding: 10px 0; }
  .sidebar-mobile .holiday-row + .holiday-row { border-top: 1px solid var(--rule-soft); }

  .page-foot {
    margin-top: 32px;
    padding-top: 14px;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
  }
}
