/* Santa's advent calendar in Christmas Town (js/xmastown.js) */
.santa-overlay {
  --sx-red: #e8293a;
  --sx-green: #1f8a4c;
  --sx-gold: #ffd23f;
  --sx-ink: #1b0d18;
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-y: auto;
  background: radial-gradient(120% 90% at 50% 0%, rgba(32, 60, 110, 0.92) 0%, rgba(14, 24, 52, 0.94) 55%, rgba(6, 10, 24, 0.96) 100%);
  animation: sx-fade 0.25s ease;
}
.santa-overlay[hidden] { display: none; }

.santa-card {
  position: relative;
  width: min(820px, 100%);
  padding: 24px 24px 18px;
  border-radius: 28px;
  color: #f3f7ff;
  text-align: center;
  background: linear-gradient(180deg, rgba(178, 22, 38, 0.97) 0%, rgba(122, 12, 26, 0.98) 100%);
  border: 3px solid var(--sx-gold);
  box-shadow: 0 0 0 6px rgba(27, 13, 24, 0.85), 0 0 50px rgba(255, 210, 63, 0.35), 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 0 70px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  animation: sx-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
/* a frosted snowy edge along the top of the card */
.santa-card::before {
  content: "";
  position: absolute;
  left: -10px;
  right: -10px;
  top: -14px;
  height: 34px;
  background: radial-gradient(18px 16px at 18px 22px, #fff 98%, transparent) 0 0 / 40px 34px repeat-x;
  filter: drop-shadow(0 2px 0 rgba(150, 175, 215, 0.8));
  pointer-events: none;
}

.santa-snow { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.santa-snow i {
  position: absolute;
  top: -10px;
  left: var(--x);
  width: var(--w);
  height: var(--w);
  border-radius: 50%;
  background: #fff;
  opacity: 0.75;
  animation: sx-fall var(--d) linear var(--l) infinite;
}

.santa-x {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.santa-x:hover, .santa-x:focus-visible { background: rgba(255, 210, 63, 0.35); outline: none; }

.santa-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 8px 40px 14px;
}
.santa-face { font-size: 52px; line-height: 1; filter: drop-shadow(0 4px 0 rgba(27, 13, 24, 0.6)); animation: sx-bob 2.4s ease-in-out infinite; }
.santa-head h2 {
  margin: 0;
  font: 400 clamp(26px, 5vw, 40px) / 1.05 "Lilita One", system-ui, sans-serif;
  color: #fff;
  -webkit-text-stroke: 1.5px var(--sx-ink);
  text-shadow: 0 4px 0 var(--sx-ink), 0 0 18px rgba(255, 210, 63, 0.5);
}
.santa-sub { margin: 6px 0 0; font-size: 14px; color: #ffe3e6; }

.santa-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.santa-wait { grid-column: 1 / -1; margin: 30px 0; font: 400 18px "Lilita One", system-ui, sans-serif; }

.santa-door {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  justify-items: center;
  gap: 2px;
  min-height: 108px;
  padding: 8px 4px 6px;
  border-radius: 14px;
  border: 2px solid rgba(27, 13, 24, 0.7);
  background: linear-gradient(180deg, #2a9a5a 0%, #17683a 100%);
  color: #fff;
  font: inherit;
  cursor: default;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.25), 0 3px 0 rgba(27, 13, 24, 0.55);
}
.santa-door:nth-child(even) { background: linear-gradient(180deg, #f2f6ff 0%, #c9d6ec 100%); color: var(--sx-ink); }
.santa-door.is-big { border-color: var(--sx-gold); }
.santa-door .sd-num { font: 400 20px / 1 "Lilita One", system-ui, sans-serif; }
.santa-door .sd-icon { font-size: 26px; line-height: 1.2; }
.santa-door .sd-prize { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; font-size: 11px; font-weight: 800; line-height: 1.3; }
.santa-door .sd-prize span { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.santa-door .sd-prize i { width: 13px; height: 13px; }
.santa-door .sd-tag { font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }

.santa-door.is-locked { filter: saturate(0.55) brightness(0.88); }
.santa-door.is-locked .sd-prize { opacity: 0.7; }
.santa-door.is-missed { filter: grayscale(0.9) brightness(0.7); }
.santa-door.is-missed .sd-prize { text-decoration: line-through; opacity: 0.6; }
.santa-door.is-opened { background: linear-gradient(180deg, #ffe58a 0%, #e3a91c 100%); color: var(--sx-ink); }
.santa-door.is-opened .sd-tag { opacity: 1; }
.santa-door.is-xmas:not(.is-opened):not(.is-missed) { background: linear-gradient(180deg, #ff5a66 0%, #b3121f 100%); color: #fff; }
.santa-door.is-today {
  cursor: pointer;
  background: linear-gradient(180deg, #ff5a66 0%, #c8202f 100%);
  color: #fff;
  border-color: var(--sx-gold);
  box-shadow: 0 0 0 3px var(--sx-gold), 0 0 24px rgba(255, 210, 63, 0.8), inset 0 -4px 0 rgba(0, 0, 0, 0.25);
  animation: sx-glow 1.4s ease-in-out infinite alternate;
}
.santa-door.is-today .sd-icon { animation: sx-shake 1.2s ease-in-out infinite; }
.santa-door.is-today .sd-tag { opacity: 1; color: var(--sx-gold); }
.santa-door.is-today:hover, .santa-door.is-today:focus-visible { transform: translateY(-3px) scale(1.04); outline: none; }
/* a missed day that can still be opened */
.santa-door.is-catchup {
  cursor: pointer;
  background: linear-gradient(180deg, #34b56c 0%, #17683a 100%);
  color: #fff;
  border-color: var(--sx-gold);
  box-shadow: 0 0 0 2px var(--sx-gold), 0 0 14px rgba(255, 210, 63, 0.55), inset 0 -4px 0 rgba(0, 0, 0, 0.25);
}
.santa-door.is-catchup .sd-icon { animation: sx-shake 1.6s ease-in-out infinite; }
.santa-door.is-catchup .sd-tag { opacity: 1; color: var(--sx-gold); }
.santa-door.is-catchup:hover, .santa-door.is-catchup:focus-visible { transform: translateY(-3px) scale(1.04); outline: none; }
/* what's inside stays a secret until it's opened */
.santa-door .sd-mystery { font-style: italic; letter-spacing: 0.04em; opacity: 0.85; }
.santa-door.is-opening { animation: sx-open 0.6s ease-in-out infinite; }
.santa-hat-prize { color: #fff3a0; }
.santa-door:nth-child(even) .santa-hat-prize, .santa-door.is-opened .santa-hat-prize { color: #b3121f; }

.santa-foot { position: relative; margin-top: 14px; min-height: 20px; font-size: 14px; font-weight: 700; color: #fff1c4; }

/* the present-opening reveal */
.santa-reveal {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 8, 16, 0.72);
  animation: sx-fade 0.25s ease;
}
.santa-reveal[hidden] { display: none; }
.santa-reveal-card {
  width: min(420px, 100%);
  padding: 22px 20px 20px;
  border-radius: 24px;
  color: var(--sx-ink);
  background: linear-gradient(180deg, #ffffff 0%, #e6eefb 100%);
  border: 3px solid var(--sx-gold);
  box-shadow: 0 0 0 5px rgba(27, 13, 24, 0.8), 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: sx-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.santa-reveal-card h3 { margin: 6px 0 10px; font: 400 28px / 1 "Lilita One", system-ui, sans-serif; color: #c8202f; }
.santa-box { position: relative; display: inline-block; font-size: 74px; line-height: 1; animation: sx-unwrap 0.9s cubic-bezier(0.3, 1.6, 0.5, 1); }
.santa-lid { position: absolute; left: 50%; top: -6px; font-size: 34px; transform: translateX(-50%); animation: sx-lid 0.9s ease-out forwards; }
.santa-burst { position: absolute; inset: -20px; display: grid; place-items: center; font-size: 60px; opacity: 0; animation: sx-burst 0.9s ease-out 0.25s; }
.santa-got { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; font: 400 22px "Lilita One", system-ui, sans-serif; }
.santa-got span { display: inline-flex; align-items: center; gap: 5px; }
.santa-got i { width: 22px; height: 22px; }
.santa-hat-note { margin: 10px 0 0; font-size: 14px; }
.santa-ok {
  margin-top: 16px;
  padding: 10px 26px;
  border: 0;
  border-radius: 999px;
  font: 400 18px "Lilita One", system-ui, sans-serif;
  color: #fff;
  background: linear-gradient(180deg, #2fb36a 0%, #17683a 100%);
  box-shadow: 0 4px 0 var(--sx-ink);
  cursor: pointer;
}
.santa-ok:hover, .santa-ok:focus-visible { filter: brightness(1.1); outline: 3px solid var(--sx-gold); outline-offset: 2px; }

@media (max-width: 560px) {
  .santa-card { padding: 18px 12px 14px; }
  .santa-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
  .santa-door { min-height: 96px; }
  .santa-face { font-size: 40px; }
}

@keyframes sx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sx-pop { from { transform: translateY(24px) scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sx-fall { to { transform: translate(30px, 820px); } }
@keyframes sx-bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-4px) rotate(4deg); } }
@keyframes sx-glow { from { box-shadow: 0 0 0 3px var(--sx-gold), 0 0 14px rgba(255, 210, 63, 0.5), inset 0 -4px 0 rgba(0, 0, 0, 0.25); } to { box-shadow: 0 0 0 3px var(--sx-gold), 0 0 30px rgba(255, 210, 63, 0.95), inset 0 -4px 0 rgba(0, 0, 0, 0.25); } }
@keyframes sx-shake { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-12deg); } 85% { transform: rotate(12deg); } 92% { transform: rotate(-6deg); } }
@keyframes sx-open { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-4deg) scale(1.05); } 75% { transform: rotate(4deg) scale(1.05); } }
@keyframes sx-unwrap { 0% { transform: scale(0.3) rotate(-20deg); } 60% { transform: scale(1.15) rotate(6deg); } 100% { transform: none; } }
@keyframes sx-lid { 0% { transform: translate(-50%, 0) rotate(0); } 100% { transform: translate(-50%, -46px) rotate(-24deg); opacity: 0.9; } }
@keyframes sx-burst { 0% { opacity: 0; transform: scale(0.4); } 40% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }

@media (prefers-reduced-motion: reduce) {
  .santa-snow, .santa-face, .santa-door.is-today, .santa-door.is-today .sd-icon, .santa-door.is-catchup .sd-icon, .santa-box, .santa-lid, .santa-burst { animation: none !important; }
  .santa-snow { display: none; }
}
