:root {
  --bg: #0b1d3a;
  --bg-2: #14315f;
  --page: #050b18;
  --gold: #d4af37;
  --gold-2: #f3d57a;
  --ink: #ffffff;
  --ink-dim: rgba(255,255,255,.82);
  --shadow: 0 12px 32px rgba(0,0,0,.35);
  --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Cairo', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--page);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

/* =========================================================
   .frame — the mobile viewport.
   On phones: takes the whole screen.
   On wider screens: a centered phone-shaped panel.
   ========================================================= */
.frame {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

@media (min-width: 600px) {
  body { padding: 24px; }
  .frame {
    width: 420px;
    height: min(900px, calc(100dvh - 48px));
    max-height: 900px;
    border-radius: 36px;
    box-shadow:
      0 30px 80px rgba(0,0,0,.6),
      0 0 0 8px #0c1426,
      0 0 0 9px rgba(255,255,255,.06);
  }
}

/* ---------- top bar (hidden) ---------- */
.topbar {
  display: none;
}
.topbar--legacy {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 30;
  padding: 14px 16px;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand {
  margin: 0;
  font-family: 'Amiri', 'Cairo', serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: .3px;
  color: var(--ink);
  text-shadow: 0 2px 14px rgba(0,0,0,.5);
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.28);
  background: rgba(11, 29, 58, .55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  font: 600 13px/1 'Cairo', sans-serif;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.lang-toggle:active { background: rgba(11, 29, 58, .85); }
.lang-toggle .globe { display: inline-flex; color: var(--gold-2); }
.lang-toggle .globe svg { width: 18px; height: 18px; }

/* ---------- stage / slider ---------- */
.stage {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
}
.slider {
  position: absolute;
  inset: 0;
}
.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity .8s var(--ease), transform .8s var(--ease);
  background-size: cover;
  background-position: center;
  will-change: opacity, transform;
}
.slide.active { opacity: 1; transform: translateY(0); }
.slide.above  { transform: translateY(-100%); }

.overlay-gradient {
  display: none;
}

/* ---------- hero ---------- */
.hero {
  position: absolute;
  inset: auto 0 16% 0;
  z-index: 2;
  text-align: center;
  padding: 0 20px;
  transition: opacity .24s var(--ease), transform .24s var(--ease);
}
.hero.swapping {
  opacity: 0;
  transform: translateY(10px);
}

/* Slide 1 — calligraphic styling for the loyalty document text */
.hero[data-slide="0"] {
  inset: 12% 0 auto 0;
}
.hero[data-slide="0"] .kicker {
  font-family: 'Aref Ruqaa', 'Amiri', serif;
  font-size: 18px;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.6;
  color: #1e3a8a;
  margin-bottom: 14px;
}
.hero[data-slide="0"] .kicker .muted {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: #1e3a8a;
  margin-top: 4px;
}
.hero[data-slide="0"] .hero-title {
  font-family: 'Aref Ruqaa', 'Amiri', serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.55;
  color: #1e3a8a;
  text-shadow: 0 2px 12px rgba(255,255,255,.35);
}
.hero[data-slide="0"] .hero-sub {
  font-family: 'Aref Ruqaa', 'Amiri', serif;
  font-size: 14px;
  font-weight: 400;
  color: #1e3a8a;
  max-width: 340px;
}
.kicker {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 2.5px;
  color: var(--gold-2);
  text-transform: uppercase;
}
.hero-title {
  margin: 0 0 8px;
  font-family: 'Amiri', 'Cairo', serif;
  font-weight: 700;
  font-size: 30px;
  line-height: 1.18;
  text-shadow: 0 4px 24px rgba(0,0,0,.6);
}
.hero-sub {
  margin: 0 auto 20px;
  max-width: 320px;
  color: var(--ink-dim);
  font-size: 14px;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  min-height: 48px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  color: #1b1306;
  font: 800 15px/1 'Cairo', sans-serif;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .15s var(--ease), filter .2s var(--ease);
}
.cta:active { transform: scale(.97); filter: brightness(.96); }
.cta svg { transform: scaleX(-1); }

/* ---------- dots + nav ---------- */
.dots {
  position: absolute;
  inset: auto 0 6% 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,.45);
  cursor: pointer;
  padding: 0;
  transition: width .25s var(--ease), background .25s var(--ease);
}
.dot.active { width: 22px; border-radius: 6px; background: var(--gold-2); }

.nav { display: none; }
.nav--legacy {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(11,29,58,.45);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.nav:active { transform: translateX(-50%) scale(.92); }
.nav.prev { top: 72px; }
.nav.next { bottom: 72px; }

/* ---------- language menu ---------- */
.lang-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(0,0,0,.55);
  animation: fade .2s var(--ease);
}
.lang-menu {
  position: absolute;
  z-index: 41;
  inset: 0;            /* full-screen drawer on mobile */
  background: #0e2347;
  display: flex;
  flex-direction: column;
  animation: slideUp .3s var(--ease);
}
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

.lang-menu-head {
  display: flex;
  gap: 8px;
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.lang-menu-head input {
  flex: 1;
  padding: 12px 14px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: var(--ink);
  font: 500 15px 'Cairo', sans-serif;
  outline: none;
}
.lang-menu-head input::placeholder { color: rgba(255,255,255,.5); }
.lang-menu-head input:focus { border-color: var(--gold); }
.lang-close {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.04);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.lang-close:active { background: rgba(255,255,255,.1); }

.lang-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}
.lang-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  min-height: 52px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--ink-dim);
  font-weight: 600;
  font-size: 15px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.lang-item:active { background: rgba(255,255,255,.08); color: var(--ink); }
.lang-item .native { opacity: .65; font-weight: 500; font-size: 13px; }
.lang-item.is-active { background: rgba(212,175,55,.14); color: var(--gold-2); }

/* ---------- form on slide 3 ---------- */
.walaa-form {
  position: absolute;
  top: 21%;
  left: 7%;
  right: 7%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s var(--ease);
}
.walaa-form.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.wf-field { display: flex; flex-direction: column; gap: 4px; position: relative; }
.wf-en {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-end: 10px;
  font: 600 10px 'Cairo', system-ui, sans-serif;
  color: rgba(255,255,255,.55);
  letter-spacing: .3px;
  pointer-events: none;
}
.wf-label {
  font: 600 11px 'Cairo', sans-serif;
  color: rgba(255,255,255,.92);
  padding-inline-start: 2px;
  letter-spacing: .2px;
}
.wf-input {
  width: 100%;
  padding: 4px 8px;
  padding-inline-end: 56px;
  min-height: 26px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.32);
  background: rgba(255,255,255,.12);
  color: #fff;
  font: 500 12px 'Cairo', sans-serif;
  text-align: right;
  outline: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.wf-input:focus { border-color: var(--gold); background: rgba(255,255,255,.2); }
.wf-input::placeholder { color: rgba(255,255,255,.7); }

.wf-sig-wrap {
  position: relative;
  height: 110px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.32);
  background: rgba(255,255,255,.94);
  overflow: hidden;
}
.wf-sig {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.wf-sig-clear {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.12);
  background: rgba(255,255,255,.9);
  color: #1e3a8a;
  font: 700 12px 'Cairo', sans-serif;
  cursor: pointer;
}
.wf-sig-clear:active { background: rgba(255,255,255,1); }

