/* ─────────────────────────────────────────────────────────────
   Qandeel sign-in.
   References (Mobbin): Lovable / Origin / Buffer — form on paper
   beside an inset art card; Homerun — one character on a flat warm
   field; Duolingo / SuperHi — the mascot reacts, chunky friendly
   buttons. Shuala rises from the bottom of a sand card and reacts:
   waves hello, thinks while we check, encourages on a mistake,
   cheers when you're in.
   ───────────────────────────────────────────────────────────── */
:root {
  --paper: #fbf7f0;
  --ink: #1b1645;
  --ink-2: #3a3463;
  --muted: #736c8f;
  --line: #e6dccb;
  --field: #ffffff;
  --field-line: #e3d8c6;
  --error: #b5442a;
  --error-bg: #fbe7df;
  --ok: #2f6b3d;
  --ok-bg: #e1f0de;

  --amber-200: #ffe6a8;
  --amber-300: #ffc85a;
  --amber-400: #f9b13a;
  --amber-500: #f29a1a;
  --amber-edge: #d9850f;
  --on-amber: #2a1a05;
  --sand: #f1d6b8;

  --display: "Kufam", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --body: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: 10px;
  --r-plate: 30px;
  --ease-land: cubic-bezier(.1, .75, .15, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #110f2c; --ink: #f6eee2; --ink-2: #ded5ea; --muted: #a9a2c3; --line: #2b2758;
    --field: #1b1844; --field-line: #353070;
    --error: #ffb4a0; --error-bg: #3a1d2a; --ok: #a8dcae; --ok-bg: #173323;
  }
}
:root[data-theme="dark"] {
  --paper: #110f2c; --ink: #f6eee2; --ink-2: #ded5ea; --muted: #a9a2c3; --line: #2b2758;
  --field: #1b1844; --field-line: #353070;
  --error: #ffb4a0; --error-bg: #3a1d2a; --ok: #a8dcae; --ok-bg: #173323;
}
:root[lang="en"] {
  --display: "Parkinsans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Parkinsans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
img, video, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 3px solid var(--amber-400); outline-offset: 3px; border-radius: 10px; }

/* ═════════ Layout ═════════ */
.page {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--gutter);
  padding: var(--gutter);
}
.side { display: flex; flex-direction: column; min-height: calc(100svh - 2 * var(--gutter)); padding: 18px clamp(16px, 4vw, 48px) 14px; }
.top, .panel { width: min(100%, 380px); margin-inline: auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel { margin-block: auto; padding-block: 40px; }
.note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; color: var(--muted); font-size: 13.5px; }
.note svg { width: 15px; height: 15px; flex: none; }

.brand { display: inline-flex; color: var(--ink); text-decoration: none; border-radius: 8px; }
.brand svg { height: 34px; width: auto; }
.brand .brand__en { height: 38px; margin-block: -4px; }
[lang="en"] .brand__ar, [lang="ar"] .brand__en { display: none; }
.lang {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  font-size: 13.5px; font-weight: 500;
}
.lang svg { width: 15px; height: 15px; }
.lang:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }

/* ═════════ Shuala's card ═════════ */
.art {
  position: sticky; top: var(--gutter);
  height: calc(100svh - 2 * var(--gutter));
  margin: 0;
  border-radius: var(--r-plate);
  overflow: hidden;
  isolation: isolate;
  background-color: var(--sand);
  transition: background-color .5s linear;
}
/* a little warmth from the flame above, and a soft floor */
.art::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(70% 45% at 50% 18%, rgba(255, 236, 200, .55), transparent 70%),
    linear-gradient(to top, rgba(160, 90, 40, .10), transparent 30%);
}
.art__stage {
  position: absolute; inset-inline: 0; bottom: 0; margin-inline: auto;
  height: min(88%, 860px); aspect-ratio: 586 / 720; max-width: 100%;
  /* the clips' own backdrop fades into the card on the top and sides; the bottom edge is the card's */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent, #000 16%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent, #000 16%);
  mask-composite: intersect;
}
.clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s linear; }
.clip.is-on { opacity: 1; }

