/* ============================================================
   Dragon's Den Investing — styles
   Dark, financial, credible. Near-black + parchment + amber.
   Bloomberg terminal meets essayist. No stock photos.
   ============================================================ */

:root {
  --bg: #0d0e0b;            /* near-black */
  --bg-soft: #141511;       /* panel */
  --bg-card: #161713;       /* card */
  --paper: #ece7db;         /* warm parchment text */
  --muted: #a39d8c;         /* muted sage secondary */
  --faint: #6e6a5d;         /* faint text */
  --gold: #d9a441;          /* amber accent */
  --gold-deep: #b4832e;
  --line: rgba(236, 231, 219, 0.13);
  --line-soft: rgba(236, 231, 219, 0.07);
  --green: #5da86a;         /* performance deltas only */
  --red: #d0604f;           /* performance deltas only */
  --radius: 12px;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.35);
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--paper);
  background: var(--bg);
  line-height: 1.7;
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: #e8bd63; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.18;
  color: var(--paper);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 14, 11, 0.93);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--paper);
}
.brand:hover { color: var(--paper); }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(217, 164, 65, 0.55);
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  align-items: center;
}

.nav-links a {
  padding: 9px 15px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.94rem;
  transition: background 0.18s, color 0.18s;
}

.nav-links a:hover { background: rgba(236, 231, 219, 0.07); color: var(--paper); }
.nav-links a.active { color: var(--gold); background: rgba(217, 164, 65, 0.1); }

.nav-cta {
  background: var(--gold) !important;
  color: #141511 !important;
  font-weight: 700 !important;
  margin-left: 8px;
}
.nav-cta:hover { background: #e8bd63 !important; color: #141511 !important; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--paper);
  padding: 8px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 96px 0 88px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-soft);
}

.hero-mark {
  position: absolute;
  right: -40px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.08;
  border-radius: 50%;
  pointer-events: none;
}

.hero-kicker {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.2rem);
  max-width: 16ch;
  margin-bottom: 22px;
  text-wrap: balance;
}

.hero p.lede {
  font-size: 1.22rem;
  max-width: 52ch;
  color: var(--muted);
  margin-bottom: 36px;
}
.hero p.lede strong { color: var(--paper); }

.btn-row { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.15s, background 0.2s;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
}
.btn:hover { transform: translateY(-2px); }

.btn-primary { background: var(--gold); color: #141511; }
.btn-primary:hover { background: #e8bd63; color: #141511; }

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

/* ---------- Interior page hero ---------- */
.page-hero {
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
}
.page-hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.1rem);
  margin-bottom: 14px;
  max-width: 20ch;
}
.page-hero p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 64ch;
}

/* ---------- Sections ---------- */
section.block { padding: 72px 0; }
section.block.tint { background: var(--bg-soft); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }

.section-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 12px;
  display: block;
}
.section-title {
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  margin-bottom: 12px;
  max-width: 24ch;
}
.section-sub {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 66ch;
  margin-bottom: 40px;
}

/* ---------- Stat cards ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  display: block;
  line-height: 1.1;
}
.stat-label {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 8px;
  display: block;
  line-height: 1.45;
}
.stat-label .muted { color: var(--faint); }

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 28px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-4px); border-color: rgba(217, 164, 65, 0.4); }

.card h3 { font-size: 1.3rem; margin-bottom: 10px; }
.card .card-kicker {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 10px;
  display: block;
}
.card p { color: var(--muted); font-size: 0.98rem; flex: 1; }
.card p strong { color: var(--paper); }
.card-link { font-weight: 600; margin-top: 16px; display: inline-block; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
  background: var(--bg-card);
}
table.data th, table.data td {
  padding: 14px 18px;
  text-align: right;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-weight: 700;
  background: rgba(236, 231, 219, 0.03);
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: rgba(236, 231, 219, 0.025); }
table.data tr.total td { border-top: 1px solid var(--line); font-weight: 700; color: var(--paper); }
table.data tr.year-head td {
  background: rgba(217, 164, 65, 0.08);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  color: var(--gold, #d9a441);
  text-align: left;
  letter-spacing: 0.02em;
}
table.data td.cell-note { white-space: normal; text-align: left; min-width: 280px; color: var(--muted); }
table.data td.cell-action-buy { color: var(--paper); font-weight: 600; }
.table-note { color: var(--faint); font-size: 0.88rem; margin-top: 14px; }

/* ---------- Chart ---------- */
.chart-frame {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.chart-frame canvas { width: 100%; height: 380px; display: block; }
.chart-frame-tall canvas { height: 600px; }
.chart-legend {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}
.chart-legend .swatch { display: inline-block; width: 26px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 8px; }
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: #1e201a;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.86rem;
  line-height: 1.5;
  display: none;
  z-index: 5;
  box-shadow: var(--shadow);
  white-space: nowrap;
}
.chart-tip .tt-label { color: var(--faint); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; display: block; margin-bottom: 2px; }

