/* Liturgical-book look: parchment, cinnabar for red-letter days, gold leaf accents. */
:root {
  --parchment: #FBF8F3;
  --paper: #FFFEFB;
  --ink: #2A1E16;
  --ink-soft: #6B5A4A;
  --line: #ECE3D2;
  --cinnabar: #A8261D;
  --gold: #A9822F;
  --gold-soft: #E9D7A6;
  --gold-text: #7A5A17;   /* gold dark enough for small text (>= 4.5:1 on paper) */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  --free: #A9822F;     --free-bg: transparent;
  --dairy: #B86A1E;    --dairy-bg: #F7E3C9;
  --fish: #2C5A8A;     --fish-bg: #DCE6F1;
  --oil: #66742A;      --oil-bg: #E6E9CF;
  --water: #3F7880;    --water-bg: #D8E9E8;
  --dry: #84552A;      --dry-bg: #EADBC6;
  --total: #6E1F1F;    --total-bg: #E8CDC8;

  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans: 'Alegreya Sans', 'Segoe UI', sans-serif;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--ink);
  background: radial-gradient(900px 480px at 100% 0%, #F6EFE2 0%, transparent 60%), var(--parchment);
  min-height: 100dvh;
  padding-bottom: 96px;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:active { transform: scale(.97); }
.skip { position: absolute; left: 16px; top: -60px; z-index: 30; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-weight: 700; }
.skip:focus { top: 12px; }
a { color: var(--cinnabar); }
:focus-visible { outline: 2px solid var(--cinnabar); outline-offset: 2px; }

/* ---------- Header ---------- */
.top {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.top::after { /* double gold rule like a printed menologion */
  content: '';
  position: absolute; left: 24px; right: 24px; bottom: -5px;
  border-top: 1px solid var(--gold-soft);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-cross { width: 26px; height: 36px; color: var(--cinnabar); flex: none; }
h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(30px, 4.2vw, 44px);
  line-height: 1;
  margin: 0;
  letter-spacing: .01em;
}
.subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold-text);
  font-weight: 700;
}

