/* ========================================================================
   Daniel Stinson CPA PLLC — Stealth Wealth / Viridian
   ========================================================================
   Palette, type, components — shared across all pages.
   ======================================================================== */

:root {
  /* Palette — Viridian Stealth */
  --ink: #0e1814;
  --forest: #1c3329;     /* primary surface for inverse sections */
  --viridian: #2a5247;
  --sage: #6b8579;
  --ivory: #f1ece0;      /* default page bg */
  --cream: #e6dfcd;      /* alt sections */
  --bone: #c9bfa6;       /* hairlines on light bg */
  --gold: #8c6d3f;       /* patina accent */
  --gold-soft: #b59766;
  --gold-ink: #7a5c31; /* gold darkened for TEXT on light surfaces (≥4.5:1 on ivory/cream) */

  /* Semantic status roles (shared with portal) */
  --danger: #9b3b2f;        /* error text, invalid borders */
  --danger-bg: #f6e6e1;     /* error banner background */
  --danger-fg: #6e2a20;     /* error banner text */
  --chip-red: #9a3b2a;      /* status chip red accent */
  --success: #2f6b50;       /* success text / green chip */
  --amber-fg: #6e4a16;      /* ops-banner text */
  --amber-bg: #fbf2dd;      /* ops-banner background */

  /* Type */
  --display: "Newsreader", "GT Sectra", "Spectral", Georgia, serif;
  --sans: "Manrope", -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  /* Scale */
  --maxw: 1240px;
  --gutter: clamp(20px, 4vw, 56px);
  --vrhythm: clamp(72px, 10vw, 144px);
}

/* ─── Reset / base ─── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ivory);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.005em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
hr { border: 0; border-top: 1px solid currentColor; opacity: .25; margin: 0; }
main { display: block; }

/* ─── Accessible focus (keyboard users only) ─── */
:focus:not(:focus-visible) { outline: none; }
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 1px;
}
.section-forest :focus-visible,
.footer :focus-visible,
.portal-aside :focus-visible {
  outline-color: var(--gold-soft);
}
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--viridian);
  outline-offset: 2px;
}

/* ─── Skip link ─── */
.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 200;
  background: var(--forest);
  color: var(--ivory);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 18px;
  border: 1px solid var(--gold-soft);
  transition: top .2s ease;
}
.skip-link:focus { top: 16px; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ─── Type ─── */
.display, .h1, h1 {
  font-family: var(--display);
  font-weight: 400;
  font-style: normal;
  line-height: 1.0;
  letter-spacing: -0.022em;
  font-feature-settings: "ss01", "ss02";
}
h1 { font-size: clamp(46px, 8.6vw, 124px); margin: 0; }
h2 { font-family: var(--display); font-weight: 400; line-height: 1.05; letter-spacing: -0.018em; font-size: clamp(40px, 5.4vw, 72px); margin: 0; }
h3 { font-family: var(--display); font-weight: 400; line-height: 1.1; letter-spacing: -0.012em; font-size: clamp(26px, 2.6vw, 34px); margin: 0; }
p { margin: 0; max-width: 62ch; }
em { font-style: italic; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--viridian);
  font-weight: 500;
}
.eyebrow .dot { color: var(--gold); }
.eyebrow.on-dark { color: var(--bone); }
.eyebrow.on-dark .dot { color: var(--gold-soft); }

.lead { font-size: 21px; line-height: 1.45; max-width: 56ch; color: color-mix(in srgb, var(--ink) 78%, transparent); }
.small { font-size: 14px; color: color-mix(in srgb, var(--ink) 64%, transparent); }
.muted { color: color-mix(in srgb, var(--ink) 68%, transparent); }
.mono { font-family: var(--mono); }
.italic { font-style: italic; font-family: var(--display); }

::selection { background: var(--forest); color: var(--ivory); }

/* ─── Layout ─── */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.section { padding: var(--vrhythm) 0; }
.section-cream { background: var(--cream); }
.section-forest { background: var(--forest); color: var(--ivory); }
.section-forest .muted { color: color-mix(in srgb, var(--ivory) 60%, transparent); }
.section-forest .lead { color: color-mix(in srgb, var(--ivory) 84%, transparent); }
.section-forest hr { border-color: var(--bone); opacity: .3; }
.rule { width: 100%; height: 1px; background: currentColor; opacity: .18; }
.rule.thick { height: 2px; opacity: .9; }

