/* Filsbook: ink, statement paper, a banknote violet and a highlighter. See brand/brand-book.html.
   Layout: full-width bands; results print as a receipt with the key number highlighted. */
:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eceef4;
  --text: #141b2d;
  --muted: #5b6478;
  --border: #dde1ea;
  --accent: #5b3fd0;
  --accent-strong: #4b32bd;
  --accent-soft: #ebe7fb;
  --hi: #ffe14d;
  --ink: #15213b;
  --danger: #c2412d;
  --ok: #1f8a5b;
  --rule: rgba(21, 33, 59, .07);
  --radius: 12px;
  /* The receipt is printed paper: the same in both themes. */
  --paper: #fffef9;
  --paper-ink: #15213b;
  --paper-muted: #5b6478;
  --paper-rule: #c9d0dc;

  --display: "Archivo", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1424;
    --surface: #161e33;
    --surface-2: #1d2740;
    --text: #e8ebf3;
    --muted: #9ea7bd;
    --border: #26304a;
    --accent: #a897ff;
    --accent-strong: #c4b8ff;
    --accent-soft: #241f45;
    --danger: #f08a72;
    --ok: #5fd29c;
    --rule: rgba(255, 255, 255, .045);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--body); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }

h1, h2, h3 { font-family: var(--display); text-wrap: balance; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5.4vw, 3.2rem); line-height: 1.02; margin: 0; font-weight: 850; font-stretch: 118%; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.1; margin: 0 0 18px; font-weight: 800; font-stretch: 115%; }
h3 { font-size: 1.1rem; margin: 24px 0 8px; font-weight: 750; font-stretch: 108%; letter-spacing: -0.01em; }
p { margin: 0 0 14px; }
mark { background: linear-gradient(to bottom, transparent 58%, var(--hi) 58%); color: inherit; padding: 0 .08em; }
@media (prefers-color-scheme: dark) { mark { background: linear-gradient(to bottom, transparent 58%, rgba(255,225,77,.5) 58%); } }
.eyebrow, .src-label { font-family: var(--mono); font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.note { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: .92rem; color: var(--muted); }

/* ---------- Header ---------- */
.site-header { background: var(--ink); color: #fff; position: relative; z-index: 2; }
.site-header .bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; min-height: 64px; flex-wrap: wrap; padding-block: 8px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo svg { width: 30px; height: 30px; flex: none; }
.word { font-family: var(--display); font-weight: 850; font-stretch: 122%; font-size: 1.3rem; letter-spacing: -0.03em; line-height: 1; }
.site-header .word b, .site-footer .word b { color: var(--hi); font-weight: inherit; }
.logo:hover { color: inherit; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { color: #d6dbe7; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; font-weight: 600; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--hi); border-radius: 0; }
.nav .nav-cta { background: var(--hi); color: var(--ink); margin-left: 6px; }
.nav .nav-cta:hover, .nav .nav-cta[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: none; border-radius: 8px; }

/* ---------- Page head (inner pages) ---------- */
.page-head { background: var(--surface); border-bottom: 1px solid var(--border); padding-block: 28px 34px; background-image: repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px); }
.page-head .wrap { display: grid; gap: 12px; }
.crumbs { font-family: var(--mono); font-size: .78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.lede { color: var(--muted); font-size: clamp(1.02rem, 2vw, 1.15rem); max-width: 60ch; margin: 0; }
.content { padding-block: 32px 64px; }
.content > h2 { margin-top: 48px; }

/* ---------- Buttons ---------- */
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 18px; min-height: 46px; border-radius: 10px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 700; font-size: .97rem; cursor: pointer; }
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.primary:hover { color: #141b2d; } }
.btn.ghost { background: transparent; }
.btn.hi { background: var(--hi); border-color: var(--hi); color: var(--ink); }
.btn.hi:hover { background: #fff; border-color: #fff; color: var(--ink); }

/* ---------- Receipt ---------- */
.receipt { position: relative; background: var(--paper); color: var(--paper-ink); border-radius: 10px 10px 0 0; padding: 20px 22px 18px; font-family: var(--mono); box-shadow: 0 1px 2px rgba(21,33,59,.08), 0 18px 40px rgba(21,33,59,.16); margin-bottom: 12px; min-width: 0; }
.receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px; background:
  linear-gradient(135deg, var(--paper) 50%, transparent 50%) 0 0 / 14px 10px repeat-x,
  linear-gradient(225deg, var(--paper) 50%, transparent 50%) 0 0 / 14px 10px repeat-x; }
.rc-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--paper-muted); padding-bottom: 12px; border-bottom: 1.5px dashed var(--paper-rule); }
.rc-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--paper-ink); }
.rc-brand svg { width: 20px; height: 20px; }
.rc-body { padding-block: 14px; min-height: 120px; }
.rc-body p { font-family: var(--body); }
.rc-foot { border-top: 1.5px dashed var(--paper-rule); padding-top: 10px; font-size: .74rem; color: var(--paper-muted); letter-spacing: .02em; }
.receipt .muted { color: var(--paper-muted); }
.receipt .small { font-family: var(--mono); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
.big { font-family: var(--mono); font-size: clamp(1.7rem, 5vw, 2.3rem); font-weight: 600; line-height: 1.15; display: inline-block; margin: 2px 0 6px; background: linear-gradient(to bottom, transparent 52%, var(--hi) 52%); padding: 0 .15em; color: var(--paper-ink); letter-spacing: -0.02em; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 0; margin: 12px 0 0; font-size: .86rem; }
.kv dt, .kv dd { padding: 7px 0; border-bottom: 1px dotted var(--paper-rule); }
.kv dt { color: var(--paper-muted); padding-right: 12px; }
.kv dd { margin: 0; text-align: right; font-weight: 600; white-space: nowrap; }
.receipt .kv:first-child { margin: 0 0 14px; }
.warn { color: var(--danger); font-weight: 600; }
.receipt .warn { color: #b4372a; }

/* ---------- Calculator layout ---------- */
.calc { display: grid; gap: 28px; align-items: start; }
@media (min-width: 880px) { .calc { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 36px; } .calc .receipt { position: sticky; top: 20px; } }
.calc-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; min-width: 0; }
.form { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .form { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
input, select, button { font: inherit; }
input[type="number"], input[type="date"], select {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); min-height: 46px; font-family: var(--mono); font-size: .95rem;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.form-note { margin: 18px 0 0; font-size: .82rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.form-note::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }

/* ---------- Prose & sources ---------- */
.prose { max-width: 70ch; margin-top: 40px; }
.prose h2 { margin-top: 0; }
.prose ul { padding-left: 1.2em; display: grid; gap: 6px; margin: 0 0 16px; }
.prose li::marker { color: var(--accent); }
.source { max-width: 70ch; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 10px 10px 0; padding: 14px 18px; margin-top: 24px; display: grid; gap: 4px; }
.source p { margin: 0; font-size: .92rem; color: var(--muted); }

/* ---------- Ledger list ---------- */
.ledger { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--text); }
.ledger li { border-bottom: 1px solid var(--border); }
.ledger a { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 18px 6px; color: var(--text); text-decoration: none; background: linear-gradient(to right, var(--accent-soft), var(--accent-soft)) no-repeat 0 0 / 0 100%; transition: background-size .25s ease; }
.ledger a:hover { background-size: 100% 100%; color: var(--text); }
.lg-tag { font-family: var(--mono); font-size: .74rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lg-q { font-family: var(--display); font-weight: 800; font-stretch: 112%; font-size: clamp(1.05rem, 2.2vw, 1.35rem); letter-spacing: -0.015em; line-height: 1.2; }
.lg-name { font-size: .88rem; color: var(--muted); white-space: nowrap; }
.lg-arrow { font-family: var(--mono); font-size: 1.2rem; color: var(--accent); transition: transform .2s ease; }
.ledger a:hover .lg-arrow { transform: translateX(4px); }
@media (max-width: 700px) {
  .ledger a { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 16px 4px; }
  .lg-tag { grid-column: 1; grid-row: 1; }
  .lg-q { grid-column: 1; grid-row: 2; }
  .lg-name { grid-column: 1; grid-row: 3; white-space: normal; }
  .lg-arrow { grid-column: 2; grid-row: 1 / span 3; }
}

/* ---------- Home ---------- */
.home-hero { background: var(--ink); color: #f1f3f7; padding-block: 56px 72px; background-image: repeating-linear-gradient(to bottom, transparent 0 39px, rgba(255,255,255,.05) 39px 40px); position: relative; overflow: hidden; }
.home-hero::before { content: ""; position: absolute; top: 0; bottom: 0; left: max(20px, calc(50% - 560px)); width: 2px; background: rgba(255,225,77,.25); }
.hero-grid { display: grid; gap: 40px; align-items: center; position: relative; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 56px; } }
.hero-copy { display: grid; gap: 20px; padding-left: 18px; }
.home-hero h1 { color: #fff; font-size: clamp(2.6rem, 7.5vw, 5rem); line-height: .98; }
.home-hero mark { background: linear-gradient(to bottom, transparent 60%, rgba(255,225,77,.9) 60%); color: #fff; }
.home-hero .eyebrow { color: #aab3c8; }
.home-hero .lede { color: #c9cfdc; }
.home-hero .btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); }
.home-hero .btn.ghost:hover { border-color: #fff; }
@media (prefers-color-scheme: dark) { .home-hero .btn.primary { color: #141b2d; } }
.home-hero .receipt { transform: rotate(1.5deg); max-width: 420px; justify-self: center; width: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .home-hero .receipt { animation: print .7s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes print { from { transform: translateY(-14px) rotate(1.5deg); opacity: .6; } to { transform: rotate(1.5deg); opacity: 1; } }
}
.band { padding-block: 56px; }
.band + .band { border-top: 1px solid var(--border); }
.planner-band { background: var(--accent); color: #fff; border-top: 0 !important; }
.planner-band h2 { color: #fff; }
.planner-band .eyebrow { color: #d9d1ff; }
.planner-band p { color: #ece8ff; }
@media (prefers-color-scheme: dark) { .planner-band { background: #2b2163; } }
.split { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .split { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 48px; } }
.split-copy { display: grid; gap: 14px; justify-items: start; }
.split-copy p { margin: 0; }
.principles { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.principles div { border-top: 2px solid var(--text); padding-top: 12px; display: grid; gap: 6px; }
.principles p { margin: 0; color: var(--muted); }

/* ---------- Spreadsheet preview ---------- */
.sheet { margin: 0; background: #ffffff; color: #15213b; border-radius: 10px; overflow: hidden; box-shadow: 0 18px 40px rgba(10,16,35,.25); min-width: 0; }
.sheet-tabs { display: flex; gap: 2px; background: #e4e7ef; padding: 6px 6px 0; overflow-x: auto; }
.sheet-tabs span { font-size: .74rem; font-weight: 600; padding: 6px 10px; border-radius: 6px 6px 0 0; color: #5b6478; white-space: nowrap; }
.sheet-tabs .on { background: #fff; color: #15213b; }
.sheet table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.sheet th { text-align: left; font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: #5b6478; background: #f5f6f9; padding: 8px 12px; border-bottom: 1px solid #dde1ea; }
.sheet td { padding: 8px 12px; border-bottom: 1px solid #eceef3; }
.sheet .r { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sheet tr:last-child td { border-bottom: 0; }
.meter { display: block; height: 8px; background: #eceef3; border-radius: 4px; overflow: hidden; min-width: 48px; }
.meter i { display: block; height: 100%; background: #5b3fd0; border-radius: 4px; }
.sheet figcaption { font-family: var(--mono); font-size: .7rem; color: #5b6478; padding: 8px 12px; background: #f5f6f9; border-top: 1px solid #dde1ea; }
@media (max-width: 520px) { .sheet th:nth-child(4), .sheet td:nth-child(4) { display: none; } }

/* ---------- Planner page ---------- */
.launch { margin: 0; display: grid; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--hi); border-radius: 0 10px 10px 0; padding: 14px 16px; }
.features { display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin: 0; border-top: 2px solid var(--text); }
.features div { padding: 16px 18px 16px 0; border-bottom: 1px solid var(--border); }
.features dt { font-family: var(--display); font-weight: 800; font-stretch: 112%; font-size: 1.05rem; margin-bottom: 4px; }
.features dd { margin: 0; color: var(--muted); font-size: .93rem; }
p.prose { margin-top: 0; }

/* ---------- FAQ ---------- */
.faq { max-width: 70ch; margin-top: 48px; }
details { border-bottom: 1px solid var(--border); padding: 4px 0; }
details:first-of-type { border-top: 2px solid var(--text); }
summary { cursor: pointer; font-weight: 700; padding: 14px 32px 14px 0; list-style: none; position: relative; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; position: absolute; right: 4px; top: 10px; font-family: var(--mono); font-size: 1.3rem; color: var(--accent); }
details[open] summary::after { content: "–"; }
details p { color: var(--muted); margin: 0 0 14px; }

/* ---------- Tables in prose ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #aab3c8; padding-block: 40px; font-size: .9rem; }
.foot { display: grid; gap: 20px; }
@media (min-width: 800px) { .foot { grid-template-columns: 1.2fr 1fr; } .foot .fine { grid-column: 1 / -1; } }
.foot-brand { display: grid; gap: 10px; justify-items: start; }
.foot-brand .logo { color: #fff; }
.foot-brand p { margin: 0; max-width: 46ch; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; align-content: start; }
.site-footer a { color: #d6dbe7; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.fine { margin: 0; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.1); font-size: .8rem; color: #8f99b0; }

/* ---------- Guides ---------- */
h2.sub { margin-top: 48px; }
.answer { max-width: 70ch; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--hi); border-radius: 0 12px 12px 0; padding: 18px 20px; display: grid; gap: 6px; }
.answer p { margin: 0; font-size: 1.05rem; }
.content .prose:first-of-type { margin-top: 36px; }
.budgets { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); align-items: start; }
.budget { background: var(--paper); color: var(--paper-ink); border-radius: 10px; padding: 18px 18px 14px; box-shadow: 0 1px 2px rgba(21,33,59,.08), 0 10px 26px rgba(21,33,59,.12); min-width: 0; }
.budget-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 10px; border-bottom: 1.5px dashed var(--paper-rule); }
.budget-head h3 { margin: 0; font-size: 1rem; line-height: 1.25; }
.verdict { font-family: var(--mono); font-size: .7rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 4px 8px; border-radius: 99px; white-space: nowrap; color: #15213b; }
.verdict.ok { background: #8fe0b8; }
.verdict.mid { background: #ffe14d; }
.verdict.hard { background: #f6a48f; }
.budget-table { width: 100%; border-collapse: collapse; font-size: .86rem; margin: 6px 0 10px; }
.budget-table td { padding: 7px 0; border-bottom: 1px dotted var(--paper-rule); color: var(--paper-ink); }
.budget-table td.num { text-align: right; font-family: var(--mono); font-weight: 600; padding-left: 10px; }
.budget-table tr.total td { border-top: 1.5px solid var(--paper-ink); font-weight: 700; }
.budget-table tr.left td { font-weight: 700; color: #1f8a5b; border-bottom: 0; }
.budget-table tr.short td { font-weight: 700; color: #b4372a; border-bottom: 0; }
.budget .muted { color: var(--paper-muted); margin: 0; }
