/* ==========================================================================
   Access Portal — Event Horizon 2 (DS-52)

   THE UNGATED FRONT DOOR. This page carries `platform-auth.horizon.io/skip`,
   so it is the first Horizon surface a person sees — before any sign-in, on
   any device. Until DS-52 it was the only platform surface that had never been
   themed at all: a blue-accented default (#0b0e14 ground, #5b8cff accent) that
   looked like nothing else we ship, and went WHITE on a light-mode system.

   ── HOW THIS REACHES THE PAGE ───────────────────────────────────────────────
   Fed to the cognito module as `portal_theme_css` (read by _envcommon/
   cognito.hcl with file()), published as the `theme.css` key of the
   access-portal-web ConfigMap, and LINKED AFTER the page's inline <style>.

   Appended, not substituted, and that is deliberate. The inline block stays as
   a complete working fallback, so an installation that supplies no theme still
   gets a functioning portal rather than unstyled markup — the same reason DS-48
   gates the Nexus proxy on `theme_css` being non-empty. Everything here is
   therefore an OVERRIDE and needs no `!important`: it simply comes later.

   ── DARK ONLY, AND THAT IS THE POINT ────────────────────────────────────────
   The inline fallback carries two `@media (prefers-color-scheme: light)` rules.
   Event Horizon is dark-only (DESIGN.md §2), so those are overridden
   unconditionally below rather than mirrored. A visitor on a light-mode laptop
   sees the same front door as everyone else.

   Values are EH2, from branding/themes/event-horizon/palette.css. They are
   INLINE LITERALS on purpose: this file is served standalone from a ConfigMap
   with no build step and no access to branding/, so it cannot `@import` or
   `var()` its way to the palette. That makes it the one hand-maintained copy in
   the system — DS-53's guard does not reach here — so if the ground moves,
   this file moves with it.
   ========================================================================== */

:root {
  /* Dark only. Overrides the fallback's `light dark`, which is what let the
     browser paint form controls and scrollbars for a light page. */
  color-scheme: dark;

  --portal-void: #08090c;
  --portal-panel: #0e1116;
  --portal-line: rgba(255, 255, 255, 0.1);
  --portal-text: #edeff3;
  --portal-text-2: #a7aebb;
  /* The platform accent. Still the brand colour, and still used elsewhere —
     it is simply no longer painted on a sign-in control. PAS-34. */
  --portal-accent: #f5a623;
  --portal-accent-hover: #ffbe52;
  --portal-ink-on-accent: #08090c;

  /* PAS-34 — the provider button's face, its boundary, and the focus ring.
     ⚠️ This file is why "the portal's buttons are blue" was WRONG. The blue
     (#5b8cff) is the inline fallback in index.html; nobody sees it, because
     this sheet is linked after it and repainted every control ORANGE. There
     were two orange surfaces on the sign-in path, not one.

     The border is load-bearing: with the fill gone it is the only thing giving
     the button a shape, so it carries the 3:1 WCAG 1.4.11 floor on BOTH sides.
     Measured against this palette: #6b7486 is 3.78:1 on #141821 and 4.02:1 on
     #0e1116. */
  --portal-raised: #141821;
  --portal-raised-hover: #1b2029;
  --portal-line-ui: #6b7486;
  --portal-line-ui-hover: #8b93a1;
  --portal-focus: #edeff3;
  --portal-danger: #ff8f88;
}

/* The ground.
   Jad, 2026-09-18: "background should be some kind of gradient".
   It was a flat --portal-void. The consoles this page hands you to paint
   `radial-gradient(ellipse at 50% 40%, #161922 0%, var(--horizon-deep) 70%)`
   (services/{admin-ui,user-dashboard}/src/styles.css `.ambient-bg`, where
   --horizon-deep resolves to the kit's --hz-void #08090C = --portal-void here).
   Copied value-for-value so the seam between the front door and the console
   disappears — the same reason the spinner above is amber again.
   `background-attachment: fixed` because the card is vertically centred in a
   min-height:100vh grid: without it the ellipse re-centres on the content box
   and the highlight sits off-centre. */
