/* Shared stylesheet for the logged-out / gated client pages.
 *
 * Linked rather than inlined on purpose. Ten pages used to carry their own copy of
 * this, and folding it into the shared template instead simply moved the duplication
 * from the repo to the wire — every page paid for the whole stylesheet again. As a
 * file it is fetched once for the funnel and revalidated with an ETag thereafter.
 *
 * The one page-specific value, the column width, arrives as --auth-w from the page.
 * Edit this alongside client_auth_base.html; the template documents the blocks.
 */
/* ─── Tokens — names and values mirror client_base.html's dark block ───── */
:root, [data-theme="dark"] {
  --gat-bg:             #0d0f14;
  --gat-surface:        #161820;
  --gat-surface-raised: #1e2028;
  --gat-border:         #252836;
  --gat-border-subtle:  rgba(255,255,255,0.05);
  --gat-text:           #e8eaed;
  --gat-muted:          #9aa0a6;
  --gat-muted2:         #5f6368;
  --gat-brand:          #f0b429;
  --gat-brand-dk:       #d4a017;
  --gat-brand-ink:      #0d0f14;   /* text ON the brand colour */
  --gat-success:        #34d399;
  --gat-danger:         #f87171;
  --gat-warning:        #fbbf24;

  /* Tinted surfaces. Previously eleven different opaque hexes (#0d2415,
     #2a1010, #2a1418, #0d1a2a …); alpha over the card keeps one hue per state. */
  --tint-brand:         rgba(240,180,41,0.06);
  --tint-brand-line:    rgba(240,180,41,0.25);
  --tint-success:       rgba(52,211,153,0.10);
  --tint-success-line:  rgba(52,211,153,0.30);
  --tint-danger:        rgba(248,113,113,0.10);
  --tint-danger-line:   rgba(248,113,113,0.30);
  --tint-warning:       rgba(251,191,36,0.10);
  --tint-warning-line:  rgba(251,191,36,0.30);
  --tint-info:          rgba(147,197,253,0.09);
  --tint-info-line:     rgba(147,197,253,0.28);
  --gat-info:           #93c5fd;

  /* Type. 1rem on form controls is not cosmetic: below 16px, iOS Safari zooms
     the whole page when a field takes focus, and these were all 0.9rem. */
  --fs-xs:    0.75rem;
  --fs-sm:    0.8125rem;
  --fs-md:    0.875rem;
  --fs-input: 1rem;
  --fs-title: 1.125rem;
  --fs-brand: 1.4rem;

  --radius:    8px;
  --radius-lg: 14px;

  /* The built-in easings are too weak to read as intentional. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --dur-press: 140ms;
  --dur-enter: 200ms;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--gat-bg);
  color: var(--gat-text);
  font-family: system-ui, -apple-system, sans-serif;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 100vh is wrong on mobile Safari — the URL bar is excluded from the value, so
     the page is taller than the viewport and the card can sit under the chrome.
     dvh tracks the visible area; the vh line stays as the fallback. */
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* Top-aligned scrolling variant, for a page too tall to centre. */
body.flow {
  display: block;
  padding: 2rem 1rem 4rem;
}

.wrap { width: 100%; max-width: var(--auth-w, 420px); }
body.flow .wrap { margin: 0 auto; }

/* ─── Brand ─────────────────────────────────────────────────────────────── */
.brand { text-align: center; margin-bottom: 2rem; }
.brand-logo {
  font-size: var(--fs-brand);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--gat-brand);
  line-height: 1.2;
}
.brand-logo span { color: #fff; }
/* Was #4b5563 on #0d0f14 — 2.54:1, under the 4.5:1 AA floor. */
.brand-sub {
  font-size: var(--fs-xs);
  color: var(--gat-muted);
  margin-top: 0.35rem;
  line-height: 1.5;
}

/* ─── Card ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--gat-surface);
  border: 1px solid var(--gat-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
}
.card + .card { margin-top: 1.25rem; }
.card-title {
  font-size: var(--fs-title);
  font-weight: 700;
  color: var(--gat-text);
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
/* Was #6b7280 on #161820 — 3.66:1. */
.card-sub {
  font-size: var(--fs-md);
  color: var(--gat-muted);
  margin-bottom: 1.5rem;
  line-height: 1.55;
}
.card-body {
  font-size: var(--fs-md);
  color: var(--gat-muted);
  line-height: 1.65;
  margin-bottom: 1.5rem;
}
.card-body strong { color: var(--gat-text); }
.card-body a, .card-sub a { color: var(--gat-brand); text-decoration: none; }
.card-body a:hover, .card-sub a:hover { text-decoration: underline; }

/* Status icon above a title. The state is always also stated in the adjacent
   title, so the glyph itself is decorative and carries aria-hidden. */
.icon { font-size: 3rem; margin-bottom: 1.25rem; line-height: 1; }

/* ─── Alerts ────────────────────────────────────────────────────────────── */
/* Both .alert and .alert-error existed as the error class, on different pages.
   Both are kept so no page's markup has to change meaning. */
.alert, .alert-error, .alert-success, .alert-warning, .error-banner, .info-box {
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  font-size: var(--fs-md);
  line-height: 1.55;
  margin-bottom: 1.25rem;
  border: 1px solid transparent;
}
.alert, .alert-error, .error-banner {
  background: var(--tint-danger);
  border-color: var(--tint-danger-line);
  color: var(--gat-danger);
}
.alert-success {
  background: var(--tint-success);
  border-color: var(--tint-success-line);
  color: var(--gat-success);
}
.alert-warning {
  background: var(--tint-warning);
  border-color: var(--tint-warning-line);
  color: var(--gat-warning);
}
.alert-warning a { color: var(--gat-warning); }
.info-box {
  background: var(--tint-info);
  border-color: var(--tint-info-line);
  color: var(--gat-info);
  font-size: var(--fs-sm);
}
.info-box strong { color: #bfdbfe; }

/* ─── Form controls ─────────────────────────────────────────────────────── */
label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--gat-muted);
  margin-bottom: 0.35rem;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--gat-bg);
  border: 1px solid var(--gat-border);
  color: var(--gat-text);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--fs-input);
  padding: 0.6rem 0.85rem;
  outline: none;
  transition: border-color var(--dur-press) var(--ease-out),
              box-shadow   var(--dur-press) var(--ease-out);
  margin-bottom: 1rem;
}
textarea { line-height: 1.55; }
input:focus, select:focus, textarea:focus {
  border-color: var(--gat-brand);
  box-shadow: 0 0 0 3px rgba(240,180,41,0.12);
}
/* Deliberately below AA: a placeholder is an example, and every field here has a
   real <label>, so nothing is carried by placeholder text alone. Still a large
   improvement on the #374151 (1.86:1) it replaces. */
