:root {
  --bg: #f7f1e6;
  --surface: #fffaf1;
  --ink: #2a2135;
  --muted: #6b5f70;
  --line: #e4d8c3;
  --gold: #b8862b;
  --gold-soft: #f3e3bd;
  --night: #1d1830;
  --night-2: #2f2550;
  --on-night: #f6efe0;

  /* Advent week colors */
  --hope: #6a4c93;
  --peace: #3f5e96;
  --joy: #c0587e;
  --love: #b8862b;

  --radius: 14px;
  --shadow: 0 1px 2px rgba(42, 33, 53, .06), 0 8px 24px rgba(42, 33, 53, .08);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15121f;
    --surface: #1f1a2d;
    --ink: #efe7d8;
    --muted: #b3a8b8;
    --line: #362e48;
    --gold: #e0b057;
    --gold-soft: #3a3020;
    --hope: #a88bd6;
    --peace: #86a5dd;
    --joy: #e58aad;
    --love: #e0b057;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg: #15121f;
  --surface: #1f1a2d;
  --ink: #efe7d8;
  --muted: #b3a8b8;
  --line: #362e48;
  --gold: #e0b057;
  --gold-soft: #3a3020;
  --hope: #a88bd6;
  --peace: #86a5dd;
  --joy: #e58aad;
  --love: #e0b057;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  text-align: center;
  padding: 56px 16px 64px;
  color: var(--on-night);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(224, 176, 87, .25), transparent 60%),
    radial-gradient(1px 1px at 12% 30%, #fff8, transparent),
    radial-gradient(1px 1px at 82% 22%, #fff9, transparent),
    radial-gradient(1.5px 1.5px at 68% 62%, #fff7, transparent),
    radial-gradient(1px 1px at 28% 72%, #fff6, transparent),
    radial-gradient(1px 1px at 92% 70%, #fff7, transparent),
    linear-gradient(180deg, var(--night), var(--night-2));
}
.hero-star {
  width: 40px; height: 40px;
  fill: #e8bd62;
  filter: drop-shadow(0 0 12px rgba(232, 189, 98, .8));
}
.eyebrow {
  margin: 12px 0 0;
  font-size: 13px;
  letter-spacing: .18em;
  text-transform: uppercase;
  opacity: .8;
}
.hero h1 {
  margin: 4px 0 6px;
  font: 600 clamp(40px, 8vw, 68px)/1.05 var(--serif);
  letter-spacing: .01em;
}
.hero h1 em { color: #e8bd62; font-style: italic; }
.hero-sub { margin: 0; opacity: .85; font-size: 16px; }
.today {
  display: inline-block;
  margin: 20px 0 0;
  padding: 4px 14px;
  border: 1px solid rgba(246, 239, 224, .3);
  border-radius: 999px;
  font-size: 14px;
}
.today:empty { display: none; }

/* ---------- Layout ---------- */
.wrap {
  max-width: 760px;
  margin: -32px auto 0;
  padding: 0 16px 48px;
  position: relative;
}

/* ---------- Reader ---------- */
.reader {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 5vw, 44px);
  border-top: 6px solid var(--week, var(--gold));
}
.loading, .error { color: var(--muted); text-align: center; margin: 24px 0; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.week-pill {
  color: var(--week);
  font-weight: 700;
}
.today-pill {
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: .1em;
}
.reader h2 {
  margin: 6px 0 4px;
  font: 600 clamp(32px, 6vw, 44px)/1.1 var(--serif);
}
.passage {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 16px;
}
.passage strong { color: var(--ink); font-weight: 600; }

.day-image { margin: 0 0 28px; }
.day-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.verse {
  margin: 0 0 28px;
  padding: 18px 22px;
  border-left: 3px solid var(--week);
  background: color-mix(in srgb, var(--week) 8%, transparent);
  border-radius: 0 10px 10px 0;
}
.verse p {
  margin: 0;
  font: italic 500 24px/1.4 var(--serif);
}
.verse cite {
  display: block;
  margin-top: 8px;
  font: 600 13px/1 var(--sans);
  font-style: normal;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.label {
  margin: 28px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--week);
}
.body-text { margin: 0; font-size: 19px; }

.prompts {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}
.prompt {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px 16px;
}
.prompt .label { margin-top: 0; }
.prompt p:last-child { margin: 0; }

.prayer {
  margin-top: 28px;
  padding: 20px 22px;
  background: var(--gold-soft);
  border-radius: 12px;
}
.prayer .label { margin-top: 0; color: var(--gold); }
.prayer p:last-child {
  margin: 0;
  font: italic 500 21px/1.5 var(--serif);
}

.share { margin-top: 28px; }
.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: 600 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.share-btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.share-btn:hover { border-color: var(--week); color: var(--week); }
.share-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.share-native {
  background: var(--week);
  border-color: var(--week);
  color: #fff;
}
.share-native:hover { color: #fff; filter: brightness(1.08); }

.nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: 600 15px/1 var(--sans);
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  min-height: 44px;
}
.btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:focus-visible, .door:focus-visible, summary:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* Before December 1 */
.waiting { text-align: center; padding: 12px 0; }
.waiting h2 { margin-top: 0; }
.waiting .count {
  font: 700 64px/1 var(--serif);
  color: var(--gold);
  margin: 8px 0 0;
}

/* ---------- Calendar ---------- */
.calendar-section { margin-top: 48px; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
}
.section-head h2 { margin: 0; font: 600 32px/1.2 var(--serif); }
.legend {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; margin-left: 8px;
}
.dot:first-child { margin-left: 0; }
.dot-hope { background: var(--hope); }
.dot-peace { background: var(--peace); }
.dot-joy { background: var(--joy); }
.dot-love { background: var(--love); }
.cal-note { color: var(--muted); font-size: 15px; margin: 6px 0 16px; }

.calendar {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
@media (max-width: 600px) {
  .calendar { grid-template-columns: repeat(4, 1fr); gap: 8px; }
}
.door {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-bottom: 4px solid var(--week);
  background: var(--surface);
  color: var(--ink);
  font: 700 26px/1 var(--serif);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.door small {
  font: 600 10px/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.door:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow); }
.door.is-today {
  background: var(--week);
  color: #fff;
  border-color: var(--week);
}
.door.is-today small { color: rgba(255,255,255,.85); }
.door.is-current { box-shadow: 0 0 0 3px var(--gold); }
.door:disabled {
  cursor: not-allowed;
  background: transparent;
  border-style: dashed;
  border-bottom-style: dashed;
  color: var(--muted);
  opacity: .7;
}
.door svg { width: 14px; height: 14px; fill: currentColor; }

/* ---------- How to ---------- */
.howto {
  margin-top: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 22px;
}
.howto summary {
  cursor: pointer;
  padding: 14px 0;
  font: 600 22px/1.3 var(--serif);
}
.howto-body { padding-bottom: 16px; font-size: 17px; }
.howto-body h3 {
  margin: 18px 0 2px;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
}
.howto-body p { margin: 0 0 6px; }

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  padding: 32px 16px 48px;
  color: var(--muted);
  font: italic 500 20px/1.4 var(--serif);
}
.footer span {
  display: block;
  font: 600 12px/1.6 var(--sans);
  font-style: normal;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* Week color applied per devotional / door */
[data-week="HOPE"] { --week: var(--hope); }
[data-week="PEACE"] { --week: var(--peace); }
[data-week="JOY"] { --week: var(--joy); }
[data-week="LOVE & CHRIST"] { --week: var(--love); }

@media print {
  .hero, .calendar-section, .howto, .nav, .share, .footer { display: none; }
  body { background: #fff; }
  .wrap { margin: 0; }
  .reader { box-shadow: none; border: none; }
}
