/* Halloween party invitation. One dark theme: it's always night here. */

@font-face {
  font-family: "Creepster";
  src: url("/fonts/creepster.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --night: #0b0614;
  --orange: #ff7a1a;
  --amber: #ffcf5a;
  --text: #f7f1ff;
  --muted: #cfc3e0;
  --panel: rgba(10, 5, 20, 0.55);
  --gutter: 16px;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--night);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

h1,
h2,
p,
dl,
dd,
ul {
  margin: 0;
}

h1,
h2,
p {
  text-wrap: balance;
}

a {
  color: var(--amber);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- Background scene ---------- */

.sky,
.candlelight,
.ghosts,
.bats,
.fog {
  position: fixed;
  pointer-events: none;
}

/* The photo sits in a fixed layer (iOS ignores background-attachment: fixed).
   The gradient darkens it enough for the card and the bats to stand out. */
.sky {
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(11, 6, 20, 0.55) 0%, rgba(11, 6, 20, 0.35) 45%, rgba(11, 6, 20, 0.7) 100%),
    url("/assets/images/halloween.jpg") 50% 65% / cover no-repeat,
    var(--night);
}

/* Warm light from the jack-o'-lanterns in the photo, flickering like candles. */
.candlelight {
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 60vh;
  background: radial-gradient(ellipse 70% 60% at 50% 85%, rgba(255, 140, 40, 0.22), transparent 70%);
  animation: flicker 3.6s linear infinite;
}

.ghosts {
  inset: 0;
  z-index: 1;
}

.ghost {
  position: absolute;
  width: clamp(44px, 7vw, 80px);
  height: auto;
  aspect-ratio: 60 / 80;
  opacity: 0.35;
  animation: float 7s ease-in-out infinite;
}

.ghost:nth-child(1) {
  top: 44vh;
  left: 4vw;
}

.ghost:nth-child(2) {
  top: 36vh;
  right: 5vw;
  width: clamp(36px, 5vw, 64px);
  animation-duration: 9s;
  animation-delay: -3s;
}

.ghost:nth-child(3) {
  top: 70vh;
  left: 12vw;
  width: clamp(30px, 4vw, 52px);
  opacity: 0.3;
  animation-duration: 11s;
  animation-delay: -6s;
}

.bats {
  inset: 0;
  z-index: 2;
  overflow: hidden;
}

.bat {
  position: absolute;
  top: var(--top);
  left: 0;
  width: var(--size);
  animation: fly var(--dur) linear infinite;
  animation-delay: var(--delay);
  filter: drop-shadow(0 0 2px rgba(255, 140, 60, 0.35));
}

.bat svg {
  display: block;
  width: 100%;
  height: auto;
  fill: #050208;
  transform-origin: 50% 40%;
  animation: flap 0.18s ease-in-out infinite alternate;
}

.bat:nth-child(1) { --top: 9vh;  --size: 56px; --dur: 16s; --delay: -3s; }
.bat:nth-child(2) { --top: 18vh; --size: 38px; --dur: 21s; --delay: -11s; animation-direction: reverse; }
.bat:nth-child(3) { --top: 31vh; --size: 46px; --dur: 25s; --delay: -7s; }
.bat:nth-child(4) { --top: 5vh;  --size: 30px; --dur: 19s; --delay: -15s; animation-direction: reverse; }
.bat:nth-child(5) { --top: 44vh; --size: 34px; --dur: 28s; --delay: -20s; }

.bat:nth-child(2) svg,
.bat:nth-child(4) svg {
  animation-duration: 0.22s;
}

.fog {
  left: -50%;
  bottom: -4vh;
  z-index: 2;
  width: 200%;
  height: 28vh;
  background:
    radial-gradient(ellipse 30% 60% at 20% 70%, rgba(200, 190, 230, 0.16), transparent 70%),
    radial-gradient(ellipse 25% 50% at 55% 80%, rgba(200, 190, 230, 0.12), transparent 70%),
    radial-gradient(ellipse 30% 55% at 85% 75%, rgba(200, 190, 230, 0.14), transparent 70%);
  animation: drift 40s linear infinite alternate;
}

/* ---------- Invitation card ---------- */

.stage {
  position: relative;
  z-index: 3;
  flex: 1;
  width: 100%;
  padding:
    clamp(2rem, 7vh, 5rem)
    max(var(--gutter), env(safe-area-inset-right))
    clamp(3rem, 10vh, 6rem)
    max(var(--gutter), env(safe-area-inset-left));
}

.card-wrap {
  position: relative;
  max-width: 40rem;
  margin: 0 auto;
}

.card {
  padding: clamp(1.5rem, 5vw, 3rem) clamp(1.1rem, 5vw, 3rem);
  text-align: center;
  background: linear-gradient(165deg, rgba(160, 76, 20, 0.62), rgba(48, 20, 58, 0.78));
  border: 3px solid rgba(92, 140, 60, 0.85);
  border-radius: 28px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 70px rgba(255, 122, 26, 0.18);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.eyebrow {
  color: var(--amber);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin-top: 0.5rem;
  font-family: "Creepster", "Chiller", fantasy, cursive;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.02em;
}

h1 .names {
  display: block;
  color: var(--text);
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45);
}

h1 .title {
  display: block;
  margin-top: 0.15em;
  color: var(--orange);
  font-size: clamp(2.5rem, 10vw, 4.4rem);
  text-shadow:
    0 3px 0 #5a1f00,
    0 0 24px rgba(255, 122, 26, 0.55);
}

.lead {
  margin-top: 1.1rem;
  font-size: clamp(1.1rem, 3.6vw, 1.3rem);
  font-weight: 700;
}

.grad {
  margin-top: 0.2rem;
  color: var(--muted);
  font-style: italic;
}

/* Countdown */

.countdown {
  margin-top: 1.75rem;
}

.countdown-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.4rem, 2vw, 0.8rem);
  margin-top: 0.6rem;
}