.grid { display: grid; gap: var(--gutter); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-12 { grid-template-columns: repeat(12, 1fr); }
@media (max-width: 880px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  /* Collapse the 12-col grid on small screens. Many children set their column
     via inline `grid-column: span N` / `X / span N`; force them full-width so
     content stacks readably without touching each inline style. */
  .cols-12 { grid-template-columns: 1fr; }
  .cols-12 > * { grid-column: 1 / -1 !important; }
}

/* ─── Nav ─── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--ivory) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: -0.015em;
}
.brand .sep { color: var(--gold); font-style: italic; opacity: .8; }
.brand .mark {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--viridian);
  padding-left: 2px;
}
.nav ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 36px;
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.01em;
}
.nav ul a { color: color-mix(in srgb, var(--ink) 80%, transparent); position: relative; padding: 6px 0; }
.nav ul a:hover { color: var(--ink); }
.nav ul a.active { color: var(--forest); }
.nav ul a.active::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px; background: var(--gold);
}
.nav .cta {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--forest); border: 1px solid var(--forest);
  padding: 10px 16px;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}
.nav .cta:hover { background: var(--forest); color: var(--ivory); }

/* ─── Mobile nav toggle ─── */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  color: var(--forest);
  padding: 0;
}
.nav-toggle .bars {
  position: relative;
  display: block;
  width: 20px; height: 2px;
  background: currentColor;
  transition: background .2s ease;
}
.nav-toggle .bars::before,
.nav-toggle .bars::after {
  content: ""; position: absolute; left: 0;
  width: 20px; height: 2px;
  background: currentColor;
  transition: transform .25s ease, top .25s ease;
}
.nav-toggle .bars::before { top: -6px; }
.nav-toggle .bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; order: 3; }
  .nav .cta { order: 2; }
  .nav ul {
    order: 4;
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
  }
  .nav-inner { flex-wrap: wrap; row-gap: 0; }
  .nav ul[data-open="true"] {
    max-height: 360px;
    margin-top: 12px;
    border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  }
  .nav ul li { width: 100%; }
  .nav ul a {
    display: block;
    padding: 16px 0;
    border-bottom: 1px solid color-mix(in srgb, var(--ink) 8%, transparent);
  }
  .nav ul a.active::after { display: none; }
  .nav ul a.active { color: var(--forest); border-left: 2px solid var(--gold); padding-left: 12px; }
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--sans); font-size: 15px; font-weight: 500;
  padding: 16px 24px;
  border: 1px solid currentColor;
  background: transparent;
  color: var(--forest);
  letter-spacing: 0.005em;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.btn .arrow { font-family: var(--display); font-style: italic; font-size: 18px; transition: transform .25s ease; }
.btn:hover .arrow { transform: translateX(4px); }
.btn-solid { background: var(--forest); color: var(--ivory); border-color: var(--forest); }
.btn-solid:hover { background: var(--ink); border-color: var(--ink); }
.btn-ghost { border-color: color-mix(in srgb, currentColor 25%, transparent); }
.btn-ghost:hover { border-color: currentColor; }
.btn-ivory { background: var(--ivory); color: var(--forest); border-color: var(--ivory); }
.btn-ivory:hover { background: transparent; color: var(--ivory); border-color: var(--ivory); }

