/* ==========================================================================
   PurposeBuilt Money — Design System
   Navy / gold / signal-blue. Sober, precise, warm.
   ========================================================================== */

:root {
  /* Type scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 4.5rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-full: 999px;

  --font-display: 'Cabinet Grotesk', 'Satoshi', 'Segoe UI', sans-serif;
  --font-body: 'Satoshi', 'Inter', 'Segoe UI', sans-serif;

  --maxw: 1200px;
  --maxw-prose: 68ch;

  --shadow-sm: 0 1px 2px rgba(11, 31, 58, 0.06), 0 1px 3px rgba(11, 31, 58, 0.04);
  --shadow-md: 0 4px 12px rgba(11, 31, 58, 0.08), 0 2px 4px rgba(11, 31, 58, 0.04);
  --shadow-lg: 0 18px 48px rgba(11, 31, 58, 0.14), 0 4px 12px rgba(11, 31, 58, 0.06);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

:root,
[data-theme='light'] {
  --navy-900: #081827;
  --navy-800: #0b1f3a;
  --navy-700: #122d51;
  --navy-600: #1b3f6c;

  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-surface-2: #fbfcfd;
  --color-surface-offset: #eef1f5;
  --color-surface-deep: var(--navy-800);
  --color-border: #d9dfe8;
  --color-divider: #e6eaf0;

  --color-text: #0e1c2c;
  --color-text-muted: #5a6b80;
  --color-text-faint: #8d9cae;
  --color-text-inverse: #f4f7fb;
  --color-text-on-deep: #dde6f2;

  --color-primary: #12406f;
  --color-primary-hover: #0d3159;
  --color-primary-soft: #e7eef7;

  --color-accent: #b1801f; /* gold, AA-safe on light */
  --color-accent-bright: #d4a24a; /* brand gold for dark surfaces */
  --color-accent-soft: #fbf3e2;

  --color-signal: #2f6fb0;
  --color-signal-soft: #e8f0f9;

  --color-success: #1f6b45;
  --color-success-soft: #e4f1ea;
  --color-error: #a32a2a;
  --color-error-soft: #fbe9e9;
}

