/* ============================================================
   LEDGER — shared design system for the tool empire
   ============================================================ */

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

:root {
  --ink: #1B2430;
  --ink-soft: #2A3444;
  --paper: #EDEAE0;
  --paper-dim: #E2DECE;
  --paper-line: #C9C3AE;
  --green: #1F4D3A;
  --green-bright: #2E6E51;
  --red: #8C2F2F;
  --gold: #B8923F;
  --muted: #6B7280;

  --display: 'Fraunces', serif;
  --body: 'Inter', -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', monospace;

  --radius: 3px;
  --max: 880px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Faint ledger-rule texture on the ink background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 38px,
    rgba(237, 234, 224, 0.035) 39px
  );
}

a { color: inherit; }

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
header.site {
  border-bottom: 1px solid rgba(237,234,224,0.15);
  padding: 22px 0;
}
header.site .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--paper);
}
.brand .mark { color: var(--gold); }
nav.crumbs {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}
nav.crumbs a { text-decoration: none; border-bottom: 1px solid transparent; }
nav.crumbs a:hover { border-bottom-color: var(--gold); color: var(--paper); }

/* ---------- Hero / index page ---------- */
.hero {
  padding: 56px 0 36px;
}
.hero .eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.08;
  margin: 0 0 16px;
  max-width: 14ch;
}
.hero p {
  color: rgba(237,234,224,0.72);
  max-width: 52ch;
  font-size: 1.02rem;
}

/* ---------- Ledger tool index ---------- */
.ledger-section { margin: 40px 0; }
.ledger-section h2 {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid rgba(237,234,224,0.18);
  padding-bottom: 10px;
  margin-bottom: 0;
}
.ledger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 2px;
  border-bottom: 1px dashed rgba(237,234,224,0.15);
  text-decoration: none;
  transition: background 0.15s ease;
}
.ledger-row:hover { background: rgba(237,234,224,0.04); }
.ledger-row .left { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.ledger-row .num {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.82rem;
  flex-shrink: 0;
}
.ledger-row .name {
  font-family: var(--body);
  font-weight: 600;
  color: var(--paper);
  font-size: 1rem;
}
.ledger-row .desc {
  color: var(--muted);
  font-size: 0.88rem;
  display: none;
}
.ledger-row .go {
  font-family: var(--mono);
  color: var(--gold);
  font-size: 0.85rem;
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .ledger-row .desc { display: block; }
}

/* ---------- Tool page layout ---------- */
main.tool { padding: 40px 0 80px; }
.tool-head { margin-bottom: 32px; }
.tool-head .eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}
.tool-head h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin: 0 0 10px;
}
.tool-head .sub { color: rgba(237,234,224,0.68); max-width: 56ch; }

.panel {
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
}
@media (max-width: 640px) { .panel { padding: 22px 18px; } }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
}
@media (max-width: 560px) { .field-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field .input-row {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--paper-line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.field .input-row:focus-within { border-color: var(--green); }
.field input, .field select {
  border: none;
  outline: none;
  background: transparent;
  padding: 11px 12px;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--ink);
  width: 100%;
}
.field .affix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--paper-dim);
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--muted);
  border-left: 1px solid var(--paper-line);
}

/* ---------- Receipt / result strip (signature element) ---------- */
.receipt {
  margin-top: 30px;
  background: #fff;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}
.receipt::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 6px;
  background: repeating-linear-gradient(
    to right,
    var(--paper) 0 8px,
    transparent 8px 14px
  );
}
.receipt-inner { padding: 26px 28px 22px; }
.receipt-line {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.88rem;
  color: var(--ink-soft);
  padding: 7px 0;
  border-bottom: 1px dotted var(--paper-line);
}
.receipt-line span:last-child { font-variant-numeric: tabular-nums; }
.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid var(--ink);
}
.receipt-total .label {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.receipt-total .amount {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 2rem;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.stamp {
  position: absolute;
  top: 20px;
  right: 24px;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: 3px;
  padding: 3px 8px;
  transform: rotate(4deg);
  opacity: 0.85;
}

/* ---------- Warning box ---------- */
.warn-box {
  display: none;
  margin-top: 20px;
  background: rgba(140,47,47,0.08);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--red);
}

/* ---------- Explainer / SEO content ---------- */
.explain {
  margin-top: 56px;
  color: rgba(237,234,224,0.78);
}
.explain h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--paper);
  margin: 32px 0 12px;
}
.explain p { margin: 0 0 14px; max-width: 68ch; }
.explain .faq dt {
  font-weight: 600;
  color: var(--paper);
  margin-top: 18px;
}
.explain .faq dd { margin: 6px 0 0; color: rgba(237,234,224,0.7); }

/* ---------- Related tools ---------- */
.related {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid rgba(237,234,224,0.15);
}
.related h2 {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
.related-list { display: flex; flex-wrap: wrap; gap: 10px; }
.related-list a {
  font-family: var(--mono);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--paper);
  border: 1px solid rgba(237,234,224,0.25);
  border-radius: 3px;
  padding: 7px 12px;
}
.related-list a:hover { border-color: var(--gold); color: var(--gold); }

/* ---------- Footer ---------- */
footer.site {
  border-top: 1px solid rgba(237,234,224,0.12);
  padding: 28px 0 40px;
  margin-top: 40px;
}
footer.site .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}
footer.site a { text-decoration: none; }
footer.site a:hover { color: var(--gold); }

/* ---------- Focus visibility ---------- */
a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
