:root {
  --maroon: #8b1a1a;
  --maroon-dark: #6b0f0f;
  --maroon-light: #c0392b;
  --gold: #c8953a;
  --gold-light: #f5d98b;
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f4f1ec;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --border: #e5e0d8;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,.07);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

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

/* ── Header ── */
header {
  background: var(--maroon-dark);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 24px rgba(0,0,0,.3);
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
  min-height: 64px;
}

.brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 14px 24px 14px 0;
  border-right: 1px solid rgba(255,255,255,.12);
  gap: 3px;
}
.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
  line-height: 1;
  color: #fff;
}
.brand-title span {
  color: var(--gold-light);
}
.brand-sub {
  font-size: .7rem;
  opacity: .55;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.header-nav {
  margin-left: auto;
  display: flex;
  gap: 2px;
  align-items: center;
  flex-wrap: wrap;
}

.year-tab {
  padding: 8px 18px;
  border-radius: 0;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: rgba(255,255,255,.6);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .3px;
  transition: color .15s, border-color .15s;
  height: 100%;
  align-self: stretch;
  display: flex;
  align-items: center;
}
.year-tab:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}
.year-tab.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
  background: rgba(255,255,255,.05);
}

.nav-divider { width: 1px; height: 24px; background: rgba(255,255,255,.15); margin: 0 4px; }

/* ── Summary strip ── */
.summary-strip {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.summary-inner {
  max-width: 1140px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; gap: 24px; flex-wrap: wrap; align-items: center;
}
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-num   { font-size: 1.4rem; font-weight: 700; color: var(--maroon); line-height: 1; }
.stat-label { font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.stat-div   { width: 1px; height: 34px; background: var(--border); }
.next-box {
  margin-left: auto;
  background: var(--surface);
  border: 1.5px solid var(--gold);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: .82rem;
  min-width: 200px;
}
.next-box strong { color: var(--maroon); display: block; font-size: .88rem; }
.next-box span   { color: var(--text-muted); }

/* ── Main container ── */
.page-wrap { max-width: 1140px; margin: 0 auto; padding: 32px 24px 80px; }

/* ── Legend ── */
.legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  margin-bottom: 28px;
}
.legend-item { display: flex; align-items: center; gap: 7px; font-size: .78rem; color: var(--text-muted); }
.legend-dot  { width: 11px; height: 11px; border-radius: 3px; }

/* ── Month grid ── */
.months-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}

.month-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.month-header {
  background: var(--maroon);
  color: #fff;
  padding: 11px 18px;
  display: flex; justify-content: space-between; align-items: center;
}
.month-header h2 { font-size: .95rem; font-weight: 600; }
.month-count {
  background: rgba(255,255,255,.22);
  border-radius: 12px; padding: 2px 10px;
  font-size: .72rem;
}

.no-holidays { padding: 16px 18px; color: var(--text-muted); font-size: .82rem; font-style: italic; }

/* ── Holiday row ── */
.holiday-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  color: inherit;
  display: flex;
}
.holiday-row:last-child { border-bottom: none; }
.holiday-row:hover { background: var(--surface-2); }
.holiday-row:hover .holiday-name { color: var(--maroon); }
.holiday-row:hover .arrow-hint { opacity: 1; }

