:root {
  --ink: #17211b;
  --muted: #5e6c63;
  --line: #dce5df;
  --paper: #ffffff;
  --soft: #f3f7f4;
  --brand: #147a50;
  --brand-dark: #0c5537;
  --accent: #e9b44c;
  --radius: 18px;
  --shadow: 0 14px 40px rgba(20, 55, 38, 0.08);
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}
a { color: var(--brand-dark); text-underline-offset: 0.2em; }
a:hover { color: var(--brand); }
.wrap { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.site-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid rgba(220, 229, 223, 0.8); background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(12px); }
.header-inner { min-height: 70px; display: flex; align-items: center; gap: 28px; }
.brand { color: var(--ink); font-size: 1.35rem; font-weight: 800; letter-spacing: -0.04em; text-decoration: none; }
.brand span { color: var(--brand); }
.primary-nav { display: flex; align-items: center; gap: 24px; margin-left: auto; }
.primary-nav a { color: var(--muted); font-weight: 650; text-decoration: none; }
.primary-nav a:hover { color: var(--brand); }
.language-picker select { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: white; padding: 0 34px 0 12px; color: var(--ink); }
.header-selectors { display: flex; align-items: center; gap: 10px; }
.year-picker select { min-width: 96px; min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: white; padding: 0 34px 0 12px; color: var(--ink); }
.nav-toggle { display: none; margin-left: auto; border: 1px solid var(--line); border-radius: 9px; background: white; padding: 8px 12px; }