input::placeholder, textarea::placeholder { color: var(--gat-muted2); }
input[readonly] { color: var(--gat-muted); cursor: default; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%239aa0a6' stroke-width='2' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.25rem;
}
select:invalid { color: var(--gat-muted2); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--gat-brand); }

.hint {
  font-size: var(--fs-xs);
  color: var(--gat-muted);
  margin-top: -0.7rem;
  margin-bottom: 1rem;
  line-height: 1.5;
}
.hint a { color: var(--gat-brand); }
.hint strong { color: var(--gat-text); }
/* Two spacing patterns exist across these pages: a bare label+input pair, which
   takes its gap from the input's own margin, and an input wrapped in .field /
   .field-group / .form-group, which takes it from the wrapper. Without this the
   wrapped pattern would get both and sit 2rem apart. */
.field, .field-group, .form-group { margin-bottom: 1rem; }
.field input, .field select, .field textarea,
.field-group input, .field-group select, .field-group textarea,
.form-group input, .form-group select, .form-group textarea { margin-bottom: 0; }
.field > .hint, .field-group > .hint, .form-group > .hint {
  margin-top: 0.3rem;
  margin-bottom: 0;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary, .submit-btn {
  display: block;
  width: 100%;
  background: var(--gat-brand);
  border: none;
  color: var(--gat-brand-ink);
  font-family: inherit;
  font-weight: 700;
  font-size: var(--fs-md);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  margin-top: 0.25rem;
  transition: background-color var(--dur-press) var(--ease-out),
              transform        var(--dur-press) var(--ease-out);
}
/* Inline width when the button is a link acting as a CTA. */
.btn-primary.is-inline { display: inline-block; width: auto; padding: 0.7rem 1.75rem; }
.btn-primary:visited, .submit-btn:visited { color: var(--gat-brand-ink); }
/* Touch devices fire :hover on tap and it then sticks; gate it. */
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover, .submit-btn:hover {
    background: var(--gat-brand-dk);
    color: var(--gat-brand-ink);
  }
}
/* Instant confirmation that the press registered. */
.btn-primary:active, .submit-btn:active { transform: scale(0.97); }
.btn-primary:disabled, .btn-primary[aria-disabled="true"],
.submit-btn:disabled {
  background: var(--gat-surface-raised);
  color: var(--gat-muted2);
  cursor: not-allowed;
  transform: none;
}
.btn-primary:disabled:hover, .submit-btn:disabled:hover {
  background: var(--gat-surface-raised);
  color: var(--gat-muted2);
}
.btn-primary[aria-disabled="true"] { pointer-events: none; }