/* ─── Footer ─── */
.footer {
  background: var(--forest);
  color: var(--ivory);
  padding: 88px 0 32px;
}
.footer .container { max-width: var(--maxw); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr;
  gap: var(--gutter);
  padding-bottom: 64px;
  border-bottom: 1px solid color-mix(in srgb, var(--ivory) 22%, transparent);
}
@media (max-width: 980px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 880px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer h4 {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase; font-weight: 500;
  color: var(--bone); margin: 0 0 18px;
}
.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.footer ul a { color: color-mix(in srgb, var(--ivory) 88%, transparent); }
.footer ul a:hover { color: var(--gold-soft); }
.footer .brand-lg { font-family: var(--display); font-size: 38px; line-height: 1; letter-spacing: -0.015em; margin-bottom: 14px; }
.footer .brand-lg .sep { color: var(--gold-soft); font-style: italic; }
.footer .colophon {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 28px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  color: color-mix(in srgb, var(--ivory) 55%, transparent);
}
@media (max-width: 720px) { .footer .colophon { flex-direction: column; gap: 12px; } }

/* ─── Hairline number markers for the Stack ─── */
.stage-num {
  font-family: var(--display);
  font-feature-settings: "ss01";
  font-size: clamp(56px, 9vw, 128px);
  line-height: 0.85;
  letter-spacing: -0.04em;
  color: var(--forest);
}
.stage-num.on-dark { color: var(--ivory); }

/* ─── Card ─── */
.card {
  background: var(--ivory);
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  padding: 32px;
  transition: border-color .25s ease, transform .25s ease;
}
.card:hover { border-color: var(--forest); }
.section-forest .card { background: transparent; border-color: color-mix(in srgb, var(--ivory) 22%, transparent); color: var(--ivory); }
.section-forest .card:hover { border-color: var(--gold-soft); }

/* ─── Image slot styling ─── */
image-slot {
  background: var(--cream);
  border: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);
}
image-slot::part(placeholder) {
  color: var(--viridian);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ─── Reveal on scroll ─── */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ─── Utilities ─── */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-sm { gap: 14px; }
.gap { gap: 24px; }
.gap-lg { gap: 48px; }
.col { display: flex; flex-direction: column; }
.stack-y > * + * { margin-top: 24px; }
.stack-y-sm > * + * { margin-top: 12px; }
.stack-y-lg > * + * { margin-top: 48px; }
.text-center { text-align: center; }
.relative { position: relative; }

/* ─── Forms ─── */
.field { display: flex; flex-direction: column; gap: 8px; }
fieldset.field { border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.field label,
.field legend {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--viridian);
}
.field legend { padding: 0; float: none; width: auto; }
.field input, .field textarea, .field select {
  font-family: var(--sans); font-size: 16px;
  padding: 14px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  color: var(--ink);
  outline: none;
  transition: border-color .2s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-bottom-color: var(--forest);
}
.field textarea { resize: vertical; min-height: 96px; }
.checkboxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
@media (max-width: 720px) { .checkboxes { grid-template-columns: 1fr; } }
.checkbox { display: flex; align-items: center; gap: 12px; font-size: 15px; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--forest); }

/* Invalid field state + inline error note */
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-bottom-color: var(--danger);
}
.field-error {
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--danger);
  margin-top: 2px;
}
/* Form-level error banner */
.form-banner {
  padding: 16px 18px;
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger-fg);
  font-size: 15px;
  line-height: 1.5;
}
.form-banner a { color: var(--danger-fg); text-decoration: underline; text-underline-offset: 3px; }
/* Loading / disabled submit */
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; pointer-events: none; }

/* ─── Page hero (consistent across inner pages) ─── */
.page-hero {
  padding-top: 80px;
  padding-bottom: 80px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}
.page-hero .eyebrow { margin-bottom: 28px; }
.page-hero h1 { font-size: clamp(48px, 6.4vw, 88px); max-width: 16ch; }
.page-hero .lead { margin-top: 28px; }

/* ─── Helpers for narrow text columns ─── */
.prose { max-width: 64ch; }
.prose p + p { margin-top: 1.1em; }
.prose h3 { margin-top: 1.6em; margin-bottom: .4em; }

/* ─── Motion & touch ─── */
/* Respect users who ask for reduced motion: neutralize animations,
   transitions, and smooth scrolling site-wide. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
/* On touch devices, give small tappable controls a comfortable hit target
   (WCAG 2.5.5 ~44px) without disturbing pointer/desktop layout. */
@media (pointer: coarse) {
  .nav-toggle,
  .btn,
  .folder-tab,
  .pill-link,
  .cta {
    min-height: 44px;
  }
  .pill-link,
  .cta {
    display: inline-flex;
    align-items: center;
  }
  /* Icon buttons include the mobile rail toggle — the only way to open
     navigation on a phone, so it must meet the 44px target too. */
  .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }
}
