/* auth.css - the sign-in screens and the three banners (UI overhaul R3,
   track D; docs/spec-ui-overhaul-r3-build.md §3, D1, D4): #auth-screen's
   views under aw-auth-* names, the update notice, the offline banner and
   the iOS install hint. Print rules: block "R3 D" of the page's print block.

   Colours are tokens only (static/ui/tokens.css; scripts/test_ui_tokens.py
   checks). Referenced as /static/ui/auth.css?v=<CACHE_VERSION number>.

   The sign-in screens (D1) are the prototype's (docs/ui-overhaul/prototype/
   src/css/screens/auth.css) under aw-auth-* names (the page's legacy .auth-*
   names collided): one centred column - the logo, one card (at most 420 px),
   the legal links. The column is in the document's flow, so the page
   scrolls when it is taller than the window (phones in landscape, large
   text); the legacy screen was a fixed box that could not scroll. */

/* ---------- the sign-in screens (D1) ---------- */

.aw-auth {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1 0 auto;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(32px + var(--top-t)) max(var(--gutter), var(--safe-r)) calc(32px + var(--safe-b)) max(var(--gutter), var(--safe-l));
  background: var(--bg); color: var(--text);
  font-family: var(--sans);
}
.aw-auth-col { display: flex; flex-direction: column; gap: 18px; width: min(100%, 420px); }

.aw-auth-brand { display: flex; justify-content: center; padding-bottom: 6px; }
.aw-auth-brand .logo { gap: 10px; }
.aw-auth-brand .logo-name { font-size: 22px; }