.hero { padding-block: 104px 76px; background: radial-gradient(circle at 80% 10%, #e4f3e9 0, transparent 38%); }
.hero h1, .page-hero h1 { max-width: 820px; margin: 0; font-size: clamp(2.4rem, 7vw, 5.5rem); line-height: 1.02; letter-spacing: -0.055em; }
.page-hero { padding-block: 68px 42px; }
.page-hero h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.hero-copy, .page-hero > p:last-child { max-width: 720px; color: var(--muted); font-size: 1.16rem; }
.eyebrow { margin: 0 0 12px; color: var(--brand); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.section { padding-block: 54px; }
.section-tint { background: var(--soft); }
.section h2 { margin-top: 0; letter-spacing: -0.025em; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card { min-height: 190px; display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); text-decoration: none; transition: transform 160ms ease, border-color 160ms ease; }
.card:hover { transform: translateY(-3px); border-color: #a9cdb8; }
.card .card-code { color: var(--brand); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.12em; }
.card h3 { margin: 18px 0 6px; color: var(--ink); font-size: 1.35rem; }
.card p { margin: 0; color: var(--muted); }
.card .card-link { margin-top: auto; padding-top: 18px; color: var(--brand-dark); font-weight: 750; }

.flag-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  object-fit: cover;
  flex-shrink: 0;
}

.flag-icon-lg {
  width: 40px;
  height: 40px;
}
.year-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.year-link { display: inline-flex; min-width: 110px; justify-content: center; padding: 16px 22px; border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 1.15rem; font-weight: 800; text-decoration: none; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; color: var(--muted); font-size: 0.9rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span + span::before, .breadcrumb a + span::before, .breadcrumb a + a::before { content: "/"; margin-right: 8px; color: #a3aea7; }
.notice { margin-bottom: 26px; padding: 15px 18px; border-left: 4px solid var(--accent); border-radius: 8px; background: #fff8e8; color: #6a5120; }
.holiday-list { display: grid; gap: 12px; }
.holiday-row { display: grid; grid-template-columns: minmax(150px, 0.32fr) 1fr; gap: 24px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; }
.holiday-row time { color: var(--brand-dark); font-weight: 800; }
.holiday-row h2 { margin: 0; font-size: 1.12rem; }
.holiday-row p { margin: 4px 0 0; color: var(--muted); }
.year-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 34px; }
.year-nav a { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.source-box { padding-block: 8px; }

.site-footer { margin-top: 50px; border-top: 1px solid var(--line); color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; padding-block: 36px; }
.footer-inner p { margin: 0; }
.footer-inner a + a { margin-left: 18px; }

@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; gap: 12px; padding-block: 14px; }
  .nav-toggle { display: inline-flex; }
  .primary-nav { order: 4; display: none; width: 100%; margin: 0; padding-block: 10px; border-top: 1px solid var(--line); }
  .primary-nav.is-open { display: flex; }
  .language-picker { margin-left: 0; }
  .header-selectors { margin-left: auto; }
  .hero { padding-block: 72px 52px; }
  .card-grid { grid-template-columns: 1fr; }
  .holiday-row { grid-template-columns: 1fr; gap: 8px; }
  .footer-inner { flex-direction: column; }
}

/* Country-year pages retain the denser calendar presentation from the original HoliWiki. */
#main-content > .hero:not(.wrap),
#main-content > .answer-box,
#main-content > .stats,
#main-content > .panel {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

#main-content > .hero:not(.wrap) { padding-block: 68px 42px; }
#main-content > .hero:not(.wrap) h1 {
  max-width: 880px;
  margin: 0 0 1rem;
  font-size: clamp(2.25rem, 6vw, 4.8rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.answer-box,
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.answer-box {
  margin-bottom: 2rem;
  border-left: 5px solid var(--accent);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.answer-box strong { display: block; margin-bottom: 0.35rem; font-size: 1.1rem; }
.answer-box p { margin: 0; }
.panel { margin-bottom: 2rem; padding: clamp(1.25rem, 3vw, 2rem); }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}
.stat {
  min-width: 0;
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 18px;
}
.stat:nth-child(2) { border-left-color: #355c9a; }
.stat:nth-child(3) { border-left-color: var(--accent); }
.stat b { display: block; overflow-wrap: anywhere; font-size: 28px; line-height: 1.15; }
.stat p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.stat-value { display: flex; align-items: center; gap: 12px; }
.stat-year b { font-size: 36px; }
.calendar-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand);
  font-size: 22px;
}
.country-value small { color: var(--muted); font-size: 0.75rem; }
.stat-next b span, .stat-next b small { display: block; }
.stat-next b span { font-size: 1rem; }
.stat-next b small { margin-top: 0.3rem; font-size: 0.92rem; }

.calendar-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.calendar-intro p { margin: 0; color: var(--muted); }
.calendar-legend { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 0.75rem; font-size: 0.86rem; }
.calendar-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.calendar-legend i { font-style: normal; }
.legend-star { color: var(--brand); }
.legend-workday { color: var(--accent); }
.calendar-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.15rem; }
.calendar-month {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(24, 52, 40, 0.06);
  overflow: visible;
}
.month-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0.9rem;
}
.month-heading h3 { margin: 0; font-size: 1rem; }
.month-heading span { color: var(--muted); font-size: 0.75rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0.55rem; }
.weekday-name { padding: 0.25rem 0; color: var(--muted); font-size: 0.68rem; font-weight: 800; text-align: center; }
.day-cell { position: relative; min-height: 48px; border: 1px solid #edf1ee; background: #fff; padding: 0.22rem; }
.day-cell.blank { border-color: transparent; background: transparent; }
.day-cell.has-holiday { background: #eef8f2; }
.day-cell.has-workday { background: #fff8e8; }
.day-cell.has-holiday.has-workday { background: linear-gradient(135deg, #eef8f2 50%, #fff8e8 50%); }
.day-number { display: block; color: #35423b; font-size: 0.72rem; font-variant-numeric: tabular-nums; line-height: 1; }
.day-events { display: flex; align-items: center; flex-wrap: wrap; gap: 0.12rem; margin-top: 0.35rem; }
.calendar-event {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: help;
  font-size: 0.68rem;
  outline: none;
}
.calendar-event.workday { background: var(--accent); }
.calendar-event:hover, .calendar-event:focus-visible { box-shadow: 0 0 0 3px rgba(20, 122, 80, 0.2); }
.event-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: 220px;
  transform: translateX(-50%);
  border-radius: 10px;
  background: #17221d;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  color: #fff;
  padding: 0.7rem 0.8rem;
  text-align: left;
}
.event-popover strong, .event-popover small { display: block; }
.event-popover small { color: #d7e1dc; }
.calendar-event:hover .event-popover, .calendar-event:focus .event-popover { display: block; }

.holiday-table-section { margin-top: 2.25rem; }
.table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: rgba(255, 255, 255, 0.96);
  padding: 1rem;
}
.table-heading h3 { margin: 0; font-size: 1.2rem; }
.table-heading p { margin: 0.2rem 0 0; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 0 0 12px 12px; }
.table-wrap table { width: 100%; border-collapse: collapse; background: #fff; }
.table-wrap th, .table-wrap td { border-bottom: 1px solid var(--line); padding: 0.85rem 1rem; text-align: left; vertical-align: top; }
.table-wrap th { background: var(--soft); color: var(--muted); font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.local-name { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.82rem; }
.type-badge { display: inline-block; border-radius: 999px; background: var(--soft); color: var(--brand-dark); padding: 0.25rem 0.6rem; font-size: 0.78rem; font-weight: 750; white-space: nowrap; }
.source-box { border-left: 4px solid var(--brand); background: var(--soft); box-shadow: none; }
.source-box p:last-child { margin-bottom: 0; }
.faq details { border-top: 1px solid var(--line); padding: 1rem 0; }
.faq details:last-child { padding-bottom: 0; }
.faq summary { cursor: pointer; font-weight: 760; }
.faq details p { margin: 0.7rem 0 0; color: var(--muted); }

.holiday-stories {
  width: min(1120px, calc(100% - 40px));
  margin: 3rem auto 2rem;
}
.holiday-stories h2 { margin-bottom: 1.5rem; text-align: center; }
.stories-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.story-card { display: flex; gap: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.story-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #f8e8d4;
  color: #9b2c20;
  font-family: ui-serif, Georgia, serif;
  padding: 0.25rem;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}
.story-body h3 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.story-body p { margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.7; }

@media (max-width: 940px) {
  .calendar-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .calendar-board, .stats { grid-template-columns: 1fr; }
  .stories-grid { grid-template-columns: 1fr; }
  .story-card { align-items: flex-start; flex-direction: column; }
  .calendar-intro { align-items: flex-start; flex-direction: column; }
  .day-cell { min-height: 44px; }
  .event-popover { left: 0; transform: none; }
}