/* ---------- Layout ---------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 8px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 32px;
  align-items: start;
}

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.cal-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(26px, 3.4vw, 36px);
  margin: 0 auto 0 8px;
  order: -1;
  text-transform: capitalize;
  min-width: 0;
}
.nav-btn, .today-btn {
  border: 1px solid var(--line); background: var(--paper);
  min-width: 44px; height: 44px; border-radius: 999px;
  font-size: 22px; line-height: 1;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease);
}
.today-btn { font-size: 15px; font-weight: 700; padding: 0 16px; }
.nav-btn:hover, .today-btn:hover { border-color: var(--gold); background: var(--parchment); }

.weekdays, .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.weekdays div {
  text-align: center; font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-soft); padding-bottom: 6px;
}
.weekdays div:last-child { color: var(--cinnabar); }

.cell {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  min-height: 86px;
  padding: 8px 9px;
  text-align: left;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
  animation: fade .18s var(--ease) both;
}
.cell:hover { transform: translateY(-2px); box-shadow: 0 6px 16px -10px rgba(42, 30, 22, .45); }
.cell .num { font-family: var(--serif); font-weight: 700; font-size: 24px; line-height: 1; }
.cell .jul { position: absolute; top: 9px; right: 9px; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cell .ic { width: 20px; height: 20px; }
.cell .feast-dot {
  position: absolute; bottom: 10px; right: 10px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--gold);
}
.cell.red .num { color: var(--cinnabar); }
.cell.red .feast-dot { background: var(--cinnabar); }
.cell.today { border-color: var(--ink); border-width: 2px; padding: 7px 8px; }
.cell[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--cinnabar); border-color: var(--cinnabar); }
.empty { min-height: 1px; }

/* Fasting levels: cell tint + icon color */
.lv-free  { --c: var(--free);  --bg: var(--free-bg); }
.lv-dairy { --c: var(--dairy); --bg: var(--dairy-bg); }
.lv-fish  { --c: var(--fish);  --bg: var(--fish-bg); }
.lv-oil   { --c: var(--oil);   --bg: var(--oil-bg); }
.lv-water { --c: var(--water); --bg: var(--water-bg); }
.lv-dry   { --c: var(--dry);   --bg: var(--dry-bg); }
.lv-total { --c: var(--total); --bg: var(--total-bg); }
.cell:not(.lv-free) { background: var(--bg); border-color: color-mix(in srgb, var(--c) 22%, transparent); }
.cell .ic, .lv-ic { color: var(--c); }
.cell.lv-free .ic { opacity: .45; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Day detail ---------- */
.day {
  position: sticky; top: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 26px 22px;
  box-shadow: 0 20px 40px -30px rgba(42, 30, 22, .5);
  scroll-margin-top: 16px;
}
.day-date { font-family: var(--serif); font-weight: 700; font-size: 30px; line-height: 1.1; margin: 0; text-wrap: balance; }
.day-date.red { color: var(--cinnabar); }
.day-jul { margin: 6px 0 0; color: var(--ink-soft); font-size: 14px; font-style: italic; }
.period-chip {
  display: inline-block; margin-top: 12px; padding: 3px 12px; border-radius: 999px;
  border: 1px solid var(--gold-soft); color: var(--gold-text); font-weight: 700; font-size: 13px;
  letter-spacing: .06em; text-transform: uppercase;
}
.level-card {
  margin-top: 18px; padding: 16px; border-radius: 12px;
  background: var(--bg); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  display: flex; align-items: center; gap: 14px;
}
.level-card.lv-free { background: #F8EFD8; }
.level-card .lv-ic { width: 40px; height: 40px; flex: none; }
.level-card strong { font-family: var(--serif); font-size: 26px; line-height: 1.1; color: var(--c); }
.lists { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.lists h3 {
  margin: 0 0 6px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
}
.lists ul { list-style: none; padding: 0; margin: 0; }
.lists li { padding: 4px 0 4px 22px; position: relative; font-size: 16px; line-height: 1.35; }
.lists .no li::before { content: '✕'; position: absolute; left: 2px; color: var(--cinnabar); font-size: 13px; top: 6px; }
.lists .yes li::before { content: '✓'; position: absolute; left: 2px; color: var(--oil); font-weight: 700; }
.lists .single { grid-column: 1 / -1; }

.feasts { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.feast { margin: 0 0 14px; }
.feast h3 { font-family: var(--serif); font-size: 22px; line-height: 1.2; margin: 0 0 4px; font-weight: 700; }
.feast.red h3 { color: var(--cinnabar); }
.feast .tag { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--cinnabar); font-weight: 700; }
.feast p, .period-info { margin: 0; color: var(--ink); font-size: 16px; }
.period-info { margin-top: 14px; color: var(--ink-soft); }
.relaxed-note { margin: 10px 0 0; font-size: 15px; color: var(--gold-text); font-weight: 500; }
.rules-note { margin: 16px 0 0; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 13px; color: var(--ink-soft); }


/* ---------- Legend + footer ---------- */
.legend-wrap, .foot { max-width: 1180px; margin: 0 auto; padding: 24px; }
.legend-wrap h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 12px; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.legend li {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px;
  border-radius: 999px; background: var(--bg); border: 1px solid color-mix(in srgb, var(--c) 25%, transparent);
  font-size: 15px; font-weight: 500;
}
.legend li.lv-free { background: var(--paper); }
.legend .lv-ic { width: 20px; height: 20px; }
.legend li.red-key { --c: var(--cinnabar); background: var(--paper); }
.legend .red-key span.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cinnabar); margin: 0 5px; }
.foot { color: var(--ink-soft); font-size: 14px; border-top: 1px solid var(--line); }
.foot p { max-width: 760px; margin: 0 0 8px; }

/* ---------- Prayer ---------- */
.prayer-fab {
  position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px 12px 16px; min-height: 52px;
  border: 1px solid #7E1C15; border-radius: 999px;
  background: var(--cinnabar); color: #FFF6E6;
  font-family: var(--sans); font-size: 17px; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 12px 28px -10px rgba(110, 31, 31, .65), inset 0 0 0 2px rgba(233, 215, 166, .35);
  transition: transform .2s var(--ease);
}
.prayer-fab:hover { transform: translateY(-2px); }
.prayer-fab svg { width: 16px; height: 22px; color: var(--gold-soft); }

.prayer {
  border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  background: var(--paper); color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
}
.prayer::backdrop { background: rgba(42, 30, 22, .55); backdrop-filter: blur(3px); }
.prayer[open] { animation: rise .25s ease both; }
.prayer-inner { padding: 22px 28px 24px; border: 1px solid var(--gold-soft); margin: 8px; border-radius: 12px; }
.prayer-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.prayer-tabs button {
  border: 1px solid var(--line); background: none; border-radius: 999px; padding: 4px 12px;
  font-size: 14px; font-weight: 700; color: var(--ink-soft); min-height: 44px;
}
.prayer-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.prayer h2 { font-family: var(--serif); font-size: 30px; color: var(--cinnabar); margin: 12px 0 8px; text-align: center; outline: none; }
.prayer { scrollbar-gutter: stable both-edges; }
.prayer-text { font-family: var(--serif); font-size: 20px; line-height: 1.42; text-align: center; font-weight: 500; }
.prayer-text p { margin: 0; }
.prayer-text p:empty { height: .7em; }
.prayer-text p:first-child::first-letter { color: var(--cinnabar); font-size: 1.6em; font-weight: 700; }
.prayer-close {
  display: block; margin: 22px auto 0; border: 1px solid var(--line); background: none;
  border-radius: 999px; padding: 8px 22px; font-weight: 700; min-height: 44px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
  .day { position: static; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .top { padding: 18px 16px 14px; }
  .top::after { left: 16px; right: 16px; }
  .layout, .legend-wrap, .foot { padding-left: 16px; padding-right: 16px; }
  .layout { padding-top: 18px; }
  .cal-head { flex-wrap: wrap; }
  .cal-head h2 { flex-basis: 100%; margin: 0 0 6px; }
  .today-btn { margin-left: auto; }
  .weekdays, .grid { gap: 3px; }
  .weekdays div { font-size: 11px; letter-spacing: .04em; }
  .cell { min-height: 56px; padding: 5px; border-radius: 8px; align-items: center; }
  .cell.today { padding: 4px; }
  .cell .num { font-size: 19px; }
  .cell .jul { display: none; }
  .cell .ic { width: 16px; height: 16px; }
  .cell .feast-dot { top: 5px; right: 5px; bottom: auto; width: 6px; height: 6px; }
  .day { padding: 20px 18px; }
  .day-date { font-size: 26px; }
  .lists { grid-template-columns: 1fr; gap: 12px; }
  .prayer-fab { font-size: 16px; padding: 10px 18px 10px 14px; }
  .prayer-inner { padding: 18px 16px 20px; }
  .prayer-text { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Squircles, dropdowns, simplified navigation ---------- */
:root { --sq: 16px; }
.nav-btn, .today-btn, .prayer-fab, .prayer-close, .prayer-tabs button, .pick select, .cell, .level-card, .day, .skip {
  corner-shape: squircle; /* progressive: true squircle where supported, rounded rect elsewhere */
}
.nav-btn, .today-btn, .prayer-close, .prayer-tabs button, .pick select { border-radius: var(--sq); }
.prayer-fab { border-radius: 22px; }
.cell { border-radius: 14px; }
.day { border-radius: 24px; }
.level-card { border-radius: 18px; }

.brand-icon {
  width: 52px; height: 66px; object-fit: cover; object-position: 46% 6%;
  border-radius: 26px 26px 8px 8px; /* arch, like an icon niche */
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--gold-soft);
  flex: none;
}
.controls { display: flex; gap: 12px; flex-wrap: wrap; }
.pick { display: grid; gap: 4px; }
.pick span { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.pick select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 15px; font-weight: 500; color: var(--ink);
  min-height: 44px; padding: 0 40px 0 14px;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%236B5A4A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  border: 1px solid var(--line); cursor: pointer;
  transition: border-color .2s var(--ease);
}
.pick select:hover { border-color: var(--gold); }

.cal-head { justify-content: space-between; }
.month-nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cal-head h2 { order: 0; margin: 0; min-width: 9ch; text-align: center; }
.nav-btn { display: grid; place-items: center; background: transparent; border-color: transparent; }
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn:hover { background: var(--paper); border-color: var(--line); }
.today-btn { background: var(--paper); }

.feast-icon {
  display: block; width: 120px; height: 150px; object-fit: cover; object-position: 50% 8%;
  margin: 4px 0 16px; border-radius: 60px 60px 12px 12px;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--gold-soft);
}
.prayer-icon {
  display: block; width: 88px; height: 112px; object-fit: cover; object-position: 50% 0%;
  margin: 4px auto 0; border-radius: 44px 44px 10px 10px;
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--gold-soft);
}
.credits { font-size: 13px; }
.rules-note strong { color: var(--ink); font-weight: 700; }

@media (max-width: 560px) {
  .top { gap: 14px; }
  .controls { width: 100%; }
  .pick { flex: 1 1 0; min-width: 0; }
  .pick select { width: 100%; font-size: 14px; }
  .brand-icon { width: 44px; height: 56px; }
  .cal-head { flex-wrap: nowrap; }
  .cal-head h2 { flex-basis: auto; font-size: 24px; margin: 0; }
  .today-btn { margin-left: 0; }
}

/* ---------- Legal page ---------- */
.legal { max-width: 720px; margin: 0 auto; padding: 32px 24px 64px; }
.legal h1 { margin: 16px 0 0; }
.legal h2 { font-family: var(--serif); font-size: 30px; margin: 40px 0 0; }
.legal h3 { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin: 24px 0 6px; }
.legal p { margin: 0 0 12px; max-width: 65ch; }
.legal-sub { color: var(--ink-soft); font-size: 15px; }

.story { line-height: 1.6; }
.brand-cross { width: 26px; height: 36px; color: var(--cinnabar); flex: none; }

/* ---------- About / FAQ (static text for readers and search engines) ---------- */
.about { max-width: 1180px; margin: 0 auto; padding: 8px 24px 24px; }
.about h2 { font-family: var(--serif); font-size: 28px; margin: 0 0 8px; }
.about h3 { font-size: 17px; margin: 20px 0 4px; }
.about p { margin: 0; max-width: 70ch; color: var(--ink-soft); }
@media (max-width: 560px) { .about { padding-left: 16px; padding-right: 16px; } }
