/* ── The landing / sign-in surface (`eca-login*`) ────────────────────────────────────────────────
   Extracted from `EcaLoginPage`'s inline `<style>` so ONE definition serves the shared ECAW login and
   every app-specific one. A page-local `<style>` block is banned by the fleet standard even when the
   page is shared: it cannot be cached, audited, or overridden by the app that mounts it.

   Deliberately a SEPARATE sheet rather than an addition to `daisy/ui-alias.css`: the login is a
   full-bleed surface with its own colour system (light ink on dark media), and it is the only place
   in the layer where that inversion is correct. Keeping it out of the component sheet is what stops
   "dark by accident" leaking into an admin page.

   The classes are the ones `EcaLoginPage` already emits, so the fleet's login keeps working from this
   sheet unchanged once that page's inline block is retired (a follow-up in elementum-core-agent-web —
   this file is a superset, not a fork: same names, same structure, no property removed).

   Layers, back to front:
     .eca-login-colour   the site's configured colour (or the brand gradient) — always present, so the
                         page is never white while media loads or when a deployment has no video
     .eca-login-media    the still (and the clip, when the site config asks for one)
     .eca-login::after   the scrim that keeps card text above 4.5:1 on the brightest frame
     .eca-login-card     the panel
   ───────────────────────────────────────────────────────────────────────────────────────────── */

/* ── Shell stretch ──────────────────────────────────────────────────────────────────────────────
   `eca-shell.css` makes the body a flex column and pins the page footer to the bottom; the
   page column between them shrink-wraps its content, so a short card left the whole lower half of
   the viewport empty (measured: card ended at y=472 of 900). The login is the one page whose content
   must FILL that space, so it alone stretches the shell row. Scoped by `:has(.eca-login)` — not by a
   body class — because the same shell hosts every admin page and none of them may change.

   The container keeps its GUTTER: the shell audit's footer contract is "the footer's text starts on
   the page's content edge", read from `.eca-container`'s padding, and it is measured on /login. So the
   surface bleeds OUT of the padding by its own width instead of removing it — the media still spans
   the viewport, and the footer still lines up with the page's content edge. */
