@font-face {
  font-family: "Fraunces";
  src: url("../assets/fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("../assets/fonts/outfit.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --night: #1a2144;
  --night-deep: #12182f;
  --ink: #f4f0e6;
  --muted: rgba(244, 240, 230, 0.78);
  --amber: #e6b56a;
  --line: rgba(244, 240, 230, 0.22);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--night-deep);
  color: var(--ink);
}

body {
  font-family: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  font-weight: 360;
}

.page {
  position: relative;
  min-height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(80% 55% at 8% 0%, #2c3766 0%, transparent 58%),
    radial-gradient(50% 40% at 78% 8%, #2a315c 0%, transparent 60%),
    var(--night);
}

.scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100vw;
  height: calc(100vw * 9 / 16);
  min-height: 100vh;
  min-height: 100dvh;
  min-width: calc(100vh * 16 / 9);
  min-width: calc(100dvh * 16 / 9);
  transform: translate(-50%, -50%);
}

.frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

.piece {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
}

.piece.head {
  clip-path: ellipse(6.6% 8.2% at 45.8% 39.4%);
  animation: bob 4.6s ease-in-out infinite;
}

.piece.shoulders {
  clip-path: ellipse(9.5% 7.2% at 45.2% 52.5%);
  animation: shrug 4.6s ease-in-out infinite;
}

.piece.thumbs {
  clip-path: ellipse(3.4% 2.6% at 49.8% 62.8%);
  animation: tap 2.45s ease-in-out infinite;
}

.piece.tail {
  clip-path: ellipse(4.2% 3.2% at 76.5% 74.2%);
  transform-origin: 73% 76%;
  animation: flick 6.8s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, 4px, 0); }
}

@keyframes shrug {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(0, 2px, 0); }
}

@keyframes tap {
  0%, 60%, 100% { transform: translate3d(0, 0, 0); }
  68% { transform: translate3d(0, 2px, 0); }
  76% { transform: translate3d(0, 0, 0); }
  86% { transform: translate3d(1px, 2px, 0); }
  94% { transform: translate3d(0, 0, 0); }
}

@keyframes flick {
  0%, 70%, 100% { transform: rotate(0deg); }
  78% { transform: rotate(4deg); }
  88% { transform: rotate(-2deg); }
}

.glow, .led, .bulb, .win {
  position: absolute;
  pointer-events: none;
}

.spill {
  left: 42%;
  top: 30%;
  width: 38%;
  height: 36%;
  background: radial-gradient(ellipse at 70% 46%, rgba(186, 214, 255, 0.34), rgba(110, 150, 230, 0.08) 40%, transparent 68%);
  mix-blend-mode: screen;
  animation: flicker 5.8s ease-in-out infinite;
}

.screen {
  left: 57.8%;
  top: 37%;
  width: 10.2%;
  height: 13.4%;
  border-radius: 10px;
  background: radial-gradient(ellipse at 50% 48%, rgba(236, 246, 255, 0.55), rgba(150, 190, 255, 0.16) 46%, transparent 72%);
  mix-blend-mode: screen;
  animation: flicker 5.8s ease-in-out infinite;
}

.lamp {
  right: 0;
  top: 22%;
  width: 16%;
  height: 46%;
  background: radial-gradient(ellipse at 78% 28%, rgba(255, 196, 130, 0.2), transparent 68%);
  mix-blend-mode: screen;
  animation: breathe 7.5s ease-in-out infinite;
}

.led {
  left: 75.55%;
  top: 50.7%;
  width: 0.38%;
  height: 0.5%;
  border-radius: 50%;
  background: #d7ecff;
  box-shadow: 0 0 7px 2px rgba(150, 205, 255, 0.95);
  animation: led 2.8s ease-in-out infinite;
}

.bulb {
  width: 0.32%;
  height: 0.55%;
  margin-left: -0.16%;
  margin-top: -0.28%;
  border-radius: 50%;
  background: #ffe7bc;
  box-shadow: 0 0 7px 2px rgba(255, 196, 120, 0.75);
  mix-blend-mode: screen;
  animation: twinkle 3.4s ease-in-out infinite;
}

