/* Arkad raffle kiosk — one page: the drum video always running, the form beside it
   (landscape Macs) or below it (portrait iPad). Brand: black + gold, Inter.
   Audience: older attendees — large type, high contrast, but the whole page fits. */

@font-face {
  font-family: "Inter";
  src: url("/inter.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --black: #0d0d0d;
  --gold: #f2d27c;
  --gold-deep: #b8862f;
  --gold-grad: linear-gradient(135deg, #f6cf6b 0%, #e2b04a 45%, #be8602 100%);
  --white: #ffffff;
  --muted: #d8d1c2;
  --error: #ffb8a8;
  --radius: 16px;
  --field-h: clamp(48px, 5.4vh, 56px);
  --label: clamp(18px, 1.9vh, 20px);
  --input: clamp(20px, 2.2vh, 23px);
  font-family: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--black);
  color: var(--white);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Ambient backdrop behind the form column ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 20% 110%, #2a1f08 0%, transparent 60%),
    radial-gradient(90% 70% at 15% -10%, #1f1708 0%, transparent 55%),
    var(--black);
}

.glow {
  position: absolute;
  width: 90vmax;
  height: 90vmax;
  left: 30%;
  top: 50%;
  translate: -50% -50%;
  background: conic-gradient(from 0deg, transparent 0 20%, rgba(242, 210, 124, 0.08) 30%, transparent 45% 70%, rgba(190, 134, 2, 0.08) 82%, transparent 95%);
  filter: blur(60px);
  animation: spin 60s linear infinite;
}

.mote {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 207, 107, 0.9) 0%, rgba(246, 207, 107, 0.25) 40%, transparent 70%);
  filter: blur(1px);
  opacity: 0;
  animation: rise linear infinite;
}
.m1 { left: 4%;  width: 16px; height: 16px; animation-duration: 19s; animation-delay: -2s; }
.m2 { left: 12%; width: 40px; height: 40px; animation-duration: 27s; animation-delay: -14s; filter: blur(6px); }
.m3 { left: 20%; width: 10px; height: 10px; animation-duration: 16s; animation-delay: -8s; }
.m4 { left: 28%; width: 28px; height: 28px; animation-duration: 24s; animation-delay: -19s; filter: blur(4px); }
.m5 { left: 36%; width: 12px; height: 12px; animation-duration: 18s; animation-delay: -5s; }
.m6 { left: 50%; width: 50px; height: 50px; animation-duration: 31s; animation-delay: -11s; filter: blur(8px); }
.m7 { left: 64%; width: 14px; height: 14px; animation-duration: 21s; animation-delay: -16s; }
.m8 { left: 80%; width: 32px; height: 32px; animation-duration: 26s; animation-delay: -3s; filter: blur(5px); }
.m9 { left: 94%; width: 9px;  height: 9px;  animation-duration: 15s; animation-delay: -10s; }

@keyframes spin { to { rotate: 360deg; } }
@keyframes rise {
  0%   { transform: translate3d(0, 105vh, 0); opacity: 0; }
  10%  { opacity: 0.8; }
  85%  { opacity: 0.6; }
  100% { transform: translate3d(4vw, -10vh, 0); opacity: 0; }
}

/* ---------- Page: video + panel ---------- */

.page {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: grid;
  /* Portrait (iPad): logo, headline, video band, form. The video takes what the rest leaves. */
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
.brand { grid-row: 1; }
.intro { grid-row: 2; }
.media { grid-row: 3; }
.panel { grid-row: 4; }

/* ---------- Brand: the Arkad logo, big and centred, with a light orbiting it ---------- */

.brand {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: max(18px, env(safe-area-inset-top)) 24px 4px;
  pointer-events: none;
}

.brand-logo {
  position: relative;
  /* Room around the logo for the orbiting light. */
  padding: 22px 34px;
}

.brand-logo .logo {
  position: relative;
  display: block;
  width: min(62vw, 360px);
  height: auto;
  filter: drop-shadow(0 0 18px rgba(242, 210, 124, 0.25));
}

.orbit {
  position: absolute;
  inset: -20px;
  width: calc(100% + 40px);
  height: calc(100% + 40px);
  mix-blend-mode: screen;
}

.media {
  position: relative;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 80%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 12%, #000 80%, transparent 100%);
}

.media-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 58%;
}

.panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 28px max(18px, env(safe-area-inset-bottom));
  min-height: 0;
}

.intro {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2px 24px clamp(8px, 1.2vh, 14px);
}

