/* AlDar pass registration, opened on the visitor's own phone.
   Sizes, colours and type come from the Figma "Activate Your Pass" frames (ALDAR (ADGP), node 6201:98),
   drawn at 2160×3840 for a 55" screen. Everything is written in design pixels times --u
   (1 design pixel = 1/2160 of the screen width); small text, fields and buttons have a floor in px so
   they stay readable and easy to tap on a phone. Phones taller than 9:16 get the extra room above the
   bottom button. */
@font-face { font-family: "Poppins"; font-weight: 200; font-display: swap; src: url("fonts/Poppins-200.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 300; font-display: swap; src: url("fonts/Poppins-300.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 600; font-display: swap; src: url("fonts/Poppins-600.woff2") format("woff2"); }
@font-face { font-family: "Poppins"; font-weight: 700; font-display: swap; src: url("fonts/Poppins-700.woff2") format("woff2"); }

:root {
  --teal: #7ac9d4;                 /* rgb(122 201 212) */
  --sand: #d7d1ca;                 /* field and card labels */
  --error: #ff9d8f;
  --u: min(calc(100vw / 2160), calc(100vh / 3840));
  /* Figma "Vignette": a top/bottom fade and a softer side fade. */
  --vignette:
    linear-gradient(180deg, rgb(0 0 0 / .6) 0%, rgb(0 0 0 / 0) 22%, rgb(0 0 0 / 0) 60%, rgb(0 0 0 / .85) 100%),
    linear-gradient(90deg, rgb(0 0 0 / .35) 0%, rgb(0 0 0 / 0) 20%, rgb(0 0 0 / 0) 80%, rgb(0 0 0 / .35) 100%);
  --glass: linear-gradient(180deg, rgb(11 15 20 / .8), rgb(11 15 20 / .62));
  --glass-card: linear-gradient(180deg, rgb(11 15 20 / .86), rgb(11 15 20 / .66));
}
@supports (height: 100lvh) {
  :root { --u: min(calc(100vw / 2160), calc(100lvh / 3840)); }
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; background: #24282a; }
/* Pass → user page is a page load: cross-fade it where the browser can. */
@view-transition { navigation: auto; }
body.aldar {
  min-height: 100%; margin: 0; overflow-x: hidden; color: #fff;
  font-family: "Poppins", system-ui, sans-serif; font-weight: 300;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
p { margin: 0; }
[hidden] { display: none !important; }

.stage {
  position: relative; margin: 0 auto; overflow: hidden; isolation: isolate;
  width: calc(2160 * var(--u)); min-height: max(calc(3840 * var(--u)), 100vh);
}
@supports (height: 100svh) {
  .stage { min-height: max(calc(3840 * var(--u)), 100svh); }
}

/* Aldar logo: 220×220 at 160,160 on every frame. The PNG is the white logo on transparent, which is what
   Figma's SCREEN blend of the black-backed logo shows. */
.logo {
  position: absolute; z-index: 2; left: calc(160 * var(--u)); top: calc(160 * var(--u));
  width: max(44px, calc(220 * var(--u))); height: auto; pointer-events: none;
}

/* The photo stays put while the screens change: body[data-scene] fades between the sharp and blurred
   versions, so nothing ever fades from black. */
.backdrop {
  position: fixed; z-index: 0; top: 0; left: 50%; width: calc(2160 * var(--u)); height: 100vh; overflow: hidden;
  transform: translateX(-50%); background: linear-gradient(#2b2b2b, #67645f 30%, #3d4a4a 60%, #16181a); pointer-events: none;
}
@supports (height: 100lvh) { .backdrop { height: 100lvh; } }
.backdrop i { position: absolute; inset: 0; transition: opacity .6s linear; }
.backdrop .scene { background: url("aldar/scene.jpg") center / cover no-repeat; animation: drift 26s ease-in-out infinite alternate; }
.backdrop .scene-blur { inset: -3%; background: url("aldar/scene-blur.jpg") center / cover no-repeat; opacity: 0; }
.backdrop .shade { background: var(--vignette); }
/* Welcome's extra top shade. It has its own layer so it fades with the rest instead of snapping off. */
.backdrop .top-shade { background: linear-gradient(180deg, rgb(0 0 0 / .8) 0, rgb(0 0 0 / 0) 52%); opacity: 0; }
[data-scene="start"] .backdrop .top-shade { opacity: 1; }
.backdrop .glow {
  opacity: 0;
  background:
    radial-gradient(circle at 50% calc(1540 * var(--u)), rgb(122 201 212 / .15), rgb(122 201 212 / 0) calc(1200 * var(--u))),
    linear-gradient(rgb(0 0 0 / .38), rgb(0 0 0 / .38));
}
[data-scene="details"] .scene-blur, [data-scene="details"] .glow, [data-scene="pass"] .glow { opacity: 1; }
/* The drift stops behind the glass card, so its blur isn't redrawn every frame. */
body:not([data-scene="start"]) .backdrop .scene { animation-play-state: paused; }
@keyframes drift { from { transform: scale(1.01); } to { transform: scale(1.09) translate(-1.5%, -1%); } }

.screen {
  position: relative; z-index: 1; min-height: inherit; display: flex; flex-direction: column;
  padding: 0 calc(160 * var(--u)) calc(160 * var(--u));
}
.welcome { padding-bottom: calc(200 * var(--u)); }

/* Headlines: Poppins ExtraLight over Bold, 100% line height, soft drop shadow. */
.headline {
  margin: 0 0 0 calc(-8 * var(--u)); font-size: calc(240 * var(--u)); font-weight: 200; line-height: 1;
  letter-spacing: 0; text-shadow: 0 calc(8 * var(--u)) calc(30 * var(--u)) rgb(0 0 0 / .45);
}
.headline span { display: block; }
.headline .bold { font-weight: 700; }
.headline.center { margin-left: 0; text-align: center; }

/* 01 · Welcome */
.welcome-copy { padding-top: calc(500 * var(--u)); }
/* "Echo outline": two teal outlines of "your pass", 20/16 and 40/32 design px behind the words. */
.echo { position: relative; width: max-content; isolation: isolate; }
.echo::before, .echo::after {
  content: attr(data-echo); position: absolute; left: 0; top: 0; z-index: -1;
  color: transparent; text-shadow: none; -webkit-text-stroke: calc(5 * var(--u)) rgb(122 201 212 / .45);
  transform: translate(calc(20 * var(--u)), calc(16 * var(--u)));
}
.echo::after {
  -webkit-text-stroke-color: rgb(122 201 212 / .22);
  transform: translate(calc(40 * var(--u)), calc(32 * var(--u)));
}
.body {
  margin-top: calc(40 * var(--u)); text-wrap: balance;   /* two lines, as in the frame */
  font-size: max(12px, calc(82 * var(--u))); line-height: 1.4; color: rgb(255 255 255 / .9);
}

.bottom { margin-top: auto; }

/* "Button primary": white pill, teal glow. */
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: max(54px, calc(200 * var(--u))); padding: 0 calc(56 * var(--u));
  border: 0; border-radius: 999px; cursor: pointer; text-decoration: none;
  background: linear-gradient(180deg, #fff, #e9eef0); color: #000;
  font-size: max(14px, calc(54 * var(--u))); font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  box-shadow: 0 0 calc(70 * var(--u)) rgb(122 201 212 / .6), 0 calc(10 * var(--u)) calc(30 * var(--u)) rgb(0 0 0 / .4);
  transition: transform .12s ease, filter .12s ease;
}
.btn:active { transform: scale(.985); filter: brightness(.94); }
.btn:focus-visible { outline: max(2px, calc(6 * var(--u))) solid var(--teal); outline-offset: max(3px, calc(8 * var(--u))); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.ghost {
  gap: max(10px, calc(40 * var(--u))); background: rgb(11 15 20 / .6); color: #fff;
  border: max(1px, calc(3 * var(--u))) solid rgb(255 255 255 / .3); box-shadow: none;
}
.btn.ghost:disabled { opacity: 1; color: rgb(255 255 255 / .75); }
.btn.ghost:disabled:active { transform: none; filter: none; }
.soon {
  padding: .35em .8em; border-radius: 999px; background: rgb(122 201 212 / .18); color: var(--teal);
  font-size: max(10px, calc(38 * var(--u))); font-weight: 600; letter-spacing: .06em; white-space: nowrap;
}

/* "Pulse ring" ×2 around Tap to start: 10 and 30 design px out. */
.pulse { position: relative; }
.pulse::before, .pulse::after {
  content: ""; position: absolute; border-radius: 999px; pointer-events: none;
  border: max(1px, calc(5 * var(--u))) solid rgb(122 201 212 / .5);
  inset: calc(-1 * max(4px, calc(10 * var(--u))));
}
.pulse::after {
  inset: calc(-1 * max(10px, calc(30 * var(--u))));
  border-color: rgb(122 201 212 / .25);
}
.pulse::before, .pulse::after { animation: ring 2.4s ease-out infinite; }
.pulse::after { animation-delay: .35s; }
@keyframes ring { 0% { transform: scale(.985, .9); opacity: 0; } 35% { opacity: 1; } 100% { transform: scale(1.02, 1.14); opacity: 0; } }

/* 02 · Your details */
.details { padding-top: calc(460 * var(--u)); }
.details .headline { font-size: calc(220 * var(--u)); }
.details-form { display: flex; flex-direction: column; margin-top: calc(60 * var(--u)); }
.field { display: flex; flex-direction: column; margin-bottom: calc(40 * var(--u)); }
.label {
  display: block; padding-left: calc(8 * var(--u));
  font-size: max(11px, calc(40 * var(--u))); font-weight: 600; line-height: 1;
  letter-spacing: .28em; text-transform: uppercase; color: var(--sand);
}
.field input {
  width: 100%; height: max(50px, calc(170 * var(--u))); margin-top: calc(24 * var(--u));
  padding: 0 calc(56 * var(--u)); border-radius: max(12px, calc(40 * var(--u)));
  border: max(1px, calc(3 * var(--u))) solid rgb(255 255 255 / .25);
  background: var(--glass);
  font-size: max(16px, calc(64 * var(--u))); font-weight: 300; color: #fff; caret-color: var(--teal);
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: rgb(255 255 255 / .45); opacity: 1; }
/* The focused field: teal 5 px line and glow (the "EMAIL" field in the frame). */
.field input:focus {
  border: max(1.5px, calc(5 * var(--u))) solid var(--teal);
  padding-left: calc(56 * var(--u) - max(1.5px, calc(5 * var(--u))) + max(1px, calc(3 * var(--u))));
  box-shadow: 0 0 calc(40 * var(--u)) rgb(122 201 212 / .45);
}
.field input[aria-invalid="true"] { border-color: var(--error); }
.field-error {
  display: block; padding-left: calc(8 * var(--u)); color: var(--error);
  font-size: max(12px, calc(42 * var(--u))); line-height: 1.35;
}
.field-error:not(:empty) { margin-top: calc(14 * var(--u)); }

.consent {
  position: relative; display: flex; align-items: flex-start; gap: calc(32 * var(--u));
  min-height: max(24px, calc(80 * var(--u))); cursor: pointer;
  font-size: max(13px, calc(48 * var(--u))); line-height: 1.4; color: rgb(255 255 255 / .85);
}
.consent > span:last-child { padding-top: max(1px, calc(6 * var(--u))); }
.consent input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tick {
  flex: none; width: max(24px, calc(80 * var(--u))); height: max(24px, calc(80 * var(--u)));
  border-radius: max(5px, calc(16 * var(--u))); border: max(1px, calc(3 * var(--u))) solid rgb(255 255 255 / .45);
  background: rgb(11 15 20 / .6) center / 58% no-repeat;
  transition: background-color .15s ease, border-color .15s ease;
}
.consent input:checked + .tick {
  border-color: var(--teal); background-color: var(--teal);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 46 36'%3E%3Cpath d='M4 18.5 16.5 31 42 5' fill='none' stroke='%23000' stroke-width='9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.consent input:focus-visible + .tick { outline: max(2px, calc(6 * var(--u))) solid var(--teal); outline-offset: 3px; }
.consent-error:not(:empty) { margin-top: calc(14 * var(--u)); }
.details-form .btn { margin-top: calc(52 * var(--u)); }

/* 03 · Your QR pass */
.pass { padding-top: calc(950 * var(--u)); }
/* Room for two buttons on short phones. */
@media (min-aspect-ratio: 1/2) { .pass { padding-top: calc(560 * var(--u)); } }
.pass .headline { font-size: calc(220 * var(--u)); }
.pass-card {
  position: relative; display: flex; flex-direction: column; gap: calc(35 * var(--u));
  margin-top: calc(55 * var(--u)); padding: calc(56 * var(--u)); border-radius: calc(56 * var(--u));
  background: var(--glass-card); -webkit-backdrop-filter: blur(calc(30 * var(--u))); backdrop-filter: blur(calc(30 * var(--u)));
  box-shadow: 0 0 calc(70 * var(--u)) rgb(122 201 212 / .35);
}
/* Gradient outline, drawn as a masked ring so the glass fill stays see-through. */
.pass-card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  padding: max(1px, calc(4 * var(--u)));
  background: linear-gradient(160deg, rgb(122 201 212 / .95) 0%, rgb(255 255 255 / .18) 45%, rgb(122 201 212 / .55) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.pass-card .label { padding-left: 0; }
.pass-name { font-size: max(18px, calc(90 * var(--u))); font-weight: 700; line-height: 1; overflow-wrap: anywhere; }
.pass-qr {
  position: relative; overflow: hidden;
  align-self: center; width: calc(1000 * var(--u)); aspect-ratio: 1; padding: calc(80 * var(--u));
  border-radius: calc(32 * var(--u)); background: #fff;
  box-shadow: 0 0 calc(60 * var(--u)) rgb(122 201 212 / .5);
}
.pass-qr img { display: block; width: 100%; height: 100%; }
.pass-row { display: flex; justify-content: space-between; gap: calc(40 * var(--u)); }
.pass-row .label { margin-bottom: calc(24 * var(--u)); }
.pass-row .right { text-align: right; }
.pass-value { font-size: max(18px, calc(90 * var(--u))); font-weight: 700; line-height: 1; letter-spacing: .02em; }
.points { color: var(--teal); text-shadow: 0 0 calc(60 * var(--u)) rgb(122 201 212 / .7); }
.pass .bottom { padding-top: calc(80 * var(--u)); }
.pass .bottom .ghost { margin-top: max(10px, calc(56 * var(--u))); }

/* Messages and the busy spinner (not in the frames). */
.toast {
  position: fixed; z-index: 10; left: 50%; bottom: max(24px, calc(420 * var(--u)));
  width: min(calc(1840 * var(--u)), calc(100vw - 32px)); transform: translateX(-50%);
  padding: max(12px, calc(44 * var(--u))) max(16px, calc(56 * var(--u)));
  border-radius: max(12px, calc(40 * var(--u))); border: 1px solid rgb(255 157 143 / .6);
  background: rgb(11 15 20 / .92); color: #fff; font-size: max(14px, calc(48 * var(--u))); line-height: 1.4;
  box-shadow: 0 10px 30px rgb(0 0 0 / .4);
}
/* While sending, the page never dims: an invisible layer blocks taps and the button shows the spinner. */
.busy { position: fixed; z-index: 9; inset: 0; }
.btn.loading { position: relative; opacity: 1; color: transparent; }
.btn.loading::after {
  content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid rgb(0 0 0 / .15); border-top-color: #000; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Motion ----------
   Plays each time a screen is shown. --i orders the pieces. */
@keyframes rise { from { opacity: 0; transform: translateY(max(14px, calc(90 * var(--u)))); } }
@keyframes fade { from { opacity: 0; } }
@keyframes leave { to { opacity: 0; transform: translateY(min(-10px, calc(-60 * var(--u)))); } }
@keyframes echo-out { from { opacity: 0; transform: none; } }
@keyframes logo-in { from { opacity: 0; transform: scale(.8); } }
@keyframes sheen { 0%, 62% { transform: translateX(-120%) skewX(-18deg); } 85%, 100% { transform: translateX(520%) skewX(-18deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes tick-in { 40% { transform: scale(1.18); } }
@keyframes card-in { from { opacity: 0; transform: perspective(900px) translateY(40px) rotateX(16deg) scale(.94); } }
@keyframes qr-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0); } }
@keyframes scan { 0% { opacity: 0; transform: translateY(0); } 10%, 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(100%); } }

.logo { animation: logo-in .7s cubic-bezier(.2, .9, .3, 1.2) both; }
.in { animation: rise .65s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * 70ms + 80ms) both; }
.welcome .headline .light { animation: rise .8s cubic-bezier(.2, .8, .2, 1) .1s both; }
.welcome .headline .bold { animation: rise .8s cubic-bezier(.2, .8, .2, 1) .22s both; }
.welcome .echo::before { animation: echo-out .8s cubic-bezier(.2, .8, .2, 1) .75s both; }
.welcome .echo::after { animation: echo-out 1s cubic-bezier(.2, .8, .2, 1) .85s both; }
.welcome .body { animation: rise .7s ease-out .45s both; }
.welcome .bottom { animation: rise .7s ease-out .6s both; }
.details .headline span, .pass .headline span { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.details .headline .bold, .pass .headline .bold { animation-delay: .1s; }
.pass-card { animation: card-in .9s cubic-bezier(.2, .8, .2, 1) .25s both; }
.pass-qr img { animation: qr-in .9s cubic-bezier(.4, 0, .2, 1) .8s both; }
/* One sweep while the code appears. It then stays invisible, so scanning is never affected. */
.scan { position: absolute; inset: 0; opacity: 0; pointer-events: none; border-top: max(2px, calc(10 * var(--u))) solid var(--teal); animation: scan .95s cubic-bezier(.4, 0, .2, 1) .78s both; }
.pass .bottom { animation: rise .7s ease-out 1.2s both; }
.screen.leaving { animation: leave .22s ease-in both; pointer-events: none; }

.welcome .btn { position: relative; overflow: hidden; }
.welcome .btn::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 24%;
  background: linear-gradient(90deg, rgb(122 201 212 / 0), rgb(122 201 212 / .5), rgb(122 201 212 / 0));
  animation: sheen 4.5s ease-in-out 1.6s infinite both;
}
.field.shake input, .consent.shake .tick { animation: shake .4s ease; }
.consent input:checked + .tick { animation: tick-in .3s ease; }
.field .label { transition: color .2s ease; }
.field:focus-within .label { color: var(--teal); }
.toast:not([hidden]) { animation: fade .25s ease; }
.headline:focus { outline: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .welcome .btn::after, .pulse::before, .pulse::after, .scan { display: none; }
}
