/* ============================================================
   AR2EB — design system
   Document mode. Stripe Press gravitas + Linear restraint.
   ============================================================ */

:root {
  --paper:   #faf9f6;
  --paper-2: #f3f1eb;   /* category card hover, table band */
  --ink:     #0e0e0e;
  --ink-2:   #2a2a2a;
  --muted:   #6b6b66;
  --muted-2: #9a9a93;
  --rule:    #e3e0d8;
  --rule-2:  #d3cfc4;
  --accent:  #3d46b8;    /* desaturated dark indigo */
  --accent-ink: #2d3499;
  --neg:     #b8403f;    /* muted red */
  --pos:     #2f8f4f;    /* muted green */
  --ultra:   #7629a6;    /* deep purple — ULTRA BULL only */

  --r-sm: 4px;
  --r-md: 6px;

  --gutter: 96px;
  --gutter-sm: 24px;

  --type-display: 'Inter', system-ui, sans-serif;
  --type-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--paper); }
body {
  font-family: var(--type-display);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }

button { font: inherit; cursor: pointer; }

::selection { background: var(--ink); color: var(--paper); }

/* ---- type ---- */
.mono { font-family: var(--type-mono); font-feature-settings: 'tnum'; }
.tnum { font-variant-numeric: tabular-nums; }
.eyebrow {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-ink);
  font-weight: 500;
}
.muted { color: var(--muted); }

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 44px; line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: 30px; line-height: 1.2; letter-spacing: -0.015em; }
h3 { font-size: 20px; line-height: 1.3; }
h4 { font-size: 15px; line-height: 1.35; }

p { margin: 0 0 1em 0; text-wrap: pretty; }

