/* =========================================================================
   BillCheck — design tokens
   Direction: the product literally marks up a document, so the design
   leans into that — a plain itemized bill on paper, with a red pen doing
   the auditing. Monospace display type (bills are tabulated ledgers),
   ink-navy for structure/CTAs, a true correction-red reserved only for
   flagged items so it keeps its meaning, money-found green for savings.
   ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg: #f2f4f1;
  --surface: #ffffff;
  --border: #dde1dc;
  --border-strong: #c5cbc3;
  --text: #171a18;
  --text-muted: #565f5a;
  --text-faint: #8a9089;

  --ink: #1c3144;
  --ink-dim: #eef2f5;

  --redline: #c23b22;
  --redline-bg: #fbeae6;

  --savings: #1f7a54;
  --savings-bg: #e8f4ee;

  --radius: 4px;
  --radius-lg: 8px;

  --font-display: 'IBM Plex Mono', monospace;
  --font-body: 'Inter', sans-serif;

  --container: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Typography ---------- */

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--redline);
}

p { color: var(--text-muted); margin: 0; }

/* ---------- Surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 150ms ease, box-shadow 150ms ease;
}
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { box-shadow: 0 0 0 3px rgba(28,49,68,0.15); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(242, 244, 241, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-mark {
  width: 18px; height: 18px;
  border: 2px solid var(--redline);
  border-radius: 50%;
  display: inline-block;
}
.nav-links { display: flex; gap: 26px; align-items: center; font-size: 14px; color: var(--text-muted); flex-wrap: wrap; row-gap: 8px; justify-content: flex-end; }
.nav-links a:hover { color: var(--ink); }
@media (max-width: 640px) {
  .nav-inner { flex-wrap: wrap; row-gap: 10px; }
  .nav-links { gap: 14px; width: 100%; justify-content: flex-start; }
}

.lang-switcher {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
}
.lang-switcher:focus-visible { outline: 2px solid var(--ink); }

/* ---------- Hero ---------- */

.hero { padding: 80px 0 64px; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 52px;
  align-items: center;
}
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.12; margin: 14px 0 16px; }
.hero p.lead { font-size: 17px; max-width: 46ch; margin-bottom: 26px; }
.hero-cta-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.price-tag { font-family: var(--font-display); font-size: 13px; color: var(--text-muted); }
.price-tag b { color: var(--ink); font-size: 15px; }

/* ---------- Mock bill (hero signature element) ---------- */

.mock-bill {
  font-family: var(--font-display);
  font-size: 12.5px;
  padding: 24px;
  position: relative;
}
.mock-bill-header {
  display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px; margin-bottom: 14px;
  color: var(--text-faint); font-size: 11px; letter-spacing: 0.06em;
}
.mock-line {
  display: flex; justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
  color: var(--text);
  position: relative;
}
.mock-line .desc { color: var(--text-muted); }
.mock-line.flagged { color: var(--text); }
.mock-line .strike {
  position: relative;
}
.mock-line .strike::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  background: var(--redline);
  transform: scaleX(0);
  transform-origin: left;
  animation: strike-in 500ms ease forwards;
  animation-delay: 900ms;
}
@keyframes strike-in { to { transform: scaleX(1); } }
.margin-note {
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--redline);
  background: var(--redline-bg);
  border-left: 2px solid var(--redline);
  padding: 6px 10px;
  margin-top: 8px;
  opacity: 0;
  animation: note-in 400ms ease forwards;
  animation-delay: 1300ms;
}
@keyframes note-in { to { opacity: 1; } }

/* ---------- How it works ---------- */

