/* Public holiday calendar (/calendar). Uses the app's tokens from app.css/brand.css. */
:root {
  --hol-public: #c93a66; --on-public: #fff;
  --hol-school-bg: #d8f3e8; --hol-school-ink: #0b6b4a; --hol-school-bar: #10a874;
}
:root[data-theme="dark"] {
  --hol-public: #e8577e; --on-public: #1a0b10;
  --hol-school-bg: #133b2d; --hol-school-ink: #8fe3c3; --hol-school-bar: #2fbf8a;
}
.cal-page { min-height: 100%; }
.cal-top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--sidebar); position: sticky; top: 0; z-index: 10; }
.cal-brand img { display: block; height: 52px; width: auto; max-width: 180px; object-fit: contain; }
.cal-theme { display: flex; gap: 2px; padding: 3px; border-radius: 9px; background: rgba(0, 0, 0, .22); }
.cal-theme button { border: 0; background: transparent; color: var(--on-sidebar); opacity: .7; padding: 4px 10px; border-radius: 7px; }
.cal-theme button:hover { background: rgba(255, 255, 255, .08); border: 0; opacity: 1; }
.cal-theme button[aria-checked="true"] { background: rgba(255, 255, 255, .2); opacity: 1; }
.cal-main { max-width: 1200px; margin: 0 auto; padding: 24px 24px 40px; display: grid; gap: 18px; }
.cal-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cal-hero h1 { font-size: 28px; letter-spacing: -.01em; }
.cal-hero p { margin: 4px 0 0; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 7px; }
.key { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.key-public { background: var(--hol-public); }
.key-school { background: var(--hol-school-bg); border-radius: 4px; box-shadow: inset 0 -3px 0 var(--hol-school-bar); }
.key-today { box-shadow: inset 0 0 0 2px var(--brand); }

.cal-upcoming { padding: 16px 18px; }
.cal-upcoming h2 { margin-bottom: 10px; }
.up-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.up-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); border-left: 4px solid var(--hol-public); }
.up-item.up-school { border-left-color: var(--hol-school-bar); }
.up-when { font-size: 12px; font-weight: 700; color: var(--brand-strong); text-transform: uppercase; letter-spacing: .04em; }
.up-name { grid-column: 1; font-weight: 650; }
.up-date { grid-column: 1; font-size: 12.5px; color: var(--muted); }
.up-item .badge { grid-column: 2; grid-row: 1 / span 2; align-self: start; }
.badge-public { background: var(--hol-public); color: var(--on-public); border-color: transparent; }
.badge-school { background: var(--hol-school-bg); color: var(--hol-school-ink); border-color: transparent; }

.cal-yearbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cal-yearbar h2 { font-size: 24px; min-width: 64px; text-align: center; }
.cal-yearbar #prev-year, .cal-yearbar #next-year { font-size: 20px; line-height: 1; padding: 6px 14px; min-width: 40px; min-height: 38px; }
/* Arabic honorifics (ﷺ) need a font that has them; these ship with Windows, Android and Apple devices. */
.ar { font-family: "Segoe UI Historic", "Traditional Arabic", "Arabic Typesetting", "Noto Naskh Arabic", "Geeza Pro", "Times New Roman", serif; font-size: 1.15em; }
.cal-months { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.month { padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 8px; }
.month h3 { font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px 0; text-align: center; }
.wd { font-size: 11px; font-weight: 600; color: var(--muted); padding-bottom: 2px; }
.d { font: inherit; font-size: 13px; height: 32px; display: grid; place-items: center; border: 0; padding: 0; background: transparent;
  color: var(--text); border-radius: 0; position: relative; font-variant-numeric: tabular-nums; }
button.d { cursor: pointer; }
button.d:hover { background: transparent; border: 0; filter: brightness(1.06); }
.d-weekend { color: var(--muted); }
.d-school { background: var(--hol-school-bg); color: var(--hol-school-ink); font-weight: 600; box-shadow: inset 0 -3px 0 var(--hol-school-bar); }
/* The pink circle sits behind the number (isolation keeps z-index local to the cell). */
.d-public { color: var(--on-public); font-weight: 700; isolation: isolate; }
.d-public::before { content: ""; position: absolute; width: 28px; height: 28px; border-radius: 50%; background: var(--hol-public); z-index: -1; }
.d-today::after { content: ""; position: absolute; width: 30px; height: 30px; border-radius: 50%; box-shadow: 0 0 0 2px var(--brand); }
.m-events { list-style: none; margin: 4px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 12.5px; }
.m-events li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; padding: 2px 4px; border-radius: 6px; }
.m-events li.hl { background: var(--brand-soft); }
.m-events i { width: 9px; height: 9px; border-radius: 50%; background: var(--hol-public); }
.m-events .ev-school i { border-radius: 2px; background: var(--hol-school-bar); }
.m-events .muted { white-space: nowrap; font-size: 12px; }
.cal-list tr.past td { opacity: .5; }
.cal-foot { line-height: 1.6; }
.cal-foot p { margin: 0 0 4px; }
@media (max-width: 640px) {
  .cal-top { padding: 10px 16px; }
  .cal-brand img { height: 42px; }
  .cal-main { padding: 16px; }
  .cal-hero h1 { font-size: 23px; }
}
@media print {
  .cal-top, .cal-yearbar .tabs, .cal-theme, #prev-year, #next-year { display: none !important; }
  .cal-months { grid-template-columns: repeat(3, 1fr); }
  .d-public::before, .d-school, .badge-public, .badge-school, .m-events i { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
