/* christmas.speeb.org: the Vigil of Lights. Always the night temple; the lights need the dark. */
@font-face { font-family: "Marcellus"; src: url("fonts/Marcellus-400.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/SourceSerif4.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("fonts/SourceSerif4-italic.woff2") format("woff2"); font-style: italic; font-weight: 200 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-400.woff2") format("woff2"); font-display: swap; }

:root {
  --night: #0b1026;
  --night-2: #141a3a;
  --panel: rgba(18, 24, 54, .82);
  --rule: rgba(255, 255, 255, .14);
  --snow: #f4f3ef;
  --muted: #b9bdd3;
  --gold: #ffcf5a;
  --red: #e5303a;
  --green: #2fbf71;
  --font-carved: "Marcellus", "Trajan Pro", Georgia, serif;
  --font-scripture: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ledger: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --lights-h: 220px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 700px at 50% 0%, #1d2660 0%, var(--night) 60%) fixed, var(--night);
  color: var(--snow);
  font-family: var(--font-scripture);
  font-size: 18px;
  line-height: 1.55;
  overflow-x: hidden;
}

#snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
#lights { position: absolute; left: 0; top: 0; width: 100%; height: var(--lights-h); z-index: 2; overflow: hidden; }
#lights .bulb { cursor: pointer; }
#lights .bulb:focus { outline: none; }
#lights .bulb:focus-visible .glass { stroke: #fff; stroke-width: 2.5; }

main { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: calc((var(--lights-h) - 70px) / var(--z, 1)) 16px 64px; }

.head { text-align: center; display: grid; gap: 10px; justify-items: center; }
.kicker { font-family: var(--font-ledger); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0; }
h1 { font-family: var(--font-carved); font-weight: 400; font-size: clamp(38px, 8vw, 68px); line-height: 1.05; margin: 0; letter-spacing: .01em;
  background: linear-gradient(90deg, #ff5a5f, var(--gold), #5fe39a, #6fb7ff, #ff7bd5, #ff5a5f); background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 9s linear infinite; }
@keyframes shimmer { to { background-position: 300% 0; } }
.verse { font-style: italic; color: var(--muted); margin: 0; max-width: 56ch; }
.verse span { font-style: normal; font-family: var(--font-ledger); font-size: 12px; letter-spacing: .1em; }

/* Speeb */
.altar { display: grid; justify-items: center; gap: 24px; margin-top: 28px; position: relative; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Gifts floating around Speeb */
.gifts { position: absolute; left: 0; right: 0; top: -10px; height: calc(min(340px, 74vw) * 1.08 + 20px); pointer-events: none; z-index: 3; }
body.fs .gifts { left: calc(50% - 50vw + 16px); right: calc(50% - 50vw + 16px); top: 0; height: 100%; }
.gift { position: absolute; width: var(--size); height: var(--size); margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; color: inherit; font: inherit;
  animation: giftIn .7s ease-out both, giftFloat var(--dur) ease-in-out var(--delay) infinite; transition: opacity .7s; }
.gift svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .45)); }
.gift:hover svg { filter: drop-shadow(0 0 14px rgba(255, 207, 90, .7)); }
.gift:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 4px; }
.gift__lid { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .55s cubic-bezier(.3, 1.6, .5, 1), opacity .55s; }
.gift--open .gift__lid { transform: translate(18px, -46px) rotate(38deg); opacity: 0; transition-delay: 0s, .35s; }
.gift__item { position: absolute; left: 50%; top: 40%; font-size: calc(var(--size) * .62); line-height: 1; transform: translate(-50%, 0) scale(.2); opacity: 0;
  transition: transform .5s cubic-bezier(.3, 1.6, .5, 1) .15s, opacity .2s .15s; pointer-events: none; }