/* ---- layout ---- */
.page  { min-height: 100vh; display: flex; flex-direction: column; }
.shell { flex: 1; }
.wrap  { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---- top header (every page) ---- */
.topbar {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.topbar-logo { display: flex; align-items: center; }
.topbar-logo img { height: 28px; display: block; }
.topbar-nav { display: flex; gap: 32px; align-items: center; }
.topbar-nav a {
  font-size: 14px;
  color: var(--ink-2);
  transition: color 160ms ease;
}
.topbar-nav a.active { color: var(--accent-ink); }
.topbar-nav a:hover  { color: var(--accent-ink); }

/* ---- footer ---- */
.footer {
  border-top: 1px solid var(--rule);
  padding: 40px 0 56px;
  margin-top: 96px;
  color: var(--muted);
  font-size: 12px;
}
.footer-strip {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  align-items: baseline;
}
.footer-strip .dot { color: var(--muted-2); }
.footer-strip a { color: var(--accent-ink); }
.footer-strip a:hover { text-decoration: underline; }
.footer-bottom {
  margin-top: 24px;
  display: flex; justify-content: space-between; flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
}
.footer-bottom a { color: var(--ink-2); }
.footer-bottom a:hover { color: var(--accent-ink); }

/* ---- hero (home) ---- */
.hero {
  padding: 120px 0 96px;
  border-bottom: 1px solid var(--rule);
}
.hero-logo {
  display: block;
  width: 420px; max-width: 100%;
  margin-bottom: 56px;
}
.hero-tagline {
  font-size: 36px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 920px;
  margin: 0 0 28px 0;
}
.hero-sub {
  font-size: 18px;
  color: var(--muted);
  max-width: 720px;
  margin: 0;
  line-height: 1.55;
}

/* ---- category cards (home) ---- */
.cat-section { padding: 80px 0; }
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--rule);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.cat-card {
  background: var(--paper);
  padding: 56px 48px;
  display: flex; flex-direction: column;
  cursor: pointer;
  transition: background 160ms ease;
}
.cat-card:hover { background: var(--paper-2); }
.cat-card .cat-eyebrow {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 24px;
}
.cat-card h2 { margin-bottom: 6px; }
.cat-card .cat-sub {
  font-size: 16px; color: var(--muted);
  margin-bottom: 24px;
  font-style: italic;
}
.cat-card .cat-desc {
  font-size: 15px; color: var(--ink-2);
  line-height: 1.6;
  margin-bottom: 32px;
  flex: 1;
}
.cat-card .cat-go {
  display: inline-flex; gap: 8px; align-items: center;
  font-family: var(--type-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.cat-card .cat-go .arrow { transition: transform 200ms ease; }
.cat-card:hover .cat-go .arrow { transform: translateX(4px); }

.badge-count {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--rule);
  padding: 4px 8px;
  border-radius: var(--r-sm);
}

/* ---- recent memos ---- */
.recent { padding: 24px 0 0; }
.recent h3 { margin-bottom: 24px; }
.recent-list { border-top: 1px solid var(--rule); }
.recent-row {
  display: grid;
  grid-template-columns: 90px 1fr 200px 100px;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
  cursor: pointer;
  transition: background 160ms ease;
  margin: 0 -16px;
  padding-left: 16px; padding-right: 16px;
}
.recent-row:hover { background: var(--paper-2); }
.recent-row .ticker {
  font-family: var(--type-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}
.recent-row .title {
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.recent-row .head {
  font-size: 14px;
  color: var(--muted);
}
.recent-row .date {
  font-family: var(--type-mono);
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

/* ---- category index page ---- */
.cat-header { padding: 96px 0 64px; border-bottom: 1px solid var(--rule); }
.cat-header h1 { margin-bottom: 24px; max-width: 720px; }
.cat-header p { font-size: 18px; color: var(--ink-2); max-width: 780px; }

.cat-controls {
  display: flex; justify-content: space-between; align-items: center;
  padding: 32px 0 0;
  font-family: var(--type-mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.cat-controls .sort {
  display: inline-flex; gap: 6px; align-items: center;
  border: 1px solid var(--rule);
  background: var(--paper);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  color: var(--ink-2);
}

.memo-list { margin-top: 48px; }
.memo-card {
  display: grid;
  grid-template-columns: 64px 1fr 220px;
  gap: 36px;
  align-items: start;
  padding: 32px 16px;
  margin: 0 -16px;
  border-top: 1px solid var(--rule);
  cursor: pointer;
  transition: background 160ms ease;
}
.memo-card:last-child { border-bottom: 1px solid var(--rule); }
.memo-card:hover { background: var(--paper-2); }

.ticker-badge {
  width: 64px; height: 64px;
  border: 1px solid var(--rule-2);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--type-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
  border-radius: var(--r-sm);
}

.memo-card .name {
  font-size: 18px; font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.memo-card .name .ex {
  font-family: var(--type-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-left: 8px;
}
.memo-card .dcf {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}
.memo-card .q {
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.55;
  max-width: 620px;
}

.memo-card .pricing {
  text-align: right;
  font-family: var(--type-mono);
  font-variant-numeric: tabular-nums;
}
.pricing .row {
  display: flex; justify-content: flex-end; gap: 10px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.pricing .v { font-size: 18px; color: var(--ink); font-weight: 500; letter-spacing: 0; }
.pricing .delta-pos { color: var(--pos); }
.pricing .delta-neg { color: var(--neg); }
.pricing .lbl { font-size: 10px; color: var(--muted-2); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 14px;}

/* ---- memo detail page ---- */
.memo-head { padding: 80px 0 56px; border-bottom: 1px solid var(--rule); }
.memo-head .eyebrow { margin-bottom: 32px; }
.memo-head .row1 {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: end;
}
.memo-head h1 { font-size: 56px; letter-spacing: -0.025em; line-height: 1.05; margin-bottom: 18px; }
.memo-head .meta {
  font-family: var(--type-mono);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  align-items: baseline;
}
.memo-head .meta .dot { color: var(--muted-2); }
.memo-head .meta b { color: var(--ink-2); font-weight: 500; }
.memo-head .spot {
  text-align: right;
  font-family: var(--type-mono);
  font-variant-numeric: tabular-nums;
}
.memo-head .spot .label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.memo-head .spot .price { font-size: 44px; color: var(--ink); letter-spacing: -0.01em; line-height: 1; }
.memo-head .spot .as-of { font-size: 11px; color: var(--muted-2); margin-top: 6px; letter-spacing: 0.06em; }


/* ---- pdf cta ---- */
.pdf-cta-wrap { padding: 64px 0; border-bottom: 1px solid var(--rule); }
.pdf-cta {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--ink);
  padding: 28px 32px;
  border-radius: var(--r-md);
  background: var(--paper);
  transition: background 160ms ease;
}
.pdf-cta:hover { background: var(--ink); color: var(--paper); }
.pdf-cta .left .ttl { font-size: 19px; font-weight: 500; margin-bottom: 4px; }
.pdf-cta .left .meta {
  font-family: var(--type-mono); font-size: 11px;
  letter-spacing: 0.06em; color: var(--muted);
}
.pdf-cta:hover .left .meta { color: var(--muted-2); }
.pdf-cta .right {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--type-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- prior versions disclosure (under PDF download CTA) ──────────────
   Discloses historical immutable PDFs by version + as-of date + spot. */
.prior-versions { margin-top: 16px; }
.prior-versions summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 4px 0;
}
.prior-versions summary::-webkit-details-marker { display: none; }
.prior-versions summary::before {
  content: '▸';
  display: inline-block;
  font-size: 10px;
  color: var(--muted-2);
  transition: transform 120ms;
}
.prior-versions[open] summary::before { transform: rotate(90deg); }
.prior-versions summary:hover { color: var(--accent-ink); }
.prior-versions summary .mono { color: var(--muted); }
.prior-versions-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  border-top: 0.5pt solid var(--rule);
}
.prior-versions-list li { border-bottom: 0.5pt solid var(--rule); }
.prior-versions-list a {
  display: grid;
  grid-template-columns: 60px 1fr auto auto auto;
  gap: 16px;
  align-items: baseline;
  padding: 12px 4px;
  color: var(--ink-2);
  font-size: 13px;
  transition: background 120ms;
}
.prior-versions-list a:hover {
  background: var(--paper-2);
  color: var(--accent-ink);
}
.prior-versions-list .pv-version {
  font-weight: 600;
  color: var(--ink);
}
.prior-versions-list .pv-asof { color: var(--muted); }
.prior-versions-list .pv-spot { color: var(--ink-2); }
.prior-versions-list .pv-size {
  color: var(--muted-2);
  font-size: 11px;
}
.prior-versions-list .pv-arrow {
  color: var(--muted-2);
  font-size: 12px;
}
.prior-versions-list a:hover .pv-arrow { color: var(--accent); }
.prior-versions-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 720px;
}
@media (max-width: 600px) {
  .prior-versions-list a {
    grid-template-columns: 48px 1fr auto;
    grid-template-areas:
      "v asof arrow"
      "v spot size";
    row-gap: 2px;
  }
  .prior-versions-list .pv-version { grid-area: v; align-self: center; }
  .prior-versions-list .pv-asof { grid-area: asof; }
  .prior-versions-list .pv-spot { grid-area: spot; }
  .prior-versions-list .pv-size { grid-area: size; text-align: right; }
  .prior-versions-list .pv-arrow { grid-area: arrow; align-self: center; }
}

/* ---- disclaimer block ---- */
.disclaim {
  padding: 56px 0 24px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}
.disclaim h6 {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
  margin: 0 0 10px;
}
.disclaim p { margin: 0 0 18px; max-width: 780px; }

/* ---- about page ---- */
.about-page { padding: 96px 0; }
.about-page h1 { margin-bottom: 40px; }
.about-page h3 { margin: 48px 0 14px; }
.about-page p { font-size: 17px; color: var(--ink-2); line-height: 1.7; max-width: 720px; }
.about-page .kv {
  margin: 56px 0 0;
  display: grid;
  grid-template-columns: 140px 1fr;
  border-top: 1px solid var(--rule);
}
.about-page .kv > * {
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 15px;
}
.about-page .kv .k {
  font-family: var(--type-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  align-self: center;
}
.about-page .kv .v { color: var(--ink); }
.about-page .kv .v a { color: var(--accent-ink); }
.about-page .kv .v a:hover { text-decoration: underline; }

/* Thesis & method — reuses .about-page; lead-in + closing get distinct weight. */
.thesis-page h1 { max-width: 820px; letter-spacing: -0.02em; }
.thesis-page .thesis-lead {
  font-size: 20px;
  line-height: 1.55;
  color: var(--ink);
  margin: 28px 0 8px;
  max-width: 760px;
}
.thesis-page .thesis-close {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-size: 16px;
  color: var(--muted);
}
.thesis-page .thesis-close a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.thesis-page .thesis-close a:hover { color: var(--accent); }

/* ---- disclaimers page ---- */
.disclaimers-page { padding: 96px 0; }
.disclaimers-page h1 { margin-bottom: 24px; }
.disclaimers-page .lead { font-size: 18px; color: var(--muted); margin-bottom: 56px; max-width: 720px; }
.disclaimers-page section { padding: 32px 0; border-top: 1px solid var(--rule); max-width: 800px; }
.disclaimers-page section:last-child { border-bottom: 1px solid var(--rule); }
.disclaimers-page h3 { margin-bottom: 14px; font-size: 18px; }
.disclaimers-page p { font-size: 15px; color: var(--ink-2); line-height: 1.7; }

/* ---- responsive ---- */
/* Topbar nav has two label variants per long-named item: full text for
   desktop ("Asymmetrical Moonshots") and short text for mobile ("Moonshots").
   Default = desktop. The mobile media query below swaps them. */
.nav-label-short { display: none; }
.nav-label-full { display: inline; }

@media (max-width: 1024px) {
  :root { --gutter: 56px; }
  h1 { font-size: 36px; }
  .memo-head h1 { font-size: 44px; }
}
@media (max-width: 760px) {
  :root { --gutter: 32px; }
  body { font-size: 16px; }
  .topbar-nav { gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
  .topbar-nav a { font-size: 13px; white-space: nowrap; }
  .nav-label-full  { display: none; }
  .nav-label-short { display: inline; }
  .hero { padding: 72px 0 64px; }
  .hero-logo { width: 280px; margin-bottom: 36px; }
  .hero-tagline { font-size: 24px; }
  .hero-sub { font-size: 16px; }
  .cat-grid { grid-template-columns: 1fr; }
  .cat-card { padding: 36px 28px; }
  .recent-row {
    grid-template-columns: 60px 1fr;
    grid-template-areas:
      "tk title"
      "tk head"
      ".  date";
    row-gap: 4px;
  }
  .recent-row .ticker { grid-area: tk; }
  .recent-row .title  { grid-area: title; }
  .recent-row .head   { grid-area: head; }
  .recent-row .date   { grid-area: date; text-align: left; }

  .memo-card { grid-template-columns: 56px 1fr; gap: 20px; }
  .memo-card .pricing { grid-column: 1 / -1; text-align: left; padding-top: 4px; }
  .pricing .row { justify-content: flex-start; }

  .memo-head .row1 { grid-template-columns: 1fr; }
  .memo-head .spot { text-align: left; }
  .memo-head h1 { font-size: 32px; }

  .pdf-cta { flex-direction: column; gap: 18px; align-items: flex-start; }

  h1 { font-size: 30px; }
  h2 { font-size: 24px; }
}

/* ---- focus styles ---- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Embedded memo viewer ─────────────────────────────────────────────
   MemoPage embeds the full 5-page JSX memo (same components as the PDF
   print harness). Each .memo-page is 14"×8.5" native; the JS in
   <EmbeddedMemo> scales the inner wrapper to fit the container. The
   memo-page footer is print-only (absolute positioned overlapping
   content); the site uses normal flow so we re-flow the page chrome. */
.memo-embed-section .memo-embed-wrap {
  overflow: hidden;
  /* Height is set in JS (EmbeddedMemo) to the scaled content height, so it
     reserves the right space for any page count — 5, or 6 with the §6d
     competitive page. min-height is just a pre-JS-paint placeholder. */
  min-height: 60vh;
  background: transparent;   /* beige page bg shows through the inter-page gaps */
}
.memo-embed-section .memo-embed-inner {
  /* JS sets transform: scale(); the page components retain their native
     pt sizing for layout fidelity with the PDF. */
}
/* On the website the .memo-page base box (14×8.5 + padding) is NOT inherited from
   print.html — re-create it here so the site renders the content exactly like the
   PDF: a 12in × 7.4in content area inside a 1in/0.55in white frame. Without this
   the content fills the full 14in and the black text butts the white edge. Then add
   web-only chrome — a white card + a beige gap between pages. The PDF is untouched. */
.memo-embed-section .memo-page {
  width: 14in;
  height: 8.5in;
  padding: 0.55in 1in;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  background: #ffffff;
  border: 1px solid #ece7dd;
  margin: 0 auto 0.5in;
  page-break-after: auto;
  break-after: auto;
}
.memo-embed-section .memo-page:last-child { margin-bottom: 0; }

/* ── Portfolio page ─────────────────────────────────────────────────────
   Cross-asset weighting per spec §12. Result-first hierarchy: hero block
   leads with weighted upside + deployed%, then the allocation bar gives
   the portfolio at a glance, controls sit below, math table + method
   collapse follow. */

/* Two-tone allocation palette: longs get accent-shaded indigos, cash is
   a quiet warm grey. Tokens are local to the portfolio block so they
   don't leak into the rest of the site. */
.portfolio-allocation,
.portfolio-hero {
  --alloc-long-0: var(--accent);            /* primary indigo */
  --alloc-long-1: #6a73d4;                  /* lighter indigo */
  --alloc-long-2: #8b91dd;                  /* lighter still (3rd long, if any) */
  --alloc-long-3: #abafe6;                  /* 4th */
  --alloc-cash:   #d9d4c8;                  /* warm pale grey */
}

.portfolio-head { padding: 56px 0 16px; }
.portfolio-head h1 { margin: 8px 0 12px; }
.portfolio-head .lead {
  max-width: 720px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}
.portfolio-head .lead a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Hero — the headline numbers. Two stacked figures, separator, meta row. */
.portfolio-hero { padding: 8px 0 32px; }
.portfolio-hero .hero-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 32px;
  background: linear-gradient(180deg, #fcfbf8 0%, #fafafa 100%);
  border: 0.5pt solid var(--rule);
  border-radius: 8px;
}
.portfolio-hero .hero-numbers {
  display: flex;
  align-items: flex-end;
  gap: 32px;
  flex-wrap: wrap;
}
.portfolio-hero .hero-primary,
.portfolio-hero .hero-secondary {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.portfolio-hero .big-number {
  font-family: 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.portfolio-hero .hero-secondary .big-number { font-size: 36px; color: var(--ink-2); }
.portfolio-hero .big-number.delta-pos { color: var(--pos); }
.portfolio-hero .big-number.delta-neg { color: var(--neg); }
.portfolio-hero .big-label {
  font-size: 12px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}
.portfolio-hero .hero-sep {
  width: 0.5pt;
  align-self: stretch;
  background: var(--rule);
  margin: 4px 0 8px;
}
.portfolio-hero .hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--muted);
  padding-top: 8px;
  border-top: 0.5pt solid var(--rule);
}
.portfolio-hero .hero-meta b { color: var(--ink); font-weight: 600; }
.portfolio-hero .meta-sep { color: var(--rule-2); }
@media (max-width: 600px) {
  .portfolio-hero .hero-card { padding: 20px 20px; }
  .portfolio-hero .big-number { font-size: 40px; }
  .portfolio-hero .hero-secondary .big-number { font-size: 26px; }
  .portfolio-hero .hero-sep { display: none; }
}

/* Allocation — single stacked horizontal bar + legend list */
.portfolio-allocation { padding: 16px 0 32px; }
.portfolio-allocation .eyebrow { margin-bottom: 12px; }
.portfolio-allocation .alloc-empty {
  font-style: italic; color: var(--muted-2); padding: 24px 0;
}
.portfolio-allocation .alloc-bar {
  display: flex;
  width: 100%;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--rule);
  box-shadow: inset 0 0 0 0.5pt var(--rule-2);
}
.portfolio-allocation .alloc-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 220ms ease-out;
  position: relative;
  min-width: 2px;
}
.portfolio-allocation .alloc-seg-long.alloc-shade-0 { background: var(--alloc-long-0); }
.portfolio-allocation .alloc-seg-long.alloc-shade-1 { background: var(--alloc-long-1); }
.portfolio-allocation .alloc-seg-long.alloc-shade-2 { background: var(--alloc-long-2); }
.portfolio-allocation .alloc-seg-long.alloc-shade-3 { background: var(--alloc-long-3); }
.portfolio-allocation .alloc-seg-cash { background: var(--alloc-cash); }
.portfolio-allocation .alloc-seg-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portfolio-allocation .alloc-seg-cash .alloc-seg-label { color: var(--ink-2); }
.portfolio-allocation .alloc-seg-label .p {
  font-size: 11px;
  opacity: 0.85;
  font-weight: 500;
}
.portfolio-allocation .alloc-seg-cash .alloc-seg-label .p { color: var(--muted); opacity: 1; }
/* Hide in-bar labels when segment is too narrow to fit them. */
.portfolio-allocation .alloc-seg[style*="width: 0%"] .alloc-seg-label,
.portfolio-allocation .alloc-seg[style*="width: 1%"] .alloc-seg-label,
.portfolio-allocation .alloc-seg[style*="width: 2%"] .alloc-seg-label,
.portfolio-allocation .alloc-seg[style*="width: 3%"] .alloc-seg-label,
.portfolio-allocation .alloc-seg[style*="width: 4%"] .alloc-seg-label,
.portfolio-allocation .alloc-seg[style*="width: 5%"] .alloc-seg-label,
.portfolio-allocation .alloc-seg[style*="width: 6%"] .alloc-seg-label,
.portfolio-allocation .alloc-seg[style*="width: 7%"] .alloc-seg-label { visibility: hidden; }

.portfolio-allocation .alloc-legend {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.portfolio-allocation .alloc-legend-row {
  display: grid;
  grid-template-columns: 16px 64px 1fr 64px;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 0.5pt solid var(--rule);
  font-size: 13px;
}
.portfolio-allocation .alloc-legend-row:last-child { border-bottom: none; }
.portfolio-allocation .alloc-legend-row .swatch {
  width: 12px; height: 12px; border-radius: 2px;
  display: inline-block;
}
.portfolio-allocation .alloc-legend-row.alloc-shade-0 .swatch { background: var(--alloc-long-0); }
.portfolio-allocation .alloc-legend-row.alloc-shade-1 .swatch { background: var(--alloc-long-1); }
.portfolio-allocation .alloc-legend-row.alloc-shade-2 .swatch { background: var(--alloc-long-2); }
.portfolio-allocation .alloc-legend-row.alloc-shade-3 .swatch { background: var(--alloc-long-3); }
.portfolio-allocation .alloc-legend-row.alloc-legend-cash .swatch { background: var(--alloc-cash); }
.portfolio-allocation .alloc-legend-row .t {
  font-weight: 600;
  color: var(--ink);
}
.portfolio-allocation .alloc-legend-row a.t {
  color: var(--accent-ink);
  text-decoration: none;
}
.portfolio-allocation .alloc-legend-row a.t:hover { text-decoration: underline; }
.portfolio-allocation .alloc-legend-row .sub {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.portfolio-allocation .alloc-legend-row .p {
  text-align: right;
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 600px) {
  .portfolio-allocation .alloc-bar { height: 44px; }
  .portfolio-allocation .alloc-legend-row {
    grid-template-columns: 16px 56px 1fr 56px;
    font-size: 12px;
  }
  .portfolio-allocation .alloc-legend-row .sub { display: none; }
}

/* Controls — compact, secondary visual weight */
.portfolio-controls { padding: 8px 0 24px; }
.portfolio-controls .eyebrow { margin-bottom: 12px; }
.portfolio-controls .control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 40px;
  max-width: 720px;
}
.portfolio-controls .control-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}
.portfolio-controls .control label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.portfolio-controls .control .control-value {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}
.portfolio-controls .control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.portfolio-controls .control .hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.4;
}
@media (max-width: 600px) {
  .portfolio-controls .control-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* Math table */
.portfolio-table { padding: 24px 0; }
.portfolio-table .eyebrow { margin-bottom: 12px; }
.portfolio-table .ptable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.portfolio-table .ptable thead th {
  text-align: left;
  font-weight: 600;
  color: var(--muted-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px;
  border-bottom: 0.5pt solid var(--rule);
}
.portfolio-table .ptable th.num,
.portfolio-table .ptable td.num { text-align: right; }
.portfolio-table .ptable tbody td {
  padding: 10px 10px;
  border-bottom: 0.5pt solid var(--rule);
}
.portfolio-table .ptable tbody tr.row-out td { opacity: 0.55; }
.portfolio-table .ptable tbody tr.row-cash td {
  background: #fafafa;
  font-style: italic;
  color: var(--muted-2);
}
.portfolio-table .ptable a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.portfolio-table .ptable a:hover { text-decoration: underline; }

/* Hide secondary columns at narrow widths so the four most important
   stay legible on phones: ticker, spot, expected, upside, weight.
   Tighten cell padding at narrow widths too so the 5 remaining columns
   fit in 320–390px of content area without spilling past the gutter. */
@media (max-width: 720px) {
  .portfolio-table .ptable .col-secondary { display: none; }
  .portfolio-table .ptable tbody tr.row-cash td[colspan] { display: none; }
  .portfolio-table .ptable thead th,
  .portfolio-table .ptable tbody td { padding: 8px 6px; }
  .portfolio-table .wrap { overflow-x: auto; }
}

/* Method — collapsed by default, opens to detail */
.portfolio-method { padding: 16px 0 32px; }
.portfolio-method details {
  border-top: 0.5pt solid var(--rule);
  padding-top: 16px;
}
.portfolio-method summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.portfolio-method summary::-webkit-details-marker { display: none; }
.portfolio-method summary::before {
  content: '▸';
  display: inline-block;
  font-size: 10px;
  transition: transform 120ms;
  color: var(--muted-2);
}
.portfolio-method details[open] summary::before { transform: rotate(90deg); }
.portfolio-method .method-body { padding-top: 12px; }
.portfolio-method .method-body p {
  max-width: 720px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0 0 12px;
  font-size: 14px;
}
.portfolio-method .method-body p .mono { color: var(--ink); font-weight: 500; }

/* Export — link-style, tertiary visual weight */
.portfolio-export { padding: 4px 0 64px; }
.portfolio-export .export-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.portfolio-export .export-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  margin-right: 4px;
  font-weight: 600;
}
.portfolio-export button {
  background: transparent;
  border: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--rule-2);
  transition: text-decoration-color 120ms;
}
.portfolio-export button:hover { text-decoration-color: var(--accent); }
.portfolio-export .export-sep { color: var(--rule-2); }
.portfolio-export .export-flash {
  font-size: 11px;
  color: var(--pos);
  font-weight: 500;
  font-style: italic;
  margin-left: 6px;
}
