/* Advent calendar teaser on the homepage (December 2026).
   Remove after the holidays: this file, js/advent-promo.js, img/advent-cat.webp
   and the <section class="advent-promo"> in index.html. The script also hides
   the section on its own from 7 January (version 28). */

section.advent-promo { padding: clamp(8px, 2vw, 24px) var(--gutter) calc(var(--section) / 2); }

.ap-card {
  --ap-amber: #ffcf7a;
  --ap-night: #141a36;
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: 1.25fr 1fr; align-items: center; gap: clamp(24px, 5vw, 64px);
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) clamp(24px, 5vw, 72px);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 90% at 85% 110%, rgba(249, 129, 167, 0.35), transparent 60%),
    radial-gradient(80% 70% at 0% 0%, rgba(156, 208, 203, 0.18), transparent 60%),
    linear-gradient(160deg, var(--ap-night) 0%, var(--dusk-a) 55%, var(--dusk-b) 120%);
  color: #fff; text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.ap-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(38, 40, 74, 0.06), 0 28px 60px rgba(38, 40, 74, 0.22); color: #fff; }
.ap-card:focus-visible { outline: 3px solid var(--ap-amber); outline-offset: 4px; }

/* --- sky: stars and snow -------------------------------------------------- */
.ap-sky { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.ap-sky i {
  position: absolute; left: var(--x); top: var(--y);
  width: var(--s, 3px); height: var(--s, 3px); border-radius: 50%;
  background: #fff6dc; box-shadow: 0 0 6px 1px rgba(255, 230, 170, 0.7);
  animation: ap-twinkle 3.2s ease-in-out var(--d, 0s) infinite;
}
.ap-sky::before, .ap-sky::after {
  content: ""; position: absolute; inset: -100% 0 0 0;
  background-image:
    radial-gradient(2px 2px at 20px 30px, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(2px 2px at 90px 120px, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(3px 3px at 160px 60px, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(2px 2px at 230px 170px, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(3px 3px at 300px 20px, rgba(255, 255, 255, 0.6), transparent 60%);
  background-size: 320px 200px;
  animation: ap-snow 18s linear infinite;
  opacity: 0.55;
}
.ap-sky::after { background-size: 260px 240px; animation-duration: 28s; opacity: 0.35; filter: blur(0.6px); }

/* --- text ---------------------------------------------------------------- */
.ap-text { position: relative; }
.ap-text .eyebrow { color: var(--ap-amber); }
.ap-text h2 { color: #fff; margin: 0 0 14px; }
.ap-text p { color: rgba(255, 255, 255, 0.88); font-size: clamp(1.05rem, 1.25vw, 1.15rem); line-height: 1.55; max-width: 46ch; margin: 0 0 26px; }
.ap-cta { position: relative; }
.ap-cta::after {
  content: ""; position: absolute; inset: -4px; border-radius: inherit;
  border: 2px solid rgba(255, 207, 122, 0.8);
  animation: ap-ring 2.6s var(--ease) infinite;
  pointer-events: none;
}
.ap-card:hover .ap-cta { transform: translateY(-2px); }
.ap-arrow { display: inline-block; transition: transform 0.3s var(--ease); }
.ap-card:hover .ap-arrow { transform: translateX(4px); }

/* --- the window with shutters ------------------------------------------- */
.ap-window {
  position: relative; justify-self: center;
  width: clamp(180px, 22vw, 250px); aspect-ratio: 5 / 7;
  border-radius: 999px 999px 18px 18px;
  padding: 10px; background: linear-gradient(180deg, #e9c486, #b98a4a);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 20px 50px rgba(0, 0, 0, 0.35), 0 0 80px rgba(255, 207, 122, 0.25);
  animation: ap-float 6s ease-in-out infinite;
}
.ap-pane {
  position: relative; height: 100%; overflow: hidden;
  border-radius: 999px 999px 10px 10px;
  background: #0f1d2a; perspective: 700px;
}
.ap-pane img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block; }
.ap-pane::after { /* warm glow from inside */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 50% at 50% 40%, rgba(255, 207, 122, 0.25), transparent 70%);
  mix-blend-mode: screen; pointer-events: none;
}
.ap-shutter {
  position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 22px),
    linear-gradient(180deg, #6e73b6, #4f5496);
  border: 2px solid rgba(255, 255, 255, 0.25);
  backface-visibility: hidden;
  animation: ap-left 7s var(--ease) infinite;
}
.ap-shutter.l { left: 0; transform-origin: left center; border-radius: 999px 0 0 8px; }
.ap-shutter.r { right: 0; transform-origin: right center; border-radius: 0 999px 8px 0; animation-name: ap-right; }
.ap-num {
  position: absolute; z-index: 2; left: 50%; top: 56%; transform: translate(-50%, -50%);
  min-width: 2.2em; padding: 0.15em 0.35em; border-radius: 12px;
  font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 700; line-height: 1; text-align: center;
  color: var(--ap-night); background: var(--ap-amber);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 30px rgba(255, 207, 122, 0.6);
  animation: ap-num 7s var(--ease) infinite;
}
.ap-card:hover .ap-shutter, .ap-card:hover .ap-num, .ap-card:focus-visible .ap-shutter, .ap-card:focus-visible .ap-num { animation-play-state: paused; }

/* --- motion -------------------------------------------------------------- */
@keyframes ap-twinkle { 0%, 100% { opacity: 0.25; transform: scale(0.7); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes ap-snow { from { transform: translateY(0); } to { transform: translateY(50%); } }
@keyframes ap-float { 0%, 100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-8px) rotate(1deg); } }
@keyframes ap-ring { 0% { opacity: 0.9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.12, 1.4); } }
/* shutters: closed → swing open → stay open → close again */
@keyframes ap-left  { 0%, 14% { transform: rotateY(0); } 30%, 82% { transform: rotateY(-105deg); } 96%, 100% { transform: rotateY(0); } }
@keyframes ap-right { 0%, 14% { transform: rotateY(0); } 30%, 82% { transform: rotateY(105deg); } 96%, 100% { transform: rotateY(0); } }
@keyframes ap-num {
  0%, 10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  16% { transform: translate(-50%, -50%) scale(1.12); }
  26%, 86% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  96%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 720px) {
  .ap-card { grid-template-columns: 1fr; text-align: center; }
  .ap-text p { margin-left: auto; margin-right: auto; }
  .ap-window { grid-row: 1; width: 170px; }
}

@media (prefers-reduced-motion: reduce) {
  .ap-card, .ap-card *, .ap-sky::before, .ap-sky::after { animation: none !important; transition: none !important; }
  .ap-shutter.l { transform: rotateY(-105deg); }
  .ap-shutter.r { transform: rotateY(105deg); }
  .ap-num { opacity: 0; }
}