.aw-auth-card {
  display: flex; flex-direction: column; gap: 16px;
  padding: 28px 28px 24px;
  border: 1px solid var(--border); border-radius: var(--r-box);
  background: var(--surface); box-shadow: var(--shadow-card);
}
.aw-auth-view { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.aw-auth-title { margin: 0; font-size: 20px; line-height: 27px; font-weight: 600; color: var(--text-hi); }
.aw-auth-title:focus { outline: none; }
.aw-auth-text { margin: 0; font-size: 15px; line-height: 22px; color: var(--text-dim); overflow-wrap: anywhere; }
.aw-auth-text strong { font-weight: 600; color: var(--text-hi); }
.aw-auth-note { margin: 0; font-size: 14px; line-height: 20px; color: var(--muted); }
.aw-auth-center { text-align: center; }
.aw-auth-view > .aw-auth-title + .aw-auth-text { margin-top: -8px; }
.aw-auth-view .aw-icon-slot { display: inline-flex; flex: none; }

/* offline (R3 plan §9 item 16): one line in the card while the browser is offline */
.aw-auth-offline { max-width: none; margin: 0; font-size: 14px; line-height: 20px; color: var(--text-hi); }
.aw-auth-offline > .aw-icon-slot { display: inline-flex; flex: none; margin-top: 1px; color: var(--amber-text); }

/* the round icon above "Check your email" and "Verify your identity" */
.aw-auth-hero { display: flex; justify-content: center; padding-top: 4px; }
.aw-auth-hero-icon {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  border: 1px solid var(--amber-line); background: var(--amber-tint); color: var(--amber-text);
}
/* while the device's prompt is up: a slow ring (none under reduced motion) */
.aw-auth-pulse::after {
  content: ""; position: absolute; inset: -7px;
  border: 2px solid var(--amber-line); border-radius: 50%;
  opacity: 0; animation: aw-auth-ring 1.8s ease-out infinite;
}
@keyframes aw-auth-ring {
  0% { transform: scale(0.9); opacity: 0.9; }
  100% { transform: scale(1.25); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .aw-auth-pulse::after { display: none; }
}

/* the error box: an icon and words, never colour alone; role="alert" */
.aw-auth-error {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--red-line); border-radius: var(--r-ctl);
  background: var(--red-bg); color: var(--text-hi);
  font-size: 15px; line-height: 22px;
}
.aw-auth-error > .aw-icon-slot { display: inline-flex; flex: none; margin-top: 1px; color: var(--red); }
.aw-auth-error-main { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.aw-auth-error-text { margin: 0; overflow-wrap: anywhere; }
.aw-auth-error-link {
  display: inline-flex; align-items: center; min-height: 44px; margin: -4px 0 -10px; padding: 0;
  border: 0; background: transparent; color: var(--text-hi); cursor: pointer;
  font-family: var(--sans); font-size: 15px; font-weight: 600; text-align: left;
  text-decoration: underline; text-underline-offset: 3px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}

/* the Terms tick: a real checkbox drawn with tokens; the sentence is its
   label (a tap on the sentence ticks the box, a tap on one of its three
   links opens that policy instead) */
.aw-auth-tick { display: flex; align-items: flex-start; gap: 12px; }
.aw-auth-tick input {
  -webkit-appearance: none; appearance: none;
  position: relative;
  display: grid; place-content: center;
  width: 24px; height: 24px; flex: none; margin: 0;
  /* --muted: the box's edge must reach 3:1 against the card */
  border: 2px solid var(--muted); border-radius: 6px;
  background: var(--field); cursor: pointer;
}
/* a 44 px target around the 24 px box */
.aw-auth-tick input::after { content: ""; position: absolute; inset: -12px; }
.aw-auth-tick input::before {
  content: ""; width: 6px; height: 12px; margin-top: -2px;
  border: solid var(--on-amber); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
}
.aw-auth-tick input:checked { border-color: var(--amber-edge); background: var(--amber); }
.aw-auth-tick input:checked::before { transform: rotate(45deg) scale(1); }
.aw-auth-tick input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.aw-auth-tick label { flex: 1; min-width: 0; font-size: 15px; line-height: 22px; color: var(--text); cursor: pointer; }
.aw-auth-tick a { color: var(--text-hi); text-decoration: underline; text-underline-offset: 3px; }
.aw-auth-tick a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

/* the small ways between the views (R3 plan §9 item 15) */
.aw-auth-alt { margin: -6px 0 -10px; text-align: center; font-size: 15px; line-height: 22px; color: var(--text-dim); }
.aw-auth-alt .aw-link,
.aw-auth-mail { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-hi); font-weight: 500; }
.aw-auth-text .aw-auth-mail { vertical-align: middle; margin: -11px 0; }

/* the Terms gate: who is signed in, and Sign out */
.aw-auth-signed {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 12px;
  margin-top: -4px; font-size: 14px; line-height: 20px; color: var(--muted);
}
.aw-auth-signed > span { overflow-wrap: anywhere; }
.aw-auth-quiet {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px;
  border: 0; border-radius: var(--r-ctl); background: transparent; cursor: pointer;
  color: var(--text-dim); font-family: var(--sans); font-size: 15px; font-weight: 500;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-auth-quiet:focus-visible, .aw-auth-error-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* the legal links under the card */
.aw-auth-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 20px; font-size: 14px; }
.aw-auth-legal a {
  display: inline-flex; align-items: center; min-height: 44px;
  color: var(--text-dim); text-decoration: none;
}
.aw-auth-legal a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

@media (hover: hover) {
  .aw-auth-quiet:hover, .aw-auth-error-link:hover { color: var(--text-hi); }
  .aw-auth-quiet:hover { background: var(--hover); }
  .aw-auth-legal a:hover { color: var(--text-hi); text-decoration: underline; }
}

@media (max-width: 699px) {
  .aw-auth { justify-content: flex-start; padding-top: calc(28px + var(--top-t)); }
  .aw-auth-card { padding: 24px 20px 20px; }
}

/* ---------- the three banners (D4): the update notice, offline, the iOS install hint ----------
   In the app's column under the top bar, in the flow (they scroll away
   with the page, as before; from 1024 px they head the column). An icon for
   each old glyph, controls of 44 px, hover only under (hover: hover). The
   tint of each is today's: purple, amber, blue. */

.aw-banner {
  display: flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 2px max(var(--gutter), var(--safe-r)) 2px max(var(--gutter), var(--safe-l));
  border-bottom: 1px solid var(--border);
  background: var(--surface); color: var(--text-hi);
  font-family: var(--sans); font-size: 14px; line-height: 20px;
}
.aw-banner-ic { display: inline-flex; flex: none; }
.aw-banner-text { flex: 1; min-width: 0; padding: 12px 0; overflow-wrap: anywhere; }
.aw-banner-text strong { font-weight: 600; }
.aw-banner-action {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  min-height: 44px; margin: 0; padding: 0 16px;
  border: 1px solid var(--amber-line); border-radius: var(--r-ctl);
  background: var(--amber-tint); color: var(--amber-text);
  font-family: var(--sans); font-size: 14px; line-height: 20px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.aw-banner-action:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.aw-banner-x { margin-right: -10px; color: var(--text-hi); }
.aw-banner-x .aw-icon-slot { display: inline-flex; }
/* the update notice is neutral (founder 2026-11-19, D6: purple means "not
   from your documents" only), its Reload soft amber (D5: solid amber is the
   Ask arrow's alone) */
.aw-banner-update { background: var(--surface); border-bottom-color: var(--border-hi); }
.aw-banner-update > .aw-banner-ic { color: var(--text-dim); }
.aw-banner-offline { background: var(--amber-tint); border-bottom-color: var(--amber-line); }
.aw-banner-offline > .aw-banner-ic { color: var(--amber-text); }
.aw-banner-ios { background: var(--blue-bg); border-bottom-color: var(--blue-line); }
.aw-banner-ios > .aw-banner-ic { color: var(--blue); }

@media (hover: hover) {
  .aw-banner-action:hover { filter: brightness(1.06); }
}