[data-theme='dark'] {
  --color-bg: #07131f;
  --color-surface: #0d1f33;
  --color-surface-2: #11263c;
  --color-surface-offset: #16304a;
  --color-surface-deep: #050e18;
  --color-border: #22415f;
  --color-divider: #1b3350;

  --color-text: #e7eef7;
  --color-text-muted: #9fb2c7;
  --color-text-faint: #728aa3;
  --color-text-inverse: #07131f;
  --color-text-on-deep: #dde6f2;

  --color-primary: #7cb2e8;
  --color-primary-hover: #a4cbf2;
  --color-primary-soft: #14304c;

  --color-accent: #e2b869;
  --color-accent-bright: #e2b869;
  --color-accent-soft: #2a2314;

  --color-signal: #6ea9e0;
  --color-signal-soft: #132b44;

  --color-success: #6cc39a;
  --color-success-soft: #102a20;
  --color-error: #e88b8b;
  --color-error-soft: #2c1414;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------- reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img,
svg,
picture {
  display: block;
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
h1 {
  font-size: var(--text-2xl);
}
h2 {
  font-size: var(--text-xl);
}
h3 {
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}
h4 {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 700;
  letter-spacing: 0;
}
p {
  text-wrap: pretty;
}
a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
:focus-visible {
  outline: 2px solid var(--color-signal);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
::selection {
  background: var(--color-accent-soft);
  color: var(--color-text);
}

/* -------------------------------------------------------------- layout --- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(var(--space-5), 4vw, var(--space-10));
}
.wrap--narrow {
  max-width: 880px;
}
section {
  padding-block: clamp(var(--space-16), 8vw, var(--space-32));
}
section.tight {
  padding-block: clamp(var(--space-12), 5vw, var(--space-20));
}
.stack > * + * {
  margin-top: var(--space-4);
}
.grid {
  display: grid;
  gap: clamp(var(--space-5), 3vw, var(--space-8));
}
.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.deep {
  background: var(--color-surface-deep);
  color: var(--color-text-on-deep);
}
.deep h1,
.deep h2,
.deep h3 {
  color: #fff;
}
.deep .eyebrow {
  color: var(--color-accent-bright);
}
.deep .lede,
.deep .muted {
  color: #b7c7da;
}

/* ------------------------------------------------------------ elements --- */
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}
.lede {
  font-size: var(--text-lg);
  line-height: 1.45;
  color: var(--color-text-muted);
  max-width: 58ch;
}
.muted {
  color: var(--color-text-muted);
}
.small {
  font-size: var(--text-sm);
}
.xs {
  font-size: var(--text-xs);
}
.prose {
  max-width: var(--maxw-prose);
}
.prose p + p,
.prose p + ul,
.prose ul + p {
  margin-top: var(--space-4);
}
.center {
  text-align: center;
}
.center .lede,
.center .eyebrow {
  margin-inline: auto;
}
.rule {
  width: 56px;
  height: 3px;
  background: var(--color-accent-bright);
  border-radius: 2px;
  margin-block: var(--space-5);
}
.center .rule {
  margin-inline: auto;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.8em 1.5em;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease),
    border-color 0.18s var(--ease), color 0.18s var(--ease);
}
[data-theme='dark'] .btn {
  color: var(--navy-900);
}
.btn:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn--gold {
  background: var(--color-accent-bright);
  color: var(--navy-900);
}
.btn--gold:hover {
  background: #e7bd6d;
  color: var(--navy-900);
}
.btn--ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}
.btn--ghost:hover {
  background: var(--color-surface-offset);
  border-color: var(--color-text-faint);
  color: var(--color-text);
  box-shadow: none;
}
.deep .btn--ghost {
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
.deep .btn--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.btn--lg {
  font-size: var(--text-base);
  padding: 0.9em 1.9em;
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}
.center .btn-row {
  justify-content: center;
}

/* cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: clamp(var(--space-5), 3vw, var(--space-8));
  box-shadow: var(--shadow-sm);
}
.card--flat {
  box-shadow: none;
  background: var(--color-surface-2);
}
.deep .card {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  color: var(--color-text-on-deep);
}

/* badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.35em 0.85em;
  border-radius: var(--radius-full);
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.badge--gold {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}
.badge--req {
  background: var(--color-error-soft);
  color: var(--color-error);
}
.badge--opt {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}
.badge--ok {
  background: var(--color-success-soft);
  color: var(--color-success);
}
.badge--never {
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

/* tables */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  min-width: 620px;
}
th,
td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--color-divider);
  vertical-align: middle;
}
thead th {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  background: var(--color-surface-offset);
  white-space: nowrap;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody th {
  font-weight: 600;
  color: var(--color-text);
}
td.yes {
  color: var(--color-success);
  font-weight: 700;
}
td.no {
  color: var(--color-text-faint);
}
.col-feature {
  background: var(--color-accent-soft);
}
[data-theme='dark'] .col-feature {
  background: rgba(226, 184, 105, 0.08);
}

/* lists */
.checklist {
  list-style: none;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}
.checklist li {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  gap: var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.5;
}
.checklist li::before {
  content: '✓';
  font-weight: 700;
  color: var(--color-success);
}
.checklist--never li::before {
  content: '✕';
  color: var(--color-error);
}
.checklist--opt li::before {
  content: '○';
  color: var(--color-text-faint);
}

/* --------------------------------------------------------------- header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--color-divider);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
  flex-shrink: 0;
}
.brand svg {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}
.brand__name {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
}
.brand__name em {
  font-style: normal;
  color: var(--color-signal);
}
.nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}
.nav a {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 0.5em 0.75em;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.nav a:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}
.nav a[aria-current='page'] {
  color: var(--color-text);
  font-weight: 700;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.icon-btn:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.nav-toggle {
  display: none;
}
@media (max-width: 960px) {
  .nav {
    position: fixed;
    inset: 68px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-3) clamp(var(--space-5), 4vw, var(--space-10)) var(--space-5);
    box-shadow: var(--shadow-lg);
    transform: translateY(-120%);
    transition: transform 0.3s var(--ease);
  }
  .nav.open {
    transform: translateY(0);
  }
  .nav a {
    padding: var(--space-3) var(--space-2);
    border-bottom: 1px solid var(--color-divider);
    font-size: var(--text-base);
  }
  .nav .btn {
    margin-top: var(--space-4);
  }
  .nav-toggle {
    display: grid;
  }
}

/* --------------------------------------------------------------- footer --- */
.site-footer {
  background: var(--color-surface-deep);
  color: #aebfd3;
  padding-block: var(--space-16) var(--space-8);
  font-size: var(--text-sm);
}
.site-footer h4 {
  color: #fff;
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
  color: var(--color-accent-bright);
}
.site-footer a {
  color: #cfdcea;
  text-decoration: none;
  display: block;
  padding-block: var(--space-1);
}
.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
}
.footer-grid {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1.6fr repeat(3, 1fr);
}
@media (max-width: 800px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
  .footer-grid > :first-child {
    grid-column: 1 / -1;
  }
}
.footer-bottom {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  justify-content: space-between;
  font-size: var(--text-xs);
  color: #8ea3bb;
}
.disclaimer {
  font-size: var(--text-xs);
  line-height: 1.6;
  color: #8ea3bb;
  max-width: 70ch;
}

/* --------------------------------------------------------------- motion --- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  html {
    scroll-behavior: auto;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-accent-bright);
  color: var(--navy-900);
  padding: var(--space-3) var(--space-5);
  z-index: 100;
  font-weight: 700;
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus {
  left: 0;
}
@media print {
  .site-header,
  .site-footer,
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
  }
}

/* browser default fieldset min-width:min-content lets wide scrollable tables
   stretch the page on small screens */
fieldset {
  min-width: 0;
}
