/* ============================================
   VOX POPULI ETF — Design Tokens & Styles
   Clean white bg, dark slate/navy-to-black,
   Cinzel display + Inter body
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- Type Scale --- */
:root {
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);
  --text-3xl:  clamp(2.5rem,   1rem    + 4vw,    5rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Fonts */
  --font-display: 'Cinzel', 'Georgia', serif;
  --font-body: 'Inter', 'Helvetica Neue', sans-serif;

  /* Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;

  /* Transitions */
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 640px;
  --content-default: 960px;
  --content-wide: 1200px;
}

/* --- Color Palette: Light (default) --- */
:root, [data-theme="light"] {
  --color-bg: #ffffff;
  --color-surface: #f8f9fa;
  --color-surface-2: #f1f3f5;
  --color-surface-offset: #e9ecef;
  --color-divider: #dee2e6;
  --color-border: #ced4da;

  --color-text: #1a1d23;
  --color-text-muted: #6c757d;
  --color-text-faint: #adb5bd;
  --color-text-inverse: #ffffff;

  /* Primary: dark slate-navy */
  --color-primary: #1e293b;
  --color-primary-hover: #334155;
  --color-primary-active: #0f172a;

  /* Accent: muted steel blue */
  --color-accent: #475569;
  --color-accent-light: #64748b;

  /* Table header */
  --color-thead: #1e293b;
  --color-thead-text: #ffffff;

  /* Links */
  --color-link: #2563eb;
  --color-link-hover: #1d4ed8;

  /* Positive/Negative for financial data */
  --color-positive: #16a34a;
  --color-negative: #dc2626;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
}

/* --- Dark Mode --- */
[data-theme="dark"] {
  --color-bg: #0f1117;
  --color-surface: #1a1d28;
  --color-surface-2: #232736;
  --color-surface-offset: #1e2130;
  --color-divider: #2d3044;
  --color-border: #3d4158;

  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-text-faint: #64748b;
  --color-text-inverse: #0f1117;

  --color-primary: #cbd5e1;
  --color-primary-hover: #e2e8f0;
  --color-primary-active: #94a3b8;

  --color-accent: #94a3b8;
  --color-accent-light: #cbd5e1;

  --color-thead: #1e293b;
  --color-thead-text: #e2e8f0;

  --color-link: #60a5fa;
  --color-link-hover: #93bbfd;

  --color-positive: #4ade80;
  --color-negative: #f87171;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0f1117;
    --color-surface: #1a1d28;
    --color-surface-2: #232736;
    --color-surface-offset: #1e2130;
    --color-divider: #2d3044;
    --color-border: #3d4158;
    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --color-text-faint: #64748b;
    --color-text-inverse: #0f1117;
    --color-primary: #cbd5e1;
    --color-primary-hover: #e2e8f0;
    --color-primary-active: #94a3b8;
    --color-accent: #94a3b8;
    --color-accent-light: #cbd5e1;
    --color-thead: #1e293b;
    --color-thead-text: #e2e8f0;
    --color-link: #60a5fa;
    --color-link-hover: #93bbfd;
    --color-positive: #4ade80;
    --color-negative: #f87171;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  }
}

/* ============================================
   LAYOUT
   ============================================ */

.site-wrapper {
  width: 100%;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 calc(90px + var(--space-6)); /* clear the 90px fixed side columns */
}

.container--narrow {
  max-width: var(--content-default);
}

/* ============================================
   INTRO SEQUENCE (5 stacked assets)
   ============================================ */

.intro {
  background: #ffffff;
  padding: clamp(var(--space-10), 6vw, var(--space-20)) 0 0;
  text-align: center;
}

