/* AL-RAZA HIGH SCHOOL - login / register screens.
   Colours come from the school crest:  navy #1a1044 | teal #489888 | gold #f1c700 | white.
   Everything is visible by default; JS only adds motion (class "anim-run"). */

:root {
  --navy: #1a1044;
  --navy-2: #241a63;
  --teal: #489888;
  --bg-1: #3b9484;          /* background gradient, light end (crest ribbon teal, deepened) */
  --bg-2: #2c7e72;
  --bg-3: #1f655b;
  --gold: #f1c700;
  --gold-2: #ffd92e;
  --ink: #1a1044;
  --err: #b3261e;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
/* Optional alternative: deep crest navy instead of teal (set data-theme="navy" on <html>) */
:root[data-theme="navy"] { --bg-1: #2a2072; --bg-2: #1d1556; --bg-3: #140e3e; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body.auth {
  margin: 0;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  font-family: var(--font-body);
  color: #fff;
  background: #100b3a;               /* the supplied dark purple, flat */
  overflow-x: clip;
}

.skip-link {
  position: absolute; left: 12px; top: -52px; z-index: 60;
  background: #fff; color: var(--navy); padding: 10px 14px; border-radius: 10px; font-weight: 700;
  transition: top .2s;
}
.skip-link:focus { top: 12px; }

/* ---------- header: school name + tagline (in normal flow: nothing can sit on top of it) ---------- */
.auth-head {
  position: relative; z-index: 5; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 20px 20px 8px; text-align: left;
}
.auth-crest { width: 56px; height: 56px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.3); }
.school-name {
  margin: 0; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(20px, 2.4vw, 30px); letter-spacing: .05em; line-height: 1.15; color: #fff;
}
.school-tag { margin: 3px 0 0; font-size: clamp(12.5px, 1.2vw, 15px); font-weight: 500; letter-spacing: .14em; color: #f0d58b; }

/* ---------- stage: character slot + form ---------- */
.stage {
  position: relative; z-index: 2; flex: 1 0 auto;
  display: flex; align-items: center; justify-content: center;
  padding: 8px 24px 26px;
}
.formcol { position: relative; z-index: 2; width: min(440px, 100%); margin-left: clamp(0px, 11.7vw, 160px); }

.scene { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.hero-canvas, .hero-img {
  position: absolute; left: 0; top: 0; max-width: none;
  opacity: 0; user-select: none; pointer-events: none;
}
.hero-video { position: absolute; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }
html.no-js .scene { display: none; }

/* ---------- the form (no box - white text, white fields, like the reference) ---------- */
.auth-card { position: relative; transform-origin: 50% 100%; will-change: transform, opacity; }
html.anim-run:not(.anim-ready) .auth-card { opacity: 0; }
html.anim-fallback .auth-card { opacity: 1 !important; transform: none !important; pointer-events: auto !important; }

.tabs {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(255,255,255,.16); border-radius: 999px; padding: 4px; margin-bottom: 18px;
}
.tab {
  position: relative; z-index: 1;
  text-align: center; padding: 10px 8px; border-radius: 999px;
  font-weight: 700; font-size: 14px; color: rgba(255,255,255,.92); text-decoration: none;
  transition: color .25s;
}
.tab.is-active { color: var(--navy); }
.tab-indicator {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  background: #fff; border-radius: 999px; box-shadow: 0 4px 12px rgba(8,25,40,.22);
  transition: transform .38s cubic-bezier(.3,1.2,.4,1);
}
body.auth[data-mode="register"] .tab-indicator { transform: translateX(100%); }

.panel h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(27px, 3.2vw, 34px); line-height: 1.15;
  margin: 0 0 6px; text-align: center; color: #fff;
  text-shadow: 0 2px 14px rgba(8,25,40,.28);
}
.panel .sub { margin: 0 0 16px; text-align: center; color: rgba(255,255,255,.92); font-size: 14.5px; line-height: 1.5; }
.panel.is-entering { animation: panelIn .42s cubic-bezier(.2,.8,.2,1) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: #fff; margin-bottom: 6px; letter-spacing: .01em; }
.control { position: relative; }
.field input[type="text"], .field input[type="email"], .field input[type="tel"], .field input[type="password"] {
  width: 100%; height: 48px; padding: 0 14px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 2px solid transparent; border-radius: 10px;
  box-shadow: 0 3px 0 rgba(8,25,40,.12);
  transition: border-color .2s, box-shadow .2s;
}
.field input[type="password"] { padding-right: 48px; }
.field input::placeholder { color: #8a87a6; }
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(241,199,0,.34); }
.field input[readonly] { background: #eef2f1; color: #3a4a47; }
.field.has-error input { border-color: #ff8a7a; }
.hint { display: block; margin-top: 5px; font-size: 12.5px; color: rgba(255,255,255,.88); }
.error {
  display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 8px;
  background: #fff; color: var(--err); font-size: 12.5px; font-weight: 700; line-height: 1.35;
  box-shadow: 0 3px 10px rgba(8,25,40,.2);
}
.error:empty { display: none; }

.toggle-pw {
  position: absolute; right: 4px; top: 4px; width: 40px; height: 40px;
  display: grid; place-items: center; background: transparent; border: 0; border-radius: 8px;
  color: #6c6a8a; cursor: pointer; transition: color .2s, background .2s;
}
.toggle-pw:hover { color: var(--navy); background: #eef0f6; }
.toggle-pw[aria-pressed="true"] { color: var(--teal); }

.meter { height: 6px; background: rgba(255,255,255,.28); border-radius: 99px; margin: -6px 0 14px; overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: 99px; background: #e0584a; transition: width .3s, background .3s; }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: #fff; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--gold); margin: 0; }
.same-check { margin: -4px 0 14px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 18px; }

.link { color: #ffe36b; font-weight: 700; text-decoration: none; font-size: 14px; }
.link:hover { text-decoration: underline; }
.switch { text-align: center; margin: 18px 0 0; font-size: 14px; color: rgba(255,255,255,.92); }

.btn {
  width: 100%; height: 52px; border: 0; border-radius: 10px; cursor: pointer;
  background: var(--gold); color: var(--navy);
  font: inherit; font-weight: 800; font-size: 16px; letter-spacing: .01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  text-decoration: none;
  box-shadow: 0 5px 0 #b99600, 0 12px 22px rgba(8,25,40,.25);
  transition: transform .15s, background .2s, box-shadow .15s;
}
.btn:hover { background: var(--gold-2); transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #b99600, 0 6px 12px rgba(8,25,40,.25); }
.btn:focus-visible, .tab:focus-visible, .link:focus-visible, .toggle-pw:focus-visible, .skip-intro:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.btn[disabled] { opacity: .8; cursor: progress; transform: none; }
.btn.is-loading span::after {
  content: ""; display: inline-block; width: 16px; height: 16px; margin-left: 10px; vertical-align: -3px;
  border: 2.5px solid rgba(26,16,68,.3); border-top-color: var(--navy); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-link { margin-top: 6px; }

.alert { padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 1.45; margin: 0 0 16px; font-weight: 600; }
.alert-error { background: #fff; color: var(--err); box-shadow: 0 4px 14px rgba(8,25,40,.22); }
.alert-ok { background: #e8f8f1; color: #14604a; box-shadow: 0 4px 14px rgba(8,25,40,.18); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.auth-foot {
  position: static; flex: 0 0 auto; text-align: center;
  color: rgba(255,255,255,.72); font-size: 12px; padding: 10px 16px 18px;
}

.skip-intro {
  display: none;
  position: fixed; right: clamp(14px, 3vw, 30px); bottom: 38px; z-index: 30;
  align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px;
  border: 1.5px solid rgba(255,255,255,.7); background: rgba(8,25,40,.22); color: #fff;
  font: 600 13px var(--font-body); cursor: pointer; backdrop-filter: blur(4px);
}
.skip-intro:hover { background: rgba(8,25,40,.4); }
html.anim-run:not(.intro-done):not(.capture) .skip-intro { display: inline-flex; }

html.capture *, html.capture *::before, html.capture *::after { transition: none !important; animation: none !important; }

/* ---------- phones & small tablets: the character band sits above the form ---------- */
@media (max-width: 899px) {
  .auth-head { padding: 14px 14px 4px; gap: 11px; }
  .auth-crest { width: 44px; height: 44px; }
  .stage { flex-direction: column; justify-content: flex-start; align-items: stretch; padding: 4px 16px 18px; }
  .scene { position: relative; inset: auto; width: calc(100% + 32px); margin: 0 -16px; height: clamp(210px, 34svh, 330px); flex: 0 0 auto; }   /* full-bleed: he walks in from the screen edge */
  .formcol { width: min(470px, 100%); margin: 0 auto; }
  .skip-intro { bottom: 18px; }
}
@media (max-width: 380px) {
  .panel h1 { font-size: 24px; }
  .school-name { font-size: 18px; }
}

/* ---------- reduced motion: no walking, no unfolding ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  html.anim-run:not(.anim-ready) .auth-card { opacity: 1; }
}

/* register: phone + WhatsApp, password + confirm sit side by side on wider screens */
.pair { display: grid; grid-template-columns: 1fr; column-gap: 12px; }
@media (min-width: 520px) {
  .pair { grid-template-columns: 1fr 1fr; }
  .pair .field input[type="password"] { padding-right: 44px; }
  .pair .toggle-pw { width: 36px; right: 3px; }
}
.meter { margin: -4px 0 12px; }


/* Register form: validation messages make it taller than a screen, so the submit button stays pinned
   to the bottom of the screen (fully visible and clickable) until the form's own end is reached. */
.actions {
  position: sticky; bottom: 0; z-index: 6;
  margin: 8px -6px 0; padding: 14px 6px 12px;
  background: linear-gradient(to top, #100b3a 70%, rgba(16, 11, 58, 0));
}
.panel[data-panel="register"] .field { margin-bottom: 10px; }
.panel[data-panel="register"] .sub { margin-bottom: 12px; }
.error { padding: 3px 8px; font-size: 12px; margin-top: 5px; }
html.intro-done .auth-card { will-change: auto; }