/* Buttons and links had no focus indicator at all. */
a:focus-visible, button:focus-visible, .btn-primary:focus-visible,
.submit-btn:focus-visible, input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid var(--gat-brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── Divider, links, disclaimer ───────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--gat-muted);
  font-size: var(--fs-xs);
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gat-border);
}

.register-link, .login-link, .back-link, .footer-note {
  text-align: center;
  font-size: var(--fs-md);
  color: var(--gat-muted);
  line-height: 1.55;
}
.back-link, .footer-note { margin-top: 1.25rem; }
.register-link a, .login-link a, .back-link a, .footer-note a {
  color: var(--gat-brand);
  text-decoration: none;
  font-weight: 600;
}
@media (hover: hover) and (pointer: fine) {
  .register-link a:hover, .login-link a:hover,
  .back-link a:hover, .footer-note a:hover { text-decoration: underline; }
}

/* This is the risk warning. It was #374151 at 0.68rem — 1.86:1 contrast at
   ~10.9px, which is the lowest-legibility text on the whole funnel and the one
   piece that most needs to be readable. */
.disclaimer {
  font-size: var(--fs-xs);
  color: var(--gat-muted);
  text-align: center;
  margin-top: 1.5rem;
  line-height: 1.6;
  text-wrap: pretty;
}

/* ─── Progress steps (pending) ─────────────────────────────────────────── */
.steps {
  text-align: left;
  background: var(--gat-bg);
  border: 1px solid var(--gat-border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.75rem;
}
.step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.45rem 0;
  font-size: var(--fs-sm);
  color: var(--gat-muted);
  line-height: 1.5;
}
.step + .step { border-top: 1px solid var(--gat-border-subtle); }
.step-num {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gat-surface-raised);
  border: 1px solid var(--gat-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--gat-brand);
  margin-top: 0.1rem;
}
.step-done .step-num {
  background: var(--tint-success);
  border-color: var(--tint-success-line);
  color: var(--gat-success);
}
/* Struck-through and complete: de-emphasised on purpose, so this one stays
   under AA. The step's state is also carried by the tick, not colour alone. */
.step-done .step-text { color: var(--gat-muted2); text-decoration: line-through; }

/* ─── Highlighted notes ────────────────────────────────────────────────── */
.next-step, .email-match {
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--gat-muted);
  background: var(--tint-brand);
  border: 1px solid var(--tint-brand-line);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  margin: 0 0 1.5rem;
}
.next-step a { color: var(--gat-brand); font-weight: 700; text-decoration: none; }
@media (hover: hover) and (pointer: fine) {
  .next-step a:hover { text-decoration: underline; }
}

/* ─── Entrance ──────────────────────────────────────────────────────────── */
/* One-shot on load, so keyframes are fine here — nothing can interrupt them.
   Short, and a small rise rather than a scale, so it reads as the page settling
   rather than as an effect. */
.brand  { animation: auth-in var(--dur-enter) var(--ease-out) both; }
.wrap > .card, .wrap > form { animation: auth-in var(--dur-enter) var(--ease-out) 40ms both; }
.disclaimer { animation: auth-in var(--dur-enter) var(--ease-out) 80ms both; }
@keyframes auth-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Narrow phones ────────────────────────────────────────────────────── */
@media (max-width: 400px) {
  body { padding: 0.75rem; }
  .card { padding: 1.5rem 1.25rem; }
  .brand { margin-bottom: 1.5rem; }
}
