/* بناء · sign in and sign up. Loaded after tokens.css, components.css and site.css and reads only tokens, so both themes carry over.
   Two halves: the form on the page ground, and the stage, a photograph of a center with the mark built
   on it. The stage stays photographic in both themes; the form side follows the theme. */

/* ---------------------------------------------------------------- form layout
   Fields, pickers, errors and the button base are the design system's (components.css); only layout lives here. */
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px; }
@media (max-width: 760px) {
  .row2 { grid-template-columns: minmax(0, 1fr); }
}
@keyframes busy { 0% { transform: scaleX(0); } 70% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }

.auth-body { background: var(--bg); }
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); min-height: 100vh; min-height: 100svh; }

/* ---------------------------------------------------------------- the form side */
.auth-side { display: flex; flex-direction: column; min-height: 100vh; min-height: 100svh; padding: 22px clamp(20px, 4.5vw, 64px) 20px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-logo .lockup { height: 30px; width: auto; overflow: visible; }
[data-theme="dark"] .auth-logo [fill="#06393A"] { fill: var(--on-brand); }
.auth-tools { display: flex; align-items: center; gap: 16px; }
.auth-main { flex: 1; width: min(100%, 460px); margin-inline: auto; display: grid; align-content: center; gap: 26px; padding-block: clamp(28px, 6vh, 64px); }
.auth-head .eyebrow { margin-bottom: 14px; }
.auth-head .h1 { font-size: clamp(2rem, 1.5rem + 1.5vw, 2.75rem); text-wrap: balance; }
.auth-head .lede { font-size: 1.05rem; margin-top: 10px; }
.auth-form { display: grid; gap: 22px; }
.auth-form .fld { padding-top: 18px; }
.auth-form .fld label { top: 27px; }
.auth-form .fld.filled label, .auth-form .fld:focus-within label { top: 0; }
.auth-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; font-size: .8rem; color: var(--fg-3); }
.auth-foot span:last-child { display: flex; gap: 18px; }
.auth-foot a { transition: color .15s; }
.auth-foot a:hover { color: var(--link); }
/* the accounts sit between the © and the links, black in light and white in dark (--glyph-mono, the networks' one-colour
   rule); their 44px targets overhang the line so the footer keeps its height */
.auth-foot { align-items: center; }
.auth-foot .social { margin: -14px 0; }
.auth-foot .social a { color: var(--glyph-mono); }
.auth-foot .social a:hover { color: var(--link); }
.auth-foot .social .ico { font-size: 16px; }
/* review copy: the fixed draft pill sits at the bottom corner; on a wide screen the footer rises clear of it */
@media (min-width: 900px) { html[data-draft="on"] .auth-foot { margin-block-end: 52px; } }
.auth-alt { font-size: .92rem; color: var(--fg-2); display: flex; flex-wrap: wrap; gap: 6px 10px; }
.auth-alt a { color: var(--link); font-weight: 600; }
.auth-alt a:hover { text-decoration: underline; text-underline-offset: 4px; }
.auth-alt span { color: var(--fg-3); }
.auth-alt .alt-links { display: inline-flex; gap: 10px; white-space: nowrap; }   /* the two links wrap together, never the dot alone */
.auth-link { color: var(--link); font-weight: 500; font-size: .9rem; display: inline-flex; align-items: center; gap: 6px; }
.auth-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.auth-link[disabled] { color: var(--fg-3); cursor: default; text-decoration: none; }
.auth-link.back { justify-self: start; }
.auth-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; }
[hidden] { display: none !important; }

