/*
 * Design system foundation for SRB-Investing.
 *
 * All stylesheets in this directory are linked separately (alphabetically),
 * so this file — "application.css" — loads first and defines the shared
 * tokens, base typography and components. The per-area files (header,
 * navigation, footer, auth, pp_opo, ppdg_3r, profiles) build on top of it.
 *
 * Visual language: Manrope + IBM Plex Mono, indigo (#3D50E0) accent on an
 * off-white canvas with soft, rounded, lightly-bordered surfaces.
 */

/* ===== Design tokens ===================================================== */
:root {
  color-scheme: light only;

  --brand: #3D50E0;
  --brand-hover: #3242c9;
  --brand-soft: #EDEFFD;        /* light indigo tint (badges, callout bg) */
  --brand-border: #D6DBF7;

  /* Logo palette — tricolor bar-chart + rising-arrow mark (direction 4c) */
  --logo-red: #C6363C;
  --logo-blue: #2F6FD0;         /* wordmark "guide" accent */
  --logo-navy: #14263F;

  --ink: #0E1424;               /* near-black text / dark panels */
  --text: #0E1424;
  --text-2: #2B3242;            /* body copy */
  --muted: #59617A;             /* secondary text */
  --muted-2: #8890A2;           /* tertiary / labels */

  --bg: #F6F7F9;                /* page canvas */
  --surface: #ffffff;
  --surface-2: #FBFBFC;         /* zebra / subtle fills */
  --fill: #F0F2F6;              /* code / chip backgrounds */

  --border: #E6E9F0;
  --border-strong: #DDE1EA;
  --border-dashed: #C9D0DE;

  --success: #22A06B;
  --success-bg: #E4F5EC;
  --success-border: #C6E9D6;

  --warn: #D1A400;
  --warn-bg: #FBF6E9;
  --warn-border: #F0E4C2;
  --warn-text: #6B5A2A;

  --danger: #C43D34;
  --danger-bg: #FDECEA;
  --danger-border: #F5C6C2;

  --purple: #8250DF;
  --purple-bg: #F3EDFC;
  --purple-border: #E3D5F7;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 3px rgba(14, 20, 36, 0.05);
  --shadow-md: 0 10px 30px -18px rgba(14, 20, 36, 0.35);
  --shadow-lg: 0 30px 60px -34px rgba(14, 20, 36, 0.35);

  --nav-h: 65px;
  --page-max: 1200px;
}

/* ===== Reset / base ===================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.16s ease;
}

a:hover {
  color: var(--brand-hover);
}

img {
  max-width: 100%;
}

/* Saturated enough to stay visible on brand-soft surfaces (e.g. .wizard__note),
   whose background would otherwise match a plain brand-soft highlight. */
::selection {
  background: rgba(61, 80, 224, 0.18);
}

/* ===== Layout shell ===================================================== */

/* Docs pages: sidebar + article, centered within the page width. */
.content-container {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

/* Full-bleed pages (home) drive their own sections. */
.page-home {
  flex: 1 0 auto;
  width: 100%;
}

/* Auth pages: a single centered card. */
.page-auth {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px) 24px 80px;
}

/* Main content card (docs/service pages). */
.main-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(26px, 4vw, 46px);
  margin: 32px 0 56px;
  min-width: 0;
}

/* Same white card frame as .main-content, but WITHOUT the article typography
   below — used by the app pages (profiles, subscriptions), which bring their own
   components (cards, buttons, lists) and would otherwise collide with the article
   `a`/`ul`/`li`/`h1` rules. */
.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: clamp(26px, 4vw, 46px);
  margin: 32px 0 56px;
  min-width: 0;
}

/* ===== Page header primitives ========================================= */
/* Canonical page heading — ONE definition, shared by the app pages (.page-title)
   and the docs/generator articles (.main-content h1), so every H1 is identical. */