body {
  background: radial-gradient(ellipse at 50% 40%, #161922 0%, var(--portal-void) 70%);
  background-attachment: fixed;
  color: var(--portal-text);
  font-family: "Inter", "Inter var", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* The fallback sets these inside a light-mode media query. Repeating the
   selector unconditionally here beats it on order, without !important. */
@media (prefers-color-scheme: light) {
  body {
    background: radial-gradient(ellipse at 50% 40%, #161922 0%, var(--portal-void) 70%);
    background-attachment: fixed;
    color: var(--portal-text);
  }
  .card {
    background: var(--portal-panel);
    border-color: var(--portal-line);
  }
}

.card {
  background: var(--portal-panel);
  border: 1px solid var(--portal-line);
  border-radius: 14px;
  /* EH2 e2 elevation. */
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
}

h1 {
  color: var(--portal-text);
}

p {
  color: var(--portal-text-2);
}

/* PAS-34 said ONE SPINNER and made this one neutral. ⚠️ ITS RULE NOW POINTS THE
   OTHER WAY, and that is why this is amber again rather than a reversal.
   PAS-34's argument was: "the same wait continues on a surface whose spinner is
   NEUTRAL, and a colour that changes mid-flow reads as a different page." The
   premise was true when written. PAS-39 then landed (verified in Jad's browser
   2026-09-17) and moved admin-ui and user-dashboard's whole-page waits onto the
   kit's `.hz-spinner`, which is `border-top-color: var(--hz-accent)` = #F5A623.
   So the surface the wait continues ONTO is amber, and a neutral head here is
   now itself the colour change mid-flow that PAS-34 set out to prevent.
   Jad, 2026-09-18: "the sign in and whitelist spinner still is white, should be
   horizon yellow."
   Same rule, current facts, opposite answer. --portal-accent is #f5a623, which
   is the kit's --hz-accent to the byte. */
.spinner {
  border-color: var(--portal-line);
  border-top-color: var(--portal-accent);
}

/* PAS-34 — the provider buttons. Geometry (64×64, radius 14, 28px mark, 16px
   gap) is set by the page's inline fallback and matched exactly by the
   auth-gateway picker and by admin-ui / user-dashboard. What lives HERE is the
   palette, so a re-theme still needs no rebuild (LPH-13 / DS-52).

   ⚠️ There is deliberately no bare `button` rule any more. The old one painted
   EVERY control on the page with the accent — including, after this change,
   the icon-only provider buttons, which would have put the orange straight
   back underneath the Google mark. */
.pbtn {
  background: var(--portal-raised);
  border-color: var(--portal-line-ui);
  color: var(--portal-text);
}

.pbtn:hover {
  background: var(--portal-raised-hover);
  border-color: var(--portal-line-ui-hover);
}

.retry {
  background: var(--portal-raised);
  border-color: var(--portal-line-ui);
  color: var(--portal-text);
}

.retry:hover {
  background: var(--portal-raised-hover);
  border-color: var(--portal-line-ui-hover);
}

.pbtn:focus-visible,
.retry:focus-visible {
  outline: 2px solid var(--portal-focus);
  outline-offset: 3px;
}

.err {
  color: var(--portal-danger);
}

/* PAS-46 — the access card: the title, the remainder as a clock, two verbs.
   Jad, 2026-10-04: "just show the title, a countdown timer and two buttons
   (one for Disconnect and one for Renew)." Geometry is the page's inline
   fallback; what lives HERE is the palette, as for the provider buttons above.

   ⚠️ THE ACCENT IS BACK ON A CONTROL, ON PURPOSE, AND ON EXACTLY ONE. PAS-34
   took it off the SIGN-IN controls, where it sat under a vendor's mark, and
   that still holds — `.pbtn` and `.retry` stay neutral. Renew (Reconnect, when
   there is nothing left to renew) is the card's one primary action, and one
   amber primary per view is the rule (DESIGN.md §6.1). Disconnect is the
   danger OUTLINE: a filled red would compete with it.

   Hover is behind `(hover: hover)` for the reason the page gives: on a phone a
   tapped button keeps :hover until something else is tapped. */
.timer {
  color: var(--portal-text);
}

.timer.muted {
  color: var(--portal-text-2);
}

.btn-primary {
  background: var(--portal-accent);
  border-color: var(--portal-accent);
  color: var(--portal-ink-on-accent);
}

.btn-danger {
  background: transparent;
  border-color: var(--portal-danger);
  color: var(--portal-danger);
}

@media (hover: hover) {
  .btn-primary:hover:not([aria-disabled="true"]) {
    background: var(--portal-accent-hover);
    border-color: var(--portal-accent-hover);
  }

  .btn-danger:hover:not([aria-disabled="true"]) {
    background: rgba(255, 143, 136, 0.08);
  }
}

.btn:focus-visible {
  outline: 2px solid var(--portal-focus);
  outline-offset: 3px;
}