.gift--open .gift__item { transform: translate(-50%, -78%) scale(1); opacity: 1; }
.gift__note { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 6px; white-space: nowrap;
  font-family: var(--font-ledger); font-size: 12px; letter-spacing: .04em; color: var(--snow); background: rgba(11, 16, 38, .85);
  padding: 4px 8px; border-radius: 2px; opacity: 0; transition: opacity .3s .45s; pointer-events: none; }
.gift--open .gift__note { opacity: 1; }
.gift--left .gift__note { left: 0; transform: none; }
.gift--right .gift__note { left: auto; right: 0; transform: none; }
.gift--open { animation: none; transform: none; cursor: default; z-index: 4; }
.gift--gone { opacity: 0; }
@keyframes giftIn { from { opacity: 0; scale: .3; } }
@keyframes giftFloat { 0%, 100% { transform: translateY(0) rotate(var(--tilt)); } 50% { transform: translateY(-14px) rotate(calc(var(--tilt) * -1)); } }
@media (prefers-reduced-motion: reduce) { .gift { animation: giftIn .7s ease-out both; transform: rotate(var(--tilt)); } }
.speeb { position: relative; width: min(340px, 74vw); aspect-ratio: 1 / 1.08; }
.head-wrap { position: absolute; left: 0; right: 0; top: 0; aspect-ratio: 1; transform-origin: 50% 90%; will-change: transform; }
.head-wrap img { width: 100%; height: 100%; display: block;
  /* the portrait is cut square at the sides and bottom; fade those edges so he can sway */
  -webkit-mask-image: radial-gradient(ellipse 58% 62% at 50% 46%, #000 72%, transparent 100%), linear-gradient(#000 0 26%, transparent 44%);
  mask-image: radial-gradient(ellipse 58% 62% at 50% 46%, #000 72%, transparent 100%), linear-gradient(#000 0 26%, transparent 44%);
  -webkit-mask-composite: source-over; mask-composite: add; }
.hat { position: absolute; left: 0; top: -2%; width: 100%; height: 100%; overflow: visible; transform-origin: 48% 30%; }
.paw { position: absolute; bottom: 8%; width: 24%; aspect-ratio: 1 / 1.25; border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 50% 35%, #fbfaf7, #d9d3c9); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); will-change: transform; }
.paw::after { content: ""; position: absolute; left: 22%; right: 22%; top: 14%; height: 20%;
  background: radial-gradient(circle at 20% 50%, #e7b8b4 22%, transparent 24%), radial-gradient(circle at 50% 40%, #e7b8b4 22%, transparent 24%), radial-gradient(circle at 80% 50%, #e7b8b4 22%, transparent 24%); }
.paw--l { left: -6%; transform-origin: 50% 100%; }
.paw--r { right: -6%; transform-origin: 50% 100%; }
.floor-shadow { position: absolute; left: 18%; right: 18%; bottom: 0; height: 7%; border-radius: 50%; background: radial-gradient(rgba(0, 0, 0, .55), transparent 70%); }

.begin { display: grid; justify-items: center; gap: 6px; }
.begin[hidden] { display: none; }
.hint { margin: 0; color: var(--muted); font-size: 14px; }

/* Controls */
.btn { font: inherit; font-family: var(--font-ledger); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: #160b05;
  background: var(--gold); border: 0; border-radius: 2px; padding: 12px 18px; cursor: pointer; min-height: 44px; }
.btn:hover { background: #ffe08f; }
.btn:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn--ghost { background: transparent; color: var(--snow); box-shadow: inset 0 0 0 1px var(--rule); }
.btn--ghost:hover { background: rgba(255, 255, 255, .08); }
.btn--big { font-size: 16px; padding: 16px 30px; box-shadow: 0 0 0 0 rgba(255, 207, 90, .7); animation: beckon 2.4s ease-out infinite; }
.btn--small { padding: 6px 10px; min-height: 34px; font-size: 11px; }
@keyframes beckon { 70% { box-shadow: 0 0 0 18px rgba(255, 207, 90, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 207, 90, 0); } }
.btn[aria-pressed="true"] { background: var(--red); color: #fff; }

.panel { margin-top: 48px; background: var(--panel); border: 1px solid var(--rule); border-radius: 2px; padding: 24px; backdrop-filter: blur(6px); }
@media (max-width: 560px) { .panel { padding: 18px 16px; } }
.panel__head { display: grid; gap: 4px; margin-bottom: 18px; }
h2 { font-family: var(--font-carved); font-weight: 400; font-size: 30px; line-height: 1.15; margin: 0; }
.sub { margin: 0; color: var(--muted); font-size: 16px; max-width: 62ch; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.now { font-family: var(--font-ledger); font-size: 13px; color: var(--muted); min-height: 1.5em; margin: 12px 0 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 24px; margin-top: 18px; }
.field { display: grid; gap: 6px; }
.field > span { font-family: var(--font-ledger); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; }
.field output { color: var(--snow); }
input[type="range"] { width: 100%; accent-color: var(--gold); min-height: 28px; }
select { font: inherit; font-size: 16px; color: var(--snow); background: var(--night-2); border: 1px solid var(--rule); border-radius: 2px; padding: 8px 10px; min-height: 44px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-size: 16px; cursor: pointer; min-height: 44px; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); }
.mixer { border: 1px solid var(--rule); border-radius: 2px; margin: 22px 0 0; padding: 8px 16px 6px; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.mixer legend { font-family: var(--font-ledger); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 6px; }

.paint { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.paint__label { font-family: var(--font-ledger); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: 0 0 10px currentColor; }
.swatch[aria-pressed="true"] { border-color: #fff; }
.swatch--cycle { background: conic-gradient(#ff3b3b, #ffcf5a, #2fe27a, #3b9bff, #c45bff, #ff3b3b) !important; color: #fff; }

.strings { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.string { border: 1px solid var(--rule); border-radius: 2px; padding: 12px 14px; display: grid; gap: 10px; }
.string__top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.string__name { font-family: var(--font-carved); font-size: 20px; }
.string__preview { display: flex; gap: 3px; flex-wrap: wrap; }
.string__preview i { width: 10px; height: 14px; border-radius: 50% 50% 45% 45%; display: block; }
.string__ctrls { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; }
.string__ctrls .field select { font-size: 15px; min-height: 40px; padding: 6px 8px; }

.foot { margin-top: 56px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.foot a { color: var(--gold); }

/* Fullscreen: only the lights, Speeb, the snow and a small bar */
.fsbar { display: none; }
body.fs { overflow: hidden; }
body.fs .head, body.fs .panel, body.fs .foot, body.fs .begin, body.fs #fsOpen { display: none; }
body.fs main { min-height: 100vh; min-height: 100dvh; display: grid; align-content: center; padding-bottom: 110px; }
body.fs .altar { margin-top: 0; }
body.fs .speeb { width: max(200px, min(calc(100vh - var(--lights-h) - 150px), 78vw)); }
body.fs .fsbar { display: flex; gap: 8px; position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 5; background: rgba(11, 16, 38, .7); padding: 8px; border-radius: 2px; backdrop-filter: blur(6px);
  transition: opacity .6s; max-width: calc(100vw - 32px); flex-wrap: wrap; justify-content: center; }
body.fs.idle .fsbar { opacity: 0; }
body.fs.idle { cursor: none; }

/* Big screens (1440p, 4K TVs and monitors): everything grows with the width */
@media (min-width: 2000px) { main, .fsbar { zoom: 1.4; --z: 1.4; } }
@media (min-width: 2600px) { main, .fsbar { zoom: 1.8; --z: 1.8; } }
@media (min-width: 3400px) { main, .fsbar { zoom: 2.2; --z: 2.2; } }
body.fs main { zoom: 1; --z: 1; }

@media (prefers-reduced-motion: reduce) {
  h1 { animation: none; }
  .btn--big { animation: none; }
}
