:root {
  color-scheme: light;
  --paper: #f5ebd4;
  --calendar-ink: #263b32;
  --wine: #782c30;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Raleway, system-ui, sans-serif;
  background: #eee3ca;
  color: var(--calendar-ink);
  font-family: var(--sans);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: #eee3ca; color: var(--calendar-ink); font-weight: 400; line-height: normal; }
[hidden] { display: none !important; }
.site-header a { color: inherit; }
.site-header {
  width: min(100% - 2rem, 68rem);
  min-height: 4.35rem;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid #9b764a65;
}
.author-brand { font: 700 1.6rem/.92 var(--serif); text-decoration: none; }
.author-brand span {
  display: block;
  margin-top: .43rem;
  font: 700 .55rem/1 var(--sans);
  letter-spacing: .18em;
  text-transform: uppercase;
}
.site-return { font-size: .78rem; font-weight: 600; text-decoration: underline; text-underline-offset: .22em; }
.site-return span { margin-left: .25rem; color: var(--wine); }
.countdown { width: min(100% - 2rem, 68rem); margin: 0 auto; padding: 0 0 1.4rem; }
.intro { text-align: center; margin: 1.25rem auto .95rem; }
.eyebrow {
  margin: 0;
  color: var(--wine);
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .23em;
  text-transform: uppercase;
}
.intro h1 {
  margin: .24rem 0 0;
  color: var(--wine);
  font: 600 clamp(2.55rem, 6vw, 4.55rem)/.92 var(--serif);
  letter-spacing: -.025em;
}
.intro h1 em { font-weight: 600; }
.season { margin: .48rem 0 0; font: 700 clamp(1.05rem, 2.1vw, 1.25rem)/1 var(--serif); }
.intro .instructions { margin: .55rem auto 0; max-width: 38rem; font-size: .84rem; font-weight: 500; line-height: 1.48; }
.sound-toggle {
  margin-top: .55rem;
  min-height: 2.75rem;
  padding: .35rem .8rem;
  border: 1px solid #9b764a;
  border-radius: .25rem;
  background: var(--paper);
  color: var(--calendar-ink);
  font: 700 .75rem/1 var(--sans);
  cursor: pointer;
}
.sound-toggle:hover { background: #e9dbbb; }
.sound-toggle:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }
.picture-frame {
  overflow: hidden;
  position: relative;
  isolation: isolate;
  width: min(100%, max(44rem, calc((100svh - 15rem) * 1.5)));
  margin-inline: auto;
  aspect-ratio: 3 / 2;
  box-shadow: 0 .6rem 1.4rem #3e2a2040;
}
.tree {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: inline-size;
  transform: translate(var(--pan-x, 0px), var(--pan-y, 0px)) scale(var(--zoom, 1));
  transform-origin: top left;
  transition: transform 1.3s cubic-bezier(.2, .7, .22, 1);
}
.scene { display: block; width: 100%; height: 100%; }
.hanger {
  --body-height: calc(clamp(1.58rem, 5.55cqw, 3.78rem) * var(--size));
  --string-length: clamp(.45rem, 1.45cqw, .91rem);
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 0;
  height: 0;
}
.cord {
  position: absolute;
  left: -.5px;
  width: 1px;
  height: calc(var(--string-length) + .08rem);
  background: #e7d3a7;
  box-shadow: 0 0 1px #342a1a;
}
.door {
  position: absolute;
  top: calc(var(--string-length) + var(--body-height) * .5);
  left: 0;
  width: max(2.75rem, var(--body-height));
  height: max(2.75rem, var(--body-height));
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.door:disabled { cursor: default; }
.hanger:has([data-state="today"]) { z-index: 2; }
.bauble {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--body-height) * var(--ratio));
  height: var(--body-height);
  transform: translate(var(--pivot), -50%);
  filter: drop-shadow(0 .16rem .09rem #1f281db0);
  pointer-events: none;
}
.painted { position: absolute; inset: 0; background-repeat: no-repeat; }
.ring {
  --ring-size: clamp(.25rem, .88cqw, .49rem);
  position: absolute;
  top: calc(var(--ring-size) * -.77);
  left: calc(var(--pivot) * -1);
  transform: translateX(-50%);
  width: var(--ring-size);
  height: var(--ring-size);
  border: 1px solid #efede4;
  border-right-color: #a7aeaa;
  border-bottom-color: #737b7d;
  border-radius: 48%;
  box-shadow: 0 0 1px #37433e;
}
.door[data-state="today"] .bauble {
  filter: drop-shadow(0 0 2px #fff6c9) drop-shadow(0 0 7px #ffc64f);
}
.aura, .twinkle { position: absolute; display: none; pointer-events: none; }
.door[data-state="today"] .aura, .door[data-state="today"] .twinkle { display: block; }
.aura {
  inset: -48%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff1ad 0%, #ffce66b3 30%, #ffc15c52 49%, transparent 70%);
  animation: glow 2.8s ease-in-out infinite;
}
.twinkle {
  width: clamp(.82rem, 2.45cqw, 1.3rem);
  aspect-ratio: 1;
  filter: drop-shadow(0 0 2px #ffd467) drop-shadow(0 0 4px #ffbe49);
  animation: twinkle 2.8s ease-in-out infinite;
}
.twinkle::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, #fffdf1 15%, #ffe59e 70%);
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}
.twinkle.one { left: -14%; top: -13%; }
.twinkle.two { right: -14%; top: 21%; animation-delay: -.94s; }
.twinkle.three { bottom: -9%; left: 0; animation-delay: -1.87s; }
.door:not(:disabled):hover .bauble { filter: brightness(1.12) drop-shadow(0 0 5px #ffc64f); }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 2px solid #862e3b; outline-offset: 4px; }
.door:focus-visible { outline-color: #fff4c5; border-radius: 50%; }
@keyframes glow {
  0%, 100% { opacity: .62; transform: scale(.92); }
  50% { opacity: .96; transform: scale(1.1); }
}
@keyframes twinkle {
  0%, 62%, 100% { opacity: .3; transform: scale(.68); }
  23% { opacity: 1; transform: scale(1.24); }
}
dialog {
  margin: auto;
  width: min(44rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0;
  color: var(--calendar-ink);
  background: transparent;
  border: 0;
}
dialog::backdrop { background: #1a231ec4; }
.reveal-content { position: relative; padding: .6rem .95rem .95rem; }
.reveal-content form { position: absolute; z-index: 2; top: 0; right: .35rem; }
.close { width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: var(--calendar-ink); color: var(--paper); font: 1.5rem var(--sans); cursor: pointer; }
.card-leaf, .card-art, .card-front, .reveal-copy { min-width: 0; }
.reveal-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: min(27rem, 72svh);
  perspective: 1400px;
}
.card-leaf {
  position: relative;
  z-index: 1;
  display: grid;
  transform-origin: right center;
  transform-style: preserve-3d;
}
.card-art, .card-front, .reveal-copy {
  display: grid;
  align-content: center;
  border: 1px solid #bb996a;
  background: var(--paper);
  box-shadow: 0 .32rem .85rem #1d17134d;
}
.card-art, .card-front { backface-visibility: hidden; border-radius: .3rem 0 0 .3rem; }
.card-art { padding: clamp(.75rem, 3vw, 1.55rem); background: linear-gradient(90deg, #faf1dc 93%, #e4d2af); }
.card-art a { display: block; width: fit-content; max-width: 100%; margin-inline: auto; }
.card-art a[href]:hover img { outline: 2px solid var(--wine); outline-offset: 3px; }
.card-art img { width: auto; max-width: 100%; max-height: 58svh; display: block; object-fit: contain; border-radius: .15rem; }
.card-front {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
  background:
    radial-gradient(ellipse at 50% 46%, #9e4540, transparent 64%),
    #782c30;
}
.card-front::after {
  content: "";
  position: absolute;
  inset: 6%;
  border: 4px double #e2bc79;
  border-radius: .22rem;
}
.reveal-copy {
  align-content: center;
  padding: clamp(1.05rem, 4vw, 2.15rem);
  border-left: 0;
  border-radius: 0 .3rem .3rem 0;
  background: linear-gradient(90deg, #e3d1ae, #fbf2de 7%);
}
dialog[open] .card-leaf { animation: unfold-card .85s cubic-bezier(.25,.65,.25,1) both; }
dialog[open] .reveal-copy { animation: reveal-page .65s ease-out both; }
@keyframes unfold-card { from { transform: rotateY(177deg); } to { transform: rotateY(0deg); } }
@keyframes reveal-page { 0%, 28% { opacity: 0; } to { opacity: 1; } }
.reveal-copy h2 { margin: .6rem 0; color: var(--wine); font: 700 clamp(2rem, 4vw, 3.4rem)/.95 var(--serif); overflow-wrap: anywhere; }
#book-author { margin: 0 0 1.2rem; font-size: .83rem; line-height: 1.5; }
.book-button { justify-self: start; display: inline-flex; align-items: center; min-height: 2.75rem; background: var(--wine); color: var(--paper); padding: .65rem .85rem; border-radius: .23rem; font-size: .81rem; font-weight: 700; text-decoration: none; }
.book-button span[aria-hidden] { margin-left: .3rem; }
.book-button[aria-disabled="true"] { background: #a36e65; color: #fffaf0; }
.noscript { margin: 1rem; }
@media (max-width: 620px) {
  .site-header, .countdown { width: calc(100% - 1rem); }
  .site-header { padding-inline: .45rem; }
  .intro { margin-top: .95rem; }
  .intro .instructions { margin-inline: .45rem; font-size: .78rem; }
  .picture-frame { width: 100%; aspect-ratio: .94; }
  .tree { position: absolute; width: calc(150% / .94); left: 50%; translate: -50% 0; }
}
@media (max-width: 520px) and (orientation: portrait) {
  .site-return { font-size: .72rem; }
  .reveal-card { grid-template-columns: 1fr; min-height: 0; }
  .card-leaf { transform-origin: center bottom; }
  .card-art, .card-front { border-radius: .3rem .3rem 0 0; }
  .card-art { background: linear-gradient(180deg, #faf1dc 92%, #e4d2af); }
  .card-art img { max-height: 38svh; }
  .reveal-copy { padding: .95rem; }
  #book-author { margin-bottom: .8rem; }
  .card-front { transform: rotateX(180deg); }
  .reveal-copy { border-left: 1px solid #bb996a; border-top: 0; border-radius: 0 0 .3rem .3rem; background: linear-gradient(180deg, #e3d1ae, #fbf2de 8%); text-align: center; }
  .book-button { justify-self: center; }
  dialog[open] .card-leaf { animation-name: unfold-card-mobile; }
}
@media (max-width: 520px) and (max-height: 620px) and (orientation: portrait) {
  .card-art { padding: .6rem; }
  .card-art img { max-height: 33svh; }
  .reveal-copy { padding: .75rem; }
}
@media (max-height: 500px) and (orientation: landscape) {
  dialog { max-height: calc(100% - 1rem); }
  .reveal-card { min-height: 0; }
  .card-art, .reveal-copy { padding: .75rem; }
  .card-art img { max-height: 54svh; }
  #book-author { margin-bottom: .65rem; }
}
@keyframes unfold-card-mobile { from { transform: rotateX(-177deg); } to { transform: rotateX(0deg); } }
@media (prefers-reduced-motion: reduce) {
  .aura, .twinkle, dialog[open] .card-leaf, dialog[open] .reveal-copy { animation: none; }
  .tree { transition: none; }
}

/* Preserve the calendar layout alongside the shared site footer on narrow screens. */
@media (max-width: 768px) {
  .countdown { padding: 0 0 1.4rem !important; }
  .intro h1 { font-size: clamp(2.55rem, 6vw, 4.55rem) !important; }
  .reveal-copy h2 { font-size: clamp(2rem, 4vw, 3.4rem) !important; }
}