.wf-submit {
  margin-top: 6px;
  align-self: stretch;
  padding: 8px 16px;
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  color: #1b1306;
  font: 800 13px/1 'Cairo', sans-serif;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s var(--ease), filter .2s var(--ease);
}
.wf-submit:active { transform: scale(.97); filter: brightness(.96); }

/* ---------- certificate overlay ---------- */
.cert-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade .25s var(--ease);
}
.cert-canvas {
  position: relative;
  width: 100%;
  height: 100%;
}
.cert-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.cert-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 61;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(0,0,0,.55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.cert-close:active { background: rgba(0,0,0,.8); }

.cert-data {
  position: absolute;
  top: 78%;
  left: 10%;
  right: 10%;
  height: 12%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.6);
}
.cert-name {
  font: 700 24px 'Amiri', 'Cairo', serif;
  letter-spacing: 1.5px;
  color: var(--gold-2);
  white-space: nowrap;
  width: 100%;
}
.cert-cpr {
  display: none;
}
.cert-sig {
  display: block;
  max-height: 44px;
  max-width: 60%;
  margin-top: 2px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.5));
}

.cert-badge {
  position: absolute;
  bottom: 14px;
  inset-inline-start: 14px;
  z-index: 61;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.6);
  color: var(--gold-2);
  font: 700 13px 'Cairo', sans-serif;
  border: 1px solid rgba(212,175,55,.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cert-dl {
  position: absolute;
  bottom: 14px;
  inset-inline-end: 14px;
  z-index: 61;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid rgba(212,175,55,.4);
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  color: #1b1306;
  font: 800 14px 'Cairo', sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,.5);
  transition: transform .15s var(--ease), filter .2s var(--ease);
}
.cert-dl:active { transform: scale(.97); filter: brightness(.96); }

[hidden] { display: none !important; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

/* ---------- LTR adjustments ---------- */
html[dir="ltr"] .cta svg { transform: none; }

/* ---------- very small phones ---------- */
@media (max-height: 640px) {
  .nav.prev { top: 60px; }
  .nav.next { bottom: 60px; }
  .hero { inset: auto 0 14% 0; }
  .hero-title { font-size: 26px; }
}
