/* ============================================================
   Free Range Ledger — base styles, layout, components
   ============================================================ */

@import url("./tokens.css");

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--forest); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--terra-dark); }
a:focus-visible { outline: var(--focus); outline-offset: var(--focus-offset); border-radius: 2px; }

h1, h2, h3 { font-family: var(--font-body); line-height: var(--lh-tight); color: var(--forest); }
h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.005em; }
h3 { font-size: var(--fs-h3); font-weight: 600; }

p { max-width: var(--measure); }
ul, ol { padding-left: 1.4em; max-width: var(--measure); }
li + li { margin-top: var(--s2); }

strong { font-weight: 600; color: var(--forest-dark); }
em { font-style: italic; }

/* Numerics — tabular for tables */
.num, table.compare td:not(:first-child), table.compare th:not(:first-child) {
  font-variant-numeric: tabular-nums;
}

/* Layout */
.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--s4); }

/* Site header */
.site-header {
  background: var(--forest);
  color: var(--cream);
  padding: var(--s3) 0;
  border-bottom: 3px solid var(--terra);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.brand {
  font-size: 22px;
  font-weight: 700;
  color: var(--cream);
  text-decoration: none;
  letter-spacing: 0.01em;
}
.brand:hover { color: var(--cream); }
.brand-mark { color: var(--terra); }

.nav {
  display: flex;
  gap: var(--s4);
  flex-wrap: wrap;
}
.nav a {
  color: var(--cream);
  text-decoration: none;
  font-size: var(--fs-small);
  font-weight: 500;
  padding: var(--s1) 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--cream); border-bottom-color: var(--terra); }

/* Site footer */
.site-footer {
  background: var(--forest-dark);
  color: var(--cream);
  padding: var(--s6) 0 var(--s5);
  margin-top: var(--s8);
  font-size: var(--fs-small);
  line-height: 1.6;
}
.site-footer a { color: var(--cream); }
.site-footer .footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--s5);
  margin-bottom: var(--s5);
}
.site-footer h3 {
  color: var(--cream);
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--s2);
}
.site-footer ul { list-style: none; padding: 0; }
.site-footer li + li { margin-top: var(--s1); }
.site-footer .legal {
  border-top: 1px solid var(--forest-soft);
  padding-top: var(--s4);
  color: #a09888;
  font-size: 14px;
  line-height: 1.6;
}
.site-footer .legal p + p { margin-top: var(--s2); }

/* Sections */
.section { padding: var(--s7) 0; }
.section--tight { padding: var(--s6) 0; }
.section--cream { background: var(--cream); }
.section--sand { background: var(--sand); }
.section--surface { background: var(--cream-soft); }
.section--forest { background: var(--forest); color: var(--cream); }
.section--forest h1, .section--forest h2, .section--forest h3 { color: var(--cream); }

.section-eyebrow {
  font-size: var(--fs-small);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--terra-dark);
  font-weight: 600;
  margin-bottom: var(--s2);
}