/* ---------- Quote ---------- */
.pull-quote {
  border-left: 3px solid var(--gold);
  padding: 6px 0 6px 28px;
  margin: 34px 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.5;
  color: var(--paper);
  max-width: 34ch;
}
.pull-quote cite {
  display: block;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 0.9rem;
  color: var(--faint);
  margin-top: 10px;
}

/* ---------- About: author portrait ---------- */
.author-block {
  display: flex;
  gap: 44px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.author-portrait {
  width: 300px;
  max-width: 42vw;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--gold);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
  flex: 0 0 auto;
  margin-top: 4px;
}
.author-portrait-caption {
  font-size: 0.78rem;
  color: var(--faint);
  margin-top: 10px;
  max-width: 300px;
}
.author-copy { min-width: 0; }
.author-copy .pull-quote { margin-top: 0; }

/* ---------- Hero avatar ---------- */
.hero-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.hero-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold);
  flex: 0 0 auto;
}
.hero-avatar-row .hero-kicker { margin-bottom: 0; }

@media (max-width: 720px) {
  .author-block { flex-direction: column; gap: 24px; }
  .author-portrait, .author-portrait-caption { max-width: 260px; }
}

/* ---------- Essay list ---------- */
.essay-list { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.essay-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 22px;
  align-items: baseline;
  padding: 22px 6px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.15s;
}
.essay-row:hover { background: rgba(236, 231, 219, 0.025); }
.essay-date { color: var(--faint); font-size: 0.88rem; white-space: nowrap; }
.essay-row h3 { font-size: 1.18rem; margin-bottom: 4px; font-weight: 600; }
.essay-row h3 a { color: var(--paper); }
.essay-row h3 a:hover { color: var(--gold); }
.essay-desc { color: var(--muted); font-size: 0.95rem; }
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.free { color: var(--green); border: 1px solid rgba(93, 168, 106, 0.45); }
.badge.paid { color: var(--gold); border: 1px solid rgba(217, 164, 65, 0.45); }

/* ---------- Portfolio position cards ---------- */
.pos-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 30px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.pos-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.pos-ticker {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--paper);
}
.pos-ticker .co { font-size: 1.05rem; color: var(--muted); font-weight: 500; margin-left: 10px; }
.pos-meta { display: flex; gap: 26px; margin: 14px 0 18px; flex-wrap: wrap; }
.pos-meta div span { display: block; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 700; margin-bottom: 2px; }
.pos-meta div strong { font-size: 1.15rem; color: var(--paper); font-weight: 600; }
.pos-card p.thesis { color: var(--muted); margin-bottom: 14px; max-width: 72ch; }
.pos-card p.thesis strong { color: var(--paper); }
.change-mind {
  border-left: 2px solid var(--gold);
  padding: 10px 0 10px 18px;
  color: var(--muted);
  font-size: 0.96rem;
  max-width: 72ch;
}
.change-mind strong { color: var(--gold); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; display: block; margin-bottom: 4px; }

/* ---------- Strategy sections ---------- */
.strategy-block {
  padding: 34px 0;
  border-bottom: 1px solid var(--line-soft);
}
.strategy-block:last-child { border-bottom: none; }
.strategy-block h2 { font-size: 1.65rem; margin-bottom: 14px; }
.strategy-block h2 .n {
  color: var(--gold);
  font-size: 1rem;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.1em;
  display: block;
  margin-bottom: 6px;
}
.strategy-block p { color: var(--muted); margin-bottom: 14px; max-width: 70ch; }
.strategy-block p strong { color: var(--paper); }