.section { padding: 64px 0; }
.section-head { max-width: 60ch; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(24px, 3.2vw, 32px); margin-top: 10px; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1000px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step-num { font-family: var(--font-display); color: var(--redline); font-size: 12.5px; margin-bottom: 12px; }
.step h3 { font-size: 17px; margin-bottom: 8px; color: var(--ink); }
.step p { font-size: 14px; }

/* ---------- Pricing ---------- */

.pricing-card { max-width: 400px; margin: 0 auto; text-align: center; }
.price-figure { font-family: var(--font-display); font-size: 48px; font-weight: 700; margin: 16px 0 4px; color: var(--ink); }
.price-figure span { font-size: 15px; color: var(--text-muted); font-family: var(--font-body); font-weight: 400; }
.price-list { list-style: none; padding: 0; margin: 24px 0 28px; text-align: left; font-size: 14px; color: var(--text-muted); }
.price-list li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.price-list li:first-child { border-top: none; }
.price-list .check { color: var(--savings); flex-shrink: 0; }

/* ---------- Pricing (3 packs) ---------- */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
  align-items: start;
}
@media (max-width: 800px) { .pricing-grid { grid-template-columns: 1fr; max-width: 420px; } }

.pack-card {
  position: relative;
  text-align: center;
  border-color: var(--border-strong);
}
.pack-card.featured {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.pack-badge {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.pack-title { font-family: var(--font-display); font-size: 15px; color: var(--text-muted); margin-bottom: 10px; }
.pack-price { font-family: var(--font-display); font-size: 36px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.pack-note { font-size: 12.5px; color: var(--text-muted); margin-bottom: 18px; }
.pack-list { list-style: none; padding: 0; margin: 0 0 20px; text-align: left; font-size: 13px; color: var(--text-muted); }
.pack-list li { display: flex; gap: 8px; padding: 6px 0; }
.pack-list .check { color: var(--savings); flex-shrink: 0; }

/* ---------- Pack selector (tool page) ---------- */

.pack-select-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 560px) { .pack-select-grid { grid-template-columns: 1fr; } }
.pack-select-card {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 150ms ease;
}
.pack-select-card:hover { border-color: var(--ink); }
.pack-select-card .p-title { font-family: var(--font-display); font-size: 13px; color: var(--text-muted); }
.pack-select-card .p-price { font-family: var(--font-display); font-size: 22px; color: var(--ink); margin: 4px 0; }
.pack-select-card .p-note { font-size: 11px; color: var(--text-faint); }

.credits-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--savings-bg);
}
.credits-bar .count { font-family: var(--font-display); font-size: 13px; color: var(--savings); }

/* ---------- FAQ ---------- */

.faq-list {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 18px;
}
.faq-item summary {
  cursor: pointer;
  padding: 14px 0;
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--ink);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq-item summary > span { flex: 1; min-width: 0; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 20px;
  color: var(--redline);
  flex-shrink: 0;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding-bottom: 16px; font-size: 14px; margin: 0; }

/* ---------- Save-link modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 26, 24, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 28px;
  max-width: 460px;
  width: 100%;
}
.modal-box h3 {
  font-size: 18px;
  margin: 8px 0 10px;
  color: var(--savings);
}
.modal-box p { font-size: 14px; margin-bottom: 4px; }
.modal-link-row {
  display: flex;
  gap: 8px;
  margin: 14px 0 10px;
}
.modal-link-row input[type="text"] {
  flex: 1;
  font-family: var(--font-display);
  font-size: 12.5px;
  background: var(--panel-2, var(--bg));
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
}
@media (max-width: 420px) {
  .modal-box { padding: 20px; }
  .modal-link-row { flex-direction: column; }
  .modal-link-row .copy-btn { width: 100%; padding: 10px 12px; }
  .modal-actions { flex-direction: column-reverse; gap: 8px; }
  .modal-actions .btn { width: 100%; justify-content: center; }
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  gap: 10px;
}
.modal-box .field-label { margin: 14px 0 5px; font-size: 12px; }
.modal-box .field-label:first-of-type { margin-top: 4px; }
.modal-box select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
}
.modal-box textarea { min-height: 90px; }
.receipt-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  margin: 12px 0;
}
.receipt-box div { display: flex; justify-content: space-between; padding: 3px 0; flex-wrap: wrap; gap: 4px 10px; }
.receipt-box .label { color: var(--text-faint); }
.receipt-box .value { font-family: var(--font-display); color: var(--text); word-break: break-all; text-align: right; }
.need-help-link {
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.need-help-link:hover { color: var(--ink); }

/* ---------- Mobile touch-target bump ---------- */
/* Small controls sized fine for a mouse pointer are too small to reliably
   tap — widen the hit area without changing the visual footprint much. */
