:root {
  --primary: #1a0066;
  --secondary: #303f9f;
  --ink: #171522;
  --muted: #5c5867;
  --surface: #fff;
  --soft: #f3f1fa;
  --border: #d8d3e8;
  --focus: #ffbf47;
  --school: #e7e1ff;
  --term: #dceeff;
  --holiday: #e4f4e2;
  --inset: #fff0cc;
  font-family: Arial, Helvetica, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 100%; scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: #f8f7fb; line-height: 1.55; }
a { color: var(--primary); text-underline-offset: .2em; }
a:hover { text-decoration-thickness: .15em; }
button, input, select { font: inherit; }
button, .button { min-height: 44px; }
button { cursor: pointer; }
:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }
.skip-link { position: absolute; left: .5rem; top: -5rem; z-index: 20; padding: .75rem; background: #fff; }
.skip-link:focus { top: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.hidden { display: none !important; }

.site-header { color: #fff; background: var(--primary); }
.header-inner { max-width: 75rem; margin: auto; padding: .8rem 1rem; display: flex; align-items: center; gap: 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; margin-right: auto; color: #fff; text-decoration: none; line-height: 1.15; }
.brand-mark { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border: 2px solid #fff; border-radius: 50%; font-weight: 800; }
nav { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
nav a { padding: .65rem .75rem; color: #fff; border-radius: .25rem; font-weight: 700; text-decoration: none; }
nav a:hover, nav a[aria-current] { background: #fff; color: var(--primary); }
.menu-button { display: none; color: #fff; border: 2px solid #fff; border-radius: .25rem; background: transparent; }

main { max-width: 75rem; margin: auto; padding: 1rem; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: center; padding: 2.5rem 0; }
.hero h1, .content-page h1 { margin: 0 0 .75rem; color: var(--primary); font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.08; }
.hero p { max-width: 48rem; font-size: 1.1rem; }
.eyebrow { margin: 0 0 .3rem; color: var(--secondary); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.hero-actions, .button-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.button { display: inline-flex; align-items: center; justify-content: center; padding: .7rem 1rem; border: 2px solid var(--primary); border-radius: .3rem; font-weight: 800; text-decoration: none; }
.button-primary { color: #fff; background: var(--primary); }
.button-secondary { color: #fff; border-color: var(--secondary); background: var(--secondary); }
.button-quiet { color: var(--primary); background: #fff; }

.notice { margin: 0 0 1rem; padding: 1rem; border-left: .4rem solid #8a5700; background: var(--inset); }
.calendar-card, .source-note, .content-page section, .subscription-box {
  margin-bottom: 1.5rem; padding: clamp(1rem, 3vw, 1.5rem); border: 1px solid var(--border); border-radius: .55rem; background: var(--surface);
}
.calendar-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.calendar-toolbar h2 { margin: 0; color: var(--primary); font-size: 1.8rem; }
.calendar-toolbar p { margin: .2rem 0; color: var(--muted); }
.view-switch { display: inline-flex; border: 2px solid var(--primary); border-radius: .3rem; overflow: hidden; }
.view-switch button { padding: .5rem .9rem; border: 0; color: var(--primary); background: #fff; }
.view-switch button[aria-pressed="true"] { color: #fff; background: var(--primary); }

.filters { display: grid; grid-template-columns: repeat(5, minmax(8rem, 1fr)); gap: .8rem; align-items: end; margin: 1.25rem 0; padding: 1rem; background: var(--soft); border-radius: .4rem; }
.filters h3 { grid-column: 1 / -1; margin: 0; }
label { display: grid; gap: .25rem; font-weight: 700; }
input, select { width: 100%; min-height: 44px; padding: .5rem; color: var(--ink); border: 2px solid #777181; border-radius: .25rem; background: #fff; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; min-height: 44px; }
.checkbox-label input { width: 1.4rem; min-height: 1.4rem; height: 1.4rem; }
.month-controls { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }
.month-controls button { padding: .45rem .75rem; color: var(--primary); border: 2px solid var(--primary); border-radius: .25rem; background: #fff; }
.month-controls h3 { margin: 0 0 0 auto; color: var(--primary); font-size: 1.4rem; }

.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.weekday { padding: .5rem; color: #fff; background: var(--secondary); text-align: center; font-weight: 800; }
.day { min-height: 8rem; padding: .4rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: #fff; }
.day.outside { background: #f1f1f1; color: var(--muted); }
.day.today { box-shadow: inset 0 0 0 3px var(--secondary); }
.day-number { display: block; margin-bottom: .3rem; font-weight: 800; }
.calendar-event { display: block; width: 100%; min-height: 0; margin: .2rem 0; padding: .35rem; border: 0; border-left: .35rem solid var(--primary); border-radius: .2rem; color: #181229; background: var(--school); text-align: left; line-height: 1.25; }
.calendar-event.term-dates { border-color: #07528a; background: var(--term); }
.calendar-event.holiday { border-color: #237215; background: var(--holiday); }
.calendar-event.inset-day { border-color: #865700; background: var(--inset); }
.event-list { display: grid; gap: .75rem; }
.event-card { width: 100%; min-height: 0; padding: 1rem; border: 1px solid var(--border); border-left: .4rem solid var(--primary); border-radius: .35rem; color: var(--ink); background: #fff; text-align: left; }
.event-card:hover { background: var(--soft); }
.event-card strong, .event-card span { display: block; }
.event-card .event-meta { margin-top: .25rem; color: var(--muted); }
.event-category { display: inline-block; margin: 0 0 .3rem; padding: .15rem .4rem; border-radius: .2rem; color: var(--primary); background: var(--soft); font-weight: 800; }
.empty-state { padding: 2rem; border: 2px dashed var(--border); text-align: center; }
.calendar-key { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.calendar-key i { display: inline-block; width: .8rem; height: .8rem; margin-right: .25rem; border: 1px solid #555; }
.key-school { background: var(--school); } .key-term { background: var(--term); }
.key-holiday { background: var(--holiday); } .key-inset { background: var(--inset); }

dialog { max-width: 38rem; width: calc(100% - 2rem); padding: 1.5rem; border: 0; border-radius: .5rem; box-shadow: 0 1rem 4rem #0006; }
dialog::backdrop { background: #12093eb3; }
.dialog-close { float: right; width: 44px; border: 0; color: var(--primary); background: transparent; font-size: 2rem; }
dialog h2 { color: var(--primary); }
dialog dt { font-weight: 800; } dialog dd { margin: 0 0 .7rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.content-page { max-width: 65rem; padding-top: 2.5rem; padding-bottom: 2.5rem; }
.content-page .lead { max-width: 52rem; font-size: 1.15rem; }
.content-page h2 { color: var(--primary); }
.subscription-box { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; }
.subscription-box figure { margin: 0; text-align: center; }
.subscription-box img { max-width: 100%; height: auto; }
.instruction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.instruction-grid section { margin: 0; }
details { padding: .75rem 0; border-bottom: 1px solid var(--border); }
summary { color: var(--primary); font-weight: 800; cursor: pointer; }
footer { padding: 2rem 1rem; color: #fff; background: var(--primary); text-align: center; }
footer a { color: #fff; }

@media (max-width: 850px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-actions { justify-content: flex-start; }
  .day { min-height: 6rem; }
}
@media (max-width: 650px) {
  .header-inner { flex-wrap: wrap; }
  .menu-button { display: block; }
  .site-header nav { display: none; width: 100%; align-items: stretch; flex-direction: column; }
  .site-header nav.open { display: flex; }
  .filters, .instruction-grid, .subscription-box { grid-template-columns: 1fr; }
  .calendar-toolbar { display: block; }
  .view-switch { margin-top: .75rem; }
  .month-controls h3 { width: 100%; margin: .5rem 0 0; }
}
@media print {
  .site-header, .hero-actions, .filters, .view-switch, .month-controls, .calendar-key, footer { display: none !important; }
  body, .calendar-card { background: #fff; }
  .month-view { display: none !important; }
  .event-list { display: grid !important; }
  .event-card { break-inside: avoid; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
