/* ==========================================================================
   LITURGICAL DAY - styles
   A traditional, "missal / breviary" look: parchment tones, blackletter
   display headings, Roman-capital labels, and a serif body.

   Fonts are loaded from Google Fonts. To run fully offline, download the three
   families and replace the @import below with local @font-face rules.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=UnifrakturMaguntia&family=Cinzel:wght@400;500;600;700&family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

:root {
  --font-black: 'UnifrakturMaguntia', 'Blackletter', 'Old English Text MT', serif;
  --font-display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --font-body: 'EB Garamond', Georgia, 'Times New Roman', serif;

  /* parchment (light) */
  --bg: #eee4c8;
  --bg-1: #efe6cd;
  --bg-2: #e4d6ad;
  --surface: #fbf4e3;
  --surface-2: #f1e6cc;
  --text: #2a2117;
  --muted: #6f5c3e;
  --line: #d8c79e;
  --line-strong: #b39a63;
  --accent: #7d1f2c;          /* deep crimson */
  --accent-soft: #efdcc9;
  --gold: #a9761f;
  --good: #38613a;
  --warn: #96571a;
  --badge-bg: #eadfc4;
  --shadow: 0 1px 3px rgba(64, 42, 10, 0.18);
  --radius: 4px;
}

[data-theme="dark"] {
  --bg: #171209;
  --bg-1: #161209;
  --bg-2: #20180e;
  --surface: #221b10;
  --surface-2: #2b2213;
  --text: #eee1c4;
  --muted: #a7936f;
  --line: #443821;
  --line-strong: #6b5527;
  --accent: #c86a76;
  --accent-soft: #3a2228;
  --gold: #d3a559;
  --good: #6f9c6f;
  --warn: #d29a4c;
  --badge-bg: #2c2414;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

[hidden] { display: none !important; }

body {
  background: radial-gradient(ellipse at 50% -20%, var(--bg-1), var(--bg-2)) fixed;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  font-size: 17px;
  transition: background 0.25s ease, color 0.25s ease;
}

/* ---- top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.topbar-inner { padding: 14px 18px 2px; text-align: center; }
.app-title {
  margin: 0;
  font-family: var(--font-black);
  font-weight: normal;
  font-size: 2rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 1.1;
}
.app-subtitle {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  align-items: center;
  padding: 12px 18px 14px;
}
.btn {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.date-input {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 7px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

/* ---- layout ---- */
.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: inset 0 0 0 4px var(--surface), inset 0 0 0 5px var(--line), var(--shadow);
  border-radius: var(--radius);
  padding: 24px 26px;
}


/* ---- ornaments & headings ---- */
.ornament {
  text-align: center;
  color: var(--accent);
  font-size: 1.15rem;
  line-height: 1;
  margin: 10px 0 14px;
}
.ornament::before, .ornament::after {
  content: "";
  display: inline-block;
  width: 72px;
  height: 1px;
  background: var(--line-strong);
  vertical-align: middle;
  margin: 0 14px;
}
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  color: var(--accent);
  margin: 0 0 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-strong);
}
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 18px 0 8px;
}
.small { color: var(--muted); font-size: 0.82rem; }

/* ---- header card ---- */
.header-card .feast-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.28;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin: 0 0 4px;
  text-align: center;
}
.header-card .feast-date {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin: 0;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}
.badge {
  font-family: var(--font-display);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--badge-bg);
  border: 1px solid var(--line-strong);
}
.badge.rank { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.color-dot {
  display: inline-block;
  width: 0.8em; height: 0.8em;
  border-radius: 50%;
  vertical-align: baseline;
  margin-right: 5px;
  border: 1px solid rgba(0, 0, 0, 0.3);
}
.theme-text { color: var(--muted); font-style: italic; margin: 6px 0 0; text-align: center; }
.theme-text::before {
  content: "Theme of the day: ";
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--accent);
}

/* ---- glance grid (definition list) ---- */
.glance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
}
.glance-item {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 13px;
  margin: 0;
}
.glance-item dt {
  font-family: var(--font-display);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.glance-item dd {
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 500;
}
.colour-value { display: inline-flex; align-items: center; gap: 8px; }
.colour-value .color-dot { margin-right: 0; vertical-align: middle; width: 0.85em; height: 0.85em; }

/* ---- mass ---- */
.reading-list { list-style: none; padding: 0; margin: 8px 0; }
.reading-list li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.reading-list li:last-child { border-bottom: 0; }
.reading-list .rl-label { font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; }


/* ---- hours ---- */
.hour-list { list-style: none; margin: 0; padding: 0; }
.hour-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 10px 0;
  padding: 13px 15px;
  background: var(--surface);
}
.hour-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.hour-title { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; letter-spacing: 0.04em; }
.hour-meta { color: var(--muted); font-size: 0.8rem; }
.override-tag {
  font-family: var(--font-display);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
}
.override-psalter { background: var(--good); color: #fff; }
.override-proper { background: var(--warn); color: #fff; }
.override-sunday1 { background: var(--gold); color: #fff; }
.override-fixed { background: var(--accent); color: #fff; }
.cites { margin: 9px 0 0; font-size: 0.94rem; }
.cites .cite-label { font-family: var(--font-display); font-weight: 600; font-size: 0.86rem; }
.notes { color: var(--muted); font-size: 0.82rem; margin: 6px 0 0; padding-left: 18px; }
.notes li { margin: 3px 0; }
.source-line { font-size: 0.78rem; color: var(--muted); margin-top: 7px; }
.source-line .k { font-family: var(--font-display); font-weight: 600; letter-spacing: 0.04em; color: var(--text); }

/* ---- sacred art ---- */
.sacred-art { margin: 0; text-align: center; }
.sacred-art img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 440px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sacred-art figcaption {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 9px;
  line-height: 1.4;
}
.sacred-art figcaption a { color: var(--accent); text-decoration: none; }
.sacred-art figcaption a:hover { text-decoration: underline; }

/* ---- psalter table ---- */
.psalter-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.psalter-table th, .psalter-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.psalter-table th { font-family: var(--font-display); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; background: var(--surface-2); }
.psalter-table td.day { font-family: var(--font-display); font-weight: 600; white-space: nowrap; }
.psalter-table .today { background: var(--accent-soft); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.psalter-table.week-table { min-width: 560px; }

/* ---- sources ---- */
.sources-list { font-size: 0.86rem; }
.sources-list li { margin: 6px 0; }
code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}

.foot {
  color: var(--muted);
  font-style: italic;
  font-size: 0.82rem;
  text-align: center;
  padding: 4px 6px 24px;
}

@media (max-width: 520px) {
  .controls { gap: 6px; }
  .btn { padding: 7px 9px; }
  .card { padding: 18px 16px; }
  .feast-name { font-size: 1.25rem; }
  .psalter-table { font-size: 0.78rem; }
  .psalter-table th, .psalter-table td { padding: 5px 6px; }
  .psalter-table td.day { white-space: normal; }
}