.kicker {
  margin: 0 0 6px;
  font-size: clamp(14px, 1.6vh, 17px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

h1 {
  margin: 0;
  font-size: clamp(30px, 3.4vh, 40px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 em {
  font-style: normal;
  background: linear-gradient(100deg, #be8602 0%, #f6cf6b 30%, #fff4d6 45%, #f6cf6b 60%, #be8602 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* Landscape (the Macs): panel on the left, video fills the rest on the right. */
@media (min-aspect-ratio: 5/4) {
  /* Logo, then the headline, both centred across the full width; below them the video on the
     left and the form on the right. */
  .page {
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr) clamp(440px, 36vw, 580px);
  }
  .brand { grid-column: 1 / -1; grid-row: 1; padding-top: max(14px, env(safe-area-inset-top)); }
  .brand-logo .logo { width: min(28vw, 420px); }
  .intro { grid-column: 1 / -1; grid-row: 2; padding: 0 32px clamp(10px, 1.8vh, 20px); }
  h1 { font-size: clamp(34px, 3.2vw, 54px); }
  .media {
    grid-column: 1;
    grid-row: 3;
    /* Fade the right edge (towards the form) and the top edge (towards the headline). */
    -webkit-mask-image: linear-gradient(to left, transparent 0, #000 16%), linear-gradient(to bottom, transparent 0, #000 14%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to left, transparent 0, #000 16%), linear-gradient(to bottom, transparent 0, #000 14%);
    mask-composite: intersect;
  }
  .media-video { object-position: 50% 58%; }
  .panel {
    grid-column: 2;
    grid-row: 3;
    justify-content: flex-start;
    align-items: center;
    padding: clamp(4px, 1vh, 12px) clamp(32px, 4vw, 72px) 24px 0;
  }
}

/* ---------- Form ---------- */

.card {
  width: min(100%, 520px);
  padding: clamp(14px, 1.9vh, 20px) clamp(16px, 2.1vh, 22px);
  border-radius: calc(var(--radius) + 8px);
  background: rgba(20, 20, 20, 0.82);
  border: 1px solid rgba(242, 210, 124, 0.32);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.field + .field { margin-top: clamp(8px, 1.1vh, 12px); }

label {
  display: block;
  font-size: var(--label);
  font-weight: 700;
  margin: 0 0 5px 3px;
}

input[type="text"] {
  display: block;
  width: 100%;
  height: var(--field-h);
  padding: 0 18px;
  font: 600 var(--input)/1 "Inter", sans-serif;
  color: var(--black);
  background: var(--white);
  border: 3px solid transparent;
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 5px rgba(242, 210, 124, 0.28);
}
input[aria-invalid="true"] { border-color: var(--error); }

.error {
  margin: 4px 0 0 3px;
  font-size: 18px;
  font-weight: 600;
  color: var(--error);
}
.error:empty { display: none; }

.consent {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  align-items: center;
  margin: clamp(10px, 1.4vh, 16px) 0;
  font-size: clamp(15px, 1.7vh, 17px);
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
}
.consent input {
  position: absolute;
  opacity: 0;
  width: 40px;
  height: 40px;
  margin: 0;
}
.consent .box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 3px solid var(--gold);
  background: rgba(255, 255, 255, 0.06);
  display: grid;
  place-items: center;
  transition: background 0.15s;
}
.consent .box::after {
  content: "";
  width: 11px;
  height: 20px;
  border: solid var(--black);
  border-width: 0 5px 5px 0;
  rotate: 45deg;
  translate: 0 -2px;
  opacity: 0;
}
.consent input:checked + .box { background: var(--gold); }
.consent input:checked + .box::after { opacity: 1; }
.consent input:focus-visible + .box { box-shadow: 0 0 0 5px rgba(242, 210, 124, 0.35); }
.consent input[aria-invalid="true"] + .box { border-color: var(--error); box-shadow: 0 0 0 4px rgba(255, 184, 168, 0.25); }
.consent-error { margin: -6px 0 12px 54px; }

.submit {
  display: block;
  width: 100%;
  height: clamp(52px, 6.2vh, 60px);
  border: 0;
  border-radius: var(--radius);
  background: var(--gold-grad);
  color: var(--black);
  font: 800 clamp(22px, 2.6vh, 27px)/1 "Inter", sans-serif;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(190, 134, 2, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.1s, filter 0.15s;
}
.submit:active { transform: scale(0.98); filter: brightness(0.95); }
.submit:focus-visible { outline: 4px solid var(--white); outline-offset: 4px; }

.notice {
  margin: 10px 2px 0;
  font-size: 13px;
  line-height: 1.35;
  color: #bdb5a4;
}

/* ---------- Confirmation: full screen for a few seconds, then back ---------- */

.done {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 32px;
  background: radial-gradient(80% 70% at 50% 40%, #241a06 0%, var(--black) 70%);
  text-align: center;
  cursor: pointer;
  animation: fade-in 0.35s ease-out both;
}
.done[hidden] { display: none; }
.done.leaving { opacity: 0; transition: opacity 0.6s ease-in; pointer-events: none; }

.done-video, .confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* The square confirmation clip: on top (portrait) or on the right (landscape), its edge
   faded into the black page so the square never shows. */
.done-video {
  object-fit: contain;
  object-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, #000 54%, transparent 68%);
  mask-image: linear-gradient(to bottom, #000 54%, transparent 68%);
}

.done-inner { position: relative; max-width: 900px; }

.ticket {
  width: min(70vw, 440px);
  margin: 0 auto 40px;
  padding: 30px 34px 24px;
  border-radius: 18px;
  background: var(--gold-grad);
  color: var(--black);
  box-shadow: 0 30px 80px rgba(190, 134, 2, 0.45);
  -webkit-mask: radial-gradient(circle 22px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
                radial-gradient(circle 22px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 22px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat,
        radial-gradient(circle 22px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
  animation: ticket-drop 1.1s cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
}
.ticket img {
  display: block;
  width: 70%;
  height: auto;
  margin: 0 auto 16px;
  filter: brightness(0) saturate(100%);
}
.ticket span {
  display: block;
  padding-top: 14px;
  border-top: 2px dashed rgba(13, 13, 13, 0.45);
  font-size: clamp(14px, 3.6vw, 18px);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.done h2 {
  margin: 0 0 18px;
  font-size: clamp(44px, 6.5vh, 76px);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rise-in 0.6s 0.5s ease-out both;
}
.done p {
  margin: 0;
  font-size: clamp(24px, 3.2vh, 34px);
  line-height: 1.35;
  animation: rise-in 0.6s 0.7s ease-out both;
}

.countdown {
  width: min(60vw, 360px);
  height: 6px;
  margin: 40px auto 0;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.countdown span {
  display: block;
  height: 100%;
  background: var(--gold);
  transform-origin: left;
}
.done:not([hidden]) .countdown span { animation: drain var(--reset-ms, 8000ms) linear both; }

/* With the confirmation video, the video carries the ticket; text goes beside/below it. */
.done.has-video { background: var(--black); }
.done.has-video .ticket { display: none; }
.done.has-video .done-inner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(48px, env(safe-area-inset-bottom));
  max-width: none;
  padding: 0 32px;
}

@media (min-aspect-ratio: 5/4) {
  /* Same side as on the page: video left, message right. */
  .done-video {
    object-position: left center;
    -webkit-mask-image: linear-gradient(to left, transparent 36%, #000 58%);
    mask-image: linear-gradient(to left, transparent 36%, #000 58%);
  }
  .done.has-video .done-inner {
    left: auto;
    right: clamp(32px, 4vw, 72px);
    top: 50%;
    bottom: auto;
    translate: 0 -50%;
    /* The square clip fills the left ~65 % of a 14" screen: keep the text clear of the crank. */
    width: min(33vw, 560px);
    padding: 0;
    text-align: left;
  }
  .done.has-video .countdown { margin-left: 0; }
  .done.has-video h2 { font-size: clamp(40px, 3.8vw, 64px); }
  .done.has-video p { font-size: clamp(22px, 1.9vw, 30px); }
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes ticket-drop {
  0%   { opacity: 0; transform: translateY(-60vh) rotate(-18deg) scale(0.8); }
  60%  { opacity: 1; transform: translateY(12px) rotate(4deg) scale(1.02); }
  100% { transform: translateY(0) rotate(-2deg) scale(1); }
}

/* ---------- Staff-only sync indicator ---------- */

.sync {
  position: fixed;
  right: 14px;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
}
.sync::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4caf6e;
}
.sync.pending::before { background: #e8a33a; }

/* Staff-only music toggle, bottom-left, discreet. */
.sound {
  position: fixed;
  left: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 20;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(242, 210, 124, 0.5);
  border-radius: 50%;
  background: rgba(13, 13, 13, 0.6);
  color: var(--gold);
  font: 700 24px/1 "Inter", sans-serif;
  cursor: pointer;
  opacity: 0.8;
}
.sound.off { color: rgba(255, 255, 255, 0.4); text-decoration: line-through; }

/* 404 page. */
.notfound { position: relative; display: grid; place-items: center; height: 100dvh; text-align: center; }
.notfound .logo { display: block; width: 260px; height: auto; margin: 0 auto 24px; }
.lede { margin: 14px 0 0; font-size: 24px; color: var(--muted); }
.lede a { color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .mote { display: none; }
}
