/* Snap a Bill — snapabill.org
   Receipt-minimalism design system. Single stylesheet, zero JS.
   Display: Bricolage Grotesque (variable, self-hosted) · Mono: Fragment Mono · Body: system stack. */

/* wght axis instanced to 600:800 (fontTools.varLib.instancer) — declared range must match */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/assets/fonts/bricolage-grotesque-latin.woff2') format('woff2');
  font-weight: 600 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fragment Mono';
  src: url('/assets/fonts/fragment-mono-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #FAF8F3;
  --card: #FFFFFF;
  --ink: #171A20;
  --muted: #59626E;
  --accent: #0057B8;        /* brand deep blue — text-safe on paper */
  --accent-strong: #003C8F; /* brand navy */
  --cta: #0066CC;           /* brand tint (light) — button fill */
  --cta-ink: #FFFFFF;
  --tint: #E8F1FC;
  --rule: #D8D4C9;
  --ok: #12813F;
  --scan: #35B6FF;
  --shadow: 0 1px 2px rgba(23, 26, 32, .06), 0 12px 32px -16px rgba(0, 60, 143, .25);

  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Fragment Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0D1117;
    --card: #151B23;
    --ink: #E9ECF1;
    --muted: #99A3B1;
    --accent: #6FB2FF;
    --accent-strong: #8CC2FF;
    --cta: #0071E3; /* not the iOS #0A84FF: white ink on it is 3.65:1, below AA */
    --tint: #12233B;
    --rule: #2B323C;
    --ok: #43B873;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -16px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* paper grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 .5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 4.5vw + 1rem, 4rem); font-weight: 750; }
h2 { font-size: clamp(1.65rem, 2vw + .9rem, 2.35rem); font-weight: 680; }
h3 { font-size: 1.2rem; font-weight: 620; line-height: 1.3; }

p { margin: 0 0 1em; }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--cta); outline-offset: 2px; border-radius: 2px; }

.container { max-width: 68rem; margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--cta); color: var(--cta-ink);
  padding: .5rem 1rem; z-index: 1000; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- header ---------- */
