/* Friendsmas: ported from the design canvas. Mobile first (390 px design),
   wide screens (>= 720 px) spread the scenery across the window. */

[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: #0a1733;
  color: #f3e3c3;
  font-family: 'Quicksand', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { overflow-x: hidden; }

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, #0a1733 0%, #142a52 55%, #1e3c63 100%);
}
.layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.snow { z-index: 1; }
.flyers { z-index: 2; }

/* ---------- snow ---------- */
.flake {
  position: absolute;
  top: -20px;
  border-radius: 50%;
  background: #fff;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.fa { animation-name: fallA; }
.fb { animation-name: fallB; }
@keyframes fallA { 0% { transform: translate(0, -20px); } 50% { transform: translate(20px, 52vh); } 100% { transform: translate(-7px, 106vh); } }
@keyframes fallB { 0% { transform: translate(0, -20px); } 50% { transform: translate(-18px, 52vh); } 100% { transform: translate(9px, 106vh); } }

/* ---------- fairy lights ---------- */
.lights { position: fixed; left: 0; right: 0; top: 0; height: 70px; z-index: 4; pointer-events: none; }
.lights svg { position: absolute; left: 0; top: 0; }
.bulb-wrap { position: absolute; width: 10px; display: flex; flex-direction: column; align-items: center; }
.bulb-wrap .cap { width: 6px; height: 5px; background: #2b2f2c; border-radius: 1px; }
.bulb {
  width: 10px;
  height: 15px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  animation: twinkle 1.8s ease-in-out infinite;
}
.is-error .bulb.dead { animation: flicker 3.2s steps(1) infinite; opacity: .35; }
@keyframes twinkle { 0%, 100% { opacity: 1; filter: brightness(1.15); } 50% { opacity: .45; filter: brightness(.7); } }
@keyframes flicker { 0%, 100% { opacity: .35; } 12% { opacity: .9; } 14% { opacity: .35; } 62% { opacity: .8; } 63% { opacity: .35; } }

/* ---------- ground: trees and snowdrifts ---------- */
.ground { position: fixed; left: 0; right: 0; bottom: 0; height: 300px; z-index: 2; pointer-events: none; }
.tree { position: absolute; }
.drift { position: absolute; border-radius: 50%; }
.wide { display: none; }
.t1 { left: 6px; bottom: 70px; width: 80px; height: 120px; }
.t2 { left: 80px; bottom: 80px; width: 50px; height: 75px; }
.t3 { right: 4px; bottom: 64px; width: 104px; height: 156px; }
.d1 { right: -100px; bottom: -120px; width: 400px; height: 230px; background: #dfe9f6; }
.d2 { left: -80px; bottom: -110px; width: 380px; height: 220px; background: #eef4fb; }

@media (min-width: 720px) {
  .wide { display: block; }
  .t1 { left: 4%; bottom: 84px; width: 110px; height: 165px; }
  .t2 { left: 12%; bottom: 96px; width: 60px; height: 90px; }
  .t3 { right: 4%; bottom: 80px; width: 124px; height: 186px; }
  .w1 { left: calc(50% - 330px); bottom: 88px; width: 80px; height: 120px; }
  .w2 { right: calc(50% - 340px); bottom: 84px; width: 92px; height: 138px; }
  .w3 { right: 13%; bottom: 96px; width: 60px; height: 90px; }
  .d1 { left: -10%; right: auto; bottom: -130px; width: 55%; height: 250px; background: #dfe9f6; }
  .d2 { left: auto; right: -12%; bottom: -140px; width: 60%; height: 270px; background: #dfe9f6; }
  .d3 { left: -15%; bottom: -150px; width: 45%; height: 236px; background: #eef4fb; }
  .d4 { left: 22%; bottom: -150px; width: 56%; height: 250px; background: #eef4fb; }
  .d5 { right: -14%; bottom: -160px; width: 40%; height: 240px; background: #eef4fb; }
}

/* ---------- content column ---------- */
.content {
  position: relative;
  z-index: 3;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 62px 16px 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.title {
  margin: 0;
  font-family: 'Mountains of Christmas', 'Quicksand', serif;
  font-weight: 700;
  font-size: 58px;
  line-height: 1;
  color: #f5c95b;
  text-shadow: 0 0 18px rgba(245, 201, 91, .55), 0 3px 0 #7a4b12;
}
.year {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
}
.hello { margin: 18px 0 0; font-size: 22px; font-weight: 600; color: #fff7e8; }
.hint { margin: 8px 0 0; max-width: 280px; font-size: 14px; line-height: 1.45; color: #b9c6dd; }

/* ---------- sealed: the gift ---------- */
.sealed { display: flex; flex-direction: column; align-items: center; margin-top: 34px; }
.gift {
  position: relative;
  width: 210px;
  height: 200px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  animation: wiggle 2.6s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.gift:focus-visible, .ghost:focus-visible, .mute:focus-visible { outline: 3px solid #f5c95b; outline-offset: 6px; border-radius: 16px; }
@keyframes wiggle { 0%, 78%, 100% { transform: rotate(0); } 82% { transform: rotate(-6deg); } 86% { transform: rotate(5deg); } 90% { transform: rotate(-3deg); } 94% { transform: rotate(2deg); } }
.g { position: absolute; display: block; }
.g-body { left: 20px; top: 80px; width: 170px; height: 115px; background: #c8283c; border-radius: 0 0 10px 10px; box-shadow: inset 0 -10px 0 rgba(0, 0, 0, .12); }
.g-dot { border-radius: 50%; background: #fbe3c4; }
.g-dot.d1 { left: 38px; top: 100px; width: 12px; height: 12px; }
.g-dot.d2 { left: 58px; top: 150px; width: 10px; height: 10px; }
.g-dot.d3 { left: 140px; top: 112px; width: 12px; height: 12px; }
.g-dot.d4 { left: 160px; top: 160px; width: 10px; height: 10px; }
.g-ribbon { left: 91px; top: 80px; width: 28px; height: 115px; background: #f5c95b; }
.g-lid { left: 10px; top: 42px; width: 190px; height: 40px; background: #a51d30; border-radius: 7px; box-shadow: 0 5px 0 rgba(0, 0, 0, .18); }
.g-lid-ribbon { left: 91px; top: 42px; width: 28px; height: 40px; background: #f5c95b; }
.g-loop { top: 8px; width: 50px; height: 34px; box-sizing: border-box; border: 8px solid #f5c95b; border-radius: 50%; }
.g-loop.left { left: 56px; transform: rotate(-22deg); }
.g-loop.right { left: 104px; transform: rotate(22deg); }
.g-knot { left: 95px; top: 28px; width: 20px; height: 18px; background: #e0ad3c; border-radius: 7px; }
.tap { margin: 22px 0 0; font-size: 19px; font-weight: 700; color: #fff7e8; }

/* ---------- revealed: polaroid and card ---------- */
.revealed { display: flex; flex-direction: column; align-items: center; margin-top: 22px; }
.stage { position: relative; width: min(300px, calc(100vw - 40px)); display: flex; flex-direction: column; align-items: center; }
.sparks { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.spark { position: absolute; fill: #f5c95b; animation: pop .9s ease-out both; }
@keyframes pop { 0% { transform: scale(0) rotate(0); opacity: 0; } 40% { opacity: 1; } 100% { transform: scale(1) rotate(25deg); opacity: 1; } }
.polaroid {
  position: relative;
  z-index: 2;
  margin: 0;
  width: 216px;
  box-sizing: border-box;
  padding: 10px 10px 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .4);
  animation: drop .9s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes drop { 0% { transform: translateY(-70px) rotate(-14deg) scale(.6); opacity: 0; } 70% { transform: translateY(4px) rotate(6deg) scale(1.03); opacity: 1; } 100% { transform: translateY(0) rotate(4deg) scale(1); opacity: 1; } }
.tape { position: absolute; left: 78px; top: -12px; width: 60px; height: 22px; background: rgba(245, 201, 91, .75); transform: rotate(-4deg); }
.photo-box { width: 196px; height: 200px; background: #e9eef5; }
.photo-box img { display: block; width: 196px; height: 200px; object-fit: cover; opacity: 0; transition: opacity .5s ease; }
.photo-box img.ready { opacity: 1; }
.polaroid figcaption {
  height: 40px;
  line-height: 40px;
  font-family: 'Mountains of Christmas', 'Quicksand', serif;
  font-size: 21px;
  font-weight: 700;
  color: #3b2a1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card {
  position: relative;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
  margin-top: -22px;
  padding: 10px;
  background: #fffaf0;
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35);
  animation: reveal .8s cubic-bezier(.2, .9, .3, 1.2) .25s both;
}
.no-photo .card { margin-top: 0; }
@keyframes reveal { 0% { transform: translateY(40px) scale(.7) rotate(-6deg); opacity: 0; } 60% { transform: translateY(-4px) scale(1.04) rotate(1deg); opacity: 1; } 100% { transform: translateY(0) scale(1) rotate(-1.5deg); opacity: 1; } }
.card-inner {
  border: 2px dashed #e3b65a;
  border-radius: 16px;
  padding: 30px 18px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.no-photo .card-inner { padding-top: 22px; }
.label { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; color: #8a5a1f; }
.name {
  margin: 0;
  font-family: 'Mountains of Christmas', 'Quicksand', serif;
  font-weight: 700;
  font-size: 50px;
  line-height: 1.05;
  color: #b3202f;
  overflow-wrap: anywhere;
}
.holly { width: 64px; height: 24px; }
.psst { margin: 0; font-size: 15px; font-weight: 600; color: #5b4632; }
.ghost {
  margin-top: 24px;
  height: 46px;
  padding: 0 24px;
  border-radius: 999px;
  border: 2px solid #f3e3c3;
  background: transparent;
  color: #f3e3c3;
  font: 700 15px 'Quicksand', system-ui, sans-serif;
  cursor: pointer;
}
.ghost:hover { background: rgba(243, 227, 195, .12); }

/* ---------- mute button ---------- */
.mute {
  position: fixed;
  z-index: 5;
  right: 16px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid #f3e3c3;
  background: #142a52;
  color: #f3e3c3;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mute svg { width: 22px; height: 22px; }
.mute .icon-off, .mute.is-muted .icon-on { display: none; }
.mute.is-muted .icon-off { display: block; }
@media (min-width: 720px) { .mute { right: 24px; bottom: 24px; } }

/* ---------- flyers ---------- */
.fly, .cruise {
  position: absolute;
  left: 0;
  top: 0;
  opacity: .93;
  animation-iteration-count: infinite;
  animation-fill-mode: backwards;
}
.fly svg, .cruise svg.craft { display: block; width: 100%; height: 100%; }
.spin { animation: spin 2.6s linear infinite; }
.spinslow { animation: spin 5.5s linear infinite; }
.tumble { animation: tumble 4.2s linear infinite; }
.bob { animation: bob 2.4s ease-in-out infinite; }
.flight { animation: flight 7s ease-in-out infinite; transform-origin: 50% 50%; }
.waves { animation: waves 1.8s ease-in-out infinite; transform-origin: 92% 88%; }
.surf-box { height: 10px; overflow: hidden; margin-top: -7px; }
.surf { display: block; width: 132px; height: 10px; animation: surf .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes tumble { 0% { transform: rotate(0); } 50% { transform: rotate(200deg) scale(.92); } 100% { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(6deg) translateY(-6px); } }
@keyframes flight { 0%, 100% { transform: translateY(0) rotate(0); } 20% { transform: translateY(-8px) rotate(-3deg); } 45% { transform: translateY(-12px) rotate(.5deg); } 70% { transform: translateY(-3px) rotate(2.5deg); } }
@keyframes waves { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(6deg); } 55% { transform: rotate(1.5deg); } 72% { transform: rotate(3.5deg); } }
@keyframes surf { from { transform: translateX(-12px); } to { transform: translateX(0); } }
@keyframes crossR { 0% { transform: translate(-110%, 0); } 100% { transform: translate(calc(100vw + 10px), -30px); } }
@keyframes crossL { 0% { transform: translate(calc(100vw + 10px), 0); } 100% { transform: translate(-110%, 0); } }
@keyframes dA { 0% { transform: translate(calc(-10vw - 90px), 34vh); } 25% { transform: translate(20vw, 27vh); } 50% { transform: translate(50vw, 33vh); } 75% { transform: translate(78vw, 25vh); } 100% { transform: translate(calc(110vw + 30px), 19vh); } }
@keyframes dB { 0% { transform: translate(calc(110vw + 30px), 72vh); } 50% { transform: translate(50vw, 62vh); } 100% { transform: translate(calc(-10vw - 90px), 68vh); } }
@keyframes dC { 0% { transform: translate(calc(-8vw - 90px), 92vh); } 100% { transform: translate(calc(108vw + 30px), 22vh); } }
@keyframes dD { 0% { transform: translate(calc(108vw + 30px), 12vh); } 100% { transform: translate(calc(-10vw - 90px), 80vh); } }
@keyframes dE { 0% { transform: translate(calc(-8vw - 90px), 55vh); } 50% { transform: translate(50vw, 42vh); } 100% { transform: translate(calc(108vw + 30px), 60vh); } }

/* ---------- error page ---------- */
.is-error .title { font-size: 44px; text-shadow: 0 0 16px rgba(245, 201, 91, .5), 0 3px 0 #7a4b12; }
.is-error .year, .is-error .hello { display: none; }
.error { display: flex; flex-direction: column; align-items: center; }
.error h2 { margin: 26px 0 0; font-size: 24px; font-weight: 700; color: #fff7e8; }
.error .text { margin: 12px 0 0; max-width: 300px; font-size: 16px; line-height: 1.5; }
.error .hint { margin-top: 14px; max-width: 290px; }
.snowman { position: relative; width: 170px; height: 210px; margin-top: 30px; animation: wobble 3.4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.sm { position: absolute; }
.sm.body { left: 25px; top: 92px; width: 116px; height: 116px; border-radius: 50%; background: #f4f8fd; box-shadow: inset -10px -8px 0 #d6e2f0; }
.sm.button { left: 77px; width: 9px; height: 9px; border-radius: 50%; background: #24342b; }
.sm.b1 { top: 122px; }
.sm.b2 { top: 150px; }
.sm.head { left: 44px; top: 20px; width: 78px; height: 78px; border-radius: 50%; background: #f4f8fd; box-shadow: inset -8px -6px 0 #d6e2f0; }
.sm.scarf { left: 40px; top: 86px; width: 88px; height: 16px; border-radius: 8px; background: #c8283c; }
.sm.scarf-end { left: 100px; top: 92px; width: 16px; height: 40px; border-radius: 6px; background: #a51d30; transform: rotate(-12deg); }
.sm.eye { top: 46px; width: 8px; height: 8px; border-radius: 50%; background: #24342b; }
.sm.e1 { left: 64px; }
.sm.e2 { left: 92px; }
.sm.nose { left: 83px; top: 55px; width: 0; height: 0; border-left: 24px solid #f08a24; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.sm.mouth { left: 75px; top: 70px; width: 12px; height: 10px; box-sizing: border-box; border: 3px solid #24342b; border-radius: 50%; }
.sm.brim { left: 0; top: 186px; width: 40px; height: 8px; border-radius: 3px; background: #1b1d22; transform: rotate(-18deg); }
.sm.hat { left: 6px; top: 160px; width: 26px; height: 30px; border-radius: 3px 3px 0 0; background: #1b1d22; transform: rotate(-18deg); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .snow, .flyers { display: none; }
  .bulb, .gift, .polaroid, .card, .spark, .snowman, .is-error .bulb.dead { animation: none; }
  .polaroid { transform: rotate(4deg); }
  .card { transform: rotate(-1.5deg); }
}