.win {
  width: 0.42%;
  height: 0.7%;
  background: #ffd59a;
  box-shadow: 0 0 5px 1px rgba(255, 198, 120, 0.8);
  opacity: 0;
  animation: city 9s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 0.55; }
  6% { opacity: 0.95; }
  8% { opacity: 0.32; }
  11% { opacity: 0.82; }
  38% { opacity: 0.6; }
  46% { opacity: 0.98; }
  49% { opacity: 0.4; }
  63% { opacity: 0.74; }
  81% { opacity: 0.9; }
  84% { opacity: 0.46; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.72; }
  50% { opacity: 1; }
}

@keyframes led {
  0%, 100% { opacity: 0.45; }
  40% { opacity: 1; }
  70% { opacity: 0.7; }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  45% { opacity: 1; transform: scale(1); }
  70% { opacity: 0.55; transform: scale(0.9); }
}

@keyframes city {
  0%, 70%, 100% { opacity: 0; }
  76%, 90% { opacity: 0.9; }
}

.grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.14;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 3;
}

.page::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(6, 8, 20, 0.38) 100%);
}

.copy {
  position: relative;
  z-index: 5;
  padding: clamp(28px, 4.6vw, 76px) clamp(22px, 4vw, 72px);
  max-width: 38rem;
}

.kicker {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 450;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--amber);
}

h1 {
  margin: 0.28em 0 0.32em;
  font-family: "Fraunces", "Iowan Old Style", Palatino, serif;
  font-weight: 560;
  font-size: clamp(2.7rem, 4.7vw, 5.15rem);
  letter-spacing: -0.035em;
  line-height: 0.92;
  font-optical-sizing: auto;
  text-wrap: balance;
  text-shadow: 0 10px 30px rgba(8, 12, 28, 0.45);
}

.mail {
  display: inline-block;
  color: var(--ink);
  text-decoration: none;
  font-weight: 330;
  font-size: 1.02rem;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(244, 240, 230, 0.45);
  padding-bottom: 1px;
  text-shadow: 0 6px 16px rgba(8, 12, 28, 0.45);
}

.mail:hover,
.mail:focus-visible {
  color: #fff;
  border-bottom-color: var(--amber);
  outline: none;
}

.load {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 1.55rem;
  max-width: 17.5rem;
}

.track {
  position: relative;
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: var(--line);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.fill {
  display: block;
  width: 87%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c9dcff 0%, #f3e2c0 100%);
  box-shadow: 0 0 10px rgba(180, 206, 255, 0.75);
}

.pct {
  font-size: 0.75rem;
  font-weight: 450;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 2.6em;
  text-shadow: 0 4px 12px rgba(8, 12, 28, 0.5);
}

@media (max-width: 800px) {
  .page {
    background:
      linear-gradient(180deg, #1c274f 0%, #1b244c 34%, #1a2146 100%);
  }

  .copy {
    padding: 11vh 22px 0;
    max-width: 22rem;
  }

  h1 {
    font-size: clamp(2.65rem, 12.4vw, 3.35rem);
    max-width: 8.2ch;
  }

  .scene {
    top: auto;
    bottom: 0;
    height: 62%;
  }

  .frame {
    top: auto;
    bottom: 0;
    left: 54%;
    width: 206%;
    height: auto;
    aspect-ratio: 16 / 9;
    min-width: 0;
    min-height: 0;
    transform: translateX(-54%);
  }

  .frame::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 26%;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      #1b244d 0%,
      rgba(27, 36, 77, 0.94) 22%,
      rgba(27, 36, 77, 0.55) 58%,
      rgba(27, 36, 77, 0) 100%
    );
  }

  .page::after {
    background: linear-gradient(to bottom, rgba(10, 14, 32, 0.12), transparent 24%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .piece,
  .spill,
  .screen,
  .lamp,
  .led,
  .bulb,
  .win {
    animation: none !important;
  }

  .spill, .screen { opacity: 0.4; }
  .bulb { opacity: 0.7; }
  .win { opacity: 0.35; }
  .fill { width: 87%; }
}

.reduce .piece,
.reduce .spill,
.reduce .screen,
.reduce .lamp,
.reduce .led,
.reduce .bulb,
.reduce .win {
  animation: none !important;
}