body.eaw-migration-body:has(.eca-login) > .eaw-shell{
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body.eaw-migration-body:has(.eca-login) > .eaw-shell > .eca-container{
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: none;
}
/* The footer is a sibling of the shell, so it keeps the 1180px column while the page above it went
   full-bleed — the footer's text then started 130px right of the page's content edge (measured at
   1440: text x=155, content x=32) and the shell audit reports exactly that. Same width, same gutter:
   the two edges line up. */
body.eaw-migration-body:has(.eca-login) > .eca-page-footer > .eca-container{
  max-width: none;
}

.eca-login{
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  /* Full-bleed out of the container gutter, then its own padding for the card. */
  margin-inline: calc(var(--gutter) * -1);
  padding: var(--space-4);
  overflow: hidden;
  isolation: isolate;
  color: #e9eef6;
  background: var(--eca-login-bg, linear-gradient(135deg, #0b1c2c 0%, #0f2f2a 55%, #10261f 100%));
}

/* The still is a LAYER, not a `background-image` on the login box: it is rasterised once and the
   compositor scales a texture, which is what keeps the slow pan smooth and lets `reduced-motion`
   drop the motion without dropping the picture. */
.eca-login-media{
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.eca-login-poster{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center;
  will-change: transform;
  backface-visibility: hidden;
  animation: eca-login-pan 42s ease-in-out infinite alternate;
}
@keyframes eca-login-pan{
  from{ transform: scale(1.0); }
  to{ transform: scale(1.05); }
}
.eca-login video{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  /* A clip that 404s (an external host, a dead CDN) must not paint a broken-film icon over the
     card: the poster underneath is the fallback, and this keeps it visible. */
  background: transparent;
}
/* The scrim. Two stops, not one: a vertical gradient so the footer edge is legible, and a radial
   vignette so a bright frame cannot wash out the card's corners. Measured against the brightest
   frame the fleet ships (white water at ~96% luma): card ink stays above 4.5:1. */
.eca-login::after{
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(0deg, rgb(4 10 20 / .55) 0%, rgb(4 10 20 / 0) 55%),
    radial-gradient(130% 100% at 50% 30%, rgb(4 10 20 / 0) 38%, rgb(4 10 20 / .48) 100%);
}

/* ── The card ─────────────────────────────────────────────────────────────────────────────────── */
.eca-login-card{
  position: relative;
  z-index: 3;
  box-sizing: border-box;
  width: min(26rem, 100%);
  margin: 0;
  padding: var(--space-5) var(--space-4);
  border-radius: 14px;
  animation: eca-login-in .3s ease-out both;
}
/* ── The width is the CONTAINER's business, never the viewport's ───────────────────────────────
 *
 * Two rules, both measured on leave-system at 390 (2026-11-10): the card was 358 px wide in a 375 px
 * line box (a 15 px classic scrollbar), with **12 px of gap on the left and 5 px on the right**.
 * 358 = 390 − 2×16 — i.e. the width was computed from `100vw`, which counts the scrollbar, while the
 * box it sits in is narrower. A box WIDER than its line box is not centred by `place-items: center`:
 * Chromium clamps an over-wide item to the start edge, which is the asymmetry the reader saw.
 *
 * `100%` resolves against the grid area this card is in — `.eca-login`'s content box, after its own
 * padding — so the card can never be wider than the space that holds it, at 390 or at 1440.
 *
 * The rank is (0,2,0) on purpose: a sign-in page still shipping its own `<style>` (the pre-extraction
 * `EcaLoginPage` emits `.eca-login-card{…calc(100vw - 2rem)…}` and a page's embedded styles come
 * after the linked sheets) wins at equal rank, and it is the same rank as the alias layer's field
 * rules. A layer that has to be overridden by its own callers is not a layer — until that inline
 * block is retired, this rule has to out-rank it. Only the WIDTH is raised: the page keeps its own
 * padding and radius. */
.eca-login .eca-login-card{
  width: min(26rem, 100%);
  max-width: 100%;
}
.eca-login-card--glass{
  background: rgb(10 16 28 / .62);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgb(255 255 255 / .16);
  box-shadow: 0 30px 90px rgb(0 0 0 / .45), inset 0 1px 0 rgb(255 255 255 / .06);
}
.eca-login-card--solid{
  background: rgb(15 23 42 / .95);
  border: 1px solid rgb(255 255 255 / .08);
  box-shadow: 0 24px 80px rgb(0 0 0 / .4);
}
/* A browser without backdrop-filter gets the opaque panel, not a translucent smear. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){
  .eca-login-card--glass{
    background: rgb(10 16 28 / .9);
  }
}
@keyframes eca-login-in{
  from{ opacity: 0; transform: translateY(8px); }
  to{ opacity: 1; transform: none; }
}

/* ── Wordmark ────────────────────────────────────────────────────────────────────────────────────
   The product name is ONE string from configuration (`app.branding.title`); the wordmark is a type
   treatment of it, never a re-spelling. It is also the page's `<h1>` — the sign-in page needs a
   visible heading as much as any other page, and the name is the honest one.

   `.eca-login-card > h1` / `.eca-login-card > .tagline` are the SAME declarations for the shipped
   markup: `EcaLoginPage` emits a bare `<h1>` and `p.tagline`, so the two names below never matched
   it. That is not cosmetic — `admin.css` underlines every `h1` (the `border-bottom` this block's
   last two declarations exist to remove), so a deployment whose login page is served without the
   page's own inline `<style>` got a rule under its wordmark. Selector list, not a fork. */
.eca-login-brand,
.eca-login-card > h1{
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: #fff;
  /* `admin.css` draws a legacy dividing rule under every `h1` (`border-bottom` + 8px padding).
     On a landing card that rule underlines the wordmark and reads as a field separator. */
  border-bottom: 0;
  padding-bottom: 0;
}
.eca-login-tagline,
.eca-login-card > .tagline{
  margin: var(--space-1) 0 var(--space-4);
  font-size: .9rem;
  line-height: 1.45;
  color: #c3cfdf;
}

/* ── The MARK slot, as distinct from the wordmark ─────────────────────────────────────────────────
   A sign-in card can carry two different branding assets and they are not interchangeable:

     · the WORDMARK — the product's name as type (`.eca-login-brand`, above, which is also the card's
       `<h1>`). It is the lockup.
     · the MARK     — a small, square-ish device: a crest, a seal, a monogram. It is decorative next
       to the wordmark, it sits ABOVE the heading, and it is BOUNDED.

   A BANNER is neither, and it is what broke `ark`: the diocesan crest is 3:1 with the diocese's name
   — English and Chinese — drawn inside the image. Rendered at its intrinsic size it ran past the
   card's padding and painted over the heading, so the app had to delete `app.branding.logo`
   entirely. The slot is therefore a BOX with a bound, and a wide asset is CONTAINED inside it
   instead of being allowed to define the layout:

       bound      max 160 wide × max 96 tall, intrinsic aspect preserved (`object-fit: contain`)
       position   its own row above the heading — the heading never starts under it
       wide logo  1200×400 → painted 160×53 at the card's start edge: contained, no overlap, its
                  drawn-in name redundant beside the wordmark (which is why the slot's owner passes
                  `alt=""` — the mark is decorative)

   `.eca-login-card > img` is the SAME slot for markup that predates the class: the published
   `EcaLoginPage` emits a bare `<img>` for `app.branding.logo`, so a deployment that configures a
   crest again is contained from the day it does — it does not have to wait for that page's own
   release. A page that emits `.eca-login-mark` gets the slot by name. */
.eca-login-mark,
.eca-login-card > img{
  display: block;
  width: auto;
  height: auto;
  max-width: 160px;
  max-height: 96px;
  margin: 0 0 var(--space-4);
  object-fit: contain;
  object-position: left center;
}

/* The environment is a BADGE, not a line of body text. In the old markup "Test Environment" sat
   directly above the first field's label at the same size, so it read as a section heading over the
   form. As a chip it is a property of the deployment, which is what it is. */
.eca-login-env{
  display: inline-flex;
  align-items: center;
  /* The sign-in form is a flex column, so a chip stretches to the full card width unless it opts
     out of the cross-axis stretch — measured: 382px wide badge in a 384px card. */
  align-self: flex-start;
  gap: var(--space-1);
  margin: 0 0 var(--space-3);
  padding: 2px var(--space-2);
  border-radius: 999px;
  font-size: var(--text-xs);
  font-weight: 650;
  letter-spacing: .02em;
  color: #fde68a;
  background: rgb(180 130 11 / .22);
  border: 1px solid rgb(253 230 138 / .35);
}

/* ── Fields ───────────────────────────────────────────────────────────────────────────────────── */
.eca-login .eca-field{
  margin: 0 0 var(--space-3);
}
.eca-login .eca-field > label{
  display: block;
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #dbe4f0;
}
/* The control is 44px tall: the sign-in form is the one screen where a thumb is the commonest
   pointer, and 38px (the desktop `--size-field`) is below the touch minimum.
   SPECIFICITY: `.eca-form input:not([type=checkbox]):not([type=radio]):not([type=file])` in
   `daisy/ui-alias.css` is (0,4,1) and paints the admin surface (white fill, hairline border). This
   rule is the SAME rank, so it wins by source order alone — `EcaUiAssets.defaultPageStyles`
   links this sheet after `ui-alias.css` on purpose, and that is the one ordering this component
   depends on. The `[type]` selectors are what buy the rank: a bare `.eca-login .eca-field input`
   is (0,2,1) and loses, which is how the first cut of this page rendered white fields on a dark
   card (measured 2026-11-08). */
.eca-login .eca-form .eca-field input.eca-login-input{
  box-sizing: border-box;
  width: 100%;
  height: auto;
  min-height: 44px;
  padding-block: var(--space-2);
  padding-inline: var(--space-3);
  font: inherit;
  font-size: 1rem;
  color: #f8fafc;
  background: rgb(255 255 255 / .07);
  border: 1px solid rgb(255 255 255 / .18);
  border-radius: 8px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.eca-login .eca-form .eca-field input.eca-login-input::placeholder{ color: rgb(203 213 225 / .6); }
.eca-login .eca-form .eca-field input.eca-login-input:hover{ background: rgb(255 255 255 / .1); }
.eca-login .eca-form .eca-field input.eca-login-input:focus{
  outline: 2px solid #6ee7b7;
  outline-offset: 1px;
  border-color: #6ee7b7;
  background: rgb(255 255 255 / .12);
}
/* A field with a leading icon: the glyph is the affordance, the label is the word. Same rank as the
   base control so it can own the start padding without a shorthand fight. */
.eca-login-field{
  position: relative;
}
.eca-login .eca-form .eca-field input.eca-login-input--icon{
  padding-inline-start: 2.5rem;
}
.eca-login-field > .eca-login-field__icon{
  position: absolute;
  inset-inline-start: var(--space-3);
  bottom: 13px;
  font-size: 18px;
  line-height: 1;
  color: rgb(203 213 225 / .75);
  pointer-events: none;
}

/* ── Actions: one primary row, secondary actions as links ────────────────────────────────────────
   The previous markup gave every action a button box, so "Forgot your password?" competed with
   "Sign in" for attention and the page read as four equal choices. A sign-in form has ONE primary
   action; an alternative sign-in route is a peer; recovery actions are links. */
.eca-login-actions{
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.eca-login .eca-btn{
  height: auto;
  min-height: 44px;
  padding: 0 var(--space-4);
  font-size: .95rem;
  border-radius: 8px;
}
/* ── THE PRIMARY ACTION IS THE CARD'S, WHATEVER CLASS THE PAGE EMITS ─────────────────────────────
 *
 * `EcaLoginPage` — the sign-in page every app mounts — emits a bare `.eca-btn` for "Sign in" (and
 * `.eca-link` for "Forgot password?"). This sheet used to name only `.eca-login-submit`,
 * `.eca-login-provider` and `.eca-login-links a`, so none of its three action rules matched the
 * shipped markup: the one primary action of the sign-in surface was styled by whatever the layer
 * says a *table*'s quiet button looks like, on the dark card. Measured on the published markup with
 * the real chain at 1440 (2026-11-17) — the page's own inline `<style>` still paints its own green
 * there, so the collision was visible on every surface that does NOT ship that block:
 * `EcaLogoutPage` and `EcaErrorResponses` render the same `.eca-login-card` with `.eca-btn` and
 * `.eca-link` and no inline sheet, and there the button computed the utility layer's base fill.
 *
 * The fix is a SCOPE, not a new class and not a page release: `.eca-login-card .eca-btn` is (0,2,0),
 * so it beats `uno.css`'s `.eca-btn` (0,1,0) and the page's own `.eca-btn` (0,1,0) in either order —
 * the layer is the last word on its own component. The old names stay in the selector list, so a
 * page that DOES emit `.eca-login-submit` / `.eca-login-provider` keeps exactly the look it had (the
 * provider's rule is (0,3,0) and still wins over this one). One declaration block, no fork. */
.eca-login-card .eca-btn,
.eca-login .eca-btn.eca-login-submit{
  flex: 1 1 auto;
  color: #05200f;
  background: #34d399;
  border-color: #34d399;
  font-weight: 700;
}
.eca-login-card .eca-btn:hover,
.eca-login .eca-btn.eca-login-submit:hover{ background: #6ee7b7; border-color: #6ee7b7; }
/* The alternative provider keeps its own identity (Singpass red) but stays a button of the same
   rank as the primary: it is a peer route in, not an afterthought. Both size to their label and
   share the row — a fixed `flex-basis` wrapped them onto two lines at 384px (measured 2026-11-08). */
.eca-login .eca-btn.eca-login-provider{
  flex: 0 1 auto;
  padding-inline: var(--space-3);
  font-size: .9rem;
  color: #fff;
  background: #c8102e;
  border-color: #c8102e;
  font-weight: 650;
}
.eca-login .eca-btn.eca-login-provider:hover{ background: #e11d3c; border-color: #e11d3c; }

/* ── The action row draws no boundary: the CARD owns the edge ─────────────────────────────────────
   `ui-system.css`'s base `.eca-actions` draws `border-top` + a top padding, because an action row
   that ends a form inside a card normally OWNS that line. On the sign-in card the row sits inside a
   padded glass panel that already has an edge, so the layer's rule drew a hairline above "Sign in"
   that no page designed — measured on `ark`'s login, whose own (older, page-local) sheet predates the
   class and could not have asked for it.

   One separator per boundary, one owner per line (X120): here the card's padding is the boundary.
   The rank is (0,2,0), so it beats `ui-system.css`'s one-class base and the page's embedded
   `.eca-actions` rule keeps its own `margin-top` (the inline block is the page's spacing choice). A
   page that is NOT the login surface uses `.eca-actions--plain` for the same opt-out. */
.eca-login .eca-actions{
  padding-top: 0;
  border-top: 0;
}

.eca-login-links{
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-3);
}
/* `.eca-login` prefix on purpose: `ui-system.css` has `.eaw-page a:not([class*="eca-"])` at (0,2,1),
   which sets `display: inline` and therefore ignores `min-height` — the two recovery links measured
   18px tall (reported by the audit as below the 24px pointer minimum). Same rank, later sheet.
   `.eca-login-card .eca-link` is the SAME rule for the shipped markup, which puts the recovery link
   in `.eca-actions` as a bare `.eca-link` (there is no `.eca-login-links` on the published page).
   Scope rather than a new class: (0,2,0), so it also beats `ui-system.css`'s page-link rule for a
   surface whose ink is inverted. */
.eca-login .eca-login-links a,
.eca-login-card .eca-link{
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 550;
  color: #a7f3d0;
  text-decoration: none;
  border-radius: 4px;
}
.eca-login .eca-login-links a:hover,
.eca-login-card .eca-link:hover{ text-decoration: underline; }
.eca-login .eca-login-links a:focus-visible,
.eca-login-card .eca-link:focus-visible{ outline: 2px solid #6ee7b7; outline-offset: 2px; }

/* ── The alternative-provider slot, same treatment ─────────────────────────────────────────────────
   The shipped page renders each configured provider (Singpass and friends) as `a.eca-provider` inside
   `.eca-providers`; this sheet named only `.eca-login-provider` (a `.eca-btn` modifier no page emits).
   A link with no rule is not a component (X107) — on a page without the inline block it rendered as
   the admin surface's page link on a dark card. The provider is a PEER ROUTE, so it is a full-width
   bordered row of the same height as the primary, not a second primary: a red Singpass fill belongs
   to a page that asks for Singpass by name, which is what `.eca-login-provider` is for. */
.eca-login-card .eca-providers{
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.eca-login-card .eca-provider{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding-inline: var(--space-3);
  font-size: .9rem;
  font-weight: 600;
  color: #e9eef6;
  text-decoration: none;
  background: rgb(255 255 255 / .06);
  border: 1px solid rgb(255 255 255 / .16);
  border-radius: 8px;
}
.eca-login-card .eca-provider:hover{ background: rgb(255 255 255 / .1); }
.eca-login-card .eca-provider:focus-visible{ outline: 2px solid #6ee7b7; outline-offset: 2px; }

/* A hint under the fields: quiet, on the reading edge, never a heading. Carries `.eca-hint` as well
   as its own name because the shared shell audit asserts the first-time-login sentence by that class
   (`SHELL_EXPECT_HINT=1`) — a hint that is styled but not discoverable is a hint the gate cannot see. */
.eca-login-note{
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: #b9c6d6;
}

/* ── Alerts ──────────────────────────────────────────────────────────────────────────────────── */
.eca-login-alert,
.eca-login .eca-alert{
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: 8px;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: #fee2e2;
  background: rgb(127 29 29 / .78);
  border: 1px solid rgb(248 113 113 / .4);
}
.eca-login-alert--success,
.eca-login .eca-alert--success{
  color: #d1fae5;
  background: rgb(6 78 59 / .78);
  border-color: rgb(110 231 183 / .4);
}

/* ── Narrow viewports: one column, card fills the width minus the gutter ───────────────────────── */
@media (max-width: 480px) {
  .eca-login{ padding: var(--space-3); }
  .eca-login-card{
    width: 100%;
    padding: var(--space-4) var(--space-3);
    border-radius: 12px;
  }
  .eca-login-brand,
  .eca-login-card > h1{ font-size: 1.5rem; }
  .eca-login-card .eca-btn,
  .eca-login .eca-btn.eca-login-submit,
  .eca-login .eca-btn.eca-login-provider{ flex: 1 1 100%; }
  .eca-login-links{ justify-content: flex-start; }
}

/* ── Reduced motion: the picture stays, the motion goes ──────────────────────────────────────────
   The 42 s pan is decorative; a clip is decorative. A viewer who asked for less motion keeps the
   still and the scrim (the page is never blank), and — because the clip is paused-by-removal rather
   than `autoplay=false` — it never downloads its bytes either. */
@media (prefers-reduced-motion: reduce) {
  .eca-login video{ display: none; }
  .eca-login-poster{ animation: none; transform: none; }
  .eca-login-card{ animation: none; }
}

/* ── Forced colours ───────────────────────────────────────────────────────────────────────────── */
@media (forced-colors: active) {
  .eca-login-card{ border: 1px solid CanvasText; }
  .eca-login-env{ border: 1px solid CanvasText; }
}

/* ── Print: a sign-in page is never printed; if it is, drop the media ─────────────────────────── */
@media print {
  .eca-login-media,
  .eca-login::after{ display: none; }
  .eca-login{ color: #000; background: #fff; }
  .eca-login-card{ border: 1px solid #999; background: #fff; color: #000; }
  .eca-login-brand, .eca-login-tagline, .eca-login .eca-field > label, .eca-login-note,
  .eca-login-card > h1, .eca-login-card > .tagline, .eca-login-card .eca-link,
  .eca-login-card .eca-provider{ color: #000; }
}
