/* ============================================================
   FUND DETAIL PAGES — THE MARKET BRIEF DAILY
   Premium asset management aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400&family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@300;400&display=swap');

:root {
  --ink:        #faf9f6;
  --ink-2:      #ffffff;
  --ink-3:      #f0eee8;
  --surface:    #f0eee8;
  --border:     #e3e0d8;
  --border-h:   #d6d2c8;
  --gold:       #f1c453;
  --gold-dim:   rgba(241,196,83,0.22);
  --gold-glow:  rgba(241,196,83,0.2);
  --text:       #0a0a0a;
  --text-2:     #3f3f3f;
  --text-3:     #6f6c66;
  --green:      #1a8a4a;
  --red:        #b03030;
  --blue:       #0066ff;
  --radius:     4px;
  --radius-lg:  10px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ── BACK NAV ── */
.fund-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,249,246,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(1.5rem, 5vw, 4rem);
  height: 60px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.fund-nav a.back {
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.2s;
}
.fund-nav a.back:hover { color: var(--gold); }
.fund-nav a.back svg { width: 14px; height: 14px; }

.fund-nav .site-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-left: auto;
}

/* ── HERO ── */
.fund-hero {
  padding: clamp(3rem, 7vw, 6rem) clamp(1.5rem, 5vw, 4rem) clamp(2.5rem, 5vw, 4rem);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.fund-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 80% 50%, var(--gold-glow), transparent);
  pointer-events: none;
}

.fund-hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

.fund-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.85rem;
  border: 1px solid var(--gold);
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
}

.fund-badge .dot {
  width: 5px; height: 5px;
  background: var(--gold);
  border-radius: 50%;
}

.fund-hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.fund-hero h1 em {
  font-style: italic;
  color: var(--gold);
}

.fund-hero p.tagline {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 620px;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.fund-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
}

.fund-meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fund-meta-item .label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.fund-meta-item .value {
  font-family: 'DM Mono', monospace;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--text);
}

.fund-meta-item .value.positive { color: var(--green); }
.fund-meta-item .value.negative { color: var(--red); }
.fund-meta-item .value.gold     { color: var(--gold); }

/* ── MAIN LAYOUT ── */
.fund-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 5vw, 4rem);
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 900px) {
  .fund-body { grid-template-columns: 1fr; }
}

/* ── SECTIONS ── */
.fund-section {
  margin-bottom: 3rem;
}

.fund-section h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fund-section h2 .section-num {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  color: var(--gold);
  font-style: normal;
}

.fund-section p {
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.fund-section p:last-child { margin-bottom: 0; }

.fund-section h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.18rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.75rem 0 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.fund-section h3 .h3-tag {
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 400;
}

.fund-section ul {
  margin: 0 0 1rem 1.1rem;
  color: var(--text-2);
  line-height: 1.8;
}
.fund-section ul li { margin-bottom: 0.4rem; }

.macro-callout {
  background: var(--gold-glow);
  border: 1px solid var(--gold-dim);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem;
}
.macro-callout .mc-label {
  display: block;
  font-family: 'DM Mono', monospace;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.4rem;
}
.macro-callout p { margin-bottom: 0; font-size: 0.92rem; }

/* ── PERFORMANCE CHART ── */
.chart-container {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 18px 40px -30px rgba(15,15,15,0.35);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.chart-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}

.chart-tabs {
  display: flex;
  gap: 0.25rem;
}

.chart-tab {
  padding: 0.25rem 0.6rem;
  font-size: 0.72rem;
  font-family: 'DM Mono', monospace;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s;
}

.chart-tab.active, .chart-tab:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-dim);
}

canvas.fund-chart {
  width: 100% !important;
  height: 200px !important;
}

/* ── ALLOCATION DONUT ── */
.allocation-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
}

@media (max-width: 600px) {
  .allocation-wrap { grid-template-columns: 1fr; }
}

.donut-container {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-center .dc-label {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.donut-center .dc-value {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  color: var(--text);
}

.allocation-legend {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.alloc-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.82rem;
}

.alloc-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.alloc-name { color: var(--text-2); flex: 1; }
.alloc-pct {
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  color: var(--text);
}

/* ── HOLDINGS TABLE ── */
.holdings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.holdings-table thead tr {
  border-bottom: 1px solid var(--border);
}

.holdings-table th {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.holdings-table th:last-child { text-align: right; }

.holdings-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.holdings-table tbody tr:hover {
  background: rgba(0,0,0,0.03);
}

.holdings-table td {
  padding: 0.65rem 0.75rem;
  color: var(--text-2);
  vertical-align: middle;
}

.holdings-table td:last-child {
  text-align: right;
  font-family: 'DM Mono', monospace;
  color: var(--text);
}

.holdings-table td .ticker {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  color: var(--gold);
  display: block;
}

.holdings-table td .name {
  font-size: 0.82rem;
  color: var(--text-2);
}

.weight-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.weight-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.8s ease;
}

/* ── RISK METRICS GRID ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.metric-cell {
  background: var(--ink-2);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.metric-cell .m-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.metric-cell .m-value {
  font-family: 'DM Mono', monospace;
  font-size: 1.2rem;
  color: var(--text);
}

.metric-cell .m-note {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* ── SIDEBAR CARD ── */
.fund-sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-card {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 42px -32px rgba(15,15,15,0.32);
}

.sidebar-card-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.sidebar-card-body {
  padding: 1rem 1.25rem;
}

.sc-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}

.sc-row:last-child { border-bottom: none; }

.sc-row .sc-key { color: var(--text-3); }
.sc-row .sc-val {
  font-family: 'DM Mono', monospace;
  color: var(--text);
  font-size: 0.8rem;
}

/* ── DISCLAIMER ── */
.fund-disclaimer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem clamp(1.5rem, 5vw, 4rem) 3rem;
  border-top: 1px solid var(--border);
}

.fund-disclaimer p {
  font-size: 0.72rem;
  color: var(--text-3);
  line-height: 1.8;
}

.fund-disclaimer strong { color: var(--text-2); }

/* ── STRATEGY PILLARS ── */
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0;
}

.pillar {
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.2s;
  box-shadow: 0 16px 30px -26px rgba(15,15,15,0.3);
}

.pillar:hover { border-color: var(--gold); }

.pillar .p-num {
  font-family: 'DM Mono', monospace;
  font-size: 0.65rem;
  color: var(--gold);
}

.pillar .p-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.pillar .p-desc {
  font-size: 0.78rem;
  color: var(--text-3);
  line-height: 1.6;
}

/* ── ACADEMIC TAG ── */
.academic-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--gold-dim);
  border: 1px solid rgba(201,168,76,0.3);
  padding: 0.35rem 0.8rem;
  border-radius: 2px;
  font-size: 0.72rem;
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

/* ── CRITERIA TABLE (options) ── */
.criteria-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin: 1rem 0;
}

.criteria-table thead th {
  padding: 0.6rem 0.8rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.criteria-table tbody td {
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
}

.criteria-table .crit-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 2px;
  font-size: 0.72rem;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
}

.criteria-table .crit-badge.pass  { background: rgba(61,186,126,0.12); color: var(--green); }
.criteria-table .crit-badge.warn  { background: rgba(201,168,76,0.12); color: var(--gold); }
.criteria-table .crit-badge.fail  { background: rgba(224,82,82,0.12); color: var(--red); }
