/* Lodgerwell — shared base (LANDING owns this file; /docs and /ledger use it too).
   Household-ledger look: cream paper, ink, terracotta = rent/warnings, olive = income.
   Light theme only. Fonts self-hosted in /fonts (OFL, see /fonts/LICENSE.txt). */

@font-face { font-family: 'Fraunces'; src: url(/fonts/fraunces-latin-full-normal.woff2) format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url(/fonts/fraunces-latin-full-italic.woff2) format('woff2'); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url(/fonts/figtree-latin-wght-normal.woff2) format('woff2'); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url(/fonts/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url(/fonts/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #F6F1E7;      /* page */
  --paper-2: #EEE7D8;    /* sunken wells, code */
  --card: #FFFCF6;       /* raised cards */
  --ink: #1E1B16;
  --ink-2: #4A443A;      /* secondary text */
  --ink-3: #6B6357;      /* muted text (AA on paper + card) */
  --line: #E4DBC9;
  --line-2: #D2C6AF;
  --rent: #D4573B;       /* rent, warnings, "short" */
  --rent-ink: #A9402A;   /* rent colour for small text (AA) */
  --rent-tint: #F8E2D9;
  --income: #4F7A4A;     /* income, positive */
  --income-ink: #3E6639;
  --income-tint: #E3ECDA;
  --f-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --f-ui: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 9px;
  --shadow: 0 1px 0 rgba(30, 27, 22, .04), 0 10px 28px -16px rgba(60, 44, 20, .28);
  --shadow-sm: 0 1px 0 rgba(30, 27, 22, .05), 0 4px 12px -8px rgba(60, 44, 20, .3);
  --gutter: clamp(16px, 3.2vw, 32px);
  --max: 1220px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-ui); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--rent); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--income-tint); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.stack > * + * { margin-top: var(--stack, 16px); }
.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; }

/* ---------- type ---------- */
.display, h1, h2, h3 { font-family: var(--f-display); font-weight: 560; letter-spacing: -.012em; line-height: 1.05; margin: 0; font-variation-settings: 'SOFT' 100, 'WONK' 0; font-optical-sizing: auto; }
h1 { font-size: clamp(36px, 5.4vw, 64px); }
h2 { font-size: clamp(26px, 3.2vw, 36px); }
h3 { font-size: 21px; line-height: 1.2; }
.eyebrow { font-family: var(--f-ui); font-size: 12px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 0; }
.lede { font-size: clamp(16px, 1.5vw, 18px); color: var(--ink-2); max-width: 60ch; margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 13.5px; }
.mono, code, kbd, samp, pre { font-family: var(--f-mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--income-ink); }
.neg { color: var(--rent-ink); }

