:root {
  color-scheme: light dark;

  --bg: #faf8f4;
  --bg-elevated: #ffffff;
  --text: #221f1a;
  --text-muted: #5c574d;
  --border: #e2ddd2;
  --accent-fixed: #7a1f2b;       /* Mission Least-style deep, dignified red */
  --focus-ring: #2563eb;

  /* liturgical accent, overridden per "today" by JS */
  --liturgical: #3E7A4C;
  --liturgical-contrast: #ffffff;

  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #161512;
  --bg-elevated: #201f1b;
  --text: #f2efe9;
  --text-muted: #b6b0a3;
  --border: #37342c;
  --accent-fixed: #d98a92;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161512;
    --bg-elevated: #201f1b;
    --text: #f2efe9;
    --text-muted: #b6b0a3;
    --border: #37342c;
    --accent-fixed: #d98a92;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding-block: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand .name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand .tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}
.theme-toggle:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.today-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 28px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 5px solid var(--liturgical);
}
.today-strip .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--liturgical);
  flex-shrink: 0;
}
.today-strip .label { font-size: 0.9rem; color: var(--text-muted); }
.today-strip .label strong { color: var(--text); font-weight: 600; }

h1 { font-size: 1.6rem; margin: 0 0 6px; }
p.lede { color: var(--text-muted); margin-top: 0; }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}
select:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

.diocese-detail {
  border-top: 1px dashed var(--border);
  padding-top: 16px;
  margin-top: 4px;
}
.diocese-detail .note {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 8px 0 14px;
}
.diocese-detail .sources {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.diocese-detail .sources a { color: inherit; }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 6px;
}
.switch {
  position: relative;
  width: 42px; height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.slider::before {
  content: "";
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; top: 3px;
  background: var(--bg-elevated);
  border-radius: 50%;
  transition: transform 0.15s;
}
input:checked + .slider { background: var(--liturgical); }
input:checked + .slider::before { transform: translateX(18px); }

.preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 14px;
  margin: 14px 0;
  background: var(--bg);
}
.preview-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 10px 0 4px;
}
.preview ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.preview li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}
.preview li:first-child { border-top: none; }
.preview li .ev-date {
  flex-shrink: 0;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.preview li .ev-name { text-align: right; }
.preview li .ev-note {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
.preview li.past { opacity: 0.5; }

.feed-buttons {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
  margin-top: 12px;
}
@media (min-width: 480px) {
  .feed-buttons { grid-template-columns: 1fr 1fr; }
}

.btn {
  display: block;
  text-align: center;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--liturgical);
  background: var(--liturgical);
  color: var(--liturgical-contrast);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
}
.btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
  font-weight: 500;
}
.btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

.copy-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.copy-row input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.copy-row button {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 0.78rem;
  cursor: pointer;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
footer a { color: var(--accent-fixed); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