.holiday-row.is-today { background: #e8f5ee; }
.holiday-row.is-today::before {
  content: ''; position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px; background: #1a6b3c;
  border-radius: 0 2px 2px 0;
}

.date-badge { min-width: 46px; text-align: center; flex-shrink: 0; }
.date-day     { font-size: 1.35rem; font-weight: 700; line-height: 1; color: var(--maroon); }
.date-weekday { font-size: .67rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }

.holiday-info { flex: 1; min-width: 0; }
.holiday-name { font-size: .88rem; font-weight: 600; line-height: 1.3; transition: color .12s; }
.holiday-sinhala { font-size: .75rem; color: var(--text-muted); margin-top: 1px; display: block; }

.tag {
  display: inline-block; margin-top: 5px;
  padding: 2px 8px; border-radius: 10px;
  font-size: .67rem; font-weight: 600; letter-spacing: .2px;
}

.today-chip {
  background: #1a6b3c; color: #fff;
  font-size: .65rem; padding: 1px 6px;
  border-radius: 8px; font-weight: 700;
  margin-left: 5px; vertical-align: middle;
}

.arrow-hint {
  opacity: 0; transition: opacity .12s;
  color: var(--text-muted); font-size: .8rem;
  align-self: center; flex-shrink: 0;
}

/* ── Holiday detail page ── */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: rgba(255,255,255,.85); font-size: .85rem;
  transition: color .15s; cursor: pointer;
  background: none; border: none; padding: 0;
}
.back-btn:hover { color: #fff; }

.detail-hero {
  background: linear-gradient(135deg, var(--maroon) 0%, var(--maroon-dark) 100%);
  color: #fff; padding: 40px 24px 48px;
}
.detail-hero-inner { max-width: 860px; margin: 0 auto; }
.detail-date-badge {
  background: rgba(255,255,255,.15);
  border-radius: 8px; display: inline-flex;
  align-items: center; gap: 10px;
  padding: 8px 16px; margin-bottom: 20px;
  font-size: .85rem;
}
.detail-day-num { font-size: 2rem; font-weight: 800; line-height: 1; }
.detail-title   { font-size: 2rem; font-weight: 800; line-height: 1.2; margin-bottom: 8px; }
.detail-sinhala { font-size: 1.1rem; opacity: .8; margin-bottom: 16px; }
.detail-tag     { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px; border-radius: 20px; font-size: .8rem; font-weight: 600; }
.detail-desc    { margin-top: 20px; font-size: 1rem; line-height: 1.7; opacity: .9; max-width: 680px; }

.detail-body { max-width: 860px; margin: 0 auto; padding: 40px 24px 80px; }

.section-h { font-size: 1.1rem; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.section-h::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* Activities */
.activities-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 40px; }
.activity-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.activity-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.activity-icon { font-size: 2rem; margin-bottom: 10px; line-height: 1; }
.activity-title { font-size: .9rem; font-weight: 700; margin-bottom: 5px; }
.activity-desc  { font-size: .8rem; color: var(--text-muted); line-height: 1.55; }

/* Open/Closed */
.open-closed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 40px; }
.oc-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: center; gap: 10px; font-size: .82rem;
}
.oc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.oc-dot.open    { background: #2ecc71; }
.oc-dot.closed  { background: #e74c3c; }
.oc-dot.varies  { background: #f39c12; }
.oc-name { font-weight: 600; }
.oc-status { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

/* Places */
.places-list { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 40px; }
.place-chip {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px;
  font-size: .82rem; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}

/* Tip box */
.tip-box {
  background: #fffbeb; border: 1.5px solid var(--gold);
  border-radius: 12px; padding: 16px 20px;
  font-size: .88rem; line-height: 1.6;
  display: flex; gap: 12px; align-items: flex-start;
  margin-bottom: 40px;
}
.tip-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }

/* Other holidays sidebar */
.other-holidays { display: flex; flex-direction: column; gap: 8px; }
.other-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; transition: background .12s;
  text-decoration: none; color: inherit;
}
.other-row:hover { background: var(--surface-2); }
.other-date { font-size: .78rem; color: var(--text-muted); min-width: 60px; }
.other-name { font-size: .85rem; font-weight: 600; flex: 1; }

/* ── Footer ── */
footer {
  text-align: center; padding: 24px;
  font-size: .75rem; color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 640px) {
  /* Header */
  .header-inner {
    padding: 0 16px;
    min-height: 56px;
    gap: 0;
  }
  .brand {
    padding: 10px 0;
    border-right: none;
    flex: 1;
    min-width: 0;
  }
  .brand-title { font-size: 1rem; }
  .brand-sub   { display: none; }  /* hide subtitle on mobile — too cramped */
  .header-nav  { gap: 0; }
  .year-tab    { padding: 6px 12px; font-size: .78rem; }

  /* Summary strip — 2×2 grid with next holiday below */
  .summary-inner {
    padding: 12px 16px;
    gap: 0;
    display: grid;
    grid-template-columns: 1fr 1px 1fr 1px 1fr;
    grid-template-rows: auto auto;
    row-gap: 12px;
    align-items: center;
  }
  /* Hide the 4th stat (months) and its divider on very small screens —
     replace with just showing 3 stats in one row */
  .stat-div   { height: 28px; }
  .stat-num   { font-size: 1.2rem; }
  .stat-label { font-size: .6rem; letter-spacing: .3px; }

  /* Hide months stat on mobile — only 3 stats fit */
  .stat--hide-sm, .stat-div--hide-sm { display: none; }
  /* Without the 4th stat, use 3-column grid */
  .summary-inner { grid-template-columns: 1fr 1px 1fr 1px 1fr; }

  /* Next holiday box — full width on second row */
  .next-box {
    grid-column: 1 / -1;
    margin-left: 0;
    width: 100%;
    font-size: .8rem;
  }

  /* Legend */
  .legend { gap: 10px; margin-bottom: 20px; }
  .legend-item { font-size: .74rem; }
  .legend-item:last-child { display: none; } /* hide "click for details" hint */

  /* Month grid */
  .page-wrap   { padding: 16px 12px 60px; }
  .months-grid { grid-template-columns: 1fr; gap: 14px; }

  /* Holiday rows */
  .holiday-row { padding: 10px 14px; gap: 10px; }
  .date-day    { font-size: 1.2rem; }
  .holiday-name { font-size: .84rem; }

  /* Detail page */
  .detail-title    { font-size: 1.4rem; }
  .activities-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .activity-card   { padding: 14px; }
  .open-closed-grid { grid-template-columns: 1fr 1fr; }
  .holiday-nav     { flex-direction: column; gap: 8px; }
  .nav-btn         { max-width: 100%; width: 100%; }
  .nav-btn.next    { flex-direction: row; text-align: left; }
}

@media (max-width: 400px) {
  .year-tab        { padding: 6px 9px; font-size: .74rem; }
  .activities-grid { grid-template-columns: 1fr; }
  .open-closed-grid { grid-template-columns: 1fr; }
  .summary-inner   {
    grid-template-columns: 1fr 1px 1fr 1px 1fr;
  }
  /* Hide the 4th stat + its divider on very small screens */
  .stat--hide-sm, .stat-div--hide-sm { display: none; }
}
