/* Styles for the DOM-mounted contract modules on the React pages
   (/dashboard, /profile): auth wall, gating paywall card, header
   account buttons. Replaces the legacy styles.css on those pages —
   styles.css carries an unlayered `* { margin:0; padding:0 }` reset
   that, per CSS cascade-layer rules, overrides every Tailwind v4
   utility (they live in @layer). Class names here are the contract;
   the look matches the v3 briefing design system.

   auth-modal.css and checkout-toast.css still load separately. */

:root {
  /* Legacy variable aliases consumed by auth-modal.css / toast css. */
  --bg-primary: #08080d;
  --bg-secondary: #0e0e15;
  --bg-card: #11111a;
  --border: #232333;
  --border-accent: #2b2b3b;
  --text-primary: #f4f4f6;
  --text-secondary: #a8a8ba;
  --text-muted: #8a8aa3;
  --accent-amber: #e8a817;
  --accent-amber-glow: rgba(232, 168, 23, 0.12);
  --accent-green: #34d399;
  --accent-red: #e5484d;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
}

/* ── Boot skeleton ───────────────────────────────────────────────────
   Lives inside #root in dashboard.html / profile.html and shows the
   moment the HTML parses — before the React bundle downloads + mounts.
   createRoot().render() replaces it on mount, by which point React paints
   its OWN sx-veil skeletons, so the page goes shimmer → shimmer → settle
   instead of blank → pop. Uses sx-veil (from the index.css bundle, also
   render-blocking in <head>) for the shimmer; reduced-motion is handled by
   the same catch-all. Tier gating mirrors the app: anon sees the wall card,
   signed-in sees the content panels. */