@media (max-width: 640px) {
  .lang-switcher { padding: 9px 12px; }
  .need-help-link { padding: 6px 2px; display: inline-block; }
  .copy-btn { padding: 9px 14px !important; }
}

/* ---------- Blog / article content ---------- */

.article-hero { padding: 56px 0 20px; }
.article-hero .eyebrow { display: block; margin-bottom: 10px; }
.article-hero h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin-bottom: 14px; }
.article-meta { font-family: var(--font-display); font-size: 12px; color: var(--text-faint); }

.article-content { max-width: 720px; margin: 0 auto; padding: 20px 24px 80px; }
.article-content h2 { font-size: 22px; margin: 40px 0 14px; color: var(--ink); }
.article-content h3 { font-size: 17px; margin: 28px 0 10px; color: var(--ink); }
.article-content p { font-size: 15.5px; color: var(--text-muted); line-height: 1.75; margin-bottom: 16px; }
.article-content ul, .article-content ol { padding-left: 22px; margin-bottom: 16px; }
.article-content li { font-size: 15.5px; color: var(--text-muted); line-height: 1.75; margin-bottom: 8px; }
.article-content strong { color: var(--text); }
.article-content a { color: var(--ink); text-decoration: underline; }
.article-content table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.article-content th, .article-content td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.article-content th { font-family: var(--font-display); color: var(--ink); font-size: 12.5px; }
.article-cta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--redline);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
  margin: 32px 0;
}
.article-cta p { margin-bottom: 12px; color: var(--text); }
.article-nav-links { display: flex; justify-content: space-between; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 14px; }

/* ---------- Footer ---------- */

.footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--text-faint); font-size: 12.5px; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ---------- Tool page ---------- */

.tool-wrap { padding: 44px 0 72px; }
.tool-panel { max-width: 700px; margin: 0 auto; }
.progress { font-family: var(--font-display); font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.06em; margin-bottom: 16px; display: flex; justify-content: space-between; }
.field-label { font-family: var(--font-display); font-size: 12px; color: var(--ink); letter-spacing: 0.04em; display: block; margin: 18px 0 6px; }
.field-label:first-child { margin-top: 0; }
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 13px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  min-height: 160px;
  resize: vertical;
}
textarea:focus-visible { outline: 2px solid var(--ink); }
textarea::placeholder, input::placeholder { color: var(--text-faint); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
}
input[type="text"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 14px;
}
input[type="text"]:focus-visible { outline: 2px solid var(--ink); }

.buy-box {
  margin-top: 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
}
.buy-box .price { font-family: var(--font-display); font-size: 22px; color: var(--ink); }
.lock-note { font-size: 12.5px; color: var(--text-faint); margin-top: 8px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(28,49,68,0.2); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.flag-card {
  border-left: 3px solid var(--redline);
  background: var(--redline-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px;
  margin-bottom: 10px;
}
.flag-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.flag-ref { font-family: var(--font-display); font-size: 13px; color: var(--text); }
.confidence { font-family: var(--font-display); font-size: 10.5px; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 3px; white-space: nowrap; }
.confidence-high { background: rgba(194,59,34,0.16); color: var(--redline); }
.confidence-medium { background: rgba(194,59,34,0.09); color: var(--redline); }
.confidence-low { background: rgba(86,95,90,0.12); color: var(--text-muted); }
.flag-desc { font-size: 13.5px; color: var(--text-muted); margin-top: 6px; }
.flag-category { font-family: var(--font-display); font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }

.letter-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  font-size: 13.5px;
  white-space: pre-wrap;
  color: var(--text);
  line-height: 1.7;
  max-height: 340px;
  overflow-y: auto;
}
.savings-box {
  background: var(--savings-bg);
  border-left: 3px solid var(--savings);
  padding: 12px 16px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 18px;
}