/* the three roles (as-pick: the landing page already has a .roles component), each carrying its ring at the mark's own widths: 4, 3 and 2 */
.as-pick { border: 0; padding: 0; margin: 0; min-width: 0; }
.as-pick legend { padding: 0; margin-bottom: 10px; color: var(--fg-2); font-size: .9rem; }
.as-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.as { position: relative; cursor: pointer; }
.as input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.as span { display: grid; gap: 12px; padding: 14px 14px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  font: 500 .92rem/1.3 var(--font-body); color: var(--fg-2); transition: border-color var(--dur), box-shadow .25s, color .2s; }
.as span i { display: block; height: 8px; border-radius: 8px; background: var(--c); opacity: .3; transition: opacity .25s; }
.r-team { --c: var(--brand-blue); } .r-team span i { width: 100%; }
.r-spec { --c: var(--brand-teal); } .r-spec span i { width: 75%; }
.r-family { --c: var(--brand-mint); } .r-family span i { width: 50%; }
.as:hover span { border-color: var(--line-strong); color: var(--fg); }
.as input:checked + span { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 14px 28px -18px var(--c); color: var(--fg); font-weight: 600; }
.as input:checked + span i { opacity: 1; }
.as input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.mode { display: grid; gap: 20px; }
.mode-note { color: var(--fg-2); font-size: .95rem; line-height: 1.7; }
.mode-note:has(> .ico) { display: flex; align-items: flex-start; gap: 10px; }
.mode-note > .ico { color: var(--link); flex: none; margin-top: .35em; }
.mode-ok { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--tint); color: var(--fg); font-size: .9rem; line-height: 1.6; }
.mode-ok .ico { color: var(--link); margin-top: 4px; }

/* password: show and hide, and a quiet Caps Lock warning */
.peek { flex: none; width: 38px; height: 38px; display: grid; place-items: center; color: var(--fg-3); border-radius: var(--r); transition: color .15s; }
.peek:hover { color: var(--link); }
.peek .ico { font-size: 18px; }
.peek .off, .peek[aria-pressed="true"] .on { display: none; }
.peek[aria-pressed="true"] .off { display: block; }
.caps { display: none; align-items: center; gap: 6px; margin-top: 8px; font-size: .8rem; color: var(--status-on-hold-text); }
.caps.on { display: flex; }

.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; color: var(--fg-2); font-size: .9rem; line-height: 1.5; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border-radius: 5px; border: 1.5px solid var(--line-strong);
  display: grid; place-items: center; background: var(--surface); cursor: pointer; transition: background-color .15s, border-color .15s; }
.check input::after { content: ""; width: 9px; height: 5px; border: solid var(--on-primary); border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform var(--dur) var(--ease); }
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.check a { color: var(--link); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.check.bad input { border-color: var(--status-needs-attention-text); }

.fam-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--tint); color: var(--fg-2); font-size: .88rem; line-height: 1.65; }
.fam-note .ico { flex: none; color: var(--link); margin-top: 4px; }

/* the one-time code: six boxes, left to right in both languages, as the digits are read */
.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; direction: ltr; }
.otp input { width: 100%; height: 58px; padding: 0; text-align: center; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--fg);
  font: 500 1.45rem/1 var(--f-mono); transition: border-color .15s, box-shadow .15s; }
.otp input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 22%, transparent); }
.otp input.has { border-color: var(--teal); }
.otp.bad input { border-color: var(--status-needs-attention-text); }
.otp.ok input { border-color: var(--teal); background: var(--tint); }
.otp-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
[data-otp-err]:not(:empty) { margin-top: -8px; }
[data-mfa="app"] { display: grid; gap: 18px; }

.auth-act { display: grid; gap: 10px; }
.auth-submit { width: 100%; }   /* height and size: .btn-form */
.auth-submit .busy { position: absolute; inset-inline: 0; bottom: 0; height: 3px; background: var(--mint); transform: scaleX(0); transform-origin: 100% 50%; }
[dir="ltr"] .auth-submit .busy { transform-origin: 0 50%; }
.auth-submit[aria-busy="true"] { pointer-events: none; }
.auth-submit[aria-busy="true"] .busy { animation: busy 1.1s var(--ease) infinite; }
.auth-submit.btn-apricot:hover { background: var(--apricot-hover); }

.auth-done { display: grid; gap: 16px; justify-items: start; }
.auth-done .h2 { font-size: clamp(1.8rem, 1.4rem + 1.2vw, 2.4rem); }
.auth-done > p { color: var(--fg-2); font-size: 1.05rem; line-height: 1.75; }
.auth-done:focus { outline: none; }