/* ---------- CTA banner ---------- */
.cta-banner {
  background: linear-gradient(130deg, #1a1b14 0%, #23200f 100%);
  border: 1px solid rgba(217, 164, 65, 0.35);
  border-radius: 18px;
  padding: 58px 44px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-banner h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin-bottom: 14px; }
.cta-banner p { color: var(--muted); max-width: 54ch; margin: 0 auto 28px; }
.cta-banner .btn-row { justify-content: center; }
.price-line { margin-top: 22px; color: var(--faint); font-size: 0.92rem; }

/* ---------- Disclaimer ---------- */
.disclaimer-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  background: rgba(236, 231, 219, 0.025);
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 44px;
}
.disclaimer-box strong { color: var(--paper); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 52px 0 28px;
  margin-top: 60px;
  background: #0a0b09;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 34px;
}
.footer-grid h4 { font-size: 1.02rem; margin-bottom: 14px; font-family: var(--font-body); font-weight: 700; }
.footer-grid p { font-size: 0.92rem; color: var(--muted); max-width: 40ch; }
.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 9px; }
.footer-grid a { color: var(--muted); font-size: 0.92rem; }
.footer-grid a:hover { color: var(--gold); }

.footer-disclaimer {
  border-top: 1px solid var(--line-soft);
  padding-top: 22px;
  font-size: 0.84rem;
  color: var(--faint);
  line-height: 1.6;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.84rem;
  color: var(--faint);
  margin-top: 18px;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .card-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .card-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .essay-row { grid-template-columns: 1fr auto; }
  .essay-date { display: none; }
}

@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 68px; left: 0; right: 0;
    background: #10110d;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 20px 20px;
    border-bottom: 1px solid var(--line);
    gap: 2px;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 14px; }
  .nav-cta { margin-left: 0; text-align: center; }
  .hero { padding: 64px 0 60px; }
  .card-grid, .card-grid.cols-3, .card-grid.cols-4 { grid-template-columns: 1fr; }
  section.block { padding: 52px 0; }
  .cta-banner { padding: 40px 24px; }
  .footer-grid { grid-template-columns: 1fr; }
  .chart-frame canvas { height: 300px; }
  .chart-frame-tall canvas { height: 640px; }
  .pos-meta { gap: 18px; }
}

/* ---------- Live ticker tape ---------- */
.ticker-bar {
  background: #0a0b09;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}
.ticker-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 7px;
  padding-bottom: 7px;
}
.ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--gold);
  color: #141511;
  white-space: nowrap;
}
.ticker-badge .ticker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #141511;
  animation: ticker-pulse 1.6s ease-in-out infinite;
}
.ticker-badge.closed {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.ticker-badge.closed .ticker-dot {
  background: var(--muted);
  animation: none;
}
@keyframes ticker-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.ticker-asof {
  color: var(--faint);
  font-size: 0.74rem;
  white-space: nowrap;
}
.ticker-viewport {
  overflow: hidden;
  flex: 1;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}
.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation: ticker-scroll 48s linear infinite;
  will-change: transform;
}
.ticker-bar:hover .ticker-track {
  animation-play-state: paused;
}
.ticker-group {
  display: inline-flex;
  gap: 2.75rem;
  padding-right: 2.75rem;
}
.ticker-item {
  color: var(--muted);
}
.ticker-item strong {
  color: var(--paper);
  font-weight: 700;
  margin-right: 0.4em;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .ticker-badge .ticker-dot { animation: none; }
  .ticker-viewport { overflow-x: auto; }
}

/* ---------- Live stat strip (index) ---------- */
.stat-live {
  grid-column: 1 / -1;
  border-color: rgba(217, 164, 65, 0.4);
}
.stat-live-row {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  align-items: baseline;
}
.stat-live-head {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- Live table row (performance) ---------- */
tr.live-row td {
  border-top: 1px solid rgba(217, 164, 65, 0.35);
}
.badge.live {
  color: var(--gold);
  border: 1px solid rgba(217, 164, 65, 0.45);
  margin-left: 10px;
  vertical-align: 2px;
}

/* ---------- Chart live legend ---------- */
.chart-legend .swatch-dotted {
  background: transparent;
  border-top: 3px dotted var(--gold);
  height: 0;
  border-radius: 0;
}
