/* DEVILS holiday landing. Layers, bottom to top:
   page night sky (body) → the film (sticky stage) → snow (fixed canvas) → form → sound button */

@font-face { font-family: "Unbounded"; src: url("../fonts/unbounded-lat.woff2") format("woff2"); font-weight: 200 900; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("../fonts/montserrat-lat.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

:root {
  --night: #060b1f;
  --night-2: #0a1438;
  --panel: rgba(9, 18, 50, .88);
  --line: rgba(124, 152, 255, .28);
  --ink: #f2f5ff;
  --muted: #9fb0e6;
  --red: #e3231f;
  --red-hot: #ff5345;
  --display: "Unbounded", "Arial Black", system-ui, sans-serif;
  --text: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font-family: var(--text); line-height: 1.4; overflow-x: hidden; }
/* The night sky behind the whole page: a layer of its own that stays put while the page scrolls over it
   (a background "fixed" to the window is painted afresh on every scroll step; a fixed layer is only moved by the graphics card). */
body::before { content: ""; position: fixed; inset: 0 0 auto 0; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255,255,255,.75) 50%, transparent 51%),
    radial-gradient(1px 1px at 71% 9%, rgba(255,255,255,.6) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 38% 62%, rgba(255,255,255,.55) 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 44%, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 24% 83%, rgba(255,255,255,.5) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 59% 31%, rgba(255,255,255,.45) 50%, transparent 51%),
    radial-gradient(120% 80% at 50% 0%, var(--night-2), var(--night) 70%);
  background-size: 620px 540px, 540px 620px, 700px 480px, 480px 700px, 560px 560px, 660px 600px, 100% 100%; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- snow ---------- */
.snow { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }

/* ---------- the film ---------- */
/* The film stands still on the screen for the first stretch of scrolling (36 % of a screen), while its lower edge sinks into
   the night; then it rolls away with the page, and the form comes up from under it with no line between the two. */
.journey { position: relative; height: 136vh; height: 136lvh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100lvh; overflow: hidden; z-index: 1; background: var(--night); }
/* The film's box is sized and placed by the script (js/film.js): it fills the window, cut at the edges only as far as the film allows. */
.film { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform-origin: 0 0; }
.film picture { display: contents; }
.film img, .film video { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; object-fit: cover; user-select: none; -webkit-user-drag: none; pointer-events: none; }
/* A window whose shape is far from the film's: the film is shown smaller, a soft blur of it fills the bands that are left,
   and the film's edges melt into that blur. The blur is the film drawn 32 dots wide and stretched: it costs next to nothing. */
.film-glow { position: absolute; left: -8%; top: -8%; width: 116%; height: 116%; display: none; filter: blur(26px) saturate(1.15) brightness(.82); pointer-events: none; }
.stage[data-bands] .film-glow { display: block; }
.stage[data-bands="x"] .film { -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.stage[data-bands="y"] .film { -webkit-mask-image: linear-gradient(transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(transparent, #000 6%, #000 94%, transparent); }
.stage-fade { position: absolute; inset: auto 0 0 0; height: 46%; opacity: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgba(6, 11, 31, 0), var(--night) 82%); }

.hint { position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3; display: grid; justify-items: center; gap: 8px;
  font: 600 11px/1 var(--display); letter-spacing: .28em; text-transform: uppercase; color: rgba(255,255,255,.82); opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.hint i { width: 1px; height: 34px; background: linear-gradient(rgba(255,255,255,.9), rgba(255,255,255,0)); animation: hint 1.8s ease-in-out infinite; transform-origin: top; }
.hint.is-on { opacity: 1; }
@keyframes hint { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* ---------- entry screen ---------- */
/* Before the film has loaded it is plain night; once loaded the film's opening frame shows through and the words appear.
   The snow layer is above it, so it snows here too. */
html[data-gate], html[data-gate] body { overflow: hidden; }
.gate { position: absolute; inset: 0; z-index: 4; display: grid; align-items: end; justify-items: center; padding: 0 20px clamp(54px, 13vh, 140px);
  background: linear-gradient(to bottom, rgba(6, 11, 31, .12), rgba(6, 11, 31, 0) 45%, rgba(6, 11, 31, .62)); transition: opacity .5s ease, visibility 0s linear .5s; }
.gate::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 80% at 50% 0%, var(--night-2), var(--night) 70%); transition: opacity 1.1s ease; }
html[data-gate="ready"] .gate::before { opacity: 0; }
html:not([data-gate]) .gate { opacity: 0; visibility: hidden; pointer-events: none; }
/* The two wide films open with this screen's shade already in the picture (it fades away in their first frames): no second one over them. */
html:is([data-film="desk"], [data-film="wide"]) .gate { background: none; }
html[data-gate] .sound { opacity: 0; pointer-events: none; }
html[data-gate] .hint { display: none; }
.sound { transition: background .2s ease, border-color .2s ease, transform .2s ease, opacity .5s ease .2s; }
.gate-box { position: relative; display: grid; justify-items: center; gap: 14px; min-height: 92px; align-content: end; }
.gate-load { position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); display: grid; justify-items: center; gap: 12px; transition: opacity .45s ease, visibility 0s linear .45s; }
html[data-gate="ready"] .gate-load { opacity: 0; visibility: hidden; }
.gate-bar { position: relative; width: min(64vw, 260px); height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .16); }
/* The bar is moved by the browser itself (a transition on a shift, never on a width), and its spark pulses on its own:
   both go on smoothly even in a moment when the page's script is busy. `--k` = how much has loaded, 0…1. */
.gate-bar { --k: 0; }
.gate-bar span { position: absolute; inset: 0; overflow: hidden; border-radius: 2px; }
.gate-bar i, .gate-bar b { position: absolute; left: 0; top: 0; width: 100%; height: 100%; transform: translateX(calc((var(--k) - 1) * 100%)); transition: transform .5s cubic-bezier(.3, .6, .3, 1); will-change: transform; }
.gate-bar i { border-radius: 2px; background: linear-gradient(90deg, rgba(159, 182, 255, .5), #fff); }
.gate-bar b::after { content: ""; position: absolute; right: -5px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: #fff7e6; box-shadow: 0 0 16px 4px rgba(255, 236, 200, .85); animation: spark 1.1s ease-in-out infinite; }
@keyframes spark { 50% { transform: scale(1.4); opacity: .7; } }
.gate-label { font: 600 11px/1 var(--display); letter-spacing: .26em; text-transform: uppercase; color: rgba(255, 255, 255, .78); white-space: nowrap; }
.gate-label b { font-weight: 600; color: #fff; margin-left: .5em; font-variant-numeric: tabular-nums; }
/* "Tap to start": hollow letters, only their outline drawn, the night showing through; they breathe slowly. A tap anywhere on the screen starts the show. */
.gate-start { padding: 16px 20px; border: 0; background: none; cursor: pointer; font: 800 clamp(23px, 4vw, 44px)/1 var(--display); letter-spacing: .09em; text-transform: uppercase; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1.5px #fff; text-shadow: 0 0 24px rgba(6, 11, 31, .6);
  opacity: 0; visibility: hidden; transform: translateY(10px) scale(.96); transition: opacity .6s ease .25s, transform .6s cubic-bezier(.2, .8, .2, 1) .25s, visibility 0s linear .25s;
  position: relative; -webkit-tap-highlight-color: transparent; }
html[data-gate="ready"] .gate-start { opacity: 1; visibility: visible; transform: none; animation: beckon 2.6s ease-in-out 1.1s infinite; }
html[data-gate="ready"] .gate { cursor: pointer; }
@keyframes beckon { 50% { opacity: .5; } }
.gate-start:active { transform: scale(.97); }
.gate-start:focus-visible { outline: 1px solid rgba(255, 255, 255, .6); outline-offset: 6px; border-radius: 10px; }
/* The Send button breathes: a stronger glow, made once, fades in and out over the button's own
   (a glow that itself changed size would be painted afresh on every frame). */
.send::before { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 58px rgba(255, 70, 56, .85); opacity: 0; pointer-events: none; }
html.fx .delivery.is-seen .send:not([disabled])::before { animation: glow 2.6s ease-in-out 1.8s infinite; }
@keyframes glow { 50% { opacity: 1; } }

/* ---------- sound ---------- */
.sound { position: fixed; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 10; width: 46px; height: 46px; padding: 0; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: rgba(8, 16, 44, .6); color: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sound:hover { background: rgba(14, 26, 68, .8); border-color: rgba(255,255,255,.55); }
.sound:active { transform: scale(.94); }
.sound:focus-visible, .send:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.sound svg { overflow: visible; }
.sound path { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sound .sound-body { fill: currentColor; stroke: none; }
.sound .sound-wave { opacity: 0; }
.sound.is-on .sound-wave { opacity: 1; }
.sound.is-on .sound-cross { opacity: 0; }
.sound.is-on .sound-wave-2 { animation: wave 1.6s ease-in-out infinite; }
.sound.is-inviting::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 1px solid rgba(255,255,255,.7); animation: invite 2.2s ease-out infinite; }
.sound.is-missing { opacity: .45; }
@keyframes wave { 50% { opacity: .35; } }
@keyframes invite { from { transform: scale(1); opacity: .8; } to { transform: scale(1.7); opacity: 0; } }

/* ---------- form ---------- */
[hidden] { display: none !important; }       /* the sent form really goes away (its own `display` would otherwise keep it on screen) */
.delivery { position: relative; z-index: 3; min-height: 100vh; min-height: 100svh; padding: clamp(56px, 9vh, 110px) 20px clamp(48px, 8vh, 96px); display: grid; align-content: center; justify-items: center; gap: clamp(20px, 3.2vh, 34px); }
/* the film leaves as plain night; the form's own sky takes over from it gradually, with no line between the two */
.delivery::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 46vh; z-index: -1; pointer-events: none; background: linear-gradient(var(--night), rgba(6, 11, 31, 0)); }
.delivery-title { margin: 0; max-width: 22ch; text-align: center; font: 800 clamp(20px, 3.1vw, 38px)/1.12 var(--display); letter-spacing: .01em; text-transform: uppercase; text-wrap: balance; }
.form { width: min(100%, 880px); display: grid; gap: 18px; }
.panel { padding: clamp(18px, 3vw, 34px); border-radius: 22px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 0 0 1px rgba(6, 11, 31, .6), 0 30px 80px rgba(2, 6, 22, .7), inset 0 1px 0 rgba(160, 185, 255, .12); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.label { font: 600 11px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
/* a field filled in properly gets a tick, drawn from left to right, at the end of its label */
.field .label { display: flex; align-items: center; min-height: 14px; }
.field .label::after { content: ""; flex: none; margin-left: auto; width: 15px; height: 12px; background: #bcd0ff; opacity: 0; clip-path: inset(0 100% 0 0);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 12'%3E%3Cpath d='M1.6 6.4l3.9 3.9 7.9-8.5' fill='none' stroke='%23000' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 12'%3E%3Cpath d='M1.6 6.4l3.9 3.9 7.9-8.5' fill='none' stroke='%23000' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.field.is-ok .label::after { opacity: 1; clip-path: inset(0); transition: clip-path .3s cubic-bezier(.3, .7, .3, 1) .05s, opacity .1s linear; }
.label b { font-weight: 600; color: var(--red-hot); margin-left: 1px; }
.group { margin: 24px 0 14px; padding-top: 20px; border-top: 1px solid var(--line); font: 700 13px/1.2 var(--display); letter-spacing: .05em; text-transform: uppercase; }
input[type="text"], input[type="tel"], input[type="email"], textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: 9px; border: 1px solid var(--line); background: rgba(4, 9, 30, .92); color: var(--ink);
  font: 500 16px/1.3 var(--text); outline: none; transition: border-color .15s ease, box-shadow .15s ease; -webkit-appearance: none; appearance: none; }
textarea { resize: vertical; min-height: 118px; }
input:focus-visible, textarea:focus-visible { border-color: #9fb6ff; box-shadow: 0 0 0 3px rgba(120, 150, 255, .28); }
/* when a field is entered a white spark runs once round its frame and lights it up behind itself */
@property --lap { syntax: "<angle>"; inherits: false; initial-value: 400deg; }
html.fx :is(input[type="text"], input[type="tel"], input[type="email"], textarea):focus-visible { border-color: transparent;
  background: linear-gradient(#050b24, #050b24) padding-box,
    conic-gradient(from 250deg, #9fb6ff 0, #9fb6ff calc(var(--lap, 400deg) - 34deg), #fff calc(var(--lap, 400deg) - 3deg), #fff var(--lap, 400deg), rgba(124, 152, 255, .3) calc(var(--lap, 400deg) + 1deg), rgba(124, 152, 255, .3) 360deg) border-box;
  animation: lap .7s cubic-bezier(.4, .1, .3, 1) 1; }
@keyframes lap { from { --lap: 0deg; } to { --lap: 400deg; } }
html.fx .field.is-bad :is(input, textarea):focus-visible { background: rgba(4, 9, 30, .92); border-color: var(--red-hot); animation: none; }      /* a field with a mistake stays red */
.field.is-bad input, .field.is-bad textarea { border-color: var(--red-hot); box-shadow: 0 0 0 3px rgba(255, 83, 69, .2); }
.field .error { font: 500 12px/1.3 var(--text); color: #ffb3ab; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.consent { margin-top: 20px; display: flex; align-items: center; gap: 12px; cursor: pointer; width: fit-content; }
.consent input { position: absolute; opacity: 0; width: 22px; height: 22px; margin: 0; cursor: pointer; }
.consent .box { flex: none; width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line); background: rgba(4, 9, 30, .92); display: grid; place-items: center; transition: border-color .15s ease, background .15s ease; }
.consent .box::after { content: ""; width: 11px; height: 6px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px) scale(.3); opacity: 0; transition: transform .22s cubic-bezier(.3, 1.6, .5, 1), opacity .1s linear; }
.consent input:checked + .box { background: var(--red); border-color: var(--red-hot); }
.consent input:checked + .box::after { opacity: 1; transform: rotate(-45deg) translate(1px, -1px); }
.consent input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(120, 150, 255, .35); border-color: #9fb6ff; }
.consent.is-bad .box { border-color: var(--red-hot); box-shadow: 0 0 0 3px rgba(255, 83, 69, .2); }
.status { margin: 0; padding: 12px 16px; border-radius: 12px; background: rgba(120, 20, 24, .7); border: 1px solid rgba(255, 110, 100, .5); font: 500 14px/1.4 var(--text); }
.status.is-note { background: rgba(14, 30, 80, .8); border-color: var(--line); }
.send { position: relative; width: 100%; min-height: 56px; border: 0; border-radius: 14px; cursor: pointer; color: #fff; font: 700 17px/1 var(--display); letter-spacing: .02em;
  background: linear-gradient(180deg, var(--red-hot), var(--red) 70%, #c21a18); box-shadow: 0 0 34px rgba(255, 60, 48, .5), inset 0 1px 0 rgba(255, 255, 255, .28);
  transition: transform .15s ease, box-shadow .2s ease, filter .2s ease; -webkit-tap-highlight-color: transparent; }
.send:hover { box-shadow: 0 0 46px rgba(255, 60, 48, .7), inset 0 1px 0 rgba(255, 255, 255, .28); filter: brightness(1.06); }
.send:active { transform: translateY(1px) scale(.995); }
.send[disabled] { opacity: .6; cursor: progress; }
/* The finale stands free on the night sky: big words and the card's own handwriting under them. */
.thanks { width: min(100%, 880px); padding: clamp(12px, 3vw, 28px) 0; display: grid; justify-items: center; gap: clamp(12px, 2vh, 20px); text-align: center; outline: none; }
.thanks-title { margin: 0; font: 800 clamp(30px, 6.6vw, 70px)/1 var(--display); letter-spacing: .01em; text-transform: uppercase; white-space: nowrap; text-shadow: 0 0 38px rgba(255, 83, 69, .5); }
.thanks-title span { display: inline-block; white-space: pre; }
.thanks p { margin: 0; max-width: 32ch; color: var(--muted); font-size: clamp(16px, 1.5vw, 19px); text-wrap: balance; }
/* "Happy holidays", the very line from the card (its letters without the card's white edging), here in white: it is written from left to right */
.thanks-script { display: block; width: min(78%, 430px); aspect-ratio: 579 / 126; background: #fff; filter: drop-shadow(0 0 10px rgba(255, 83, 69, .8));
  -webkit-mask: url("../assets/thanks-script.svg") center / 100% 100% no-repeat; mask: url("../assets/thanks-script.svg") center / 100% 100% no-repeat; }
.thanks-note { font-size: 13px !important; opacity: .8; max-width: 46ch !important; }

/* ---------- the form's arrival, and the thank-you after Send ---------- */
/* The arrival: the title, the panel and the fields come up one after another.
   Only with script and motion allowed (html.fx); otherwise everything simply stands there. */
html.fx .delivery:not(.is-seen) :is(.delivery-title, .panel, .send) { opacity: 0; }
html.fx .delivery.is-seen .delivery-title { animation: rise .55s cubic-bezier(.2, .8, .2, 1) .05s backwards; }
html.fx .delivery.is-seen .panel { animation: rise .6s cubic-bezier(.2, .8, .2, 1) .16s backwards; }
html.fx .delivery.is-seen :is(.field, .group, .consent) { animation: rise .45s cubic-bezier(.2, .8, .2, 1) calc(.3s + var(--i, 0) * .055s) backwards; }
html.fx .delivery.is-seen .send { animation: rise .5s cubic-bezier(.2, .8, .2, 1) 1s backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@keyframes stamp { 0% { opacity: 0; transform: scale(1.75) rotate(-5deg); } 42% { opacity: 1; transform: scale(.93) rotate(0); } 68% { transform: scale(1.035); } 100% { opacity: 1; transform: scale(1); } }
/* After Send the form fades and the thank-you takes its place. */
.delivery { overflow-x: clip; }
.delivery.is-sent :is(.form, .delivery-title) { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s ease, visibility 0s linear .3s; }
.delivery.is-thanks .delivery-title { display: none; }
html.fx .delivery.is-thanks .thanks-title span { animation: stamp .34s cubic-bezier(.3, .7, .3, 1) calc(.12s + var(--i, 0) * .055s) both; }
html.fx .delivery.is-thanks .thanks p { animation: rise .5s cubic-bezier(.2, .8, .2, 1) .7s backwards; }
html.fx .delivery.is-thanks .thanks-script { animation: scribe .8s cubic-bezier(.4, 0, .3, 1) .95s both; }
@keyframes scribe { from { clip-path: inset(-30% 100% -30% -5%); } to { clip-path: inset(-30% -5% -30% -5%); } }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .field { grid-column: 1 / -1; }
  .field.half { grid-column: auto; }
  .delivery { padding-left: 14px; padding-right: 14px; }
  .panel { border-radius: 18px; }
  .sound { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .hint i, .sound.is-on .sound-wave-2, .sound.is-inviting::after, html[data-gate="ready"] .gate-start, .gate-bar b::after { animation: none; }
  .field.is-ok .label::after, .consent .box::after { transition: none; }
}