/* ---------------------------------------------------------------- sign up: steps */
.reg-steps { display: grid; gap: 10px; }
.reg-bar { display: flex; gap: 4px; height: 6px; }
.reg-bar i { flex: 4; border-radius: 6px; background: var(--line); transition: background-color .45s var(--ease); }
.reg-bar i:nth-child(2) { flex: 3; } .reg-bar i:nth-child(3) { flex: 2; } .reg-bar i:nth-child(4) { flex: 1; }
.reg-bar i.on:nth-child(1) { background: var(--brand-blue); }
.reg-bar i.on:nth-child(2) { background: var(--brand-teal); }
.reg-bar i.on:nth-child(3) { background: var(--brand-mint); }
.reg-bar i.on:nth-child(4) { background: var(--brand-apricot); }
.reg-count { font-size: .88rem; color: var(--fg-3); }
.reg-count b { font: 500 .95rem/1 var(--f-mono); color: var(--fg); }
.reg-count span { color: var(--fg-2); font-weight: 500; }
.stp { display: grid; gap: 22px; }
.stp-h { font: 600 1.3rem/1.35 var(--font-heading); color: var(--fg); letter-spacing: var(--track); }
.stp:focus { outline: none; }

.chips { border: 0; padding: 0; margin: 0; min-width: 0; }
.chips legend { padding: 0; margin-bottom: 12px; color: var(--fg-2); font-size: .9rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface);
  font-size: .9rem; color: var(--fg-2); transition: border-color .15s, background-color .15s, color .15s; }
.chip span::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); transition: background-color .15s, border-color .15s, box-shadow .15s; }
.chip:hover span { border-color: var(--line-strong); }
.chip input:checked + span { border-color: var(--teal); background: var(--tint); color: var(--fg); font-weight: 500; }
.chip input:checked + span::before { background: var(--teal); border-color: var(--teal); box-shadow: inset 0 0 0 3px var(--surface); }
.chip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.chips.bad .chip span { border-color: var(--status-needs-attention-text); }
.chips .err:not(:empty) { margin-top: 10px; }

/* password strength, drawn as the four pieces of the mark: Blue, Teal, Mint, then the Apricot point */
.pw-meter { display: flex; gap: 4px; height: 6px; margin-top: 12px; }
.pw-meter i { flex: 4; border-radius: 6px; background: var(--line); transition: background-color .3s; }
.pw-meter i:nth-child(2) { flex: 3; } .pw-meter i:nth-child(3) { flex: 2; } .pw-meter i:nth-child(4) { flex: 1; }
.pw-meter:not([data-s="0"]) i:nth-child(1) { background: var(--brand-blue); }
.pw-meter[data-s="2"] i:nth-child(2), .pw-meter[data-s="3"] i:nth-child(2), .pw-meter[data-s="4"] i:nth-child(2) { background: var(--brand-teal); }
.pw-meter[data-s="3"] i:nth-child(3), .pw-meter[data-s="4"] i:nth-child(3) { background: var(--brand-mint); }
.pw-meter[data-s="4"] i:nth-child(4) { background: var(--brand-apricot); }
.pw-hint { display: block; margin-top: 8px; font-size: .8rem; color: var(--fg-3); }

.stp-nav { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.stp-nav .auth-submit { width: auto; flex: 1; max-width: 300px; margin-inline-start: auto; }
.btn-back { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; color: var(--fg-2); font-weight: 500; transition: color .15s; }
.btn-back:hover { color: var(--link); }

.done-next { display: grid; gap: 0; width: 100%; margin-block: 6px; }
.done-next li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); color: var(--fg-2); line-height: 1.6; }
.done-next li:last-child { border-bottom: 1px solid var(--line); }
.done-next .num { font-size: .8rem; color: var(--link); padding-top: 3px; }
.reg-done [data-done-center] { color: var(--link); }
.auth-done bdi { white-space: nowrap; }

/* ---------------------------------------------------------------- the stage */
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; padding: 12px; padding-inline-start: 0; }
.stage-in { position: relative; height: 100%; border-radius: 26px; overflow: hidden; isolation: isolate; background: var(--stage); color: var(--on-brand); }
.stage-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; opacity: 0; transition: opacity .9s var(--ease); }
.stage-photo.is-on { opacity: 1; }
.stage-in::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; /* the photo's scrim, tuned to the photographs */
  background: linear-gradient(180deg, rgba(9,20,26,.28) 0%, rgba(9,20,26,0) 22%, rgba(9,20,26,.2) 38%, rgba(9,20,26,.74) 62%, rgba(9,20,26,.95) 100%); }
.stage-clock { position: absolute; top: 18px; inset-inline-start: 18px; display: inline-flex; align-items: center; gap: 10px; padding: 9px 15px; border-radius: var(--r-pill);
  background: rgba(9,20,26,.34); border: 1px solid color-mix(in srgb, var(--on-brand) 20%, transparent); -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  font: 500 .82rem/1 var(--font-body); color: var(--on-brand); }
