/* ============================================================
   SMARTVIDEO BRAND LAYER — shared by the auth / checkout-flow pages
   (login, success, recurly_failed, oauth_authorize, password, cancel).

   Extracted from checkout.css (SWA-779). Theming is CSS-only via
   prefers-color-scheme, mirroring the marketing site and checkout.
   No Bootstrap: pages link ONLY this file.

   NOTE: this duplicates checkout.css's brand layer on purpose — unifying
   the two is a deferred follow-up (checkout.css is touched by open PRs).
   Keep token values + control styling in sync with checkout.css by hand
   until that unification lands.  (SWA-788)
   ============================================================ */

/* ---- VENDORED BRAND FONTS (served locally — never block render) ---- */
@font-face { font-family: 'Space Grotesk Variable'; font-style: normal; font-display: swap; font-weight: 300 700; src: url(/fonts/space-grotesk-var.woff2) format('woff2-variations'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/dm-mono-400.woff2) format('woff2'); }
@font-face { font-family: 'DM Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/dm-mono-500.woff2) format('woff2'); }

/* ============================================================
   TOKENS (light)
   ============================================================ */
:root {
  /* GOLD */
  --gold: #e6c800;
  --gold-top: #ffe872;
  --gold-dark: #c9a000;
  --gold-edge: #a67c00;
  --gold-text: #856a00;
  --accent-light: #fee265;

  /* LIGHT THEME */
  --bg: #faf8f4;
  --tan: #f5f0e8;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --heading: #1c1917;
  --text: #6e6862;
  --muted: #8c8780;

  --featured-bg: #fffcf7;

  /* SECONDARY (stone) BUTTON */
  --stone-top: #ffffff;
  --stone-bottom: #f1efec;
  --stone-edge: #d6d3d1;
  --stone-text: #1c1917;

  /* SEMANTIC */
  --success: #16a34a;
  --success-bright: #22c55e;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --error-text: #991b1b;

  /* RADII / FOCUS / MOTION */
  --radius-card: 20px;
  --radius-input: 10px;
  --focus-ring: 0 0 0 3px rgba(230, 200, 0, 0.3);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ATMOSPHERE */
  --blob-opacity: 0.55;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { transition: background 0.3s ease, color 0.3s ease; }

body {
  margin: 0;
  padding: 0;
  font-family: 'Space Grotesk Variable', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ---- TYPE SCALE ---- */
h1, h2, h3 { color: var(--heading); margin: 0; line-height: 1.15; }
h1 { font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }

a { color: var(--gold-text); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   PAGE SHELL — centered card on the brand background, with a gold
   blob cluster for atmosphere (the split-panel checkout supplies its
   own; the simple flow pages use this).
   ============================================================ */
.page {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 48px 24px;   /* breathing room lives INSIDE the full-bleed page, not as a body gutter */
  overflow: hidden;
}
.page-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* gold blob cluster (decorative, behind content) */
.blobs { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: var(--blob-opacity); }
.blob.b1 { width: 320px; height: 320px; top: -80px; right: -60px;
  background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%); }
.blob.b2 { width: 280px; height: 280px; bottom: -100px; left: -80px;
  background: radial-gradient(circle, var(--gold-top) 0%, transparent 70%); opacity: calc(var(--blob-opacity) * 0.7); }

/* ---- WORDMARK (light/dark SVG swap, same markup as checkout) ---- */
.brand-head { display: inline-flex; justify-content: center; }
.wordmark { display: inline-flex; align-items: center; }
.wordmark img { height: 30px; width: auto; display: block; }
.wordmark .wm-dark { display: none; }

/* ---- CARD ---- */
.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: 0 16px 48px rgba(28, 25, 23, 0.08);
  padding: 36px 34px;
}
.card.wide { max-width: 720px; }
.card-head { margin-bottom: 24px; }
.card-head h1, .card-head h2 { margin-bottom: 6px; }
.card-head p { color: var(--text); font-size: 0.92rem; }

/* ============================================================
   FORM CONTROLS
   ============================================================ */
form { margin: 0; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field + .field { margin-top: 18px; }
.field label,
.control-group > label,
.control-label {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 500;
}
.field input,
.control-group input,
input[type="text"],
input[type="email"],
input[type="password"] {
  font-family: 'Space Grotesk Variable', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  color: var(--heading);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 13px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
  width: 100%;
}
input::placeholder { color: var(--muted); opacity: 0.7; }
.field input:focus,
.control-group input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--focus-ring);
  background: var(--surface);
}

/* legacy per-field error hook (display-form-errors adds .error to
   .control-group and writes the message into a sibling span) */
.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-group.error input { border-color: var(--error); box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18); }
.control-group .error,
.control-group span:not(:empty) { color: var(--error-text); font-size: 0.8rem; }

