:root {
  color-scheme: light;
  --bg: #f4f7f3;
  --surface: #ffffff;
  --ink: #17221d;
  --muted: #59655f;
  --line: #d9e1dc;
  --brand: #176b4d;
  --brand-dark: #0f4c37;
  --accent: #d7a32f;
  --soft: #eaf4ee;
  --shadow: 0 18px 50px rgba(24, 52, 40, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(23, 107, 77, 0.1), transparent 30rem),
    linear-gradient(180deg, #f8faf7 0, var(--bg) 32rem);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Noto Sans JP", sans-serif;
  line-height: 1.65;
}

a { color: var(--brand-dark); text-underline-offset: 0.18em; }
a:hover { color: var(--brand); }
.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 100; background: #fff; padding: 0.7rem 1rem; }
.site-header, main, .site-footer { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.25rem;
}
.brand { color: var(--ink); font-size: 1.05rem; font-weight: 850; text-decoration: none; }
.header-navs { display: flex; align-items: center; justify-content: flex-end; gap: 0.85rem; flex-wrap: wrap; }
.nav-group { display: grid; gap: 0.35rem; }
.nav-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav-separator {
  align-self: stretch;
  width: 1px;
  background: var(--line);
  margin: 0 0.1rem;
}
.top-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.45rem; }
.top-nav a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.78rem;
  font-size: 0.88rem;
  text-decoration: none;
}
.top-nav a[aria-current="page"] { border-color: var(--brand); background: var(--brand); color: #fff; }
.language-nav a {
  background: rgba(255,255,255,.5);
  color: var(--muted);
}
.language-nav a[aria-current="page"] {
  background: var(--soft);
  border-color: rgba(23, 107, 77, 0.22);
  color: var(--brand-dark);
}
.flag {
  position: relative;
  display: inline-block;
  width: 1.35rem;
  height: 0.95rem;
  flex: 0 0 auto;
  border: 1px solid rgba(23, 34, 29, 0.18);
  border-radius: 0.15rem;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.flag-cn {
  background: #de2910;
}
.flag-cn::before {
  content: "";
  position: absolute;
  left: 0.14rem;
  top: 0.06rem;
  width: 0.34rem;
  height: 0.34rem;
  background: #ffde00;
  clip-path: polygon(50% 0%, 61% 36%, 98% 36%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 36%, 39% 36%);
}
.flag-us {
  background:
    linear-gradient(to bottom,
      #b22234 0 7.69%,
      #fff 7.69% 15.38%,
      #b22234 15.38% 23.07%,
      #fff 23.07% 30.76%,
      #b22234 30.76% 38.45%,
      #fff 38.45% 46.14%,
      #b22234 46.14% 53.83%,
      #fff 53.83% 61.52%,
      #b22234 61.52% 69.21%,
      #fff 69.21% 76.9%,
      #b22234 76.9% 84.59%,
      #fff 84.59% 92.28%,
      #b22234 92.28% 100%);
}
.flag-us::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 0.58rem;
  height: 0.53rem;
  background: #3c3b6e;
}
.flag-jp {
  background: #fff;
}
.flag-jp::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #bc002d;
  transform: translate(-50%, -50%);
}
.top-nav a[aria-current="page"] .flag {
  border-color: rgba(255,255,255,.45);
}
.hero { padding: clamp(3rem, 8vw, 6.5rem) 0 2.5rem; }
.eyebrow { color: var(--brand); font-size: 0.8rem; font-weight: 850; letter-spacing: 0.08em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 880px; margin-bottom: 1rem; font-size: clamp(2.25rem, 6vw, 4.8rem); line-height: 1.05; letter-spacing: -0.04em; }
h2 { margin-bottom: 1rem; font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.25; }
h3 { margin-bottom: 0.45rem; }
.lede { max-width: 760px; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.25rem); }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.5rem; color: var(--muted); font-size: 0.9rem; }
.meta-row span { border-radius: 999px; background: var(--soft); padding: 0.35rem 0.7rem; }
.answer-box, .panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,.92);
  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; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 12px;
  margin: 16px 0 2rem;
  overflow-x: auto;
  padding-bottom: 2px;
}
.stat {
  min-width: 0;
  border-left: 5px solid var(--brand);
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  padding: 18px;
}
.stat:nth-child(2) { border-left-color: #355c9a; }
.stat:nth-child(3) { border-left-color: var(--accent); }
.stat:nth-child(4) { border-left-color: var(--brand); }
.stat b { display: block; overflow-wrap: anywhere; color: var(--ink); 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; font-weight: 750; }
.panel { margin-bottom: 2rem; padding: clamp(1.25rem, 3vw, 2rem); }
.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);
}
.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; white-space: nowrap; }
.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.72rem;
  line-height: 1;
  outline: none;
}
.calendar-event.workday { background: var(--accent); }
.calendar-event:hover, .calendar-event:focus-visible { box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.2); }
.calendar-event.workday:hover, .calendar-event.workday:focus-visible { box-shadow: 0 0 0 3px rgba(215, 163, 47, 0.25); }
.event-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: none;
  width: 230px;
  transform: translateX(-50%);
  border-radius: 10px;
  background: #17221d;
  box-shadow: 0 14px 32px rgba(0,0,0,.22);
  color: #fff;
  padding: 0.7rem 0.8rem;
  text-align: left;
  white-space: normal;
}
.event-popover::after {
  position: absolute;
  left: 50%;
  top: 100%;
  border: 6px solid transparent;
  border-top-color: #17221d;
  content: "";
  transform: translateX(-50%);
}
.event-popover strong, .event-popover small, .event-popover em { display: block; }
.event-popover strong { margin-bottom: 0.25rem; font-size: 0.88rem; }
.event-popover small { color: #d7e1dc; font-size: 0.75rem; line-height: 1.4; }
.event-popover em { margin-top: 0.35rem; color: #9dd8bd; font-size: 0.68rem; font-style: normal; font-weight: 800; }
.calendar-event.workday .event-popover em { color: #f2cf77; }
.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,.94);
  padding: 1rem;
}
.table-heading h3 { margin: 0; font-size: 1.2rem; }
.table-heading p { margin: 0.2rem 0 0; color: var(--muted); }
.export-link {
  border-radius: 8px;
  background: #eef4ef;
  color: #0c6b5d;
  flex: 0 0 auto;
  font-weight: 800;
  min-height: 36px;
  padding: 0.45rem 1rem;
  text-decoration: none;
}
.export-link:hover { background: #e2eee6; color: #064d43; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 0 0 12px 12px; background: #fff; }
table { width: 100%; min-width: 720px; border-collapse: collapse; background: #fff; }
th, td { border-bottom: 1px solid var(--line); padding: 1rem; text-align: left; vertical-align: top; }
th { background: #f7faf7; color: #425048; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.03em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfa; }
td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }
.local-name { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.92rem; font-weight: 500; }
.type-badge { display: inline-flex; border-radius: 999px; background: #edf4ff; color: #244f95; padding: 0.28rem 0.62rem; font-size: 0.75rem; font-weight: 800; 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); }
.link-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.link-card { display: block; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 1.25rem; text-decoration: none; }
.link-card:hover { border-color: var(--brand); box-shadow: 0 12px 28px rgba(24, 52, 40, 0.08); }
.link-card b { display: block; margin-bottom: 0.3rem; color: var(--ink); }
.link-card span { color: var(--muted); font-size: 0.9rem; }
.language-section { margin-bottom: 2.5rem; }
.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); padding: 2rem 0 3rem; color: var(--muted); font-size: 0.88rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.7rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 760px) {
  .site-header { align-items: center; flex-wrap: wrap; }
  .header-navs { justify-content: flex-start; width: 100%; }
  .nav-separator { display: none; }
  .top-nav { justify-content: flex-start; }
  .nav-group { width: 100%; }
  .link-grid { grid-template-columns: 1fr; }
  .calendar-intro { align-items: flex-start; flex-direction: column; }
  .table-heading { align-items: flex-start; flex-direction: column; }
  .calendar-board { grid-template-columns: 1fr; }
  .day-cell { min-height: 54px; }
  .hero { padding-top: 2.5rem; }
  h1 { font-size: clamp(2.2rem, 12vw, 3.6rem); }
}

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

@media print {
  body { background: #fff; }
  .top-nav, .skip-link, .related { display: none; }
  .site-header, main, .site-footer { width: 100%; }
  .panel, .answer-box { box-shadow: none; break-inside: avoid; }
  .calendar-board { grid-template-columns: repeat(3, 1fr); }
  .calendar-month { box-shadow: none; break-inside: avoid; }
  .event-popover { display: none !important; }
}

/* ---- dropdown nav ---- */
.nav-selects {
  display: flex;
  align-items: end;
  gap: 0.85rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.nav-select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2359655f' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  cursor: pointer;
}
.nav-select:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.nav-go {
  min-height: 44px;
  min-width: 64px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 0 1.5rem;
}
.nav-go:disabled {
  background: #c4d4cb;
  cursor: default;
}
.nav-go:not(:disabled):hover {
  background: var(--brand-dark);
}

/* ---- info cards ---- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2.5rem;
}
.info-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  padding: 1.25rem;
}
.info-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}
.info-card p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.info-langs {
  display: flex;
  gap: 0.5rem;
}
.info-langs a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  text-decoration: none;
}
.info-langs a:hover {
  border-color: var(--brand);
  background: var(--soft);
}

@media (max-width: 760px) {
  .nav-selects {
    flex-direction: column;
    align-items: stretch;
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
}




/* ---- Flag-based homepage ---- */
.home-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(3rem, 8vw, 6rem) clamp(18px, 4vw, 56px) 4rem;
  text-align: center;
}
.home-hero {
  margin-bottom: 3rem;
}
.home-hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  margin-bottom: 1rem;
}
.home-hero .lede {
  max-width: 600px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.6;
}
.year-selector {
  margin-bottom: 2.5rem;
}
.flag-grid {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 960px;
  width: 100%;
}
.flag-card {
  flex: 1 1 260px;
  max-width: 300px;
  min-width: 240px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 8px 30px rgba(24, 52, 40, 0.06);
  text-decoration: none;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.flag-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(24, 52, 40, 0.12);
}
.flag-large {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f8faf7, #eef2ed);
  padding: 8px;
  box-sizing: border-box;
}
.flag-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}
.flag-card-body {
  padding: 1.5rem 1.25rem 1.75rem;
  text-align: center;
}
.flag-card-body h2 {
  margin: 0 0 0.25rem;
  font-size: 1.3rem;
  color: var(--ink);
}
.flag-card-name {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 1rem;
  min-height: 1.5rem;
}
.flag-card-stat {
  margin: 0;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 700;
}
.home-footer {
  margin-top: 4rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.home-footer a {
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}
.home-footer a:hover {
  color: var(--brand);
}

@media (max-width: 760px) {
  .flag-grid {
    flex-direction: column;
    align-items: center;
  }
  .flag-card {
    max-width: 100%;
    width: 100%;
  }
  .flag-large {
    height: 70px;
  }
}


/* ---- Holiday Stories ---- */
.holiday-stories {
  margin: 3rem 0 2rem;
}
.holiday-stories h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-bottom: 1.5rem;
  text-align: center;
}
.stories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.story-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.story-icon {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
}
.story-icon svg {
  width: 52px;
  height: 52px;
  display: block;
}
.story-body h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--ink);
}
.story-body p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--muted);
}

@media (max-width: 760px) {
  .stories-grid {
    grid-template-columns: 1fr;
  }
  .story-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