.site-header { padding-block: 1.4rem; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.wordmark {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1.25rem;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
.wordmark svg { display: block; }
.site-nav { display: flex; gap: clamp(.9rem, 2.5vw, 1.75rem); }
.site-nav a {
  font-family: var(--font-mono); font-size: .8125rem; text-transform: uppercase;
  letter-spacing: .07em; text-decoration: none; color: var(--muted);
  padding-block: .25rem; border-bottom: 1px dashed transparent;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(2.5rem, 7vw, 5.5rem) clamp(3rem, 7vw, 5rem); }
.hero .container { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: center; }
.hero-copy .lede { font-size: clamp(1.1rem, 1.1vw + .9rem, 1.3rem); color: var(--muted); max-width: 34em; }
.badge {
  display: inline-block; font-family: var(--font-mono); font-size: .75rem;
  text-transform: uppercase; letter-spacing: .09em; color: var(--accent);
  border: 1px dashed var(--accent); border-radius: 999px;
  padding: .35rem .85rem; margin-bottom: 1.4rem;
}
.cta-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.8rem; }
.btn {
  display: inline-block; font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  text-decoration: none; border-radius: 10px; padding: .8rem 1.5rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-primary { background: var(--cta); color: var(--cta-ink); box-shadow: var(--shadow); }
.btn-primary:hover { color: var(--cta-ink); transform: translateY(-2px); }
.btn-ghost { color: var(--accent); border: 1px solid var(--rule); }
.btn-ghost:hover { border-color: var(--accent); }
.hero-note { margin-top: 1rem; font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }

/* ---------- receipt demo ---------- */
.receipt { max-width: 21rem; margin-inline: auto; width: 100%; }
/* real receipts don't have a dark mode — paper stays white in both schemes */
.receipt-paper {
  position: relative; overflow: hidden;
  background: #FFFFFF; color: #171A20; border-radius: 12px 12px 0 0;
  box-shadow: var(--shadow);
  padding: 1.5rem 1.4rem 1.75rem;
  font-family: var(--font-mono); font-size: .8rem; line-height: 1.5;
  transform: rotate(-1.2deg);
}
/* torn zig-zag bottom edge */
.receipt-paper::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 12px;
  background:
    linear-gradient(-135deg, var(--paper) 6px, transparent 0) 0 0 / 16px 12px repeat-x,
    linear-gradient(135deg, var(--paper) 6px, transparent 0) 8px 0 / 16px 12px repeat-x;
}
.r-vendor { font-size: .95rem; letter-spacing: .05em; margin: 0; }
.r-addr { color: #59626E; margin: .1rem 0 0; }
.r-rule { border: 0; border-top: 1px dashed #D8D4C9; margin: .9rem 0; }
.r-lines { margin: 0; }
.r-lines > div { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .35rem; }
.r-lines dt { color: #59626E; }
.r-lines dd { margin: 0; font-variant-numeric: tabular-nums; }
/* Fragment Mono ships 400 only — emphasize the total with size/tracking, not faux-bold */
.r-total { display: flex; justify-content: space-between; font-size: 1.05rem; letter-spacing: .04em; margin: 0; }
.r-due { margin: .5rem 0 0; color: #0057B8; letter-spacing: .06em; }
/* three passes then rests (WCAG 2.2.2); animates transform only, never layout */
.scanline {
  position: absolute; left: -5%; width: 110%; height: 3px; top: .75rem;
  background: var(--scan); border-radius: 2px;
  box-shadow: 0 0 14px 3px var(--scan);
  animation: scan 5s cubic-bezier(.45, 0, .55, 1) 3;
  opacity: 0;
}
@keyframes scan {
  0% { transform: translateY(0); opacity: 0; }
  6% { opacity: .85; }
  46% { transform: translateY(19rem); opacity: .85; }
  52% { opacity: 0; }
  100% { transform: translateY(19rem); opacity: 0; }
}
.chips { list-style: none; margin: .9rem 0 0; padding: 0; display: grid; gap: .5rem; justify-items: end; }
.chip {
  display: flex; align-items: baseline; gap: .5rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 9px;
  box-shadow: var(--shadow);
  font-family: var(--font-mono); font-size: .72rem; padding: .45rem .7rem;
  opacity: 0; transform: translateY(8px);
  animation: chip-in .5s ease forwards;
}
.chip .k { color: var(--muted); text-transform: uppercase; font-size: .62rem; letter-spacing: .07em; }
.chip b { color: var(--ok); font-weight: 400; }
.chip.c1 { animation-delay: .9s; }
.chip.c2 { animation-delay: 1.5s; margin-right: 1.1rem; }
.chip.c3 { animation-delay: 2.1s; margin-right: 2.2rem; }
@keyframes chip-in { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scanline { animation: none; opacity: 0; }
  .chip { animation: none; opacity: 1; transform: none; }
  .btn { transition: none; }
}

/* ---------- sections ---------- */
.section { padding-block: clamp(2.75rem, 6vw, 4.5rem); }
.section + .section { border-top: 1px dashed var(--rule); }
.kicker {
  font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--accent); margin-bottom: .9rem;
}
.section-intro { color: var(--muted); max-width: 44em; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; margin-top: 2rem; }
.card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  padding: 1.4rem 1.3rem;
}
.card h3 { margin-bottom: .4rem; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .glyph { font-family: var(--font-mono); font-size: .72rem; color: var(--accent); letter-spacing: .08em; display: block; margin-bottom: .8rem; }

/* how-it-works: receipt line items */
.steps { list-style: none; counter-reset: step; margin: 2rem 0 0; padding: 0; max-width: 40rem; }
.steps li {
  counter-increment: step;
  display: grid; grid-template-columns: auto 1fr; gap: 1.1rem;
  padding-block: 1.15rem; border-top: 1px dashed var(--rule);
}
.steps li:last-child { border-bottom: 1px dashed var(--rule); }
.steps li::before {
  content: '0' counter(step);
  font-family: var(--font-mono); color: var(--accent); font-size: .95rem; padding-top: .2rem;
}
.steps h3 { margin-bottom: .25rem; }
.steps p { margin: 0; color: var(--muted); font-size: .95rem; }

/* free vs pro */
.tiers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; margin-top: 2rem; }
.tier {
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  padding: 1.4rem 1.3rem;
}
.tier h3 { margin-bottom: .4rem; }
.tier p { margin: 0; color: var(--muted); font-size: .95rem; }
.tier .glyph { font-family: var(--font-mono); font-size: .72rem; color: var(--accent); letter-spacing: .08em; display: block; margin-bottom: .8rem; }
.tier-pro { background: var(--tint); border: 1px dashed var(--accent); }

.table-wrap {
  overflow-x: auto; margin-top: 1.1rem;
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
}
.compare { width: 100%; min-width: 24rem; border-collapse: collapse; font-size: .95rem; }
.compare th, .compare td { padding: .65rem 1.1rem; text-align: center; }
.compare th:first-child { text-align: left; }
.compare thead th {
  font-family: var(--font-mono); font-size: .75rem; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted); font-weight: 400;
  padding-top: .95rem; border-bottom: 1px solid var(--rule);
}
.compare thead .pro-col { color: var(--accent); }
.compare tbody th { font-weight: 500; }
.compare tbody tr + tr th, .compare tbody tr + tr td { border-top: 1px solid var(--rule); }
.compare tbody + tbody .group th, .compare tbody + tbody .group td { border-top: 1px solid var(--rule); }
.compare .group + tr th, .compare .group + tr td { border-top: 0; }
.compare .group th {
  font-family: var(--font-mono); font-size: .68rem; font-weight: 400;
  text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
  padding: 1.05rem 1.1rem .3rem;
}
.compare td { font-family: var(--font-mono); font-size: .82rem; white-space: nowrap; }
.compare .pro-col { background: var(--tint); }
.pricing-note { margin-top: 1rem; font-family: var(--font-mono); font-size: .78rem; color: var(--muted); }

.pro-tag {
  font-family: var(--font-mono); font-size: .6rem; font-weight: 400; text-transform: uppercase;
  letter-spacing: .08em; color: var(--accent); border: 1px dashed var(--accent);
  border-radius: 999px; padding: .12rem .5rem; vertical-align: .12em; margin-left: .4rem;
  white-space: nowrap;
}

.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;
}

/* privacy strip */
.strip {
  background: var(--tint); border: 1px dashed var(--accent); border-radius: 14px;
  padding: clamp(1.5rem, 3.5vw, 2.5rem);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: center;
}
.strip h2 { margin-bottom: .3rem; }
.strip p { margin: 0; color: var(--muted); }

/* ---------- prose pages (help / privacy / terms) ---------- */
.page-head { padding-block: clamp(2.25rem, 5vw, 3.75rem) 0; }
.page-head .meta { font-family: var(--font-mono); font-size: .78rem; color: var(--muted); letter-spacing: .05em; }
.prose { max-width: 44rem; padding-block: 1.5rem clamp(3rem, 6vw, 4.5rem); }
.prose h2 { font-size: 1.55rem; margin-top: 2.2em; scroll-margin-top: 1.5rem; }
.prose h3 { margin-top: 1.8em; scroll-margin-top: 1.5rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose li::marker { color: var(--accent); }
.toc {
  background: var(--card); border: 1px solid var(--rule); border-radius: 12px;
  padding: 1.2rem 1.4rem; margin: 1.75rem 0 0; max-width: 44rem;
}
.toc strong { font-family: var(--font-mono); font-size: .75rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 400; }
.toc ol { margin: .6rem 0 0; padding-left: 1.3rem; columns: 2; column-gap: 2rem; font-size: .92rem; }
.toc li { margin-bottom: .3em; break-inside: avoid; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }
.summary-box {
  border-left: 3px solid var(--accent); background: var(--tint);
  border-radius: 0 10px 10px 0; padding: 1rem 1.25rem; margin: 1.5rem 0;
}
.summary-box p:last-child { margin-bottom: 0; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px dashed var(--rule); padding-block: 2.5rem 3rem; margin-top: 1rem; }
.site-footer .container { display: grid; gap: 1.5rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.4rem; }
.footer-nav a { font-family: var(--font-mono); font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; text-decoration: none; color: var(--muted); }
.footer-nav a:hover { color: var(--accent); }
.site-footer .fine { color: var(--muted); font-size: .85rem; margin: 0; }
.thanks {
  font-family: var(--font-mono); font-size: .75rem; letter-spacing: .35em;
  color: var(--muted); text-align: center; margin: 1.5rem 0 0; text-transform: uppercase;
}

/* ---------- 404 ---------- */
.center-page { min-height: 55vh; display: grid; place-content: center; text-align: center; padding-block: 3rem; }
.center-page .big-mono { font-family: var(--font-mono); color: var(--accent); letter-spacing: .2em; font-size: .85rem; margin-bottom: 1rem; }
.center-page .cta-row { justify-content: center; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .hero .container { grid-template-columns: 1fr; }
  .receipt { margin-top: 1rem; max-width: 19rem; }
  .grid-3 { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 1fr; }
  .toc ol { columns: 1; }
}
@media (max-width: 480px) {
  .site-header .container { flex-direction: column; align-items: flex-start; gap: .6rem; }
}

@media print {
  .site-nav, .site-footer, .cta-row, .skip-link, body::after { display: none; }
}