.page-title,
.main-content h1 {
  font-size: clamp(28px, 4.4vw, 40px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* Header row: title (+ optional lead) on the left, optional actions on the right. */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-header__text {
  min-width: 0;
}

.page-header > .btn {
  flex-shrink: 0;
}

.page-lead {
  margin-top: 8px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.page-lead code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--fill);
  color: var(--text);
  padding: 0.1em 0.4em;
  border-radius: 5px;
  white-space: nowrap;
}

.page-lead b {
  color: var(--ink);
  font-weight: 700;
}

/* ===== Form fields ==================================================== */
/* One field primitive shared by every form (profile, PP-OPO, PPDG-3R), so labels
   and controls can't drift apart between pages. */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

.field__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.field__label .req {
  color: var(--danger);
}

.field__hint {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted-2);
}

.field input[type="text"],
.field input[type="email"],
.field select {
  width: 100%;
  height: 46px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input::placeholder {
  color: var(--muted-2);
}

.field input.mono-input {
  font-family: var(--mono);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(61, 80, 224, 0.14);
}

/* Error state — set by the wizard when a required field is missing on submit, and
   cleared as soon as the user edits the field. (The drop-zone uses .drop-zone.invalid.) */
.field input.is-invalid,
.field select.is-invalid {
  border-color: var(--danger);
}

.field input.is-invalid:focus,
.field select.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(196, 61, 52, 0.16);
}

@media (max-width: 620px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Article typography ============================================== */
.main-content h1 {
  margin-bottom: 22px;
}

.main-content h2 {
  font-size: clamp(21px, 2.6vw, 25px);
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 36px 0 16px;
}

.main-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 26px 0 12px;
}

.main-content p {
  font-size: 16.5px;
  line-height: 1.72;
  color: var(--text-2);
  margin-bottom: 16px;
}

.main-content ul,
.main-content ol {
  margin: 0 0 16px;
  padding-left: 1.5em;
}

.main-content li {
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--text-2);
  margin-bottom: 8px;
}

.main-content li::marker {
  color: var(--muted-2);
}

.main-content a {
  color: var(--brand);
  font-weight: 600;
}

.main-content a:hover {
  text-decoration: underline;
}

.main-content strong {
  font-weight: 700;
  color: var(--ink);
}

/* Inline code / mono tokens (form names, portal terms). */
.main-content code,
.mono {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--fill);
  color: var(--text);
  padding: 0.12em 0.45em;
  border-radius: 5px;
  white-space: nowrap;
}

/* ===== Callouts ======================================================== */
/* Rendered from <blockquote class="callout callout-*">. Kept class-compatible
 * with the existing views: a tinted card with a coloured left rail. */
.main-content blockquote.callout {
  position: relative;
  margin: 22px 0;
  padding: 16px 20px 16px 22px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted-2);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.main-content blockquote.callout > *:last-child {
  margin-bottom: 0;
}

.main-content blockquote.callout p,
.main-content blockquote.callout li {
  font-size: 15.5px;
  color: var(--text-2);
}

.main-content blockquote.callout-tip {
  background: var(--success-bg);
  border-color: var(--success-border);
  border-left-color: var(--success);
}

.main-content blockquote.callout-note {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  border-left-color: var(--brand);
}

.main-content blockquote.callout-important {
  background: var(--purple-bg);
  border-color: var(--purple-border);
  border-left-color: var(--purple);
}

.main-content blockquote.callout-warning {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  border-left-color: var(--warn);
}

.main-content blockquote.callout-warning p,
.main-content blockquote.callout-warning li {
  color: var(--warn-text);
}

/* ===== Buttons (shared) ================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
  padding: 13px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.16s ease, background-color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.btn--primary {
  background: var(--brand);
  color: #fff;
}

.btn--primary:hover {
  filter: brightness(1.07);
  color: #fff;
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn--secondary:hover {
  border-color: var(--border-dashed);
  color: var(--ink);
}

.btn--dark {
  background: var(--ink);
  color: #fff;
}

.btn--dark:hover {
  filter: brightness(1.15);
  color: #fff;
}

/* Full-width modifier (e.g. plan CTAs, mobile actions). */
.btn--block {
  width: 100%;
}

/* ===== Chips / pills =================================================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
}

.chip--mono {
  font-family: var(--mono);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
}

/* Flash messages are surfaced as toasts via the notification system
 * (notifications.css + app/javascript/notify.js), driven by #flash-data in the
 * layout — so there are no inline flash styles here anymore. */

