/* Science Works advent calendar */
@font-face { font-family: 'Cooper BT'; src: url('/assets/fonts/cooper/CooperLtBT-Regular.woff2') format('woff2'); font-weight: normal; font-display: swap; }
:root { --wine: #66223b; --ink: #440214; --cream: #fffbf7; --paper: #f6f0ed; --lamp: #fff5a6; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
html { background: var(--paper); }
body { background: transparent; color: var(--wine); font: 300 18px/1.5 'Roboto Slab', Georgia, serif; -webkit-font-smoothing: antialiased; }
button { font: inherit; }

/* ---------- the scene ---------- */
.adv-root { position: fixed; inset: 0; }
.adv-frame { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.is-pan .adv-frame { display: block; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.is-pan .adv-frame::-webkit-scrollbar { display: none; }
.is-zooming .adv-frame { overflow: hidden; }
.adv-stage { position: relative; flex: none; transition: transform 1s cubic-bezier(.65, 0, .35, 1); }
.adv-layer { position: absolute; left: 0; top: 0; }
.adv-anim { pointer-events: none; z-index: 3; }
.adv-doors { position: absolute; inset: 0; z-index: 2; }
.adv-door-slot { position: absolute; }
.adv-door { position: absolute; inset: 0; padding: 0; margin: 0; border: 0; background: none; cursor: pointer; transform-style: preserve-3d; -webkit-tap-highlight-color: transparent; }
.adv-door .leaf { position: absolute; top: 0; transition: transform .7s cubic-bezier(.3, .7, .3, 1), filter .7s; }
.adv-door .leaf.l { transform-origin: left center; }
.adv-door .leaf.r { transform-origin: right center; }
.adv-door.is-open:hover .leaf.l, .adv-door.is-today:hover .leaf.l { transform: rotateY(-14deg); }
.adv-door.is-open:hover .leaf.r, .adv-door.is-today:hover .leaf.r { transform: rotateY(14deg); }
.adv-door.is-opened .leaf.l { transform: rotateY(-38deg); filter: brightness(.86); }
.adv-door.is-opened .leaf.r { transform: rotateY(38deg); filter: brightness(.86); }
.adv-door.is-opened:hover .leaf.l { transform: rotateY(-50deg); }
.adv-door.is-opened:hover .leaf.r { transform: rotateY(50deg); }
.adv-door.is-swung .leaf.l { transform: rotateY(-104deg); filter: brightness(.7); }
.adv-door.is-swung .leaf.r { transform: rotateY(104deg); filter: brightness(.7); }
.adv-door.is-locked { cursor: default; }
.adv-door.is-today, .adv-door.is-focus { animation: adv-glow 2.8s ease-in-out infinite; }
@keyframes adv-glow { 0%, 100% { filter: drop-shadow(0 0 1px rgba(255, 240, 190, .5)); } 50% { filter: drop-shadow(0 0 9px rgba(255, 236, 170, 1)) drop-shadow(0 0 3px rgba(255, 255, 255, .8)); } }
.adv-door.adv-rattle { animation: adv-rattle .5s linear; }
@keyframes adv-rattle { 0%, 100% { transform: none; } 15% { transform: translateX(-2px) rotate(-1.2deg); } 35% { transform: translateX(2px) rotate(1.2deg); } 55% { transform: translateX(-1.5px) rotate(-.8deg); } 75% { transform: translateX(1px) rotate(.5deg); } }
.adv-door:focus-visible { outline: 2px solid var(--lamp); outline-offset: 3px; border-radius: 2px; }
body:not(.is-night) .adv-door:focus-visible { outline-color: #eb3131; }

/* the title painted into the sky (wide screens) */
.adv-scene-title { position: absolute; z-index: 4; pointer-events: none; }
.adv-scene-title .adv-kicker { pointer-events: auto; display: inline-block; color: inherit; text-decoration: none; font: 500 max(12px, .2em)/1 'Roboto', sans-serif; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .55em; opacity: .9; }
.adv-scene-title .adv-kicker:hover { text-decoration: underline; }
.adv-scene-title h1 { font-family: 'Cooper BT', Georgia, serif; font-weight: normal; font-size: 1em; line-height: 1.02; margin: 0; }
.adv-scene-title p { font: 300 max(15px, .37em)/1.4 'Roboto Slab', Georgia, serif; margin: .7em 0 0; color: var(--sub); }
.is-pan .adv-scene-title { display: none; }

/* ---------- the bar: home link (narrow screens) and child mode ---------- */
.adv-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 14px 16px; pointer-events: none; }
.adv-bar > * { pointer-events: auto; }
.adv-bar-title { visibility: hidden; color: var(--wine); text-decoration: none; }
.is-night .adv-bar-title { color: var(--cream); }
.adv-bar-title small { display: block; font: 500 11px/1 'Roboto', sans-serif; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 5px; opacity: .9; }
.adv-bar-title span { font: normal 22px/1.05 'Cooper BT', Georgia, serif; }
body.has-pan .adv-bar-title { visibility: visible; }
body.story-open .adv-bar-title { visibility: hidden; }
.adv-toggle { display: inline-flex; background: rgba(255, 251, 247, .94); border-radius: 999px; padding: 3px; box-shadow: 0 2px 12px rgba(40, 10, 30, .18); margin-left: auto; }
.adv-toggle button { border: 0; background: none; color: var(--wine); font: 500 13px/1 'Roboto', sans-serif; padding: 9px 13px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
@media (max-width: 520px) { .adv-toggle button { font-size: 12px; padding: 8px 10px; } .adv-bar-title span { font-size: 20px; } }
.adv-hint { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 44; background: rgba(255, 251, 247, .94); color: var(--wine);
  font: 500 13px/1 'Roboto', sans-serif; padding: 10px 14px; border-radius: 999px; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); transition: opacity .6s; white-space: nowrap; }
.adv-hint.gone { opacity: 0; pointer-events: none; }
.adv-toggle button[aria-pressed="true"] { background: var(--wine); color: var(--cream); }
.adv-toggle button:focus-visible { outline: 2px solid #eb3131; outline-offset: 1px; }

/* ---------- toast, countdown, preview banner ---------- */
.adv-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); background: var(--cream); color: var(--wine); font: 300 16px/1.3 'Roboto Slab', Georgia, serif;
  padding: 11px 18px; border-radius: 3px; opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; z-index: 60; box-shadow: 0 6px 24px rgba(0, 0, 0, .2); }
.adv-toast.show { opacity: 1; transform: translate(-50%, 0); }
.adv-count { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 45; width: min(440px, calc(100% - 32px)); background: var(--cream); color: var(--wine);
  border-radius: 4px; padding: 20px 22px 18px; box-shadow: 0 10px 40px rgba(30, 10, 30, .3); }
.adv-count[hidden] { display: none; }
.adv-count-title { font: 500 12px/1 'Roboto', sans-serif; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 10px; }
.adv-count-time { font: normal 27px/1.15 'Cooper BT', Georgia, serif; margin: 0 0 6px; color: var(--ink); }
.adv-count-note { font-size: 15px; margin: 0 0 14px; }
.adv-count-row { display: flex; gap: 10px; flex-wrap: wrap; }
.adv-btn { font: 500 14px/1 'Roboto', sans-serif; border-radius: 999px; padding: 11px 16px; cursor: pointer; border: 1px solid rgba(68, 2, 20, .25); background: transparent; color: var(--ink); text-decoration: none; display: inline-block; }
.adv-btn.primary { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.adv-btn:focus-visible { outline: 2px solid #eb3131; outline-offset: 2px; }
.adv-preview { position: fixed; left: 50%; transform: translateX(-50%); bottom: 10px; z-index: 70; background: var(--ink); color: var(--cream); font: 500 12px/1 'Roboto', sans-serif; padding: 7px 10px; border-radius: 3px; }

/* ---------- the story ---------- */
.adv-story { position: fixed; inset: 0; z-index: 40; overflow-y: auto; background: var(--story-bg, #fff5a6); color: var(--ink); opacity: 0; transition: opacity .45s; }
.adv-story.show { opacity: 1; }
.adv-story.instant { transition: none; }
.adv-story[hidden] { display: none; }
.adv-story-top { position: sticky; top: 0; padding: 14px 16px; z-index: 2; }
.adv-back { background: rgba(255, 251, 247, .9); }
.adv-story-body { max-width: 680px; margin: 0 auto; padding: 10px 24px 72px; }
.adv-story-art { display: block; width: 100%; border-radius: 3px; margin: 8px 0 28px; }
.adv-story-kicker { font: 500 13px/1 'Roboto', sans-serif; letter-spacing: .12em; text-transform: uppercase; margin: 0 0 14px; }
#adv-story-title { font-family: 'Cooper BT', Georgia, serif; font-weight: normal; font-size: clamp(34px, 6vw, 54px); line-height: 1.04; margin: 0 0 22px; outline: none; }
.adv-story-text p { font-size: 19px; line-height: 1.62; margin: 0 0 1em; }
.is-kids .adv-story-text p { font-size: 22px; line-height: 1.55; }
.adv-story-note { font-size: 14px; font-style: italic; opacity: .75; margin: 24px 0 0; }
.adv-story-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid rgba(68, 2, 20, .18); margin-top: 36px; padding-top: 18px; }
.adv-story-nav { display: flex; gap: 10px; flex-wrap: wrap; }
.adv-story-nav a[hidden] { display: none; }
/* a door with its scene: the scene fills the screen, with nothing over it */
.adv-story.has-scene { overflow: hidden; background: #1c1226; }
/* on a door's picture, a small way back to the calendar, bottom left (the picture's own buttons sit above it) */
.adv-home { display: none; }
.has-scene .adv-home { display: block; position: fixed; left: 12px; bottom: 12px; z-index: 5; font: 500 12px/1 'Roboto', sans-serif; letter-spacing: .02em; color: var(--ink); background: rgba(255, 251, 247, .8); border: 0; border-radius: 999px; padding: 7px 11px; box-shadow: 0 1px 6px rgba(0, 0, 0, .18); cursor: pointer; opacity: .85; transition: opacity .2s, background .2s; }
.has-scene .adv-home:hover, .has-scene .adv-home:focus-visible { opacity: 1; background: #fffbf7; }
.has-scene .adv-home:focus-visible { outline: 2px solid #4b5cce; outline-offset: 2px; }
.adv-scene { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #1c1226; }
.has-scene .adv-story-top, .has-scene .adv-story-body { display: none; }
/* the calendar offers day or night; a story page offers grown-ups or children */
.adv-reader { display: none; }
body.story-open .adv-reader { display: inline-flex; }
body.story-open .adv-daynight { display: none; }

/* ---------- share images ---------- */
.adv-og-caption { position: fixed; right: 92px; top: 128px; z-index: 10; text-align: right; color: var(--cream); }
.adv-og-caption b { display: block; font: normal 70px/1 'Cooper BT', Georgia, serif; }
.adv-og-caption span { font: 300 28px/1.3 'Roboto Slab', Georgia, serif; color: var(--lamp); }
.is-og .adv-bar, .is-og .adv-count, .is-og .adv-toast { display: none !important; }
.is-og .adv-frame { align-items: flex-start; }

.adv-noscript { position: fixed; inset: auto 16px 16px; z-index: 80; background: var(--cream); padding: 16px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { .adv-stage, .adv-door .leaf, .adv-story { transition: none !important; } .adv-door.is-today, .adv-door.is-focus { animation: none; filter: drop-shadow(0 0 6px rgba(255, 236, 170, .9)); } }