/* Hero */
.hero { padding: var(--s8) 0 var(--s7); }
.hero h1 { max-width: 22ch; margin-bottom: var(--s4); }
.hero .lede { font-size: 22px; max-width: 60ch; margin-bottom: var(--s5); color: var(--ink); }
.hero .cta-row { display: flex; gap: var(--s3); flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 600;
  padding: 14px 28px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn-primary { background: var(--terra); color: white; border-color: var(--terra); }
.btn-primary:hover { background: var(--terra-dark); border-color: var(--terra-dark); color: white; }
.btn-secondary { background: transparent; color: var(--forest); border-color: var(--forest); }
.btn-secondary:hover { background: var(--forest); color: var(--cream); }

/* Comparison table */
table.compare {
  width: 100%;
  border-collapse: collapse;
  background: var(--cream-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  margin: var(--s4) 0;
  font-size: var(--fs-small);
}
table.compare caption {
  font-size: var(--fs-small);
  color: var(--ink-muted);
  margin-bottom: var(--s2);
  text-align: left;
}
table.compare th, table.compare td {
  padding: var(--s3);
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  text-align: left;
}
table.compare thead th {
  background: var(--forest);
  color: var(--cream);
  font-weight: 600;
  font-size: var(--fs-small);
}
table.compare tbody th {
  background: var(--sand);
  color: var(--forest-dark);
  width: 22%;
  font-weight: 600;
}
table.compare td.qb { background: #faf0ee; color: var(--ink); width: 39%; }
table.compare td.frl { background: #ecf2ec; color: var(--ink); width: 39%; }
table.compare tr:last-child th, table.compare tr:last-child td { border-bottom: 0; }

/* Pillar cards (3-up grid) */
.pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
  margin-top: var(--s5);
}
.pillar {
  background: var(--cream-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s4);
  box-shadow: var(--shadow);
}
.pillar h3 { margin-bottom: var(--s2); color: var(--forest-dark); }
.pillar p { font-size: var(--fs-small); color: var(--ink); }

/* Stat callout strip */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s4);
  background: var(--forest);
  color: var(--cream);
  padding: var(--s5) var(--s4);
  border-radius: var(--radius);
  margin: var(--s5) 0;
}
.stat .num-big {
  font-family: var(--font-numerics);
  font-size: 40px;
  line-height: 1.1;
  color: var(--terra);
  display: block;
  margin-bottom: var(--s1);
}
.stat .label { font-size: var(--fs-small); color: var(--cream); opacity: 0.92; }

/* Cohort counter — manual update */
.cohort-counter {
  background: var(--cream-soft);
  border: 2px solid var(--terra);
  border-radius: var(--radius);
  padding: var(--s4);
  margin: var(--s4) 0;
  display: flex;
  align-items: baseline;
  gap: var(--s3);
  flex-wrap: wrap;
}
.cohort-counter .count {
  font-family: var(--font-numerics);
  font-size: 36px;
  color: var(--terra-dark);
  line-height: 1;
}
.cohort-counter .copy { color: var(--ink); font-size: var(--fs-small); }
.cohort-counter .copy strong { display: block; font-size: var(--fs-body); margin-bottom: var(--s1); color: var(--forest-dark); }

/* Pull-quote */
.pull-quote {
  border-left: 4px solid var(--terra);
  padding: var(--s2) var(--s4);
  margin: var(--s4) 0;
  font-size: 22px;
  color: var(--forest-dark);
  max-width: 60ch;
  font-style: italic;
}

/* Inline KPI list */
.kpi-list { list-style: none; padding: 0; margin: var(--s3) 0; max-width: none; }
.kpi-list li {
  background: var(--cream-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--s3);
  margin-bottom: var(--s2);
}
.kpi-list li strong { display: block; color: var(--forest-dark); margin-bottom: var(--s1); }

/* Skip-link */
.skip-link {
  position: absolute;
  left: -9999px;
  background: var(--terra);
  color: white;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { left: var(--s3); top: var(--s3); }

/* Responsive */
@media (max-width: 880px) {
  :root { --fs-h1: 34px; --fs-h2: 26px; }
  .hero { padding: var(--s6) 0 var(--s5); }
  .pillars, .stat-strip, .site-footer .footer-grid { grid-template-columns: 1fr; }
  table.compare thead { display: none; }
  table.compare tbody th, table.compare tbody td { display: block; width: 100%; }
  table.compare tbody td.qb::before { content: "QuickBooks Online (Plus): "; font-weight: 600; color: var(--terra-dark); }
  table.compare tbody td.frl::before { content: "Free Range Ledger: "; font-weight: 600; color: var(--success); }
}

/* Print */
@media print {
  .site-header, .site-footer .footer-grid, .nav, .hero .cta-row { display: none; }
  body { background: white; color: black; font-size: 12pt; }
  .section { padding: 0.5cm 0; }
  table.compare { font-size: 10pt; }
  a { color: black; text-decoration: underline; }
  a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}