.stage-clock i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-mint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-mint) 28%, transparent); }
.stage-clock b { font: 500 .86rem/1 var(--f-mono); color: color-mix(in srgb, var(--on-brand) 86%, transparent); }
.stage-stack { position: absolute; inset-inline: 0; bottom: clamp(150px, 25vh, 240px); --hD: clamp(42px, 6vh, 62px); }
.stage .cap { box-shadow: 0 20px 34px -18px rgba(0,0,0,.7); transition: filter .45s var(--ease), box-shadow .45s var(--ease); }
.stage .cap-t { min-width: 0; }
.stage .cap-t small, .stage .cap-t b { overflow: hidden; text-overflow: ellipsis; }
.stage-copy { position: absolute; inset-inline: clamp(24px, 4vw, 52px); bottom: clamp(26px, 4.5vh, 48px); display: grid; gap: 10px; }
.stage-k { display: flex; align-items: center; gap: 12px; font: 500 .82rem/1 var(--font-body); color: color-mix(in srgb, var(--on-brand) 72%, transparent); }
.stage-k::before { content: ""; width: 28px; height: 1px; background: color-mix(in srgb, var(--on-brand) 50%, transparent); }
.stage-line .verify { vertical-align: middle; }
.stage-line { font: 600 clamp(1.15rem, .85rem + .9vw, 1.65rem)/1.45 var(--font-heading); letter-spacing: var(--track); max-width: 25em; text-wrap: balance; min-height: 2.9em; }

/* sign in: the chosen ring stays lit, the other two rest */
.stage[data-role] .cap:not(.cap-pt) { filter: saturate(.5) brightness(.72); }
.stage[data-role="team"] .cap.cap-blue:not(.cap-pt), .stage[data-role="specialist"] .cap.cap-teal:not(.cap-pt), .stage[data-role="family"] .cap.cap-mint:not(.cap-pt) { filter: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--on-brand) 90%, transparent), 0 22px 40px -16px rgba(0,0,0,.7); }

/* sign up: an outline waits where each piece will land */
.cell { display: grid; justify-items: center; align-items: center; }
.cell > * { grid-area: 1 / 1; }
.cell-blue { --w: 4; } .cell-teal { --w: 3; } .cell-mint { --w: 2; } .cell-pt { --w: 1; }
.slot { height: var(--hD); width: calc(var(--w) * var(--hD)); border-radius: var(--hD); border: 1.5px dashed color-mix(in srgb, var(--on-brand) 42%, transparent); background: color-mix(in srgb, var(--on-brand) 4%, transparent); transition: border-color .4s, background-color .4s; }
.slot.is-now { border-color: color-mix(in srgb, var(--on-brand) 95%, transparent); background: color-mix(in srgb, var(--on-brand) 10%, transparent); animation: wait 2s ease-in-out infinite; }
@keyframes wait { 50% { border-color: color-mix(in srgb, var(--on-brand) 45%, transparent); } }
.js [data-auth="register"] .cell .cap { opacity: 0; }
.cap [data-out].is-ph { opacity: .62; }
.cell-teal .cap-teal { justify-content: center; padding-inline: 0; }
.cell-teal .cap-t { text-align: center; }

.js [data-in] { opacity: 0; }
.js [data-auth="login"] .stage .cap { opacity: 0; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1000px) {
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { min-height: 0; }
  .auth-main { padding-block: 40px 48px; }
  /* the stage follows the form as a closing picture, and stays in view as the steps change */
  .stage { position: relative; height: min(78vh, 640px); padding: 0 12px 12px; }
  .stage-in { border-radius: 22px; }
}
@media (max-width: 480px) {
  .as span { padding: 12px 10px 11px; font-size: .84rem; }
  .otp { gap: 6px; }
  .otp input { height: 52px; font-size: 1.25rem; }
  .stp-nav .auth-submit { max-width: none; }
  .stage-stack { --hD: 40px; bottom: 170px; }
  .auth-foot { justify-content: center; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .js [data-in], .js [data-auth="login"] .stage .cap, .js [data-auth="register"] .cell .cap.is-in { opacity: 1 !important; }
  .slot.is-now { animation: none; }
}
