/* ================================================================
   Trend Value Distribution — Stylesheet
   Extends institutional.css design system
   ================================================================ */

.dist-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ── Hero ─────────────────────────────────────── */
.dist-hero {
  padding: 60px 0 32px;
}
.dist-hero h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 12px;
}
.dist-hero .accent { color: var(--accent); }
.dist-hero .subtitle {
  font-size: 17px;
  color: var(--secondary);
  line-height: 1.6;
  max-width: 620px;
}

/* ── Position banner ─────────────────────────── */
.position-banner {
  background: #2d2d2d;
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.position-left {}
.position-label {
  color: #aaa;
  font-size: 13px;
  margin-bottom: 4px;
}
.position-value {
  color: white;
  font-weight: 800;
  font-size: 48px;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.position-badge {
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
}
.position-stats {
  margin-left: auto;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}
.position-stat { text-align: right; }
.position-stat-label { color: #aaa; font-size: 13px; }
.position-stat-value {
  color: white;
  font-weight: 600;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 24px 24px 16px;
  margin-bottom: 24px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}
.card-header h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ── Cutoff buttons ──────────────────────────── */
.cutoff-btns { display: flex; gap: 8px; }
.cutoff-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--secondary);
  font-weight: 400;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.cutoff-btn.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
  border-color: var(--accent);
}

/* ── Chart controls ──────────────────────────── */
.chart-controls {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}
.era-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.era-toggle input { accent-color: var(--accent); }

/* ── Era legend ──────────────────────────────── */
.era-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.era-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.era-legend-line {
  width: 18px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.era-legend-swatch {
  width: 14px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
  background: #aaa;
  opacity: 0.25;
}
.era-legend-name { color: var(--muted); }
.era-legend-sigma { color: #bbb; font-size: 10px; }

/* ── Chart ────────────────────────────────────── */
#chart-container svg { width: 100%; height: auto; display: block; }

/* ── Zone bars ────────────────────────────────── */
.zone-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
}
.zone-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.zone-label { width: 160px; font-weight: 600; }
.zone-track {
  flex: 1;
  height: 8px;
  background: #f0ece6;
  border-radius: 4px;
  overflow: hidden;
}
.zone-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.zone-pct {
  width: 80px;
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}
.zone-insight {
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--alt-bg);
  border-radius: 10px;
  font-size: 14px;
  color: var(--secondary);
  line-height: 1.6;
}

/* ── Era zone analysis ───────────────────────── */
.zone-analysis-desc {
  font-size: 14px;
  color: var(--secondary);
  margin: -8px 0 20px;
  line-height: 1.5;
}
.ezt-row {
  display: grid;
  grid-template-columns: 140px repeat(4, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}
.ezt-header { margin-bottom: 6px; }
.ezt-cell { padding: 10px 12px; font-size: 13px; }
.ezt-header .ezt-cell {
  padding-bottom: 6px;
  font-size: 11px; font-weight: 600;
  color: var(--muted);
}
.ezt-era-head {
  display: flex; flex-direction: column; gap: 2px; text-align: right;
}
.ezt-sigma { font-size: 10px; color: #bbb; font-weight: 400; }
.ezt-zone-cell {
  display: flex; align-items: center; gap: 8px;
}
.ezt-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.ezt-zone-name {
  display: flex; flex-direction: column; gap: 1px;
  font-weight: 600; font-size: 13px; line-height: 1.2;
}
.ezt-range { font-size: 11px; color: var(--muted); font-weight: 400; }
.ezt-data-cell {
  position: relative; text-align: right;
  font-variant-numeric: tabular-nums;
  background: var(--alt-bg, #f8f6f2);
  border-radius: 4px;
}
.ezt-bar {
  position: absolute; top: 0; left: 0; height: 100%;
  border-radius: 4px; opacity: 0.15;
}
.ezt-val { position: relative; font-weight: 600; }
.zone-analysis-insight {
  margin-top: 20px; padding: 14px 18px;
  background: var(--alt-bg, #f8f6f2); border-radius: 10px;
  font-size: 14px; color: var(--secondary); line-height: 1.6;
}

/* ── Insight cards ────────────────────────────── */
.insight-card {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFF3CD 100%);
  border-radius: 14px;
  padding: 20px 24px;
  border: 1px solid #f0e0b8;
  margin-bottom: 24px;
}
.insight-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.insight-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #444;
}

/* ── Footer ──────────────────────────────────── */
.dist-footer {
  margin-top: 32px;
  text-align: center;
  font-size: 12px;
  color: #bbb;
}

/* ── Responsive ──────────────────────────────── */
@media (max-width: 640px) {
  .position-banner { flex-direction: column; align-items: flex-start; }
  .position-stats { margin-left: 0; width: 100%; justify-content: space-between; }
  .position-value { font-size: 36px; }
  .zone-label { width: 120px; font-size: 13px; }
  .ezt-row { grid-template-columns: 110px repeat(4, 1fr); }
  .ezt-zone-name { font-size: 12px; }
  .ezt-cell { padding: 8px 6px; font-size: 12px; }
}
