/* Fursa UI v2 — sign-in page: a full-bleed split — the brand canvas (deep
   navy, grid texture, ambient glow, crest watermark, story and the data note)
   fills the inline-start side, the form pane holds a ≤400px column on the
   light surface. Below 960px the canvas becomes a natural-height band above
   the form, and the disclaimer stays with the canvas. Loaded after app.css,
   tokens.css, components.css and shell.css; every selector is scoped to
   html[data-ui="v2"]. The canvas is dark in both themes, so it uses the
   blue/green/gray palette primitives directly; everything else uses token
   roles. */

/* ---------------------------------------------------------------------------
   1. Auth frame — the page is the screen: no sheet, no footer, no stagger.
      app.css centres .auth-page main.stage with flex; override that here.
--------------------------------------------------------------------------- */

html[data-ui="v2"]:has(body.auth-page){scrollbar-gutter:auto}
html[data-ui="v2"] body.auth-page main.fx-stage{display:block; min-block-size:0; padding:0}
html[data-ui="v2"] body.auth-page .fx-footer{display:none}
html[data-ui="v2"] .fx-page--login{
  max-inline-size:none; padding:0; margin:0; min-block-size:100svh;
  display:grid; grid-template-columns:minmax(0, 1.4fr) minmax(0, 1fr);
}
html[data-ui="v2"] .fx-page--login > *{animation:none}

/* ---------------------------------------------------------------------------
   2. Header — floats over the split on desktop: the brand sits on the navy
      canvas (white wordmark and crest tile), the tools stay on the light
      pane in their normal colours. Below 960px the header returns to the
      normal sticky, solid bar.
--------------------------------------------------------------------------- */

@media (min-width: 960px){
  html[data-ui="v2"] body.auth-page .fx-header{
    position:absolute; inset-inline:0;
    background:transparent; border-block-end-color:transparent;
    -webkit-backdrop-filter:none; backdrop-filter:none;
  }
  html[data-ui="v2"] body.auth-page .fx-header::before{opacity:0}
  html[data-ui="v2"] body.auth-page .fx-header::after{display:none}
  /* Over the navy canvas the full logo (01) leads; the header wordmark steps aside. */
  html[data-ui="v2"] body.auth-page .fx-brand__name{visibility:hidden}
}

