/* Warren Buffett Stock Portfolio — Berkshire Activity Tracker
   Shared stylesheet — used by every page in /  */

:root {
  --surface-0: #e8e9e1;
  --surface-1: #f5f5ef;
  --surface-2: #dcddd2;
  --border: #c7c9bc;
  --text-primary: #1b2129;
  --text-muted: #5b6270;
  --accent: #8a6a2f;
  --accent-soft: #ded0ac;
  --positive: #3f6b4d;
  --positive-soft: #d7e3d9;
  --negative: #8a4636;
  --negative-soft: #ecdcd5;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-0: #10161f;
    --surface-1: #171f2b;
    --surface-2: #1e2836;
    --border: #2a3546;
    --text-primary: #e9e4d6;
    --text-muted: #8b93a3;
    --accent: #c69a4e;
    --accent-soft: #3a2f1b;
    --positive: #6b9c7d;
    --positive-soft: #1c2c22;
    --negative: #b2695a;
    --negative-soft: #2e1e1a;
  }
}
:root[data-theme="dark"] {
  --surface-0: #10161f;
  --surface-1: #171f2b;
  --surface-2: #1e2836;
  --border: #2a3546;
  --text-primary: #e9e4d6;
  --text-muted: #8b93a3;
  --accent: #c69a4e;
  --accent-soft: #3a2f1b;
  --positive: #6b9c7d;
  --positive-soft: #1c2c22;
  --negative: #b2695a;
  --negative-soft: #2e1e1a;
}

* { box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
a { color: inherit; }
h1, h2, h3 { font-family: "Fraunces", Georgia, "Times New Roman", serif; text-wrap: balance; margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 28px; }

/* ticker */
.ticker-band { background: var(--surface-1); border-bottom: 1px solid var(--border); overflow: hidden; white-space: nowrap; padding: 7px 0; }
.ticker-track { display: inline-flex; gap: 36px; padding-left: 100%; animation: scroll-ticker 42s linear infinite; }
@keyframes scroll-ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.ticker-item { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: var(--text-muted); letter-spacing: 0.02em; }
.ticker-item b { color: var(--text-primary); font-weight: 600; }
.ticker-item .up { color: var(--positive); }
.ticker-item .down { color: var(--negative); }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; padding-left: 24px; } }

/* nav */
nav.top { position: sticky; top: 0; z-index: 10; background: var(--surface-0); border-bottom: 1px solid var(--border); }
nav.top .row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 24px; }
.wordmark { display: flex; flex-direction: column; line-height: 1.1; text-decoration: none; }
.wordmark .name { font-family: "Fraunces", serif; font-weight: 600; font-size: 18px; color: var(--text-primary); }
.wordmark .sub { font-size: 11px; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }
.navlinks { display: flex; gap: 26px; font-size: 14px; }
.navlinks a { text-decoration: none; color: var(--text-muted); border-bottom: 1px solid transparent; padding-bottom: 2px; transition: color .15s, border-color .15s; }
.navlinks a:hover, .navlinks a:focus-visible { color: var(--text-primary); border-color: var(--accent); }
.navlinks a[aria-current="page"] { color: var(--text-primary); border-color: var(--accent); }
.navlinks a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
@media (max-width: 760px) { .navlinks { display: none; } }