.sx-boot { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
@media (min-width: 768px) { .sx-boot { padding: 0 40px; } }
.sx-boot-bar {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding-top: 14px;
}
.sx-boot-logo { width: 132px; height: 30px; border-radius: 6px; background: var(--bg-card); }
.sx-boot-status { width: 200px; height: 12px; border-radius: 4px; }
.sx-boot-main { padding: 56px 0; }
.sx-boot-panel { display: block; border-radius: 14px; }
.sx-boot-panel + .sx-boot-panel { margin-top: 20px; }
.sx-boot-wall { display: flex; justify-content: center; padding: 72px 20px; }
.sx-boot-wall-card { width: 420px; max-width: 100%; height: 360px; border-radius: 14px; }
body.is-anonymous .sx-boot-main { display: none; }
body:not(.is-anonymous) .sx-boot-wall { display: none; }

/* Landing variant (no auth wall) — two-column hero: statement lines + the
   live-readout terminal panel. */
.sx-boot-hero { padding: 64px 0; display: grid; gap: 48px; align-items: center; }
@media (min-width: 1024px) { .sx-boot-hero { grid-template-columns: 1.05fr 1fr; } }

/* ── Auth wall ───────────────────────────────────────────────────── */
.dashboard-auth-wall {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}
.auth-wall-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 40%), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px 36px;
  text-align: center;
}
.auth-wall-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: var(--accent-amber);
  margin-bottom: 14px;
}
.auth-wall-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.auth-wall-sub {
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.auth-wall-sub strong { color: var(--text-primary); font-weight: 500; }
.auth-google-btn {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border-accent);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.auth-google-btn:hover { border-color: var(--accent-amber); }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-forgot {
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  cursor: pointer;
  min-height: 44px;
}
.auth-forgot:hover { color: var(--text-secondary); }
.auth-wall-foot {
  margin-top: 20px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  color: var(--text-muted);
}
.auth-wall-foot a { color: var(--accent-amber); text-decoration: none; }

/* ── Gating paywall card (inserted by gating.js) ─────────────────── */
/* The card is injected (free tier) between the hidden .metrics-row anchor and
   the visible metrics panel, so it needs its OWN bottom gap — without it the
   card abutted the metrics panel directly below. 24px matches the metrics→
   signals rhythm (Reveal mt-6) so the teaser zone reads evenly spaced. */
.paywall-section { margin-top: 24px; margin-bottom: 24px; }

/* Reveal when the card is first shown (gating.js adds .fade-up, removes it
   on animationend). Animates max-height + margin so the content below
   slides down instead of the card hard-popping in (it can't reserve space
   — the tier resolves after auth). max-height is a generous ceiling the
   real card never reaches, so the slide tracks the card's true height and
   nothing clips; opacity + a slight rise carry the entrance. Same easing as
   the React reveals. Neutralized by index.css's reduced-motion catch-all. */
@keyframes sx-paywall-reveal {
  from { opacity: 0; max-height: 0;     margin-top: 0;    transform: translateY(-4px); }
  to   { opacity: 1; max-height: 800px; margin-top: 24px; transform: translateY(0); }
}
.paywall-section.fade-up {
  overflow: hidden;
  animation: sx-paywall-reveal 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.paywall-card {
  background: linear-gradient(180deg, rgba(232, 168, 23, 0.04), transparent 45%), var(--bg-card);
  border: 1px solid rgba(232, 168, 23, 0.25);
  border-radius: 14px;
  padding: 36px 40px;
}
.paywall-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.22em;
  color: var(--accent-amber);
  margin-bottom: 12px;
}
.paywall-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.12;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.paywall-sub {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}
.paywall-bullets {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.paywall-bullets li {
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--text-secondary);
  padding-left: 22px;
  position: relative;
}
.paywall-bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 12px;
  height: 1px;
  background: var(--accent-amber);
}
.paywall-cta {
  min-height: 44px;
  padding: 0 26px;
  border: none;
  border-radius: 8px;
  background: var(--accent-amber);
  color: #0a0a10;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.2s ease;
}
.paywall-cta:hover { filter: brightness(1.1); }
.paywall-fineprint {
  margin-top: 14px;
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* ── Header account buttons (account-button.js) ──────────────────── */
.account-btn {
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.account-btn-primary {
  background: var(--accent-amber);
  border: 1px solid var(--accent-amber);
  color: #0a0a10;
  font-weight: 600;
}
.account-btn-primary:hover { filter: brightness(1.1); }
.account-btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.account-btn-ghost:hover { border-color: var(--border-accent); color: var(--text-secondary); }
.account-trial-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 5px;
  color: var(--accent-amber);
  background: rgba(232, 168, 23, 0.08);
  border: 1px solid rgba(232, 168, 23, 0.25);
  white-space: nowrap;
}
.account-trial-chip.urgent {
  color: var(--accent-red);
  background: rgba(229, 72, 77, 0.08);
  border-color: rgba(229, 72, 77, 0.3);
}

/* Landing "Sign out" — injected by landing-checkout.js next to the
   header CTA for signed-in visitors. The real .header-cta is Tailwind-
   styled inline; this injected button only has legacy class names, so
   it needs its own rule (a ghost variant of the amber CTA). */
.header-signout-landing {
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 7px;
  border: 1px solid var(--border-accent);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.header-signout-landing:hover {
  color: var(--text-secondary);
  border-color: var(--text-muted);
}

/* Spinner used by withButtonLoading (subscription.js) */
.checkout-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid rgba(10, 10, 16, 0.3);
  border-top-color: rgba(10, 10, 16, 0.9);
  border-radius: 50%;
  animation: checkout-spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes checkout-spin { to { transform: rotate(360deg); } }

/* Visible keyboard focus for the JS-mounted contract buttons (the React
   app sets this globally; these elements are created outside React). */
.account-btn:focus-visible,
.auth-google-btn:focus-visible,
.auth-forgot:focus-visible,
.paywall-cta:focus-visible,
.header-signout-landing:focus-visible {
  outline: 2px solid var(--accent-amber);
  outline-offset: 2px;
}

/* ── Cookie consent banner (consent.js) ──────────────────────────── */
.sx-consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  transform: translateY(110%);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  background: var(--bg-card);
  border-top: 1px solid var(--border-accent);
  box-shadow: 0 -14px 44px rgba(0, 0, 0, 0.45);
}
.sx-consent-open { transform: translateY(0); }
.sx-consent-inner {
  max-width: 1180px; margin: 0 auto; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
}
.sx-consent-text {
  margin: 0; max-width: 740px;
  font-family: var(--font-sans); font-size: 13px; line-height: 1.55;
  color: var(--text-secondary);
}
.sx-consent-text a { color: var(--accent-amber); text-decoration: none; }
.sx-consent-text a:hover { text-decoration: underline; }
.sx-consent-actions { display: flex; gap: 10px; flex-shrink: 0; }
.sx-consent-btn {
  min-height: 40px; padding: 0 20px; border-radius: 8px; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  transition: filter 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.sx-consent-accept { background: var(--accent-amber); border: 1px solid var(--accent-amber); color: #0a0a10; }
.sx-consent-accept:hover { filter: brightness(1.1); }
.sx-consent-decline { background: transparent; border: 1px solid var(--border-accent); color: var(--text-secondary); }
.sx-consent-decline:hover { border-color: var(--text-muted); color: var(--text-primary); }
.sx-consent-btn:focus-visible { outline: 2px solid var(--accent-amber); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sx-consent { transition: none; } }

/* ── Plan-selection modal (js/plan-modal.js) ──────────────────────────────
   The billing-period picker every Subscribe/Upgrade CTA routes through. */
.plan-modal { position: fixed; inset: 0; z-index: 2100; display: none;
  align-items: center; justify-content: center; }
.plan-modal.plan-modal-open { display: flex; }
.plan-modal-backdrop { position: absolute; inset: 0;
  background: rgba(6, 6, 11, 0.82); backdrop-filter: blur(4px);
  animation: pm-fade 0.24s ease both; }
.plan-modal-card {
  position: relative; z-index: 1;
  width: min(452px, calc(100vw - 28px));
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(232,168,23,0.06), transparent 60%),
    var(--bg-card);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 30px 28px 22px;
  box-shadow: 0 24px 70px -18px rgba(0,0,0,0.72);
  color: var(--text-primary); font-family: var(--font-sans);
  animation: pm-rise 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.plan-modal-close { position: absolute; top: 12px; right: 15px;
  background: transparent; border: none; color: var(--text-muted);
  font-size: 24px; line-height: 1; cursor: pointer; transition: color 0.15s ease; }
.plan-modal-close:hover { color: var(--text-primary); }
.plan-modal-eyebrow { font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-amber); }
.plan-modal-title { margin: 8px 0 6px; font-size: 23px; font-weight: 600; letter-spacing: -0.01em; }
.plan-modal-sub { margin: 0 0 20px; font-size: 13px; color: var(--text-secondary); }

.plan-options { display: flex; flex-direction: column; gap: 11px; }
.plan-option { position: relative; display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left; cursor: pointer;
  padding: 15px 17px; border-radius: 11px;
  background: var(--bg-secondary); border: 1px solid rgba(255,255,255,0.09);
  color: var(--text-primary); font-family: var(--font-sans);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease; }
.plan-option:hover { border-color: rgba(255,255,255,0.20); }
.plan-option:active { transform: scale(0.992); }
.plan-option.is-selected {
  border-color: var(--accent-amber);
  background: linear-gradient(0deg, var(--accent-amber-glow), transparent), var(--bg-secondary);
  box-shadow: 0 0 0 1px var(--accent-amber), 0 8px 26px -14px var(--accent-amber); }
.plan-option:focus-visible { outline: 2px solid var(--accent-amber); outline-offset: 2px; }

.plan-radio { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.28); position: relative; transition: border-color 0.18s ease; }
.plan-option.is-selected .plan-radio { border-color: var(--accent-amber); }
.plan-option.is-selected .plan-radio::after { content: ""; position: absolute; inset: 3px;
  border-radius: 50%; background: var(--accent-amber); }

.plan-option-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plan-option-name { font-size: 15px; font-weight: 600; }
.plan-option-note { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }
.plan-option-price { margin-left: auto; font-family: var(--font-mono);
  font-size: 20px; font-weight: 700; white-space: nowrap; }
.plan-option-per { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-left: 1px; }

.plan-badge { position: absolute; top: -8px; right: 14px;
  font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: #0a0a10; background: var(--accent-amber);
  padding: 3px 7px; border-radius: 5px; }

.plan-modal-cta { margin-top: 20px; width: 100%; padding: 13px 16px;
  background: var(--accent-amber); color: #0a0a10; border: none; border-radius: 9px;
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: filter 0.15s ease, transform 0.12s ease; }
.plan-modal-cta:hover { filter: brightness(1.08); }
.plan-modal-cta:active { transform: scale(0.99); }
.plan-modal-cta:focus-visible { outline: 2px solid var(--accent-amber); outline-offset: 3px; }

.plan-modal-fine { display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 13px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-muted); }
.plan-modal-fine svg { opacity: 0.7; }

@keyframes pm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pm-rise { from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .plan-modal-backdrop, .plan-modal-card { animation: none; }
  .plan-option, .plan-modal-cta, .plan-modal-close { transition: none; }
}