/* ---------- top bar (same markup on every page; see STATUS-LANDING.md) ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-family: var(--f-display); font-weight: 620; font-size: 22px; letter-spacing: -.01em; font-variation-settings: 'SOFT' 100; white-space: nowrap; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.brand .ticker { font-family: var(--f-mono); font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a { text-decoration: none; font-size: 15px; font-weight: 550; padding: 8px 11px; border-radius: 999px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }
.nav .x-link svg { width: 15px; height: 15px; }
.nav a.btn-ink, .nav a.btn-ink:hover { color: var(--paper); background: var(--ink); padding: 0 14px; margin-left: 6px; }
@media (max-width: 720px) {
  .topbar .wrap { min-height: 56px; gap: 8px; }
  .brand { font-size: 20px; }
  .nav a { padding: 7px 8px; font-size: 14px; }
  .nav .hide-sm { display: none; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font-weight: 650; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s; }
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-ink:hover { background: #33302a; }
.btn-rent { background: var(--rent); color: #fff; border-color: var(--rent); }
.btn-rent:hover { background: #bf4b31; border-color: #bf4b31; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--paper-2); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: clamp(18px, 2vw, 26px); position: relative; min-width: 0; }
.card-flat { background: transparent; box-shadow: none; }
.card-sunk { background: var(--paper-2); border-color: transparent; box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

/* ---------- pills, tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--paper-2); font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.ok { background: var(--income); box-shadow: 0 0 0 3px var(--income-tint); }
.dot.bad { background: var(--rent); box-shadow: 0 0 0 3px var(--rent-tint); }
.dot.idle { background: #A79D8B; }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: lowercase; background: var(--paper-2); color: var(--ink-2); }
.tag-income { background: var(--income-tint); color: var(--income-ink); }
.tag-rent { background: var(--rent-tint); color: var(--rent-ink); }
.tag-buy { background: #E7E2F0; color: #4B3F6B; }
.tag-sell { background: #F1E6CC; color: #7A5A12; }
.tag-refill { background: #DDE8EE; color: #2F5568; }
.tag-burn { background: #ECE3DD; color: #6B3E2A; }
.tag-writeoff { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-3); }

/* ---------- addresses + copy ---------- */
.addr { font-family: var(--f-mono); font-size: 13.5px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.copy { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px; margin: -6px; border-radius: 8px; cursor: pointer; color: var(--ink-2); }
.copy:hover { background: var(--paper-2); color: var(--ink); }
.copy svg { width: 15px; height: 15px; }
.copy.is-done { color: var(--income-ink); }
.ext { display: inline-flex; align-items: center; gap: 3px; }
.ext::after { content: '\2197'; font-family: var(--f-ui); font-size: .9em; }

/* ---------- code / json ---------- */
pre, .code { background: var(--paper-2); border-radius: var(--r-md); padding: 14px 16px; margin: 0; overflow: auto; font-size: 13px; line-height: 1.6; color: var(--ink); tab-size: 2; }
pre code { font-size: inherit; }
:not(pre) > code { background: var(--paper-2); padding: 1px 6px; border-radius: 6px; font-size: .88em; }
.j-key { color: #6B4A2B; }
.j-str { color: var(--income-ink); }
.j-num { color: #2F5568; }
.j-lit { color: var(--rent-ink); }

/* ---------- tables (ledger, holdings) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 calc(-1 * clamp(18px, 2vw, 26px)); padding: 0 clamp(18px, 2vw, 26px); }
table.ledger { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
table.ledger th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding: 0 12px 10px 0; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
table.ledger td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.ledger tr:last-child td { border-bottom: 0; }
table.ledger .r { text-align: right; }
table.ledger td.amt { font-family: var(--f-mono); font-size: 14px; white-space: nowrap; }
table.ledger a { text-decoration: none; font-family: var(--f-mono); font-size: 13px; color: var(--ink-2); }
table.ledger a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- prose (docs) ---------- */
.prose { max-width: 72ch; }
.prose h2 { margin: 48px 0 14px; scroll-margin-top: 84px; }
.prose h3 { margin: 28px 0 10px; scroll-margin-top: 84px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; color: var(--ink-2); }
.prose li + li { margin-top: 6px; }
.prose pre { margin: 0 0 18px; }
.prose strong { color: var(--ink); }

/* ---------- notices ---------- */
.notice { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--r-md); padding: 14px 16px; background: var(--paper-2); color: var(--ink-2); font-size: 14.5px; }
.notice-rent { background: var(--rent-tint); color: #5E2416; }
.notice-ok { background: var(--income-tint); color: #24401F; }

/* ---------- footer ---------- */
.site-footer { margin-top: 72px; border-top: 1px solid var(--line); padding: 32px 0 48px; font-size: 14px; color: var(--ink-2); }
.site-footer .cols { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 28px; }
.site-footer h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li + li { margin-top: 6px; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.disclaimer { margin-top: 28px; font-size: 13px; color: var(--ink-3); max-width: 90ch; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr; gap: 20px; } }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- stale / skeleton ---------- */
.is-stale .live-val { opacity: .5; }
.skel { display: inline-block; min-width: 3ch; color: transparent !important; background: linear-gradient(90deg, var(--paper-2), #F5EFE3, var(--paper-2)); background-size: 200% 100%; border-radius: 6px; animation: skel 1.4s linear infinite; }
@keyframes skel { to { background-position: -200% 0; } }

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