/* Subscription pricing page lives in subscription.css. */

/* ===== Sign-in nudge (guests on generator pages) ====================== */
.signin-nudge {
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
}

.signin-nudge__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.signin-nudge__text p {
  font-size: 15.5px;
  color: var(--text-2);
  margin: 0;
}

.signin-nudge .auth-link {
  font-weight: 700;
  color: var(--brand);
}

.signin-nudge .auth-link:hover {
  text-decoration: underline;
}

/* ===== Home page ======================================================= */
.home-section {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero ------------------------------------------------------------------ */
.home-hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 52px;
  align-items: center;
  padding: clamp(40px, 6vw, 74px) 24px 60px;
}

.home-hero__eyebrow {
  margin-bottom: 22px;
}

.home-hero__title {
  font-size: clamp(34px, 5.4vw, 54px);
  line-height: 1.07;
  letter-spacing: -0.022em;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 20px;
}

.home-hero__lead {
  font-size: clamp(16px, 2vw, 18px);
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 30px;
  max-width: 520px;
}

.home-hero__lead b {
  color: var(--ink);
  font-weight: 700;
}

.home-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 26px;
}

.home-hero__actions .btn {
  font-size: 16px;
  padding: 15px 26px;
}

.home-hero__features {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 26px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted-2);
}

.home-hero__visual {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.home-hero__visual-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #EDEFF3;
}

.home-hero__visual-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.home-hero__visual-body {
  padding: 22px;
}

.home-hero__visual-body img {
  display: block;
  width: 100%;
  height: auto;
}

/* Stats band (full-bleed dark) ----------------------------------------- */
.home-stats {
  background: var(--ink);
  color: #fff;
  margin-top: 14px;
}

.home-stats__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.home-stat {
  padding: 30px 32px;
}

.home-stat + .home-stat {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.home-stat__value {
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.home-stat__label {
  font-size: 14px;
  line-height: 1.5;
  color: #A6ACBE;
  margin-top: 4px;
}

/* Section headings ------------------------------------------------------ */
.home-block {
  padding-top: 66px;
}

.home-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 12px;
}

.home-h2 {
  font-size: clamp(26px, 3.6vw, 34px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 28px;
}

/* Service cards --------------------------------------------------------- */
.home-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.home-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  color: inherit;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.home-card:hover {
  color: inherit;
  border-color: #C7CDF6;
  transform: translateY(-3px);
  box-shadow: 0 24px 44px -30px rgba(14, 20, 36, 0.4);
}

.home-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.home-card__title {
  font-weight: 800;
  font-size: 20px;
  color: var(--ink);
}

.home-card__text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 18px;
}

.home-card__cta {
  color: var(--brand);
  font-weight: 600;
  font-size: 15px;
}

/* Knowledge base -------------------------------------------------------- */
.home-kb {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.home-kb__group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
}

.home-kb__title {
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 14px;
}

.home-kb__links {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.home-kb__links a {
  font-size: 15px;
  color: var(--muted);
  font-weight: 500;
}

.home-kb__links a:hover {
  color: var(--brand);
  text-decoration: none;
}

/* Community CTA --------------------------------------------------------- */
.home-cta {
  margin-top: 56px;
}

.home-cta__inner {
  background: var(--brand-soft);
  border-radius: var(--radius-xl);
  padding: 40px 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.home-cta__title {
  font-size: clamp(22px, 2.8vw, 26px);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 8px;
}

.home-cta__text {
  font-size: 16px;
  color: var(--muted);
  max-width: 520px;
}

.home-cta__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.home-tail {
  height: 40px;
}

/* Responsive ------------------------------------------------------------ */
@media (max-width: 860px) {
  .content-container {
    grid-template-columns: 1fr;
    gap: 0;
  }

  /* Content-first on mobile: the article/card comes before the left menu, so the
     page content is reachable without scrolling past the whole nav. */
  .main-content,
  .content-card {
    order: 1;
    margin-top: 20px;
  }

  .nav-column {
    order: 2;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .home-stats__inner {
    grid-template-columns: 1fr;
  }

  .home-stat + .home-stat {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .home-cards,
  .home-kb {
    grid-template-columns: 1fr;
  }
}
