/* Tenner's Christmas calendar (advent.js): a night-sky sheet of 25 doors, each a rich tone with a gold drawing and
   number; a door swings open on its hinge to show a poster, and the pick comes forward on a card. Night-themed in Day and
   Night alike, like the Christmas slide it opens from, inside the popups' one frame (styles.css). Corners are --r throughout; buttons are the navy ones. */
dialog.adv { width: min(900px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0; overflow: hidden;
  border-radius: var(--r); color: #fff; background: #080d28; transform-origin: 0 0;
  box-shadow: 0 0 0 .5px rgba(255, 255, 255, .14), 0 0 0 1px rgba(255, 214, 120, .12), 0 50px 120px -30px rgba(0, 0, 0, .85); }
.adv-sc { position: relative; isolation: isolate; max-height: calc(100dvh - 32px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 26px 28px 30px;
  background: radial-gradient(1.2px 1.2px at 14% 62%, rgba(255, 255, 255, .55), transparent), radial-gradient(1px 1px at 70% 74%, rgba(255, 255, 255, .45), transparent),
    radial-gradient(1.2px 1.2px at 40% 88%, rgba(255, 255, 255, .5), transparent), radial-gradient(1px 1px at 88% 56%, rgba(255, 255, 255, .45), transparent),
    radial-gradient(80% 50% at 50% 100%, rgba(255, 159, 10, .12), transparent 70%), linear-gradient(#0a1033, #080d28 60%, #0c0a26);
  background-size: 300px 300px, 260px 260px, 340px 340px, 280px 280px, auto, auto; }
/* the Christmas scene across the top, melting into the night */
.adv-sky { position: absolute; z-index: -1; inset: 0 0 auto; height: 440px; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(#000 35%, transparent); mask-image: linear-gradient(#000 35%, transparent); }
.adv-sky img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; opacity: .7; }
.adv-sky::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, rgba(8, 13, 40, .85), rgba(8, 13, 40, .25) 60%, rgba(8, 13, 40, .5)); }
.adv-snow i { position: absolute; z-index: 1; top: -10px; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: #fff; opacity: var(--o); filter: blur(.4px); }
@media (prefers-reduced-motion: no-preference) { .adv-snow i { animation: advFall var(--d) linear infinite; animation-delay: calc(-1 * var(--w)); } }
@keyframes advFall { to { transform: translate(30px, 450px); } }

.adv-hd { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.adv-logo { flex: none; width: 46px; height: 46px; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, .5)); }
.adv-eye { margin: 0; font: 600 13px/1.2 var(--font); color: #ffd36b; }
.adv-hd h2 { margin: 3px 0 4px; color: #fff; }   /* the popups' one heading (styles.css) */
.adv-sub { margin: 0; max-width: 560px; font-size: 15px; line-height: 1.4; color: rgba(255, 255, 255, .8); }
.adv-x { flex: none; align-self: flex-start; margin-left: auto; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: var(--bt-round); color: #fff; cursor: pointer; }
.adv-x svg { width: 16px; height: 16px; }
@media (hover: hover) { .adv-x:hover { background: var(--bt-round-hover); } }

/* the doors */
.adv-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: clamp(62px, 7.6vw, 86px); gap: 9px; }
.adv-d { position: relative; padding: 0; border: 0; border-radius: var(--r); background: none; color: #fff; font: inherit; cursor: pointer; perspective: 900px; -webkit-tap-highlight-color: transparent; }
.adv-d.opening { z-index: 2; } @media (hover: hover) { .adv-d.open:hover { z-index: 2; } }
/* behind the door: warm light, then the poster */
.adv-in { position: absolute; inset: 0; overflow: hidden; border-radius: var(--r);
  background: radial-gradient(circle at 50% 45%, #ffe2a0, #ffad4a 30%, #5a1d3c 75%, #1a0b24); box-shadow: inset 0 2px 12px rgba(0, 0, 0, .65); }
.adv-in img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.adv-in b { position: absolute; inset: auto 0 0; padding: 18px 8px 7px; font: 600 12px/1.2 var(--font); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8)); }
.adv-d.big .adv-in b { font-size: 15px; padding: 30px 12px 10px; }
.adv-leaf { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; }
:root .adv-leaf { transition: transform 1s cubic-bezier(.3, 1.2, .4, 1); }
@media (prefers-reduced-motion: reduce) { :root .adv-leaf { transition: none; } }
.adv-f, .adv-b { position: absolute; inset: 0; border-radius: var(--r); -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.adv-f { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; overflow: hidden; background: linear-gradient(155deg, var(--c1), var(--c2));
  box-shadow: inset 0 0 0 1px rgba(255, 214, 120, .3), inset 0 1px 0 rgba(255, 255, 255, .2), 0 8px 20px -10px rgba(0, 0, 0, .7); }
/* a fine sprinkle of frost, and a gold inner frame */
.adv-f::before { content: ""; position: absolute; inset: 0; opacity: .55; background-image: radial-gradient(rgba(255, 255, 255, .22) .8px, transparent 1.4px); background-size: 12px 12px;
  -webkit-mask-image: linear-gradient(160deg, #000, transparent 70%); mask-image: linear-gradient(160deg, #000, transparent 70%); }
.adv-f::after { content: ""; position: absolute; inset: 5px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(255, 214, 120, .32); pointer-events: none; }
.adv-f svg { position: relative; width: 24px; height: 24px; color: #ffd36b; opacity: .8; filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .4)); }
.adv-d.big .adv-f svg { width: 72px; height: 72px; opacity: .9; }
.adv-d.mid .adv-f svg { width: 40px; height: 40px; }
.adv-n { position: relative; font: 800 clamp(30px, 3.6vw, 42px)/1 var(--font-display); letter-spacing: -.03em;
  background: linear-gradient(#fff8dc, #ffd36b 50%, #e09a2c); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.adv-d.big .adv-n { font-size: clamp(64px, 8vw, 100px); }
.adv-d.mid .adv-n { font-size: clamp(40px, 5vw, 60px); }
.adv-mc { position: relative; margin-top: 6px; font: 600 13px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: #ffe7b0; opacity: .9; }
.adv-b { transform: rotateY(180deg); background: linear-gradient(155deg, var(--c2), #05040f); box-shadow: inset 0 0 0 1px rgba(255, 214, 120, .22); }
.adv-d.open .adv-leaf { transform: rotateY(-108deg); }
.adv-d.open .adv-in { box-shadow: inset 0 0 0 1px rgba(255, 214, 120, .35); }
@media (hover: hover) { .adv-d:not(.open, .locked):hover .adv-leaf { transform: rotateY(-14deg); } .adv-d.locked:hover .adv-leaf { transform: rotateY(-3deg); } }
.adv-d.locked .adv-f { filter: saturate(.8) brightness(.78); }
.adv-lock { position: absolute; right: 9px; bottom: 8px; width: 15px; height: 15px; color: #ffe7b0; opacity: .6; }
.adv-lock svg { width: 100%; height: 100%; display: block; }
.adv-d.today .adv-f { box-shadow: inset 0 0 0 1.5px rgba(255, 214, 120, .95), 0 0 0 3px rgba(255, 214, 120, .2), 0 0 30px rgba(255, 196, 90, .5); }
@media (prefers-reduced-motion: no-preference) { .adv-d.today .adv-leaf { animation: advCall 2.6s ease-in-out infinite; } }
@keyframes advCall { 0%, 70%, 100% { transform: none; } 80% { transform: rotateY(-10deg); } 90% { transform: rotateY(-3deg); } }
.adv-now { position: absolute; top: 7px; right: 7px; padding: 3px 7px; border-radius: 5px; font: 700 10.5px/1.1 var(--font); font-style: normal; letter-spacing: .04em; text-transform: uppercase;
  color: #3a2400; background: linear-gradient(#ffe8a3, #ffc94a); }
.adv-d:focus-visible { outline: 2px solid #ffd36b; outline-offset: 3px; }
.adv-d.no .adv-leaf { animation: advNo .45s ease; }
@keyframes advNo { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

.adv-say { position: sticky; bottom: 4px; z-index: 3; width: fit-content; max-width: 100%; margin: 14px auto 0; padding: 9px 14px; border-radius: var(--r); font-size: 14px; font-weight: 500;
  color: #fff; background: rgba(20, 24, 60, .82); -webkit-backdrop-filter: var(--fr-blur); backdrop-filter: var(--fr-blur); box-shadow: inset 0 0 0 1px rgba(255, 214, 120, .3);
  opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .35s var(--ease-spring); pointer-events: none; }
.adv-say.on { opacity: 1; transform: none; }
.adv-say:empty { display: none; }

/* sparkles */
.adv-fx { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; }
.adv-sp { position: absolute; width: 0; height: 0; }
.adv-sp i { position: absolute; width: var(--s); height: var(--s); background: var(--c); filter: drop-shadow(0 0 4px rgba(255, 214, 120, .9));
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: advSp var(--t) cubic-bezier(.15, .7, .3, 1) forwards; }
@keyframes advSp { 0% { transform: translate(-50%, -50%) scale(.2) rotate(0); opacity: 1; } 65% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); opacity: 0; } }

/* the pick, on its card */
.adv-rv { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 20px; background: rgba(4, 6, 22, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.adv-card { position: relative; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 22px; align-items: center; width: min(580px, 100%); padding: 20px;
  border-radius: var(--r); background: rgba(16, 20, 54, .85); -webkit-backdrop-filter: var(--fr-blur); backdrop-filter: var(--fr-blur);
  box-shadow: inset 0 0 0 1px rgba(255, 214, 120, .32), 0 30px 80px -20px rgba(0, 0, 0, .85); }
.adv-cx { position: absolute; top: 12px; right: 12px; }
.adv-cp { position: relative; display: block; aspect-ratio: 2 / 3; border-radius: var(--r); overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 214, 120, .35), 0 0 40px rgba(255, 196, 90, .35), 0 20px 40px -14px rgba(0, 0, 0, .8); }
.adv-cp img { width: 100%; height: 100%; object-fit: cover; }
.adv-cc { display: grid; justify-items: start; gap: 6px; min-width: 0; padding-right: 26px; }
.adv-cc h3 { margin: 2px 0 0; font: 800 clamp(26px, 3vw, 34px)/1.05 var(--font-display); letter-spacing: -.03em; text-wrap: balance; }
.adv-cm { margin: 0; font-size: 14px; color: rgba(255, 255, 255, .7); }
.adv-cl { margin: 4px 0 6px; font-size: 15.5px; line-height: 1.42; color: rgba(255, 255, 255, .9); }
.adv-ca { display: flex; align-items: center; gap: 10px; }
.adv-go { height: 46px; padding: 0 20px 0 16px; font-size: 16px; }
.adv-go svg { width: 18px; height: 18px; }

/* phones */
@media (max-width: 719px) {
  dialog.adv { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .adv-sc { max-height: calc(100dvh - 16px); padding: 18px 14px 20px; }
  .adv-hd { gap: 10px; margin-bottom: 16px; } .adv-logo { width: 38px; height: 38px; align-self: flex-start; }
  .adv-sub { font-size: 14px; }
  .adv-grid { grid-auto-rows: clamp(50px, 14vw, 64px); gap: 6px; }
  .adv-n { font-size: 22px; } .adv-d.big .adv-n { font-size: 52px; } .adv-d.mid .adv-n { font-size: 34px; }
  .adv-f { gap: 2px; } .adv-f svg { width: 15px; height: 15px; } .adv-d.big .adv-f svg { width: 44px; height: 44px; } .adv-d.mid .adv-f svg { width: 26px; height: 26px; }
  .adv-f::after { inset: 3px; border-radius: 6px; }
  .adv-lock { right: 4px; bottom: 3px; width: 11px; height: 11px; }
  .adv-now { top: 3px; right: 3px; padding: 2px 4px; font-size: 8.5px; }
  .adv-mc { font-size: 10px; margin-top: 2px; }
  .adv-in b { font-size: 9.5px; padding: 10px 4px 4px; }
  .adv-lit { margin: 14px 8px 8px; }
  .adv-card { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 14px; padding: 18px 16px; }
  .adv-cp { width: 150px; }
  .adv-cc { justify-items: center; padding-right: 0; }
}

/* fairy lights round the calendar */
.adv-lit { position: relative; margin: 10px 4px 4px; }
.lt { position: absolute; inset: -7px; z-index: 2; pointer-events: none; }
.lt svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lt path { fill: none; stroke: #0d2a18; stroke-width: 2; vector-effect: non-scaling-stroke; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.lt i { position: absolute; width: 8px; height: 13px; margin: -13px 0 0 -4px; transform-origin: 50% 100%; transform: rotate(var(--a));
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%; background: radial-gradient(circle at 42% 30%, #fff 0 10%, var(--c) 48%, color-mix(in srgb, var(--c) 60%, #000));
  box-shadow: 0 0 8px 2px var(--g), 0 0 22px 6px color-mix(in srgb, var(--g) 45%, transparent); }
.lt i::after { content: ""; position: absolute; left: 1.5px; right: 1.5px; bottom: -3px; height: 4px; border-radius: 1px; background: #1d3524; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) { .lt i { animation: advTw 2.4s ease-in-out infinite; animation-delay: calc(-1 * var(--dl)); } }
@keyframes advTw { 0%, 100% { opacity: 1; filter: brightness(1.1); } 50% { opacity: .55; filter: brightness(.8); } }
