/* VOICE: quiet, reverent, warm — a devotional, not a dashboard
   IDEA: an Advent calendar — 25 numbered doors, one opened each day in December
   PICTURE: the door grid itself, with today's door glowing gold and read doors sealed with a check
   COLOUR and TYPE: evergreen field, cranberry for section marks, gold accent; Playfair titles, Lora reading text
   LAYOUT: title + progress, door calendar, then the open reading as a calm single column with prev/next */
:root {
  color-scheme: light dark;

  --bg: light-dark(#f7f4ee, #0f1a14);
  --field: light-dark(#163d2b, #0b2418);
  --card: light-dark(#fff, #16241c);
  --ink: light-dark(#1d2420, #ece8df);
  --soft: light-dark(#5b665f, #a9b3ab);
  --red: light-dark(#b3202c, #e8606a);
  --red-fill: #b3202c;
  --gold: #d9a93a;
  --line: light-dark(#e3ddd0, #2a3a30);
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  min-width: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    17px/1.65 Lora,
    Georgia,
    serif;
  overflow-x: clip;
}

h1,
h2,
h3 {
  font-family: "Playfair Display", Georgia, serif;
  line-height: 1.08;
  text-wrap: balance;
  margin: 0;
}

.top {
  background: var(--field);
  color: #f4efe2;
  padding: clamp(24px, 4vw, 48px) max(5vw, 16px) clamp(20px, 3vw, 36px);
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
}

.top h1 {
  font-size: clamp(32px, 6vw, 48px);
}

.top h1 span {
  color: var(--gold);
}

.sub {
  color: #cfd8cf;
  margin: 8px 0 18px;
  font-size: 16px;
}

.bar {
  height: 10px;
  border-radius: 99px;
  background: rgb(255 255 255 / 15%);
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--gold);
  width: 0;
  transition: width 0.5s;
}

.stat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: #cfd8cf;
  margin-top: 8px;
  flex-wrap: wrap;
}

.cal {
  max-width: 560px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
}

.door {
  position: relative;
  aspect-ratio: 1/1;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 10px;
  background: rgb(255 255 255 / 6%);
  color: #f4efe2;
  font:
    700 clamp(18px, 4vw, 26px) "Playfair Display",
    serif;
  cursor: pointer;
  display: grid;
  place-items: center;
  min-height: 44px;
  transition:
    transform 0.15s,
    background 0.15s;
}

.door:hover {
  background: rgb(255 255 255 / 12%);
}

.door:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.door.today {
  background: var(--gold);
  color: #1f2a20;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgb(217 169 58 / 30%);
}

.door.sel {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.door.done {
  background: var(--red-fill);
  border-color: var(--red-fill);
}

.door.done::after {
  content: "✓";
  position: absolute;
  top: 3px;
  right: 7px;
  font:
    600 13px Lora,
    serif;
}

.door.d25 {
  grid-column: span 5;
  aspect-ratio: auto;
  padding: 12px;
  font-size: 20px;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #cfd8cf;
  margin-top: 12px;
}

.legend b {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: -1px;
  margin-right: 5px;
}

main {
  padding: clamp(24px, 4vw, 48px) max(5vw, 16px) 64px;
}

.sec {
  color: var(--red);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  margin: 0 0 6px;
}

.read h2 {
  font-size: clamp(28px, 5vw, 40px);
}

.date {
  color: var(--soft);
  font-size: 15px;
  margin: 6px 0 22px;
}

.text {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(18px, 3.5vw, 32px);
  font-size: clamp(17px, 2.4vw, 19px);
  line-height: 1.75;
}

.text p {
  margin: 0 0 0.6em;
}

.text p:last-child {
  margin: 0;
}

.text sup {
  color: var(--red);
  font-size: 12px;
  font-weight: 600;
  margin-right: 4px;
  font-family: system-ui, sans-serif;
}

.acts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin: 20px 0;
}

button.b,
a.b {
  font:
    600 16px Lora,
    serif;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

button.b:focus-visible,
a.b:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

button.mark {
  background: var(--field);
  color: #fff;
  border-color: var(--field);
}

button.mark.on {
  background: var(--red-fill);
  border-color: var(--red-fill);
}

.nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.note {
  font-size: 13px;
  color: var(--soft);
  margin-top: 28px;
}

.note a {
  color: inherit;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

@media (width <= 600px) {
  .cal {
    gap: 6px;
  }

  .door.done::after {
    top: 1px;
    right: 4px;
    font-size: 11px;
  }
}

.legend .k-today {
  background: var(--gold);
}

.legend .k-read {
  background: var(--red-fill);
}

.legend .k-todo {
  background: rgb(255 255 255 / 15%);
  border: 1px solid rgb(255 255 255 / 30%);
}

button.b.small {
  min-height: 36px;
  padding: 4px 12px;
  font-size: 13px;
  margin-left: 6px;
}

.err {
  color: var(--red);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.read h2:focus {
  outline: none;
}

.read h2:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
}

/* Wide screens: calendar in a sticky left column, reading beside it. */
@media (width >= 1000px) {
  body {
    display: grid;
    grid-template-columns: minmax(400px, 460px) minmax(0, 1fr);
  }

  .top {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }

  .top h1 {
    font-size: 44px;
  }

  main .wrap {
    max-width: 720px;
  }
}
