/* ---------- Brand fonts ---------- */
/* Arabic: FF Shamel (brand font, licensed). Drop ff-shamel-medium.woff2 / ff-shamel-bold.woff2
   into /public/fonts to use it; until then Tajawal (free, similar geometric style) is used. */
@font-face { font-family: "FF Shamel"; font-weight: 500; font-display: swap;
  src: url("/fonts/ff-shamel-medium.woff2") format("woff2"); }
@font-face { font-family: "FF Shamel"; font-weight: 700; font-display: swap;
  src: url("/fonts/ff-shamel-bold.woff2") format("woff2"); }
@font-face { font-family: "Tajawal"; font-weight: 400; font-display: swap;
  src: url("/fonts/tajawal-arabic-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Tajawal"; font-weight: 500; font-display: swap;
  src: url("/fonts/tajawal-arabic-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Tajawal"; font-weight: 700; font-display: swap;
  src: url("/fonts/tajawal-arabic-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap;
  src: url("/fonts/montserrat-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap;
  src: url("/fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap;
  src: url("/fonts/montserrat-latin-600-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --orange: #f05d22;
  --orange-dark: #d54a12;
  --orange-tint: #fdeee7;
  --ink: #231f20;
  --muted: #6e6668;
  --line: #e6dfdb;
  --bg: #f7f3f1;
  --error: #b3261e;
  --radius: 18px;
  --font-ar: "FF Shamel", "Tajawal", "Montserrat", system-ui, sans-serif;
  --font-en: "Montserrat", "Tajawal", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-ar); font-weight: 500;
  -webkit-font-smoothing: antialiased;
}
html[lang="en"] body { font-family: var(--font-en); }

/* ---------- Hero ---------- */
.hero {
  position: relative; width: 100%;
  padding: 28px 20px 96px;
  display: flex; justify-content: center;
  background-color: var(--orange);
  background-image: url("/brand/pattern-mark.svg");
  background-size: 92px 50px;
  background-position: center;
  border-radius: 0 0 28px 28px;
}
.hero-logo { width: min(300px, 78vw); height: auto; display: block; margin-top: 30px; }
.lang-toggle {
  position: absolute; top: 16px; inset-inline-end: 16px;
  font: 600 13px/1 var(--font-en);
  color: #fff; background: rgba(35, 31, 32, .22);
  border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px;
  padding: 9px 14px; cursor: pointer;
}
html[lang="en"] .lang-toggle { font-family: var(--font-ar); font-size: 14px; }
.lang-toggle:hover { background: rgba(35, 31, 32, .35); }

/* ---------- Card ---------- */
.card {
  position: relative; z-index: 1;
  width: calc(100% - 32px); max-width: 440px;
  margin-top: -64px;
  background: #fff; border-radius: var(--radius);
  box-shadow: 0 18px 40px -18px rgba(35, 31, 32, .28), 0 2px 6px rgba(35, 31, 32, .06);
  padding: 28px 22px 26px; text-align: center;
}
.eyebrow {
  display: inline-block; margin: 0 0 12px;
  font-size: 13px; color: var(--orange-dark);
  background: var(--orange-tint); border-radius: 999px; padding: 6px 12px;
}
h1 { margin: 0 0 8px; font-size: 26px; font-weight: 700; line-height: 1.3; }
html[lang="en"] h1 { font-weight: 600; font-size: 24px; }
.lead { margin: 0 0 24px; color: var(--muted); font-size: 16px; line-height: 1.6; font-weight: 400; }

/* ---------- OTP boxes (one real input under six visual boxes) ---------- */
.otp { position: relative; width: 100%; max-width: 340px; margin: 0 auto; }
.otp input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; border: 0; font-size: 16px; /* 16px stops iOS zoom */
  caret-color: transparent; z-index: 2;
}
.otp-boxes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp-boxes span {
  aspect-ratio: 5 / 6; display: grid; place-items: center;
  font: 600 26px/1 var(--font-en); color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.otp-boxes span.filled { border-color: var(--ink); }
.otp.focused .otp-boxes span.active {
  border-color: var(--orange); box-shadow: 0 0 0 4px rgba(240, 93, 34, .16);
}
.otp.focused .otp-boxes span.active:empty::after {
  content: ""; width: 2px; height: 26px; background: var(--orange);
  animation: blink 1s steps(1) infinite;
}
.otp.error .otp-boxes span { border-color: var(--error); background: #fdf3f2; }
.otp.shake { animation: shake .35s; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.link-btn {
  margin: 14px auto 0; display: inline-flex; gap: 6px; align-items: center;
  background: none; border: 0; padding: 6px 8px; cursor: pointer;
  font: inherit; font-size: 15px; color: var(--orange-dark);
  text-decoration: underline; text-underline-offset: 4px;
}
.message { min-height: 1.5em; margin: 10px 0 4px; font-size: 14px; line-height: 1.5; color: var(--error); }

.primary {
  position: relative; width: 100%; margin-top: 6px; padding: 16px;
  font: inherit; font-size: 17px; font-weight: 700; color: #fff;
  background: var(--orange); border: 0; border-radius: 14px; cursor: pointer;
  transition: background .15s, transform .05s;
}
html[lang="en"] .primary { font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--orange-dark); }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary:disabled { background: #f3b498; cursor: not-allowed; }
.primary .spinner {
  display: none; position: absolute; top: 50%; inset-inline-end: 18px; margin-top: -10px;
  width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
.primary.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.help { margin: 18px 0 0; font-size: 13px; line-height: 1.6; color: var(--muted); font-weight: 400; }

/* ---------- Success ---------- */
.check {
  width: 84px; height: 84px; margin: 4px auto 18px; border-radius: 50%;
  background: var(--orange); display: grid; place-items: center;
  box-shadow: 0 0 0 10px var(--orange-tint);
  animation: pop .4s cubic-bezier(.2, 1.4, .4, 1);
}
.check svg { width: 46px; height: 46px; }
.check path {
  fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s .2s ease-out forwards;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

.footer { margin: auto 0 0; padding: 28px 20px 24px; font-size: 12px; color: var(--muted); text-align: center; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 640px) {
  .hero { padding-bottom: 110px; }
  .card { padding: 36px 36px 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .check path { stroke-dashoffset: 0; }
}