/* ═════════ Panel ═════════ */
.head { margin: 0 0 28px; outline: none; }
.head > span:first-child {
  display: block;
  font: 700 clamp(30px, 2.5vw, 38px)/1.2 var(--display);
  color: var(--ink);
}
[dir="ltr"] .head > span:first-child { letter-spacing: -.02em; line-height: 1.12; }
.head__sub { display: block; margin-top: 8px; font: 400 16px/1.5 var(--body); color: var(--muted); }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field label { font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.field__wrap { position: relative; }
.field input {
  width: 100%; height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--field-line); border-radius: 14px;
  background: var(--field); color: var(--ink);
  font-size: 16px;
  transition: border-color .15s, box-shadow .15s;
}
[dir="rtl"] .field input { text-align: right; }
.field input:hover { border-color: color-mix(in srgb, var(--field-line) 55%, var(--ink) 25%); }
.field input:focus { outline: none; border-color: var(--amber-400); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber-300) 32%, transparent); }
.field input[aria-invalid="true"] { border-color: var(--error); }
.field input[readonly] { opacity: .7; }
/* inputs are dir=ltr inside an RTL page, so the eye uses physical sides: always at the end of the line */
.field__wrap input { padding-right: 52px; }
[dir="rtl"] .field__wrap input { padding-right: 16px; padding-left: 52px; }
.eye {
  position: absolute; top: 0; bottom: 0; right: 4px; margin-block: auto;
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 12px; background: transparent; color: var(--muted); cursor: pointer;
}
[dir="rtl"] .eye { right: auto; left: 4px; }
.eye:hover { color: var(--ink); }
.eye svg { width: 21px; height: 21px; }
.field__hint { margin: 0; color: var(--muted); font-size: 13.5px; }
.forgot {
  padding: 0; border: 0; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--muted); text-decoration: underline; text-underline-offset: 3px;
}
.forgot:hover { color: var(--ink); }

.status {
  margin: 0; padding: 11px 14px; border-radius: 12px;
  background: var(--error-bg); color: var(--error);
  font-size: 14.5px; line-height: 1.5;
}
.status.is-ok { background: var(--ok-bg); color: var(--ok); }
.status .link { color: inherit; }

/* the one main action: a chunky amber clay button that presses down */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 54px; margin-top: 4px;
  border: 0; border-radius: 14px;
  background: linear-gradient(to bottom, var(--amber-300), var(--amber-400));
  color: var(--on-amber);
  font: 700 16.5px/1 var(--body);
  text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 0 var(--amber-edge), 0 12px 22px -12px rgba(150, 80, 0, .55);
  transition: transform .08s, box-shadow .08s, filter .2s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--amber-edge), 0 4px 10px -8px rgba(150, 80, 0, .5); }
.btn:disabled { cursor: default; filter: saturate(.6); }
.btn.is-busy span { animation: pulse 1s cubic-bezier(.37, 0, .63, 1) infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.done { display: grid; gap: 18px; }
.who {
  justify-self: start; margin: -12px 0 0;
  padding: 5px 13px; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  color: var(--ink-2); font-size: 14.5px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.switch { margin: 24px 0 0; color: var(--muted); font-size: 14.5px; text-align: center; }
.link {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px;
}

/* ═════════ Tablet and phone: Shuala on top, the form below ═════════ */
@media (max-width: 900px) {
  :root { --gutter: 8px; --r-plate: 24px; }
  .page { position: relative; grid-template-columns: minmax(0, 1fr); align-content: start; }
  .art { order: -1; position: relative; top: 0; height: clamp(220px, 34svh, 340px); }
  .art__stage { height: 100%; }
  .side { min-height: 0; padding: 0 8px 16px; }
  .top {
    position: absolute; top: calc(var(--gutter) + 12px); inset-inline: calc(var(--gutter) + 14px);
    width: auto; z-index: 2;
  }
  .brand { color: #1b1645; }
  .lang { background: rgba(255, 255, 255, .55); border-color: rgba(27, 22, 69, .12); color: #1b1645; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
  .panel { padding-block: 26px 28px; }
}
@media (max-width: 900px) and (min-width: 561px) {
  .panel { padding-block: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .clip, .art { transition: none; }
  .btn.is-busy span { animation: none; }
}
