/* =========================================================
   Church calendar (Wren's design, 22 Oct 2026; built in riley-today/inc/calendar.php). Theme tokens only.
   Gold TEXT on light grounds is #8A5A14 (AA, as on Today); --gold for rules and the cross.
   Desktop: a real <table> month grid. Phone (under 760px): the same days as a list.
   Only one of the two is displayed, so assistive tech never meets both.
   ========================================================= */
:root { --cal-ink: #8A5A14; --cal-rule: rgba(15, 28, 46, 0.12); --cal-fast: #4b5d74; }

.so-cal-head { padding: 3.2rem 1.5rem 2.6rem; }
.so-cal-head .so-page-head-cross { width: 40px; margin-bottom: 0.9rem; }
.so-cal-head p { font-size: 1rem; }
.so-cal { background: var(--ivory); padding: 2rem 0 4rem; }
.cal-wrap { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; color: var(--text-dark); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* month bar: previous / month / next, and print */
.cal-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; margin: 0 0 1rem; }
.cal-bar h2 { margin: 0; font: 400 2rem/1.2 Georgia, serif; color: var(--navy); text-align: center; }
.cal-step { font-size: 0.95rem; color: var(--navy); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; white-space: nowrap; }
.cal-step:hover, .cal-step:focus-visible { text-decoration-thickness: 2px; }
.cal-bar .next { justify-self: end; }
.cal-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem 1.5rem; margin: 0 0 1.1rem; }
.cal-season { margin: 0; font: italic 1rem/1.5 Georgia, serif; color: var(--text-muted); }
.cal-season b { font-style: normal; font-weight: 600; color: var(--navy); }
.cal-print { font: 0.92rem Georgia, serif; color: var(--navy); background: var(--ivory); border: 1px solid rgba(201, 168, 76, 0.6); border-radius: 999px; padding: 0.4rem 1rem; cursor: pointer; }
.cal-print:hover, .cal-print:focus-visible { background: #fff; }

/* the three-bar cross: the site's sOCc cross, gold, for great feasts only */
.cal-cross { display: inline-block; width: 13px; height: 21px; vertical-align: -4px; color: var(--gold); }
.cal-cross svg { width: 100%; height: 100%; display: block; }

/* fast days: a quiet navy tick at the cell's left edge, AND words. Never colour alone. */
.cal-fast { display: block; margin-top: 0.35rem; font: 600 0.72rem/1.35 "Segoe UI", system-ui, sans-serif; letter-spacing: 0.02em; color: var(--cal-fast); }
.cal-fast::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 0.35rem; border: 1.5px solid currentColor; border-radius: 50%; vertical-align: 0; }
.cal-fast.strict::before { background: currentColor; }