.intro__sequence {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.intro__asset {
  width: 100%;
  display: flex;
  justify-content: center;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.intro__asset.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.intro__asset img {
  width: 100%;
  max-width: 1100px;
  height: auto;
  display: block;
}

/* Placeholder styling — remove these once real PNGs are in place */
.intro__placeholder {
  width: 100%;
  max-width: 1100px;
  padding: var(--space-8) var(--space-6);
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

/* ============================================
   STICKY HEADER (Asset 5)
   ============================================ */

.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  text-align: center;
  border-bottom: 1px solid var(--color-divider);
  /* Start hidden, revealed by JS after intro sequence */
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.sticky-header.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.sticky-header__inner {
  max-width: var(--content-wide);
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  justify-content: center;
  align-items: center;
}

.sticky-header__inner img {
  width: 100%;
  max-width: 900px;
  height: auto;
  display: block;
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   ASSET 3 — Progressive phrase reveal
   "Vote. Invest. Align incentives. Align the future."
   Clip-path reveals each phrase left-to-right.
   ============================================ */

.intro__asset--phrases .phrases-img {
  clip-path: inset(0 100% 0 0);  /* fully clipped — invisible */
  transition: clip-path 0.5s ease;
}

/* Phase 1: reveal "Vote." — 0% to 14.8% */
.intro__asset--phrases.phrase-1 .phrases-img {
  clip-path: inset(0 85.2% 0 0);
}

/* Phase 2: reveal "Invest." — extend to 27.9% */
.intro__asset--phrases.phrase-2 .phrases-img {
  clip-path: inset(0 72.1% 0 0);
}

/* Phase 3: reveal "Align incentives." — extend to 61.7% */
.intro__asset--phrases.phrase-3 .phrases-img {
  clip-path: inset(0 38.3% 0 0);
}

/* Phase 4: reveal "Align the future." — full image */
.intro__asset--phrases.phrase-4 .phrases-img {
  clip-path: inset(0 0% 0 0);
}

/* ============================================
   SIDE COLUMNS — viewport-fixed pillars
   
   Fixed to the browser viewport. They appear
   once the user scrolls past the line5 header
   and stay locked in place while page content
   scrolls between them.

   ┌────────┐
   │ CROWN  │  ← column-top.png (always visible)
   ├────────┤
   │ SHAFT  │  ← column-mid.png tile (fills viewport gap)
   ├────────┤
   │  BASE  │  ← column-bottom.png (always visible)
   └────────┘
   ============================================ */

.side-column {
  position: fixed;
  /* top is set dynamically by JS (bottom of sticky header) */
  /* bottom is set dynamically by JS (top of footer bar) */
  bottom: 0;
  width: 90px;        /* match your column PNG width */
  display: flex;
  flex-direction: column;
  pointer-events: none;
  z-index: 90;        /* below sticky header (100) but above content */
  /* Hidden by default; JS adds .is-visible once user scrolls past line5 */
  opacity: 0;
  transition: opacity 0.5s ease;
}

.side-column.is-visible {
  opacity: 1;
}

.side-column--left {
  left: 0;
}

.side-column--right {
  right: 0;
}

/* Crown: decorative top cap, always fully visible */
.side-column__crown {
  display: block;
  width: 100%;
  height: auto;
  flex-shrink: 0;
}

/* Base: decorative bottom cap, always fully visible */
.side-column__base {
  display: block;
  width: 100%;
  height: auto;
  flex-shrink: 0;
}

/* Shaft: repeating tile that fills viewport between crown and base */
.side-column__shaft {
  flex: 1;
  background: url('./assets/images/column-mid.png') repeat-y center top;
  background-size: 100% auto;
  min-height: 0;
}

/* On narrow screens, hide the columns to avoid overlapping content */
@media (max-width: 900px) {
  .side-column {
    display: none;
  }
  .viewport-footer-bar {
    display: none;
  }
}

/* ============================================
   VIEWPORT FOOTER BAR — thin decorative strip
   fixed to the bottom of the viewport, spanning
   full width. Appears/disappears with the columns.
   ============================================ */

.viewport-footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;       /* capped height */
  z-index: 91;        /* above columns, below sticky header */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
  background: #ffffff; /* white fill on the sides / any overflow area */
  display: flex;
  justify-content: center;
  align-items: center;
}

.viewport-footer-bar.is-visible {
  opacity: 1;
}

.viewport-footer-bar img {
  display: block;
  max-width: 100%;
  max-height: 60px;   /* never taller than 60px */
  width: auto;
  height: auto;
}

/* ============================================
   SECTIONS
   ============================================ */

.section {
  padding: clamp(var(--space-10), 6vw, var(--space-20)) 0;
}

.section--alt {
  background: var(--color-surface);
}

.section__header {
  margin-bottom: var(--space-8);
}

.section__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--color-primary);
  display: inline-block;
}

.section__subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* ============================================
   FUND OVERVIEW — 2 column layout
   ============================================ */

.fund-overview {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: var(--space-8);
  align-items: start;
}

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

.fund-overview__text h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--space-4);
  letter-spacing: 0.02em;
}