/* ---------------------------------------------------------------------------
   3. Brand canvas — story centred in the first row, disclaimer pinned to
      the last; every decorative layer sits behind the content (z-index:-1
      inside the isolated stacking context) and never takes pointer events.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-auth__canvas{
  position:relative; overflow:hidden; isolation:isolate; display:grid;
  grid-template-rows:1fr auto;
  padding:calc(var(--fx-header-h) + var(--fx-space-12)) clamp(32px, 6vw, 96px) var(--fx-space-10);
  color:var(--fx-gray-0);
  background:var(--fx-hero);   /* brand cover: navy radial (guidelines p. 9) */
}
html[data-ui="v2"] .fx-auth__texture{
  position:absolute; inset:0; z-index:-1; pointer-events:none; opacity:.55;
  /* Light white dots: every dot is a tender, the gold diamond is «فرصتك». */
  background-image:radial-gradient(circle, color-mix(in srgb, var(--fx-gray-0) 22%, transparent) 1.2px, transparent 1.7px);
  background-size:28px 28px;
  -webkit-mask-image:radial-gradient(ellipse 80% 70% at 30% 40%, #000 30%, transparent 75%);
  mask-image:radial-gradient(ellipse 80% 70% at 30% 40%, #000 30%, transparent 75%);
}
html[data-ui="v2"] .fx-auth__glow{position:absolute; inset:0; z-index:-1; pointer-events:none}
html[data-ui="v2"] .fx-auth__glow span{
  position:absolute; z-index:-1; border-radius:50%;
  filter:blur(70px); opacity:.55;
}
html[data-ui="v2"] .fx-auth__glow span:first-child{
  inline-size:30rem; block-size:30rem; background:var(--fx-blue-600);
  inset-block-start:-8rem; inset-inline-end:-10rem;
  animation:fx-drift-a 24s var(--fx-ease-in-out) infinite alternate;
}
html[data-ui="v2"] .fx-auth__glow span:last-child{
  inline-size:24rem; block-size:24rem; background:var(--ft-gold); opacity:.10;
  inset-block-end:-10rem; inset-inline-start:-6rem;
  animation:fx-drift-b 28s var(--fx-ease-in-out) infinite alternate;
}
/* The gold diamond with its soft halo (guidelines p. 9 cover). */
html[data-ui="v2"] .fx-auth__glow::after{
  content:""; position:absolute; inset-block-end:24%; inset-inline-end:16%;
  inline-size:14px; block-size:14px; border-radius:2px; transform:rotate(45deg);
  background:var(--ft-gold);
  box-shadow:0 0 0 14px color-mix(in srgb, var(--ft-gold) 14%, transparent),
             0 0 0 30px color-mix(in srgb, var(--ft-gold) 7%, transparent);
}
@keyframes fx-drift-a{to{transform:translate(-4rem, 3rem) scale(1.12)}}
@keyframes fx-drift-b{to{transform:translate(3rem, -3rem) scale(1.08)}}

/* The living dot field (login-field.js): a canvas behind the story, the three promises as small labels next to gold
   diamonds. Once it runs, it replaces the still dot texture and the single static diamond. Labels are placed by the
   script with physical coordinates (it measures the page), their text still follows the page direction. */
html[data-ui="v2"] .fx-auth__field{position:absolute; inset:0; z-index:-1; pointer-events:none; overflow:hidden}
html[data-ui="v2"] .fx-auth__field canvas{display:block; inline-size:100%; block-size:100%}
html[data-ui="v2"] .fx-auth__canvas.has-field .fx-auth__texture{opacity:0}
html[data-ui="v2"] .fx-auth__canvas.has-field .fx-auth__glow::after{display:none}
/* Moving text: real catalogue counts drift slowly behind the story, in the free bands above and below it (the script places the rows;
   a row with no room stays hidden). Very faint: texture, not copy. */
html[data-ui="v2"] .fx-auth__ticks{position:absolute; inset:0; overflow:hidden}
html[data-ui="v2"] .fx-auth__tick{
  position:absolute; inset-inline:0; block-size:36px; overflow:hidden; white-space:nowrap;
  -webkit-mask-image:linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
  mask-image:linear-gradient(to right, transparent, #000 14%, #000 86%, transparent);
}
html[data-ui="v2"] .fx-auth__tick[hidden]{display:none}
html[data-ui="v2"] .fx-auth__track{
  display:inline-flex; align-items:center; gap:0; inline-size:max-content;
  font-size:clamp(1.25rem, 1.7vw, 1.75rem); font-weight:var(--fx-weight-semibold); line-height:36px;
  color:color-mix(in srgb, var(--fx-gray-0) 15%, transparent);
  animation:fx-tick var(--tick-time, 80s) linear infinite;
}
html[data-ui="v2"] .fx-auth__track.is-back{animation-direction:reverse}
html[data-ui="v2"] .fx-auth__track > span{display:inline-flex; align-items:center; padding-inline-end:2.2rem}
html[data-ui="v2"] .fx-auth__track > span::after{
  content:""; margin-inline-start:2.2rem; inline-size:7px; block-size:7px; transform:rotate(45deg);
  background:color-mix(in srgb, var(--ft-gold) 45%, transparent);
}
@keyframes fx-tick{to{transform:translateX(calc(var(--fx-dir) * -50%))}}
@media (prefers-reduced-motion: reduce){
  html[data-ui="v2"] .fx-auth__track{animation:none}
}

html[data-ui="v2"] .fx-auth__promise{position:absolute; left:0; top:0; inline-size:max-content; max-inline-size:min(260px, 100%)}
html[data-ui="v2"] .fx-auth__promise[hidden]{display:none}
html[data-ui="v2"] .fx-auth__promise.is-flip{translate:-100% 0}
html[data-ui="v2"] .fx-auth__promise{margin-block-start:-17px}   /* centres the 34px pill on its diamond */
html[data-ui="v2"] .fx-auth__promise > span{
  display:inline-flex; align-items:center; gap:8px; padding:6px 12px; border-radius:var(--fx-radius-pill);
  color:var(--fx-blue-100); font-size:var(--fx-text-sm); font-weight:var(--fx-weight-semibold); line-height:1.4;
  background:color-mix(in srgb, var(--fx-gray-0) 7%, var(--ft-navy));
  border:1px solid color-mix(in srgb, var(--ft-gold) 45%, transparent);
  box-shadow:0 6px 18px color-mix(in srgb, #000 28%, transparent);
  opacity:0; transform:translateY(6px);
  transition:opacity 380ms var(--fx-ease-out), transform 380ms var(--fx-ease-out);
}
html[data-ui="v2"] .fx-auth__promise > span svg{flex:none; color:var(--ft-gold)}
html[data-ui="v2"] .fx-auth__promise.is-on > span{opacity:1; transform:none}
@media (prefers-reduced-motion: reduce){
  html[data-ui="v2"] .fx-auth__promise > span{transition:none}
}

html[data-ui="v2"] .fx-auth__watermark{
  position:absolute; z-index:-1; inline-size:min(560px, 70%); block-size:auto;
  inset-block-end:-12%; inset-inline-end:-14%;
  opacity:.10; filter:saturate(1.2); pointer-events:none;
  animation:fx-watermark-in 1.2s var(--fx-ease-out) both,
    fx-watermark-float 30s var(--fx-ease-in-out) 1.2s infinite alternate;
}
@keyframes fx-watermark-in{from{opacity:0; transform:scale(.9) rotate(calc(var(--fx-dir) * -6deg))}}
@keyframes fx-watermark-float{to{transform:translateY(-14px) rotate(calc(var(--fx-dir) * 3deg))}}

html[data-ui="v2"] .fx-auth__story{
  align-self:center; display:grid; gap:var(--fx-space-5);
  justify-items:start; max-inline-size:36rem;
}
/* Full logo, white (01), on the navy canvas (guidelines p. 5 and 11); 220px wide,
   above the 120px minimum. Phones show the header wordmark instead. */
html[data-ui="v2"] .fx-auth__logo{display:block; inline-size:220px; block-size:auto; margin-block-end:var(--fx-space-4)}
@media (max-width: 959px){ html[data-ui="v2"] .fx-auth__logo{display:none} }
html[data-ui="v2"] .fx-auth__eyebrow{
  display:inline-flex; align-items:center; gap:8px; padding:6px 12px;
  border-radius:var(--fx-radius-pill);
  background:color-mix(in srgb, var(--fx-gray-0) 10%, transparent);
  border:1px solid color-mix(in srgb, var(--fx-gray-0) 18%, transparent);
  color:var(--fx-blue-100);
  font-size:var(--fx-text-xs); font-weight:var(--fx-weight-semibold);
  animation:fx-auth-rise var(--fx-dur-page) var(--fx-ease-out) 100ms both;
}
html[data-ui="v2"] .fx-auth__eyebrow::before{
  content:""; flex:none; inline-size:7px; block-size:7px; border-radius:50%;
  background:var(--ft-gold);
  box-shadow:0 0 0 4px color-mix(in srgb, var(--ft-gold) 25%, transparent);
}
html[data-ui="v2"] .fx-auth__headline{
  margin:0; color:var(--fx-gray-0);
  font-size:clamp(2.25rem, 4vw, 3rem); line-height:1.3;   /* H1 48/1.3 (guidelines p. 10) */
  font-weight:var(--fx-weight-bold); text-wrap:balance;
  animation:fx-auth-rise var(--fx-dur-page) var(--fx-ease-out) 200ms both;
}
html[data-ui="v2"] .fx-auth__headline::after{
  content:""; display:block; inline-size:72px; block-size:4px;
  margin-block-start:var(--fx-space-5); border-radius:var(--fx-radius-pill);
  background:var(--ft-gold);
  transform-origin:left;
  animation:fx-bar-in var(--fx-dur-page) var(--fx-ease-out) 450ms both;
}
html[data-ui="v2"][dir="rtl"] .fx-auth__headline::after{transform-origin:right}
@keyframes fx-bar-in{from{transform:scaleX(0)}}
html[data-ui="v2"] .fx-auth__lede{
  margin:0; max-inline-size:34rem; color:var(--fx-blue-100);
  font-size:var(--fx-text-base); line-height:1.8;   /* body 16/1.8 (guidelines p. 10) */
  animation:fx-auth-rise var(--fx-dur-page) var(--fx-ease-out) 320ms both;
}
html[data-ui="v2"] .fx-auth__disclaimer{
  margin:0; max-inline-size:40rem; padding-block-start:var(--fx-space-5);
  border-block-start:1px solid color-mix(in srgb, var(--fx-gray-0) 14%, transparent);
  color:var(--fx-blue-200);
  font-size:var(--fx-text-xs); line-height:var(--fx-leading-ui);
  animation:fx-auth-rise var(--fx-dur-page) var(--fx-ease-out) 480ms both;
}
@keyframes fx-auth-rise{from{opacity:0; transform:translateY(16px); filter:blur(4px)}}

/* Sales contact and marketing's legal note under the form (the page has no footer). */
html[data-ui="v2"] .fx-auth__contact{
  margin:var(--fx-space-5) 0 0; text-align:center;
  font-size:var(--fx-text-sm); line-height:var(--fx-leading-ui); color:var(--fx-text-muted);
}
html[data-ui="v2"] .fx-auth__legal{
  margin:var(--fx-space-4) 0 0; text-align:center;
  font-size:var(--fx-text-xs); line-height:var(--fx-leading-ui); color:var(--fx-text-subtle);
}

/* ---------------------------------------------------------------------------
   4. Form pane — the column slides in from the inline-end side in reading
      order; the inputs sit on the sunken surface until focus lifts them.
      The input selectors are element-qualified to outrank components.css's
      :is(input,select,textarea).fx-input rules; :user-invalid needs the same
      weight or the base rule would swallow the browser's validation edge.
--------------------------------------------------------------------------- */

html[data-ui="v2"] .fx-auth__pane{
  display:grid; place-items:center;
  padding:calc(var(--fx-header-h) + var(--fx-space-8)) clamp(24px, 4vw, 64px) var(--fx-space-10);
  background:var(--fx-surface);
}
html[data-ui="v2"] .fx-auth__form-col{inline-size:min(400px, 100%); display:grid; gap:var(--fx-space-5)}
html[data-ui="v2"] .fx-auth__form-col > *{
  animation:fx-auth-slide var(--fx-dur-page) var(--fx-ease-out) both;
}
html[data-ui="v2"] .fx-auth__form-col > :nth-child(1){animation-delay:150ms}
html[data-ui="v2"] .fx-auth__form-col > :nth-child(2){animation-delay:220ms}
html[data-ui="v2"] .fx-auth__form-col > :nth-child(3){animation-delay:290ms}
html[data-ui="v2"] .fx-auth__form-col > :nth-child(4){animation-delay:360ms}
html[data-ui="v2"] .fx-auth__form-col > :nth-child(5){animation-delay:430ms}
html[data-ui="v2"] .fx-auth__form-col > :nth-child(n+6){animation-delay:480ms}
@keyframes fx-auth-slide{from{opacity:0; transform:translateX(calc(var(--fx-dir) * 20px))}}

html[data-ui="v2"] .fx-auth__title{
  margin:0; font-size:var(--fx-text-2xl); font-weight:var(--fx-weight-bold);
  line-height:var(--fx-leading-tight);
}
html[data-ui="v2"] .fx-auth__divider{
  display:flex; align-items:center; gap:12px; margin:0;
  font-size:var(--fx-text-xs); color:var(--fx-text-subtle);
}
html[data-ui="v2"] .fx-auth__divider::before,
html[data-ui="v2"] .fx-auth__divider::after{
  content:""; flex:1; border-block-start:1px solid var(--fx-border);
}
html[data-ui="v2"] .fx-auth__form{display:grid; gap:var(--fx-space-4)}
html[data-ui="v2"] .fx-auth__form .fx-field + .fx-field{margin-block-start:0}
html[data-ui="v2"] input.fx-input.fx-auth__input{
  min-block-size:52px;
  background:var(--fx-surface-sunken);
  border-color:transparent; box-shadow:none;
}
html[data-ui="v2"] input.fx-input.fx-auth__input:hover{border-color:var(--fx-border-strong)}
html[data-ui="v2"] input.fx-input.fx-auth__input:focus,
html[data-ui="v2"] input.fx-input.fx-auth__input:focus-visible{
  background:var(--fx-surface); border-color:var(--fx-primary); box-shadow:var(--fx-ring);
}
html[data-ui="v2"] input.fx-input.fx-auth__input:user-invalid{border-color:var(--fx-danger)}
html[data-ui="v2"] input.fx-input.fx-auth__input:user-invalid:focus,
html[data-ui="v2"] input.fx-input.fx-auth__input:user-invalid:focus-visible{
  border-color:var(--fx-danger); box-shadow:var(--fx-ring-danger);
}
html[data-ui="v2"][dir="rtl"] input.fx-input.fx-auth__input[dir="ltr"]{text-align:right}
html[data-ui="v2"][dir="rtl"] input.fx-input.fx-auth__input[dir="ltr"]::placeholder{text-align:right}
html[data-ui="v2"] .fx-auth__submit{
  min-block-size:52px; justify-content:space-between; padding-inline:var(--fx-space-5);
}
html[data-ui="v2"] .fx-auth__arrow{
  inline-size:18px; block-size:18px;
  transition:transform var(--fx-dur-base) var(--fx-ease-out);
}
html[data-ui="v2"][dir="rtl"] .fx-auth__arrow{transform:scaleX(-1)}
html[data-ui="v2"] .fx-auth__submit:hover .fx-auth__arrow,
html[data-ui="v2"] .fx-auth__submit:focus-visible .fx-auth__arrow{transform:translateX(4px)}
html[data-ui="v2"][dir="rtl"] .fx-auth__submit:hover .fx-auth__arrow,
html[data-ui="v2"][dir="rtl"] .fx-auth__submit:focus-visible .fx-auth__arrow{
  transform:scaleX(-1) translateX(4px);
}
html[data-ui="v2"] .is-pending .fx-auth__arrow{display:none}

/* ---------------------------------------------------------------------------
   5. Narrow screens — the split becomes a story: a natural-height navy band
      (crest watermark, eyebrow, headline, lede, disclaimer), then the form
      pane full width; the form column rises from below instead of sliding.
--------------------------------------------------------------------------- */

@media (max-width: 959px){
  html[data-ui="v2"] .fx-page--login{grid-template-columns:minmax(0, 1fr); min-block-size:0}
  html[data-ui="v2"] .fx-auth__canvas{
    padding:var(--fx-space-10) var(--fx-gutter) var(--fx-space-8);
    grid-template-rows:auto;
  }
  html[data-ui="v2"] .fx-auth__headline{font-size:clamp(2rem, 8vw, 2.5rem)}
  html[data-ui="v2"] .fx-auth__lede{font-size:var(--fx-text-base)}
  html[data-ui="v2"] .fx-auth__watermark{inline-size:260px; inset-block-end:-30%; inset-inline-end:-20%}
  /* Stacked: the diamond sits beside the eyebrow pill, clear of the text. */
  html[data-ui="v2"] .fx-auth__glow::after{inset-block-start:calc(var(--fx-space-10) + 12px); inset-block-end:auto; inset-inline-end:calc(var(--fx-gutter) + 30px)}
  html[data-ui="v2"] .fx-auth__pane{padding:var(--fx-space-8) var(--fx-gutter) var(--fx-space-12)}
  html[data-ui="v2"] .fx-auth__form-col > *{
    animation:fx-auth-rise var(--fx-dur-page) var(--fx-ease-out) both;
  }
}

@media (max-width: 768px){
  html[data-ui="v2"] body.auth-page{padding-block-end:0}
}
/* 320px: «تسجيل الدخول بحساب Microsoft» wraps instead of widening the page. */
@media (max-width: 400px){
  html[data-ui="v2"] .fx-auth__form-col .fx-btn{white-space:normal; text-align:center; block-size:auto}
}

/* ---------------------------------------------------------------------------
   6. Dark mode — the pane already uses token roles and the canvas is dark by
      design, so nothing here changes with the theme. Reduced motion is
      neutralised by the global guard in shell.css.
--------------------------------------------------------------------------- */
