/* Auth Entry · Living Monogram — Login and Pending Profile.

   Canonical Figma: file `ZNXGrVhJws2EhnR3HJB7dD`, Design Freeze `1027:2466`.
     1027:2474  Login · Desktop 1440×900 · Light
     1027:2500  Login · Compact 390×844 · Light
     1027:2521  Pending Profile · Desktop 1440×900
     1027:2549  Pending Profile · Compact 390×844
     1027:2573  Login · Desktop · Dark Representative
     1027:2599  Motion Contract · 1000 ms
     1027:2647  prefers-reduced-motion
   It supersedes the Login / Pending presentation of `120:3`, `120:20` and
   `132:3369` only; every other Auth & Global contract is untouched.

   Loaded by the two Auth Entry templates alone, through the existing
   `extra_styles` block, so no rule here can reach a role shell or the
   Reception Display. The shared layer `accounts/css/base.css` is not edited.

   Breakpoints are the canonical ones and nothing else: Compact below 768 is
   the base, Tablet from 768 is derived from the frozen Compact + Desktop pair,
   Expanded from 1024 takes the Desktop split, Desktop from 1280 takes the
   frozen Desktop insets. They are written in the `min-width` form for the same
   iOS 16 reason `accounts/css/teacher.css` records.

   Every colour is an existing role or frozen primitive — no new palette:

     Surface        --ui-surface-status     #FBF8F0 / #222222
     Card           --ui-surface-input      #FFFFFF / #1A1A1A
     Note           --ui-surface-page       #F7F4EC   (Light)
                    --ui-surface-input      #1A1A1A   (Dark)
     Border         --ui-border-table       #DED8C9 / #3A3936
     Heading        --ui-text-heading       #1A1A1A
                    --bhc-system-warm-light #F2E6C9   (Dark, as 1027:2573)
     Text Secondary --ui-text-muted         #6D6A63 / #B8B2A8
     Access eyebrow --ui-text-muted (Light) / --bhc-system-gold (Dark)
     Verified       --ui-text-success       #2F7D4A / #57B879
     Brand stage    --bhc-system-dark, --bhc-system-gold,
                    --bhc-system-warm-light (the stage is dark in both themes)
     Trajectories   --bhc-griffin-ui        #560313 / #D96C83
                    --bhc-dragon-canonical  #C35A1C   (Light)
                    --bhc-dragon-ui         #D96B2B   (Dark)
                    --bhc-system-gold

   The trajectory values are exactly what the frozen frames export (Light
   Griffin `#560313` @ 0.28, Dragon `#C35A1C` @ 0.26, Gold @ 0.18; Dark Griffin
   `#D96C83`, Dragon `#D96B2B`). Lengths are `rem`, so at the browser default
   of 16px each value is its canonical CSS pixel value. */

.auth-entry {
  --auth-surface: var(--ui-surface-status);
  --auth-card: var(--ui-surface-input);
  --auth-note: var(--ui-surface-page);
  --auth-border: var(--ui-border-table);
  --auth-heading: var(--ui-text-heading);
  --auth-text-secondary: var(--ui-text-muted);
  --auth-eyebrow: var(--ui-text-muted);
  --auth-trajectory-dragon: var(--bhc-dragon-canonical);
  /* The Google action is white in both themes in the frozen Light and Dark
     frames; it reuses the repository's own white and Dark Ink rather than
     themed roles, because it is not supposed to change with the theme. */
  --auth-google-surface: #FFFFFF;
  --auth-google-text: var(--bhc-system-dark);
  /* The stage is a dark surface in both themes, so its secondary text is the
     repository's existing Dark `--ui-text-muted` value, fixed. */
  --auth-stage-muted: #B8B2A8;
}

[data-theme="dark"] .auth-entry {
  --auth-note: var(--ui-surface-input);
  --auth-heading: var(--bhc-system-warm-light);
  --auth-eyebrow: var(--bhc-system-gold);
  --auth-trajectory-dragon: var(--bhc-dragon-ui);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-entry {
    --auth-note: var(--ui-surface-input);
    --auth-heading: var(--bhc-system-warm-light);
    --auth-eyebrow: var(--bhc-system-gold);
    --auth-trajectory-dragon: var(--bhc-dragon-ui);
  }
}

/* The Auth Entry is full-bleed. `main` keeps its id, its landmark and the
   offline live region from `accounts/base.html`; only the content cap and
   the block padding of the ordinary shell are withdrawn, and only from the
   `main` that directly holds this screen. */
main:has(> .auth-entry) {
  max-width: none;
  padding: 0;
}

.auth-entry {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--auth-surface);
}

