/* ============================================================
   nettocheck — global stylesheet
   Editorial Finance aesthetic. Cream paper · Ink teal · Apricot.
   Tokens mirror BRAND.md.
   ============================================================ */

:root {
  /* — Brand colors — */
  --color-primary:        #0E5547;
  --color-primary-50:     #E6F0EC;
  --color-primary-700:    #073A30;
  --color-accent:         #E8854A;
  --color-accent-50:      #FCEFE3;

  /* — Surfaces — */
  --color-bg:             #FAF6EE;
  --color-surface:        #FFFFFF;

  /* — Text — */
  --color-text:           #1A2A2D;
  --color-text-muted:     #6B6358;

  /* — Borders — */
  --color-border:         #E8DFD0;
  --color-border-soft:    #F0E9DA;

  /* — Typography — */
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body:    'Manrope', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* — Radius — */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;

  /* — Shadows — */
  --shadow-md: 0 2px 6px rgba(14, 85, 71, 0.05), 0 8px 20px rgba(14, 85, 71, 0.06);
  --shadow-lg: 0 4px 12px rgba(14, 85, 71, 0.07), 0 18px 40px rgba(14, 85, 71, 0.10);

  /* — Layout — */
  --container-max: 1200px;
  --reading-max:   65ch;
  --nav-height:    72px;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 1.0625rem; /* 17px */
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  font-feature-settings: 'ss01', 'ss02', 'cv11';
}

img, svg, video { display: block; max-width: 100%; height: auto; }

/* CRITICAL: cap stray SVG icons that have no width/height attributes —
   prior bug rendered them at 1000px+ intrinsic size. */
svg {
  max-width: 1.5rem;
  max-height: 1.5rem;
  vertical-align: middle;
}
svg.icon-md, .icon-md > svg { max-width: 2rem;   max-height: 2rem; }
svg.icon-lg, .icon-lg > svg { max-width: 3rem;   max-height: 3rem; }
svg.icon-xl, .icon-xl > svg { max-width: 4.5rem; max-height: 4.5rem; }
svg.icon-unbound, .icon-unbound svg { max-width: none; max-height: none; }

button { font: inherit; cursor: pointer; }

/* ============================================================
   Typography
   ============================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--color-primary);
  margin: 0 0 0.6em;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(2.5rem, 5.5vw, 4rem);
  line-height: 1.04;
  font-weight: 500;
}
h2 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  line-height: 1.1;
}
h3 {
  font-size: clamp(1.25rem, 2vw, 1.625rem);
  line-height: 1.25;
}
h4 {
  font-size: 1.1rem;
  line-height: 1.35;
}

p { margin: 0 0 1em; }

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover { color: var(--color-primary-700); }

.lead {
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  max-width: var(--reading-max);
}

.eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-accent);
  margin: 0 0 0.85rem;
  display: inline-block;
}

ul, ol { padding-left: 1.25em; margin: 0 0 1em; }
li { margin: 0.25em 0; }

hr {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0;
}

code, pre {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}
code {
  background: var(--color-primary-50);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  color: var(--color-primary-700);
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  display: block;
  min-height: calc(100vh - var(--nav-height) - 320px);
}

.section {
  padding: clamp(4rem, 8vw, 7rem) 0;
}

.reading {
  max-width: var(--reading-max);
}

/* ============================================================
   Header / Nav
   ============================================================ */
.nav-blur {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 246, 238, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--color-border-soft);
}
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-height);
  gap: 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  color: var(--color-primary);
  text-decoration: none;
  letter-spacing: -0.015em;
}
.brand-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--color-accent);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}
.nav-links a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  font-size: 0.97rem;
}
.nav-links a:hover { color: var(--color-primary); }

/* ============================================================
   Buttons
   ============================================================ */
.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.78rem 1.4rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-primary);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--color-primary-50); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-700);
  color: #fff;
}

.btn-accent {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-ghost {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

/* ============================================================
   Cards & surfaces
   ============================================================ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}
.surface-wash { background: var(--color-primary-50); }
.surface-accent-wash { background: var(--color-accent-50); }

/* ============================================================
   Forms
   ============================================================ */
input, select, textarea {
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-50);
}
label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
  color: var(--color-text);
}

/* ============================================================
   Tables
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.97rem;
}
th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}
th {
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-50);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  margin-top: 5rem;
  padding: 3.5rem 0 2rem;
  background: var(--color-primary-700);
  color: #E5DFD3;
}
.footer h4 {
  color: #FCEFE3;
  font-family: var(--font-body);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-bottom: 1rem;
}
.footer a {
  color: #E5DFD3;
  text-decoration: none;
}
.footer a:hover { color: #fff; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer li { margin: 0.4rem 0; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}
.footer-brand {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: #FCEFE3;
  margin-bottom: 0.75rem;
}
.footer-tagline {
  color: #C9C2B5;
  font-size: 0.95rem;
  max-width: 32ch;
  line-height: 1.6;
}
.footer-disclosure {
  font-size: 0.85rem;
  color: #C9C2B5;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.5rem;
  margin-top: 1rem;
  line-height: 1.55;
}
.footer-disclosure strong { color: #FCEFE3; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: #C9C2B5;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================================
   Utilities
   ============================================================ */
.muted { color: var(--color-text-muted); }
.center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.mt-6 { margin-top: 3rem; }
.mt-8 { margin-top: 4rem; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 2rem; }
.gap-2 { gap: 1rem; }
.gap-4 { gap: 2rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid { display: grid; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  background: var(--color-primary-50);
  color: var(--color-primary-700);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge-accent { background: var(--color-accent-50); color: var(--color-accent); }

/* ============================================================
   Accessibility
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 3px;
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}
@media (max-width: 700px) {
  body { font-size: 1rem; }
  .container { padding: 0 1.1rem; }
  .nav-links { gap: 1rem; }
  .nav-links a:not(.btn) { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}
