:root {
  --ink: #46506e;
  --ink-soft: #7a84a3;
  --bg-top: #eaf1fb;
  --bg-bottom: #f6eef5;
  --card: #fdfcff;

  --ice: #cfe2f6;
  --lavender: #ddd5f3;
  --blush: #f5d8e2;
  --mint: #d2eee3;
  --butter: #f6ecce;
  --peri: #ccd6f3;

  --radius: 18px;
  --shadow: 0 1px 2px rgba(70, 80, 110, .06), 0 8px 24px -8px rgba(70, 80, 110, .18);
}

* { box-sizing: border-box; }

html { background: var(--bg-bottom); }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}

#snow {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

main {
  position: relative; z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(28px, 6vw, 64px) 20px 40px;
}

/* ── Header ───────────────────────────────── */
.masthead { text-align: center; margin-bottom: clamp(24px, 5vw, 44px); }

.flake-mark {
  width: 34px; height: 34px;
  color: #9fb4dc;
  animation: spin 24s linear infinite;
}

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  letter-spacing: -.01em;
  margin: .25em 0 .15em;
}

.subtitle { margin: 0; color: var(--ink-soft); font-size: 1.05rem; }

.status {
  display: inline-block;
  margin: 14px 0 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .6);
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.status:empty { display: none; }

/* ── Calendar grid ────────────────────────── */
.calendar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(10px, 2vw, 18px);
}

@media (max-width: 560px) {
  .calendar { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 380px) {
  .calendar { grid-template-columns: repeat(3, 1fr); }
}

/* Each cell is a frame; the door swings open inside it */
.cell {
  position: relative;
  aspect-ratio: 1 / 1.08;
  perspective: 900px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .55);
  box-shadow: inset 0 2px 6px rgba(70, 80, 110, .12);
}

/* Day 25 spans the last row on narrow screens (5×5 fits exactly on wide ones) */
@media (max-width: 560px) { .cell.wide { grid-column: span 4; aspect-ratio: auto; min-height: 110px; } }
@media (max-width: 380px) { .cell.wide { grid-column: span 3; } }

.inside {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius);
  color: var(--ink);
}
.inside svg { width: 26px; height: 26px; color: #9aa9d1; }
.inside .mini-title {
  font-size: .72rem; font-weight: 700; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.inside .mini-artist { font-size: .66rem; color: var(--ink-soft); }

.door {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--c, var(--ice));
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform .9s cubic-bezier(.3, .7, .25, 1), box-shadow .3s, filter .3s;
  backface-visibility: hidden;
  overflow: hidden;
}

/* faint frost texture */
.door::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.7) 0 1.5px, transparent 2px),
    radial-gradient(circle at 75% 30%, rgba(255,255,255,.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,.5) 0 1px, transparent 1.5px),
    linear-gradient(160deg, rgba(255,255,255,.55), rgba(255,255,255,0) 55%);
  pointer-events: none;
}

/* little knob */
.door::after {
  content: "";
  position: absolute; right: 10px; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 1px 2px rgba(70, 80, 110, .25);
}

.door .num {
  position: relative;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 4.2vw, 2.2rem);
  line-height: 1;
}
.door .icon {
  position: relative;
  width: 22px; height: 22px;
  margin-top: 8px;
  opacity: .55;
}
.door .lock {
  position: absolute; left: 10px; top: 10px;
  width: 13px; height: 13px;
  opacity: .4;
}

.door:hover, .door:focus-visible { box-shadow: 0 2px 4px rgba(70,80,110,.08), 0 14px 30px -10px rgba(70,80,110,.3); }
.door:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

/* Available but not yet opened: gentle shimmer */
.cell.ready .door { animation: breathe 3.2s ease-in-out infinite; }
.cell.ready .door .icon { opacity: .8; }
.cell.today .door::before {
  background:
    linear-gradient(115deg, transparent 30%, rgba(255,255,255,.75) 50%, transparent 70%) 0 0 / 250% 100%,
    linear-gradient(160deg, rgba(255,255,255,.55), rgba(255,255,255,0) 55%);
  animation: shimmer 2.8s ease-in-out infinite;
}

/* Locked */
.cell.locked .door { filter: saturate(.4) brightness(1.04); opacity: .78; cursor: default; }
.cell.locked .door .num { opacity: .55; }

