:root {
  color-scheme: light;
  --ivory: #f9ecdf;
  --burgundy: #71192a;
  --wine: #511321;
  --gold: #a87941;
  --ink: #4b2e29;
  --sans: system-ui, -apple-system, sans-serif;
  --serif: Georgia, 'Times New Roman', serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #f4e4d5; color: var(--ink); font-family: var(--serif); }
button, select { font: inherit; }
button:focus-visible, select:focus-visible { outline: 3px solid var(--wine); outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.preview {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.45rem 0.65rem;
  padding: 0.58rem 1rem; background: #531724; color: #fff4e9; font: 0.875rem/1.3 var(--sans);
}
.preview span { font-weight: 650; margin-right: 0.55rem; }
.preview select {
  max-width: 100%; background: #fff4e9; color: var(--wine); padding: 0.3rem 0.42rem;
  border: 1px solid #dbb584; border-radius: 0.25rem;
}
.preview select:focus-visible { outline-color: #fff4e9; }
.calendar {
  position: relative; isolation: isolate; overflow: hidden;
  margin: 0 auto; min-height: calc(100svh - 3rem);
  padding: clamp(1.7rem, 4.2vw, 4rem) 1.1rem 1.8rem;
  background: radial-gradient(ellipse at 50% 36%, #fff7ec 0%, #f9ecdf 52%, #ead0bb 100%);
  display: flex; flex-direction: column; align-items: center;
  box-shadow: inset 0 0 0 1px #b88e64;
}
.calendar::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: url('./natal.webp') center top / max(100%, 950px) 100% no-repeat;
}
.heading, .footer { text-align: center; color: var(--burgundy); }
.heading { width: min(100%, 43rem); }
.year, .subtitle, .footer p, .date {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.82rem;
}
.year { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin: 0 0 0.65rem; }
.year span { width: 1.2rem; height: 1px; background: var(--gold); }
h1 { margin: 0 auto; width: 100%; font-size: clamp(1.6rem, 5vw, 4.6rem); line-height: 1; }
h1 img { display: block; width: 100%; height: auto; }
.subtitle { margin: 0.55rem 0 0; font-size: clamp(0.76rem, 1.4vw, 1rem); }
.star-rule {
  display: flex; justify-content: center; align-items: center; gap: 0.55rem;
  color: var(--burgundy); margin: 0.75rem auto 0; font-size: 1.12rem; line-height: 1;
}
.star-rule::before, .star-rule::after { content: ''; width: 2.8rem; height: 1px; background: #bd9567; }
.board { width: min(100%, 47rem, 68vw); }
.status {
  text-align: center; min-height: 1.25em; margin: 0.75rem 0 0.8rem;
  font: 0.875rem/1.4 var(--sans); color: var(--wine);
}
.doors {
  list-style: none; padding: 0; margin: 0; display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(0.45rem, 1.1vw, 0.9rem);
}
.door {
  position: relative; display: block; width: 100%; aspect-ratio: 1.17; min-height: 44px;
  border: 1px solid #b68950; border-radius: clamp(0.42rem, 1.15vw, 0.98rem);
  background: #fae9d6 url('./janelas.webp') no-repeat;
  background-size: 600% 400%;
  background-position: var(--column) var(--row);
  box-shadow: 0 3px 8px #603a2320, inset 0 0 0 2px #fff2da80;
  color: var(--wine); padding: 0;
}
.door[data-state="open"] {
  cursor: pointer; border: 2px solid #8f323f;
  box-shadow: 0 0 0 2px #d9a66c85, 0 3px 9px #74334627;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.door[data-state="open"]:hover { transform: translateY(-3px); box-shadow: 0 0 0 2px #d9a66c, 0 6px 14px #74334652; }
.door:disabled { opacity: 1; cursor: default; }
.door-mark {
  position: absolute; right: 4px; bottom: 4px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff5e8; color: #6a493b;
  display: grid; place-items: center; box-shadow: 0 0 0 1px #b68b5e80;
}
.door-mark svg { width: 10px; height: 10px; }
.door[data-state="open"] .door-mark { background: var(--burgundy); color: #fff6df; box-shadow: none; }
.footer { margin-top: clamp(1rem, 3vw, 2rem); }
.footer p { margin: 0; line-height: 1.65; font-weight: 600; }
dialog {
  width: min(37rem, calc(100% - 1.6rem)); max-height: calc(100dvh - 2rem);
  padding: 0; border: 1px solid #b58c5b; border-radius: 1rem;
  background: #fff6ea; color: var(--ink); box-shadow: 0 18px 85px #2c0c1a66;
}
dialog::backdrop { background: #381b22a3; backdrop-filter: blur(4px); }
body:has(dialog[open]) { overflow: hidden; }
.reading { margin: 0.48rem; padding: clamp(1.2rem, 5vw, 3rem); border: 1px solid #dabd94; border-radius: 0.65rem; }
.date, .reading h2, .reading form { text-align: center; color: var(--burgundy); }
.date { margin: 0; }
.reading h2 {
  font-weight: 400; font-size: clamp(1.75rem, 5.5vw, 2.65rem);
  line-height: 1.15; margin: 1rem auto 1.2rem; outline: none;
}
.reading-body { font-size: clamp(1.06rem, 2.7vw, 1.2rem); line-height: 1.65; overflow-wrap: anywhere; }
.reading-body p { margin: 0 0 0.9rem; white-space: pre-wrap; }
.reading-body p.challenge { background: #f6e6d4; border-inline-start: 2px solid #a77746; padding: 0.65rem 0.9rem; }
.reading-body p.scripture { color: var(--burgundy); font-style: italic; font-size: 0.97rem; }
.return {
  min-height: 44px; padding: 0.65rem 1.1rem; margin: 0.35rem auto 0; cursor: pointer;
  font: 550 0.92rem var(--sans); background: var(--burgundy); color: #fff6e9;
  border: 1px solid var(--burgundy); border-radius: 0.35rem;
}
.return:hover { background: var(--wine); }
@media (max-width: 700px) {
  .calendar { padding: 2.2rem 1.05rem 4.6rem; min-height: calc(100svh - 3.1rem); }
  .calendar::before {
    background-position: center top;
    background-size: max(132%, 480px) auto;
    mask-image: linear-gradient(#000 0%, #000 35%, transparent 67%);
    opacity: 0.76;
  }
  .calendar::after {
    content: ''; position: absolute; inset: auto 0 0; z-index: -1; height: 9rem;
    background: url('./natal.webp') center bottom / max(113%, 430px) auto no-repeat;
    mask-image: linear-gradient(transparent, #000 70%); opacity: 0.9;
  }
  .board { width: min(100%, 28rem); }
  .doors { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .status { margin-bottom: 0.95rem; }
  .footer { margin-top: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) {
  .door { transition: none !important; }
}