/* Withdraws the shared element margins (`p`, `h1`, `h2`, `form` in
   `accounts/css/base.css`) at element specificity, so every component rule
   below — one class — still sets the frozen gaps. */
:where(.auth-entry) p,
:where(.auth-entry) h1,
:where(.auth-entry) h2,
:where(.auth-entry) form {
  margin: 0;
}

/* ---------------------------------------------------------------------------
   1. Brand stage
   --------------------------------------------------------------------------- */

.auth-stage {
  position: relative;
  overflow: hidden;
  padding: 4.875rem 1.75rem 6.3125rem;
  background: var(--bhc-system-dark);
  color: var(--bhc-system-warm-light);
  text-align: center;
}

.auth-entry--pending .auth-stage {
  padding-block: 3.625rem 2.6875rem;
}

/* Decorative only: hidden from the accessibility tree in the markup and never
   a pointer target, so the intro can never sit between a reader and a control. */
.auth-stage__trajectories {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.auth-trajectory {
  position: absolute;
  border: 1.5px solid;
  border-radius: 50%;
}

.auth-trajectory--gold {
  inset-block-start: 12%;
  inset-inline-start: 5%;
  width: 88%;
  height: 72%;
  border-width: 1px;
  border-color: var(--bhc-system-gold);
  opacity: 0.18;
}

.auth-trajectory--griffin {
  inset-block-start: 18.6%;
  inset-inline-start: -37.5%;
  width: 95%;
  height: 78%;
  border-color: var(--bhc-griffin-ui);
  opacity: 0.28;
  transform: rotate(12deg);
}

.auth-trajectory--dragon {
  inset-block-start: -3.6%;
  inset-inline-start: 37%;
  width: 95%;
  height: 86%;
  border-color: var(--auth-trajectory-dragon);
  opacity: 0.26;
  transform: rotate(-10deg);
}

.auth-stage__brand {
  position: absolute;
  z-index: 1;
  inset-block-start: 2.125rem;
  inset-inline-start: 1.75rem;
  text-align: start;
}

/* Compact Pending lifts the monogram level with the eyebrow (`1027:2549`), so
   the eyebrow may only use the space left of the centred 90px mark: at 390 it
   stays one line as frozen, at 320 it wraps instead of touching the mark. */
.auth-entry--pending .auth-stage__brand {
  max-width: calc(50% - 5.0625rem);
}

.auth-stage__hairline {
  display: block;
  width: 4.5rem;
  border-block-start: 1px solid var(--bhc-system-gold);
  opacity: 0.65;
}

.auth-stage__eyebrow {
  margin-block-start: 0.9375rem;
  color: var(--bhc-system-gold);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1rem;
  text-transform: uppercase;
}

.auth-stage__hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The approved transparent Gold monogram, copied unmodified: only its width is
   set, so the intrinsic ratio cannot be distorted. */
.auth-stage__monogram {
  display: block;
  width: 5.625rem;
  height: auto;
}

.auth-stage__statement {
  max-width: 21.375rem;
  margin-block-start: 1.75rem;
  color: var(--bhc-system-warm-light);
  font-family: var(--bhc-font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 2.25rem;
  text-wrap: balance;
}

.auth-entry--pending .auth-stage__statement {
  margin-block-start: 0.5rem;
}

/* The frozen Compact frames carry the statement alone. */
.auth-stage__support {
  display: none;
  max-width: 43rem;
  color: var(--auth-stage-muted);
  font-size: 0.9375rem;
  line-height: 1.375rem;
}

/* ---------------------------------------------------------------------------
   2. Surface
   --------------------------------------------------------------------------- */

.auth-surface {
  display: flex;
  flex-direction: column;
  padding: 2.625rem 1.75rem 1.875rem;
  background: var(--auth-surface);
  color: var(--ui-text);
}

.auth-entry--pending .auth-surface {
  padding-block: 2.125rem 2.5rem;
}

.auth-surface__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
}

.auth-eyebrow {
  color: var(--auth-eyebrow);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 0.875rem;
  text-transform: uppercase;
}

.auth-title {
  margin-block-start: 1.625rem;
  color: var(--auth-heading);
  font-size: 2rem;
  font-weight: 600;
  line-height: 2.375rem;
  /* The frozen frames wrap greedily («Профіль майже / готовий»); the shared
     `h1` balance would move the break. */
  text-wrap: wrap;
}

.auth-entry--pending .auth-title {
  margin-block-start: 1.375rem;
  font-size: 1.875rem;
  line-height: 2.25rem;
}

/* The frozen heading is two lines at every width (`1027:2500` breaks it as
   «Увійти до / House Cup»), and the product name is never split. The line is
   presentation only; the heading's text stays one phrase. */
.auth-title__name {
  display: block;
  white-space: nowrap;
}

.auth-lead {
  margin-block-start: 1.25rem;
  color: var(--auth-text-secondary);
  font-size: 0.9375rem;
  line-height: 1.375rem;
}

.auth-entry--pending .auth-lead {
  font-size: 0.875rem;
  line-height: 1.3125rem;
}

.auth-only-wide {
  display: none;
}

/* The one primary action. `margin-block-start` is the frozen gap; the divider
   of the Desktop frame is this block's own border, drawn from Tablet up. */
.auth-action {
  margin-block-start: 3rem;
}

.auth-google {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 3.625rem;
  padding: 0.5rem 1.125rem 0.5rem 1.0625rem;
  gap: 1rem;
  border: 1px solid var(--auth-border);
  border-radius: 0.875rem;
  background: var(--auth-google-surface);
  color: var(--auth-google-text);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.375rem;
  text-align: start;
}

.auth-google:hover {
  border-color: var(--ui-border-control);
  background: var(--auth-google-surface);
  color: var(--auth-google-text);
}

/* The frozen frames draw this mark as `Google mark placeholder`: a lettered
   disc, not Google's artwork, and it is decorative (`aria-hidden`). Its blue is
   the one third-party value on the screen and belongs to that mark alone. */
.auth-google__mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border: 1px solid var(--ui-border-table);
  border-radius: 50%;
  background: var(--auth-google-surface);
  color: #4285F4;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
}