.fund-overview__text p {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

/* Investor Materials sidebar */
.investor-materials {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-divider);
}

.investor-materials h4 {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-3);
  letter-spacing: 0.02em;
}

.investor-materials__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.investor-materials__item a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  color: var(--color-link);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color var(--transition-interactive);
}

.investor-materials__item a:hover {
  color: var(--color-link-hover);
}

.investor-materials__item a svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* ============================================
   DATA TABLES
   ============================================ */

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.data-card {
  background: var(--color-bg);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-card__header {
  background: var(--color-thead);
  color: var(--color-thead-text);
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.data-card__header .date {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--text-xs);
  opacity: 0.8;
  text-transform: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider);
}

.data-table th {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table td {
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--color-surface);
}

/* Fund details key-value table */
.kv-table td:first-child {
  font-weight: 500;
  color: var(--color-text-muted);
  width: 50%;
}

.kv-table td:last-child {
  font-weight: 600;
  text-align: right;
}

/* ============================================
   PERFORMANCE TABLES
   ============================================ */

.performance-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: var(--space-6);
}

.performance-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.performance-table thead th {
  background: var(--color-thead);
  color: var(--color-thead-text);
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.performance-table thead th:first-child {
  text-align: left;
}

.performance-table tbody td {
  padding: var(--space-3) var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--color-divider);
}

.performance-table tbody td:first-child {
  text-align: left;
  font-weight: 600;
}

.performance-table tbody tr:hover td {
  background: var(--color-surface);
}

/* ============================================
   PREMIUM/DISCOUNT CHART
   ============================================ */

.chart-container {
  background: var(--color-bg);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

#premiumDiscountChart {
  width: 100%;
  height: 400px;
}

.chart-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.chart-summary__item {
  text-align: center;
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
}

.chart-summary__label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.chart-summary__value {
  font-size: var(--text-lg);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chart-summary__value--premium { color: var(--color-positive); }
.chart-summary__value--par { color: var(--color-text); }
.chart-summary__value--discount { color: var(--color-negative); }

/* ============================================
   HOLDINGS
   ============================================ */

.holdings-controls {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  align-items: center;
}

.holdings-controls .btn {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  background: var(--color-bg);
  cursor: pointer;
}

.holdings-controls .btn:hover {
  background: var(--color-surface);
}

.holdings-controls .btn--active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.holdings-controls .btn--active:hover {
  background: var(--color-primary-hover);
}

.holdings-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.holdings-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.holdings-table thead th {
  background: var(--color-thead);
  color: var(--color-thead-text);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.holdings-table tbody td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--color-divider);
}

.holdings-table tbody td:first-child {
  text-align: right;
}

.holdings-table tbody tr:hover td {
  background: var(--color-surface);
}

/* ============================================
   DISCLOSURES
   ============================================ */

.disclosures {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.7;
}

.disclosures p {
  margin-bottom: var(--space-4);
  max-width: none;
}

.disclosures a {
  color: var(--color-link);
  text-decoration: underline;
}

.disclosures a:hover {
  color: var(--color-link-hover);
}

.disclosures strong {
  color: var(--color-text);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-divider);
  color: var(--color-text-muted);
  padding: var(--space-10) 0;
  padding-bottom: calc(var(--space-10) + 60px); /* extra room so fixed footer bar doesn't cover content */
  text-align: center;
}

.footer__brand {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.footer__copy {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

.footer__attribution {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.footer__attribution a {
  color: var(--color-text-faint);
  text-decoration: none;
}

.footer__attribution a:hover {
  color: var(--color-text-muted);
}

/* ============================================
   UTILITIES
   ============================================ */

.text-positive { color: var(--color-positive) !important; }
.text-negative { color: var(--color-negative) !important; }
.text-muted { color: var(--color-text-muted) !important; }

/* Bid-ask note */
.data-note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-border);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
  .chart-summary {
    grid-template-columns: 1fr;
  }
  
  .data-grid {
    grid-template-columns: 1fr;
  }
  
  .intro__sequence {
    gap: var(--space-3);
  }

  .sticky-header__inner {
    padding: var(--space-2) var(--space-4);
  }
}