.unit {
  padding: 0.65rem 0.25rem 0.55rem;
  background: var(--panel);
  border: 1px solid rgba(255, 122, 26, 0.35);
  border-radius: 14px;
}

.num {
  display: block;
  color: var(--amber);
  font-size: clamp(1.6rem, 7vw, 2.5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-shadow: 0 0 14px rgba(255, 180, 60, 0.45);
}

.lbl {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: clamp(0.65rem, 2.4vw, 0.8rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.countdown-message {
  margin-top: 1.75rem;
  padding: 0.9rem 1rem;
  color: var(--amber);
  font-size: 1.2rem;
  font-weight: 800;
  background: var(--panel);
  border-radius: 14px;
}

/* Details */

.details {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.detail {
  padding: 1rem 1.1rem;
  background: var(--panel);
  border-radius: 16px;
}

.detail dt {
  color: var(--orange);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.detail dd {
  margin-top: 0.25rem;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
}

.detail address {
  font-style: normal;
}

.nowrap {
  white-space: nowrap;
}

/* Buttons */

.actions {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.75rem;
}

.action-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-top: 0.55rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.6rem 0.9rem;
  color: var(--text);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  background: rgba(10, 5, 20, 0.45);
  border: 2px solid var(--orange);
  border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background-color: rgba(255, 122, 26, 0.18);
  box-shadow: 0 0 18px rgba(255, 122, 26, 0.45);
}

.btn:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

.btn-primary {
  color: #1f0b00;
  background: linear-gradient(180deg, #ff9a3c, var(--orange));
  border-color: #ff9a3c;
}

.btn-primary:hover {
  background-color: transparent;
  background-image: linear-gradient(180deg, #ffb060, #ff8a2a);
}

/* Notes */

.notes {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding: 0;
  list-style: none;
  text-align: left;
}

.note {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px dashed rgba(255, 207, 90, 0.35);
  border-radius: 16px;
}

.note-icon {
  flex: none;
  width: 2rem;
  height: 2rem;
  fill: var(--orange);
}

.note h2 {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.3;
}

.note p {
  margin-top: 0.15rem;
  color: var(--muted);
}

/* Jack-o'-lanterns: a row under the card on phones, at its corners on wide screens. */

.pumpkins {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: -2.25rem;
  position: relative;
  z-index: 1;
}

.jack {
  width: clamp(84px, 24vw, 120px);
  height: auto;
  aspect-ratio: 200 / 180;
  filter: drop-shadow(0 0 22px rgba(255, 122, 26, 0.45));
}

.jack-face {
  animation: flicker 3.2s linear infinite;
}

.jack-right .jack-face {
  animation-duration: 4.1s;
  animation-delay: -1.3s;
}

.footer {
  position: relative;
  z-index: 3;
  padding: 0 var(--gutter) max(1.5rem, env(safe-area-inset-bottom));
  color: var(--muted);
  font-family: "Creepster", "Chiller", fantasy, cursive;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-align: center;
}

/* ---------- Wider screens ---------- */

@media (min-width: 34rem) {
  .details,
  .notes {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 60rem) {
  .pumpkins {
    position: absolute;
    left: -9rem;
    right: -9rem;
    bottom: -2.5rem;
    justify-content: space-between;
    margin-top: 0;
    pointer-events: none;
  }

  .jack {
    width: 10.5rem;
  }
}

/* ---------- Animation ---------- */

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-18px) rotate(4deg); }
}

@keyframes fly {
  0% { transform: translate3d(-12vw, 0, 0); }
  25% { transform: translate3d(22vw, -3vh, 0); }
  50% { transform: translate3d(50vw, 2vh, 0); }
  75% { transform: translate3d(80vw, -2vh, 0); }
  100% { transform: translate3d(112vw, 1vh, 0); }
}

@keyframes flap {
  from { transform: scaleY(1); }
  to { transform: scaleY(0.35); }
}

@keyframes drift {
  to { transform: translateX(25%); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  8% { opacity: 0.72; }
  11% { opacity: 0.95; }
  34% { opacity: 0.82; }
  37% { opacity: 1; }
  61% { opacity: 0.68; }
  65% { opacity: 0.92; }
  82% { opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .bats {
    display: none;
  }
}