.auth-domain {
  margin-block-start: 1rem;
  color: var(--auth-text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.125rem;
}

.auth-note {
  padding: 0.875rem 1rem 1rem;
  border: 1px solid var(--auth-border);
  border-radius: 0.875rem;
  background: var(--auth-note);
}

.auth-note__title {
  color: var(--auth-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.125rem;
}

.auth-note__copy {
  margin-block-start: 0.5rem;
  color: var(--auth-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.1875rem;
}

/* The Login note is a Desktop element; the frozen Compact frame omits it. */
.auth-note--login {
  display: none;
  margin-block-start: 3.25rem;
}

/* Explicitly development-only and low-emphasis: it renders only when the
   server says local development authentication is enabled, never in
   staging or production. */
.auth-dev {
  margin-block-start: 1.5rem;
  padding: 0.5rem 1rem;
  border: 1px dashed var(--ui-border-control);
  border-radius: 0.75rem;
  color: var(--auth-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.25rem;
}

.auth-dev a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--ui-link);
  font-weight: 600;
}

.auth-footer {
  margin-block-start: auto;
  padding-block-start: 2rem;
  color: var(--auth-text-secondary);
  font-size: 0.6875rem;
  line-height: 1rem;
}

/* --- Pending ------------------------------------------------------------- */

.auth-status {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  min-height: 1.875rem;
  padding: 0.4375rem 0.875rem;
  border-radius: 999px;
  background: var(--bhc-system-warm-light);
  color: var(--bhc-system-dark);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
  text-transform: uppercase;
}

.auth-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 5.75rem;
  margin-block-start: 1.625rem;
  padding: 0.9375rem;
  gap: 0.75rem 1rem;
  border: 1px solid var(--auth-border);
  border-radius: 0.875rem;
  background: var(--auth-card);
}

.auth-identity__who {
  min-width: 0;
}

.auth-identity__name {
  color: var(--auth-heading);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.375rem;
}

.auth-identity__email {
  margin-block-start: 0.625rem;
  color: var(--auth-text-secondary);
  font-size: 0.75rem;
  line-height: 1.125rem;
}

/* Status by word, never by colour alone. The tint is derived from the approved
   success role; engines without `color-mix()` keep the soft surface. */
.auth-identity__verified {
  display: none;
  align-items: center;
  min-height: 1.875rem;
  padding: 0.4375rem 0.875rem;
  border-radius: 999px;
  background: var(--ui-surface-status);
  background: color-mix(in srgb, var(--ui-text-success) 12%, var(--auth-card));
  color: var(--ui-text-success);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
  text-transform: uppercase;
}

.auth-entry--pending .auth-note {
  min-height: 7rem;
  margin-block-start: 1.375rem;
}

.auth-entry--pending .auth-note__copy {
  margin-block-start: 0.625rem;
}

.auth-logout {
  margin-block-start: 1.625rem;
}

.auth-logout__button {
  width: auto;
  min-width: 7.5rem;
  min-height: 2.875rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--ui-text);
  border-radius: 0.6875rem;
  background: var(--auth-surface);
  color: var(--ui-text);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25rem;
}