/* hero */
.hero { padding: 56px 0 40px; border-bottom: 1px solid var(--border); }
.eyebrow { font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px; font-weight: 600; }
.hero h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 500; max-width: 18ch; }
.hero p.lede { max-width: 62ch; color: var(--text-muted); font-size: 17px; margin-top: 18px; }
.hero .distinction { margin-top: 18px; max-width: 62ch; font-size: 14.5px; color: var(--text-muted); padding: 12px 16px; border-left: 2px solid var(--accent); background: var(--surface-1); }
.hero .distinction b { color: var(--text-primary); }
.breadcrumb { font-size: 12.5px; color: var(--text-muted); margin-bottom: 12px; }
.breadcrumb a { text-decoration: none; border-bottom: 1px solid var(--border); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); margin-top: 32px; }
.stat { background: var(--surface-1); padding: 18px 20px; }
.stat .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); }
.stat .value { font-family: "IBM Plex Mono", monospace; font-size: 22px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .note { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
@media (max-width: 720px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

/* sections */
main { padding-bottom: 8px; }
section { padding: 48px 0; border-bottom: 1px solid var(--border); }
section.tight { padding: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.section-head h2 { font-size: 23px; font-weight: 500; }
.section-head .meta { font-size: 13px; color: var(--text-muted); }

.two-col { display: grid; grid-template-columns: 1.1fr 1.4fr; gap: 40px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* ledger */
.ledger { border: 1px solid var(--border); background: var(--surface-1); }
.ledger-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.ledger-row:last-child { border-bottom: none; }
.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
.tag.new, .tag.add { color: var(--positive); background: var(--positive-soft); }
.tag.trim, .tag.exit { color: var(--negative); background: var(--negative-soft); }
.ledger-row .who { flex: 1; font-size: 14.5px; }
.ledger-row .who .ticker { font-family: "IBM Plex Mono", monospace; font-weight: 600; }
.ledger-row .detail { font-size: 13px; color: var(--text-muted); }
.ledger-foot { padding: 12px 16px; font-size: 12.5px; color: var(--text-muted); background: var(--surface-2); }

/* holdings table */
table.holdings { width: 100%; border-collapse: collapse; }
table.holdings th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 600; padding: 0 0 10px; border-bottom: 1px solid var(--border); }
table.holdings td { padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; vertical-align: middle; }
table.holdings tr:last-child td { border-bottom: none; }
table.holdings td.rank { color: var(--text-muted); font-family: "IBM Plex Mono", monospace; width: 28px; }
table.holdings td.ticker { font-family: "IBM Plex Mono", monospace; font-weight: 600; width: 70px; }
table.holdings td.company { color: var(--text-muted); }
table.holdings td.value { font-family: "IBM Plex Mono", monospace; text-align: right; width: 84px; font-variant-numeric: tabular-nums; color: var(--text-muted); }
table.holdings td.pct { font-family: "IBM Plex Mono", monospace; text-align: right; width: 64px; font-variant-numeric: tabular-nums; }
.bar-cell { width: 140px; }
.bar-track { height: 6px; background: var(--surface-2); width: 100%; }
.bar-fill { height: 100%; background: var(--accent); }
.table-scroll { overflow-x: auto; }

/* 13F archive */
.archive-strip { display: flex; gap: 0; border: 1px solid var(--border); background: var(--surface-1); overflow-x: auto; }
.filing { flex: 1; min-width: 150px; padding: 16px 18px; border-right: 1px solid var(--border); }
.filing:last-child { border-right: none; }
.filing.current { background: var(--accent-soft); }
.filing .q { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 600; }
.filing .date { font-family: "IBM Plex Mono", monospace; font-size: 14px; margin-top: 6px; }
.filing .status { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.filing a.sec-link { font-size: 12px; color: var(--accent); text-decoration: underline; }

.roadmap-note { margin-top: 22px; font-size: 13.5px; color: var(--text-muted); border-left: 2px solid var(--border); padding-left: 14px; }

/* performance chart */
.chart-card { border: 1px solid var(--border); background: var(--surface-1); padding: 20px; }
.chart-legend { display: flex; gap: 22px; margin-bottom: 6px; font-size: 13px; }
.chart-legend .item { display: flex; align-items: center; gap: 7px; color: var(--text-muted); }
.chart-legend .swatch { width: 12px; height: 3px; border-radius: 2px; }
canvas#perf-canvas { width: 100%; height: 340px; display: block; }
.perf-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); margin-top: 24px; }
@media (max-width: 720px) { .perf-summary { grid-template-columns: repeat(2, 1fr); } }
.perf-cell { background: var(--surface-1); padding: 14px 16px; }
.perf-cell .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.perf-cell .v { font-family: "IBM Plex Mono", monospace; font-size: 17px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.perf-cell .v.pos { color: var(--positive); }
.perf-cell .v.neg { color: var(--negative); }
.data-table-note { font-size: 12.5px; color: var(--text-muted); margin-top: 14px; }

/* prose (about / legal pages) */
.prose { max-width: 68ch; font-size: 15.5px; }
.prose h2 { font-size: 21px; font-weight: 500; margin-top: 36px; margin-bottom: 12px; }
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0 0 14px; color: var(--text-primary); }
.prose p.muted { color: var(--text-muted); font-size: 14px; }
.prose ul { margin: 0 0 14px; padding-left: 20px; color: var(--text-primary); }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--text-primary); }
.callout { border-left: 2px solid var(--accent); background: var(--surface-1); padding: 14px 16px; font-size: 14px; color: var(--text-muted); margin: 22px 0; }
.callout b { color: var(--text-primary); }

.contact-card { border: 1px solid var(--border); background: var(--surface-1); padding: 22px 24px; max-width: 46ch; }
.contact-card .row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.contact-card .row:last-child { border-bottom: none; }
.contact-card .k { color: var(--text-muted); }

/* 404 */
.error-hero { padding: 90px 0; text-align: left; border-bottom: none; }
.error-hero .code { font-family: "IBM Plex Mono", monospace; font-size: 15px; color: var(--accent); }
.error-hero h1 { margin-top: 14px; }
.error-hero p { color: var(--text-muted); max-width: 52ch; margin-top: 14px; }
.btn { display: inline-block; margin-top: 22px; padding: 10px 18px; background: var(--accent); color: var(--surface-1); text-decoration: none; font-size: 14px; font-weight: 600; }

footer { padding: 32px 0 48px; }
footer .footer-grid { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; }
footer p { font-size: 12.5px; color: var(--text-muted); max-width: 62ch; margin: 0 0 8px; }
footer .sources { font-size: 12px; }
footer .sources a { color: var(--text-muted); text-decoration: underline; text-decoration-color: var(--border); }
footer .footlinks { display: flex; gap: 16px; font-size: 13px; }
footer .footlinks a { text-decoration: none; color: var(--text-muted); border-bottom: 1px solid var(--border); }
footer .footlinks a:hover { color: var(--text-primary); border-color: var(--accent); }