/* Opened: swing the door aside */
.cell.open .door {
  transform: rotateY(-108deg);
  box-shadow: 0 6px 18px -8px rgba(70, 80, 110, .25);
  animation: none;
}
.cell.open .inside { cursor: pointer; }

.cell.shake .door { animation: shake .45s ease; }

/* ── Reveal card ──────────────────────────── */
.reveal {
  position: fixed; inset: 0;
  z-index: 20;
  display: grid; place-items: center;
  padding: 20px;
}
.reveal[hidden] { display: none; }

.reveal-backdrop {
  position: absolute; inset: 0;
  background: rgba(225, 232, 247, .6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade .35s ease both;
}

.reveal-card {
  position: relative;
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 34px 28px 28px;
  border-radius: 24px;
  background: var(--card);
  text-align: center;
  box-shadow: 0 30px 70px -20px rgba(70, 80, 110, .45);
  animation: rise .6s cubic-bezier(.2, .9, .25, 1.15) both;
}

.reveal-card::before {           /* pastel band along the top */
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 8px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, var(--ice), var(--lavender), var(--blush), var(--mint), var(--butter));
}

.close {
  position: absolute; top: 12px; right: 14px;
  width: 34px; height: 34px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 1.6rem; line-height: 1;
  cursor: pointer;
}
.close:hover { background: #f1f3fa; }

.reveal-day {
  font-size: .78rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft);
}

.vinyl {
  width: 96px; height: 96px;
  margin: 18px auto 14px;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, #5b6482 0 1px, #4a5370 1px 3px);
  box-shadow: 0 8px 20px -6px rgba(70, 80, 110, .5);
  display: grid; place-items: center;
  animation: spin 3.5s linear infinite, pop .7s .1s cubic-bezier(.2, .9, .25, 1.3) both;
}
.vinyl span {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent, var(--blush));
  box-shadow: inset 0 0 0 14px var(--accent, var(--blush)), inset 0 0 0 16px rgba(255,255,255,.5);
  position: relative;
}
.vinyl span::after {
  content: ""; position: absolute; inset: 15px;
  border-radius: 50%; background: var(--card);
}

.reveal-card h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.65rem;
  line-height: 1.15;
  margin: 0 0 6px;
  animation: up .5s .25s ease both;
}
.reveal-artist { margin: 0; color: var(--ink-soft); font-weight: 600; animation: up .5s .35s ease both; }
.reveal-note { margin: 10px 0 0; font-size: .95rem; animation: up .5s .4s ease both; }
.reveal-note:empty { display: none; }

.embed { margin-top: 18px; animation: up .5s .45s ease both; }
.embed:empty { display: none; }
.embed iframe { width: 100%; height: 152px; border: 0; border-radius: 12px; }

.spotify-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 20px;
  padding: 11px 20px;
  border-radius: 999px;
  background: #1db954;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 6px 16px -6px rgba(29, 185, 84, .6);
  transition: transform .2s, box-shadow .2s;
  animation: up .5s .5s ease both;
}
.spotify-btn svg { width: 20px; height: 20px; }
.spotify-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -8px rgba(29, 185, 84, .7); }

/* ── Sparkle burst when a door opens ──────── */
.spark {
  position: fixed;
  z-index: 30;
  width: 14px; height: 14px;
  pointer-events: none;
  color: #fff;
  filter: drop-shadow(0 1px 2px rgba(70, 80, 110, .3));
  animation: burst .9s ease-out forwards;
}

/* ── Toast ────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 28px;
  z-index: 40;
  transform: translate(-50%, 20px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 600; font-size: .92rem;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot {
  margin-top: 48px;
  text-align: center;
  font-size: .85rem;
  color: var(--ink-soft);
}

/* ── Keyframes ────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fade    { from { opacity: 0; } }
@keyframes rise    { from { opacity: 0; transform: translateY(40px) scale(.94); } }
@keyframes up      { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop     { from { transform: scale(.3); opacity: 0; } }
@keyframes breathe { 50% { transform: translateY(-3px); } }
@keyframes shimmer { 0% { background-position: 150% 0, 0 0; } 100% { background-position: -50% 0, 0 0; } }
@keyframes shake {
  20% { transform: rotateY(-8deg); }
  40% { transform: rotateY(5deg); }
  60% { transform: rotateY(-4deg); }
  80% { transform: rotateY(2deg); }
}
@keyframes burst {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(.4);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}