/* ---------- the grid (desktop) ---------- */
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; background: #fff; box-shadow: var(--shadow); border-radius: 8px; }
/* rounded on the corner cells, not by clipping the table, so an "and N more" panel can open past the grid's edge */
.cal-grid thead th:first-child { border-top-left-radius: 8px; }
.cal-grid thead th:last-child { border-top-right-radius: 8px; }
.cal-grid tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
.cal-grid tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
.cal-grid caption { text-align: left; }
.cal-grid th { padding: 0.65rem 0.6rem; background: var(--navy); color: var(--ivory); font: 600 0.78rem/1.3 "Segoe UI", system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; text-align: left; }
.cal-grid th abbr { text-decoration: none; }
.cal-grid td { position: relative; vertical-align: top; height: 9.2rem; padding: 0.55rem 0.65rem 0.7rem; border: 1px solid var(--cal-rule); font-size: 0.86rem; line-height: 1.4; }
.cal-grid td.out { background: #faf8f3; }
.cal-grid td.fasting { box-shadow: inset 3px 0 0 rgba(75, 93, 116, 0.55); }
.cal-grid td.great { background: #fbf6e6; box-shadow: inset 0 3px 0 var(--gold); }
.cal-grid td.great.fasting { box-shadow: inset 0 3px 0 var(--gold), inset 3px 0 0 rgba(75, 93, 116, 0.55); }
.cal-grid td.sun .cal-n { color: var(--cal-ink); }

/* the whole day is a link to its detail; the saint name is its own link above it */
.cal-n { display: flex; justify-content: space-between; align-items: center; font: 400 1.35rem/1.1 Georgia, serif; color: var(--navy); text-decoration: none; }
.cal-n::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.cal-n:focus-visible { outline: none; }
.cal-n:focus-visible::after { outline: 3px solid var(--navy); outline-offset: -3px; }
.cal-grid td:hover { background: #fdfbf5; }
.cal-grid td.great:hover { background: #f9f1d9; }
.cal-today-tag { font: 600 0.66rem/1 "Segoe UI", system-ui, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: #fff; background: var(--navy); border-radius: 999px; padding: 0.25rem 0.5rem; }
td[aria-current] , .cal-list li[aria-current] { outline: 2px solid var(--navy); outline-offset: -2px; }
.cal-sun-title { display: block; margin: 0.15rem 0 0.2rem; font: italic 0.78rem/1.35 Georgia, serif; color: var(--text-muted); }
.cal-saint { display: block; margin-top: 0.35rem; font-family: Georgia, serif; font-size: 0.92rem; line-height: 1.35; color: var(--text-dark); }
a.cal-saint, .cal-saint a { position: relative; z-index: 1; color: var(--navy); text-decoration: underline; text-decoration-color: rgba(201, 168, 76, 0.7); text-underline-offset: 2px; }
a.cal-saint { padding-block: 2px; min-height: 24px; box-sizing: border-box; }   /* 24px tall: a target of its own size, next to the "and N more" button (WCAG 2.5.8) */
a.cal-saint:hover, a.cal-saint:focus-visible { text-decoration-color: var(--navy); text-decoration-thickness: 2px; }
.great .cal-saint { font-weight: 700; }
.cal-more { display: block; margin-top: 0.15rem; font-size: 0.76rem; color: var(--text-muted); }
.cal-oc { display: block; margin-top: 0.2rem; font-size: 0.76rem; line-height: 1.35; color: var(--text-muted); }
.cal-great-word { display: block; margin-top: 0.3rem; font: 600 0.68rem/1.3 "Segoe UI", system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cal-ink); }

/* ---------- legend and note ---------- */
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; margin: 1.3rem 0 0; padding: 0.9rem 1.1rem; list-style: none; background: #fff; border-top: 3px solid var(--gold); border-radius: 8px; box-shadow: var(--shadow); font-size: 0.88rem; }
.cal-legend li { display: flex; align-items: baseline; gap: 0.45rem; }
.cal-legend .cal-fast { margin: 0; display: inline; }
/* a sample of a fast day's left edge: the same bar the day cells and list items carry */
.cal-key-bar { display: inline-block; flex: none; width: 1.3rem; height: 1rem; align-self: center; background: #fff; border: 1px solid var(--cal-rule); box-shadow: inset 3px 0 0 rgba(75, 93, 116, 0.55); }
.cal-legend h2 { flex-basis: 100%; margin: 0; font: 600 0.78rem/1.6 "Segoe UI", system-ui, sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cal-ink); }
.cal-note { max-width: 760px; margin: 1.6rem 0 0; font-size: 0.92rem; line-height: 1.6; color: var(--text-muted); }
.cal-note .src { display: block; margin-top: 0.4rem; font-size: 0.85rem; }
.cal-note a { color: var(--text-muted); text-decoration: underline; text-decoration-color: rgba(201, 168, 76, 0.7); text-underline-offset: 2px; }   /* as Today's credit link */

/* ---------- the list (phone) ---------- */
.cal-list { display: none; list-style: none; margin: 0; padding: 0; }
.cal-list .wk { margin: 1.4rem 0 0.4rem; font: italic 0.95rem/1.4 Georgia, serif; color: var(--text-muted); }
.cal-list .wk:first-child { margin-top: 0; }
.cal-list .day { position: relative; display: grid; grid-template-columns: 3.4rem 1fr; gap: 0 0.8rem; padding: 0.8rem 0.9rem; margin: 0 0 0.45rem; background: #fff; border-radius: 6px; box-shadow: 0 1px 4px rgba(15, 28, 46, 0.08); }
.cal-list .day.fasting { box-shadow: inset 3px 0 0 rgba(75, 93, 116, 0.55), 0 1px 4px rgba(15, 28, 46, 0.08); }
.cal-list .day.great { background: #fbf6e6; box-shadow: inset 0 3px 0 var(--gold), 0 1px 4px rgba(15, 28, 46, 0.08); }
.cal-list .cal-n { display: block; text-align: center; font-size: 1.6rem; }
.cal-list .cal-n small { display: block; font: 600 0.66rem/1.4 "Segoe UI", system-ui, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); }
.cal-list .cal-saint { margin-top: 0; font-size: 1rem; }
.cal-list .cal-cross { width: 12px; height: 19px; margin-top: 0.3rem; }

/* "and N more": a disclosure button above the day's stretched link (never inside it), and its panel of the whole day.
   Behavior in calendar.js: hover opens it on desktop with a 700ms close and a bridge; a click pins it open. */
.cal-more-btn { position: relative; z-index: 1; display: inline-flex; align-items: center; min-height: 24px; margin: 0.1rem 0 0 -0.25rem; padding: 0 0.25rem;
  border: 0; border-radius: 4px; background: none; font: inherit; font-size: 0.76rem; line-height: 1.3; color: var(--text-muted);
  text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer; }
.cal-more-btn:hover, .cal-more-btn[aria-expanded="true"] { color: var(--navy); background: rgba(201, 168, 76, 0.16); }
.cal-more-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.cal-pop { position: absolute; z-index: 30; left: 0.4rem; width: 17rem; max-width: calc(100vw - 2rem); padding: 0.7rem 0.95rem 0.8rem;
  background: #fff; border: 1px solid rgba(15, 28, 46, 0.18); border-top: 3px solid var(--gold); border-radius: 6px;
  box-shadow: 0 10px 28px rgba(15, 28, 46, 0.22); font-size: 0.88rem; line-height: 1.4; text-align: left; white-space: normal; }
.cal-pop[hidden] { display: none; }
.cal-pop.flip-x { left: auto; right: 0.4rem; }
.cal-pop::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; }   /* the hover bridge back to the button */
.cal-pop.up::before { top: auto; bottom: -14px; }
.cal-pop-h { margin: 0 0 0.35rem; font: 600 0.72rem/1.4 "Segoe UI", system-ui, sans-serif; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cal-ink); }
.cal-pop ul { margin: 0 0 0.55rem; padding: 0; list-style: none; }
.cal-pop li { margin: 0 0 0.3rem; font-family: Georgia, serif; color: var(--text-dark); }
.cal-pop a { color: var(--navy); text-decoration: underline; text-decoration-color: rgba(201, 168, 76, 0.7); text-underline-offset: 2px; }
.cal-pop a:hover, .cal-pop a:focus-visible { text-decoration-color: var(--navy); text-decoration-thickness: 2px; }
.cal-pop-day { font-size: 0.85rem; }

@media (max-width: 759px) {
  /* phones: the panel opens in place below the day, a disclosure rather than a floating box; 44px targets */
  .cal-list .cal-more-btn { min-height: 44px; margin: 0 0 0 -0.4rem; padding: 0 0.4rem; font-size: 0.9rem; }
  .cal-pop { position: relative; z-index: 2; left: auto; right: auto; width: auto; max-width: none; margin: 0.2rem 0 0.3rem; box-shadow: none; }
  .cal-pop::before { display: none; }
  .cal-pop li a, .cal-pop-day { display: flex; align-items: center; gap: 0.3em; min-height: 44px; }
  .cal-pop li { margin: 0 0 0.1rem; }
  .cal-grid { display: none; }
  .cal-list { display: block; }
  .cal-bar h2 { font-size: 1.45rem; }
  .cal-step { font-size: 0.88rem; }
  .cal-wrap { padding: 0 1rem; }
  .so-cal-head { padding: 2.4rem 1rem 2rem; }
  .so-cal-head h1 { font-size: 1.9rem; }
  .cal-print { display: none; }
  .cal-legend { flex-direction: column; }
}

/* ---------- print: the month on one landscape Letter page, black ink ---------- */
@media print {
  @page { size: letter landscape; margin: 0.35in; }
  html, body { background: #fff !important; }
  body * { color: #000 !important; box-shadow: none !important; }
  .site-header, .site-footer, header, footer, .so-page-head, .cal-step, .cal-print, .skip-link, .cal-list, .so-cal-head { display: none !important; }
  .so-cal { padding: 0; background: #fff; }
  .cal-wrap { max-width: none; padding: 0; }
  .cal-bar { display: block; margin: 0 0 0.05in; }
  .cal-bar h2 { font-size: 18pt; text-align: left; }
  .cal-bar h2::before { content: "Simply Orthodox · Church calendar · "; font-size: 11pt; font-family: "Segoe UI", system-ui, sans-serif; letter-spacing: 0.04em; }
  .cal-tools { margin: 0 0 0.08in; }
  .cal-season { font-size: 9.5pt; }
  .cal-grid { display: table !important; border-radius: 0; font-size: 8pt; }
  .cal-grid th { background: #fff !important; border: 1px solid #000; padding: 3pt 5pt; font-size: 7.5pt; }
  .cal-grid td { height: 0.92in; padding: 2.5pt 4pt; border: 1px solid #000; font-size: 7pt; line-height: 1.22; break-inside: avoid; }
  .cal-grid.w6 td { height: 0.76in; }   /* six-week months still fit one page */
  .cal-grid td.out { background: #fff !important; }
  .cal-grid td.fasting { box-shadow: none !important; border-left: 3px solid #000; }
  .cal-grid td.great { background: #fff !important; box-shadow: none !important; border-top: 3px double #000; }
  .cal-n { font-size: 11pt; }
  .cal-saint { font-size: 7.5pt; margin-top: 0.15rem; }
  a.cal-saint, .cal-saint a { text-decoration: none; }
  .cal-more, .cal-oc, .cal-sun-title, .cal-fast, .cal-great-word { font-size: 6.3pt; margin-top: 0.05rem; }
  .cal-cross { color: #000 !important; }
  .cal-fast.strict::before { -webkit-print-color-adjust: exact; print-color-adjust: exact; background: #000 !important; }
  .cal-today-tag { display: none; }
  .cal-more-btn { all: unset; display: block; font-size: 6.3pt; margin-top: 0.05rem; }   /* print: plain "and N more", no button */
  .cal-more-btn .vh, .cal-pop { display: none !important; }
  td[aria-current] { outline: none; }
  .cal-legend { margin-top: 0.06in; padding: 0; border: 0; font-size: 7.5pt; gap: 0 0.25in; }
  .cal-legend h2 { flex-basis: auto; font-size: 7.5pt; }
  .cal-key-bar { width: 0.2in; height: 0.13in; border: 1px solid #000; border-left: 3px solid #000; box-shadow: none !important; }   /* as the cells' heavy left border */
  .cal-note, .cal-note .src { max-width: none; margin-top: 0.04in; font-size: 7pt; line-height: 1.35; }
}