.auth-logout__button:hover {
  border-color: var(--ui-text);
  background: var(--auth-card);
  color: var(--ui-text);
}

.auth-help {
  display: none;
  color: var(--auth-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.25rem;
}

/* ---------------------------------------------------------------------------
   3. Tablet 768–1023 — derived: the Compact stack with the Desktop surface
   content, centred as one readable column.
   --------------------------------------------------------------------------- */

@media (min-width: 48rem) {
  .auth-stage,
  .auth-entry--pending .auth-stage {
    padding: 6.5rem 3.5rem 4.5rem;
  }

  .auth-stage__brand,
  .auth-entry--pending .auth-stage__brand {
    max-width: none;
    inset-block-start: 3.375rem;
    inset-inline-start: 3.5rem;
  }

  .auth-stage__hairline {
    width: 6.875rem;
  }

  .auth-stage__eyebrow {
    margin-block-start: 1.1875rem;
  }

  .auth-stage__monogram {
    width: 8.75rem;
  }

  .auth-stage__statement,
  .auth-entry--pending .auth-stage__statement {
    max-width: 45rem;
    margin-block-start: 1.5rem;
    font-size: 2.25rem;
    line-height: 2.75rem;
  }

  .auth-stage__support {
    display: block;
    margin-block-start: 0.875rem;
  }

  .auth-surface,
  .auth-entry--pending .auth-surface {
    padding: 4rem 3rem 3.5rem;
  }

  .auth-surface__body {
    max-width: 26.875rem;
    margin-inline: auto;
  }

  .auth-entry--pending .auth-surface__body {
    max-width: 38.75rem;
  }

  .auth-only-wide {
    display: inline;
  }

  .auth-only-compact {
    display: none;
  }

  .auth-eyebrow {
    font-size: 0.6875rem;
    line-height: 1rem;
  }

  .auth-title {
    margin-block-start: 2rem;
    font-size: 2.75rem;
    line-height: 3.25rem;
  }

  .auth-entry--pending .auth-title {
    margin-block-start: 1.875rem;
    font-size: 2.625rem;
    line-height: 3.125rem;
  }

  .auth-lead {
    margin-block-start: 1.75rem;
    font-size: 1.0625rem;
    line-height: 1.625rem;
  }

  .auth-entry--pending .auth-lead {
    margin-block-start: 1.125rem;
    font-size: 1rem;
    line-height: 1.5rem;
  }

  .auth-action {
    margin-block-start: 1.625rem;
    padding-block-start: 2.5rem;
    border-block-start: 1px solid var(--auth-border);
  }

  .auth-domain {
    margin-block-start: 1.125rem;
    font-size: 0.8125rem;
    line-height: 1.25rem;
  }

  .auth-note {
    padding: 1rem 1.125rem 0.75rem;
  }

  .auth-note--login {
    display: block;
  }

  .auth-footer {
    font-size: 0.75rem;
    line-height: 1.125rem;
  }

  .auth-identity {
    min-height: 7.375rem;
    margin-block-start: 2.75rem;
    padding: 1.1875rem;
    border-radius: 1rem;
  }

  .auth-identity__name {
    font-size: 1.25rem;
    line-height: 1.625rem;
  }

  .auth-identity__email {
    margin-block-start: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  .auth-identity__verified {
    display: inline-flex;
    margin-block-start: 0.3125rem;
  }

  .auth-entry--pending .auth-note {
    min-height: 8.5rem;
    margin-block-start: 2rem;
    padding: 1.0625rem 1.1875rem 1.25rem;
    border-radius: 1rem;
  }

  .auth-entry--pending .auth-note__title {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }

  .auth-entry--pending .auth-note__copy {
    font-size: 0.875rem;
    line-height: 1.3125rem;
  }

  .auth-logout {
    margin-block-start: 2.625rem;
  }

  .auth-logout__button {
    min-width: 10.625rem;
    min-height: 3.125rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.375rem;
  }

  .auth-help {
    display: block;
    margin-block-start: 2.875rem;
  }
}

/* ---------------------------------------------------------------------------
   4. Expanded 1024–1279 — the Desktop split: stage beside the surface.
   --------------------------------------------------------------------------- */

@media (min-width: 64rem) {
  .auth-entry {
    grid-template-rows: none;
    grid-template-columns: 3fr 2fr;
  }

  /* Pending gives the surface the larger share: 590 / 850 in `1027:2521`. */
  .auth-entry--pending {
    grid-template-columns: 59fr 85fr;
  }

  .auth-stage {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6rem 2rem 11.125rem;
  }

  .auth-entry--pending .auth-stage {
    padding: 6rem 1.5rem 15.0625rem;
  }

  .auth-stage__monogram {
    width: 14.375rem;
  }

  .auth-entry--pending .auth-stage__monogram {
    width: 9.6875rem;
  }

  .auth-stage__statement {
    margin-block-start: 1.875rem;
    font-size: 2.875rem;
    line-height: 3.375rem;
  }

  .auth-entry--pending .auth-stage__statement {
    margin-block-start: 3.6875rem;
    font-size: 2rem;
    line-height: 3.375rem;
  }

  /* 40px at Expanded keeps the Google label on one line in the narrower 40%
     column; Desktop restores the frozen 72px below. */
  .auth-surface {
    padding: 7.5rem 2.5rem 3.5rem;
  }

  .auth-entry--pending .auth-surface {
    padding: 7.25rem 3.5rem 3.5rem;
  }

  .auth-surface__body,
  .auth-entry--pending .auth-surface__body {
    margin-inline: 0;
  }
}

/* ---------------------------------------------------------------------------
   5. Desktop ≥1280 — the frozen 1440 insets.
   --------------------------------------------------------------------------- */

@media (min-width: 80rem) {
  .auth-surface {
    padding-inline: 4.5rem;
  }

  .auth-entry--pending .auth-surface {
    padding-inline: 5.75rem;
  }

  .auth-entry--pending .auth-stage__statement {
    font-size: 2.375rem;
  }
}

/* ---------------------------------------------------------------------------
   6. Motion — `1027:2599`, opted into only when the reader allows motion.

   Everything above is the final composition, which is exactly what
   `prefers-reduced-motion: reduce` renders (`1027:2647`): no staged reveal,
   no translation, no trajectory entrance, no drift, no submit motion. The
   intro only ever starts *from* a quieter state and ends on those values, so
   nothing is hidden, and no control is animated, covered or delayed: the
   surface is interactive from the first frame.

     0–1000 ms   Monogram brightens (opacity only; no morph, no scale bounce)
     250–760 ms  Griffin / Dragon trajectories enter from opposite sides
     420–1000 ms Ceremonial statement rises 12px and appears
     after 1 s   Trajectories drift ≤4px over 8s, alternate; nothing else moves
     submit      Trajectories may converge 12px in 300ms; the POST never waits
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .auth-stage__monogram {
    animation: auth-monogram-reveal 760ms cubic-bezier(0.2, 0, 0, 1) both;
  }

  .auth-trajectory--gold {
    animation: auth-trajectory-fade 510ms ease-out 250ms backwards;
  }

  .auth-trajectory--griffin {
    animation:
      auth-griffin-enter 510ms cubic-bezier(0.2, 0, 0, 1) 250ms backwards,
      auth-griffin-drift 8s ease-in-out 1000ms infinite alternate;
    transition: margin-inline-start 300ms ease-out;
  }

  .auth-trajectory--dragon {
    animation:
      auth-dragon-enter 510ms cubic-bezier(0.2, 0, 0, 1) 250ms backwards,
      auth-dragon-drift 8s ease-in-out 1000ms infinite alternate;
    transition: margin-inline-start 300ms ease-out;
  }

  .auth-stage__statement,
  .auth-stage__support {
    animation: auth-statement-rise 580ms cubic-bezier(0.2, 0, 0, 1) 420ms backwards;
  }

  .auth-entry.is-leaving .auth-trajectory--griffin {
    margin-inline-start: 12px;
  }

  .auth-entry.is-leaving .auth-trajectory--dragon {
    margin-inline-start: -12px;
  }
}

@keyframes auth-monogram-reveal {
  from {
    opacity: 0.18;
  }
}

@keyframes auth-trajectory-fade {
  from {
    opacity: 0;
  }
}

@keyframes auth-griffin-enter {
  from {
    opacity: 0;
    translate: -2rem 0;
  }
}

@keyframes auth-dragon-enter {
  from {
    opacity: 0;
    translate: 2rem 0;
  }
}

/* Drift composes with the entrance: the entrance animates `translate`, the
   drift animates `transform`, so the two never fight over one property. */
@keyframes auth-griffin-drift {
  to {
    transform: rotate(12deg) translate(3px, -2px);
  }
}

@keyframes auth-dragon-drift {
  to {
    transform: rotate(-10deg) translate(-3px, 2px);
  }
}

@keyframes auth-statement-rise {
  from {
    opacity: 0;
    translate: 0 12px;
  }
}