.form-divider { height: 1px; background: var(--border); margin: 24px 0; }
.submit-wrap { margin-top: 26px; }
.form-foot { margin-top: 20px; font-size: 0.82rem; color: var(--muted); text-align: center; }
.form-foot a { font-weight: 600; }
.muted-note { color: var(--muted); font-size: 0.9rem; }

/* ============================================================
   TACTILE 3D BUTTON
   ============================================================ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: 'Space Grotesk Variable', system-ui, -apple-system, sans-serif;
  font-weight: 600;
  border-radius: 50px;
  color: #1c1917;
  background: linear-gradient(180deg, var(--gold-top) 0%, var(--gold) 100%);
  box-shadow: 0 4px 0 0 var(--gold-edge), 0 8px 24px rgba(230, 200, 0, 0.35);
  transition: transform 0.25s var(--spring), box-shadow 0.25s var(--spring);
  overflow: hidden;
  text-decoration: none;
}
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-18deg);
  transition: left 0.6s ease;
  pointer-events: none;
}
.btn:hover { transform: translateY(-3px); box-shadow: 0 7px 0 0 var(--gold-edge), 0 14px 32px rgba(230, 200, 0, 0.5); text-decoration: none; }
.btn:hover::after { left: 130%; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 0 var(--gold-edge), 0 4px 12px rgba(230, 200, 0, 0.3); }
.btn.md { padding: 15px 32px; font-size: 0.95rem; }
.btn.lg { padding: 18px 44px; font-size: 1.05rem; }
.btn.full { width: 100%; }

/* SECONDARY / stone */
.btn.secondary {
  background: linear-gradient(180deg, var(--stone-top) 0%, var(--stone-bottom) 100%);
  color: var(--stone-text);
  border: 1px solid var(--border-strong);
  box-shadow: 0 3px 0 0 var(--stone-edge), 0 6px 16px rgba(0,0,0,0.08);
}
.btn.secondary::after { background: linear-gradient(100deg, transparent, rgba(255,255,255,0.3), transparent); }
.btn.secondary:hover { transform: translateY(-2px); box-shadow: 0 5px 0 0 var(--stone-edge), 0 10px 22px rgba(0,0,0,0.12); }
.btn.secondary:active { transform: translateY(2px); box-shadow: 0 1px 0 0 var(--stone-edge), 0 3px 8px rgba(0,0,0,0.1); }

/* ============================================================
   ALERT / ERROR BOX
   Server writes the message into `.alert span`; Enlive removes the
   whole `.alert` div when there is no error, so no empty-state CSS
   is required, but we hide an empty alert defensively anyway.
   ============================================================ */
.alert {
  position: relative;
  border-radius: var(--radius-input);
  padding: 14px 44px 14px 18px;
  margin: 0 0 22px;          /* fills its container (the .card); no auto-centering cap */
  font-size: 0.9rem;
  line-height: 1.45;
}
.alert:has(span:empty) { display: none; }
/* semantic modifier carries the colour, matching checkout.css (.alert stays neutral) */
.alert-danger {
  color: var(--error-text);
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.35);
}
.alert .close,
.alert .btn-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  font-size: 18px;
  line-height: 22px;
}
.alert .close:hover,
.alert .btn-close:hover { opacity: 1; }

.text-danger,
.text-error { color: var(--error-text) !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 540px) {
  .card { padding: 28px 22px; }
  .field-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   DARK THEME — follows the visitor's OS preference (no JS, no cookie),
   mirroring checkout.css. Kept last on purpose (source-order override).
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --gold: #e6c800;
    --gold-dark: #c9a000;

    --bg: #0f0e0d;
    --surface: #141211;
    --surface-2: #1c1917;
    --border: #2a2623;
    --border-strong: #3a3633;
    --heading: #e8e3db;
    --text: #9c9590;
    --muted: #857e78;
    --tan: #17150f;

    --featured-bg: #1c1917;
    --gold-text: #ffe872; /* gold reads bright on dark */

    --stone-top: #232020;
    --stone-bottom: #1a1817;
    --stone-edge: #0c0b0a;
    --stone-text: #e8e3db;
    --error-bg: #2a1416;
    --error-border: #5b2326;
    --error-text: #fca5a5;

    --blob-opacity: 0.4;
    color-scheme: dark;
  }

  a { color: var(--accent-light); }
  .wordmark .wm-light { display: none; }
  .wordmark .wm-dark { display: block; }
  .card { box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
  .alert-danger { background: rgba(220, 38, 38, 0.12); border-color: rgba(220, 38, 38, 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::after, *::before { animation: none !important; transition: none !important; }
}
