/* ============================================
   KOMMS-HAUS v3 — DATAVIZ STYLES
   Swiss information hierarchy · Signal design
   Full-width rules for rhythm, constrained content
   for focus. Line weight = hierarchy level.
   ============================================

   HIERARCHY KEY:
   ━━━ 3px  — Chapter border (between modules)
   ─── 1.5px — Header/data separation
   ─   0.5px — Within-module dividers (KPI, BOP)
   ·   1px bg — Card grid hairlines
   ============================================ */

/* ============================================
   DASHBOARD HERO
   ============================================ */
.dashboard-hero {
  padding: calc(var(--nav-height) + 120px) var(--grid-margin) 100px;
}

.dashboard-hero .container {
  max-width: 1360px;
  margin: 0 auto;
}

.dashboard-eyebrow {
  font-size: var(--text-mono);
  color: var(--ink-40);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: 36px;
}

.dashboard-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 8vw, 96px);
  font-weight: var(--weight-thin);
  letter-spacing: var(--track-hero);
  line-height: var(--leading-hero);
  font-variation-settings: "wght" 250;
  margin-bottom: 40px;
}

.dashboard-sub {
  font-size: var(--text-body);
  color: var(--ink-60);
  line-height: 1.7;
  max-width: 520px;
}

/* ============================================
   MODULE STRUCTURE — CHAPTER MARKERS
   Full-width 2px rules create horizontal rhythm.
   Content constrained to 1360px for focus.
   ============================================ */
.dv-module {
  padding: 140px var(--grid-margin);
  border-top: 2px solid rgba(10, 10, 10, 0.12);
}

/* Swiss: content constrained, rules full-width */
.dv-module-header,
.dv-kpi-strip,
.dv-grid {
  max-width: 1360px;
  margin-left: auto;
  margin-right: auto;
}

/* Module header: chapter marker with thin internal rule */
.dv-module-header {
  margin-bottom: 56px;
  max-width: 1360px;
  padding-bottom: 36px;
  border-bottom: 1.5px solid rgba(10, 10, 10, 0.08);
}

/* Chapter number row — num + label with rule below */
.dv-module-header > div:first-child {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 0.5px solid rgba(10, 10, 10, 0.06);
}

/* Large display chapter number — Swiss oversized marker */
.dv-module-num {
  font-family: var(--font-display);
  font-size: clamp(56px, 10vw, 120px);
  font-weight: 200;
  letter-spacing: -0.04em;
  line-height: 0.85;
  color: rgba(10, 10, 10, 0.08);
  font-variant-numeric: tabular-nums;
}

/* Section label — tiny tracked uppercase */
.dv-module-label {
  font-size: 10px;
  color: var(--ink-50);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  padding-bottom: 8px;
}

/* Section title — display weight */
.dv-module-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: var(--weight-regular);
  letter-spacing: var(--track-section);
  line-height: var(--leading-section);
  margin: 0 0 20px;
}

/* Thesis text */
.dv-module-thesis {
  font-size: var(--text-body);
  color: var(--ink-60);
  line-height: 1.7;
  max-width: 560px;
}

/* ============================================
   KPI STRIP — medium weight (0.5px)
   ============================================ */
.dv-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  margin-bottom: 48px;
  border-top: 0.5px solid rgba(10, 10, 10, 0.08);
  border-bottom: 0.5px solid rgba(10, 10, 10, 0.08);
}

.dv-kpi {
  padding: 24px 24px 24px 0;
  border-right: 0.5px solid rgba(10, 10, 10, 0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dv-kpi:last-child {
  border-right: none;
}

.dv-kpi-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-40);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.dv-kpi-value {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.5vw, 30px);
  font-weight: var(--weight-light);
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--ink-80);
}

.dv-kpi-delta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-40);
  display: flex;
  align-items: center;
  gap: 4px;
}

.dv-kpi-delta.up {
  color: var(--ink-60);
}

.dv-kpi-delta.down {
  color: var(--ink-40);
}

.dv-kpi-delta.signal {
  color: var(--signal);
}

/* ============================================
   CARD GRID — 1px hairline background gaps
   ============================================ */
.dv-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1px;
  background: rgba(10, 10, 10, 0.04);
  border: 0.5px solid rgba(10, 10, 10, 0.06);
}

.dv-col-4 { grid-column: span 4; }
.dv-col-5 { grid-column: span 5; }
.dv-col-6 { grid-column: span 6; }
.dv-col-7 { grid-column: span 7; }
.dv-col-8 { grid-column: span 8; }

.dv-card {
  background: var(--white);
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: background var(--dur-fast) var(--ease-standard);
  position: relative;
}

.dv-card:hover {
  background: rgba(250, 250, 247, 1);
}

.dv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.dv-card-label {
  font-size: var(--text-tiny);
  color: var(--ink-60);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}

.dv-card-meta {
  font-size: 10px;
  color: var(--ink-40);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dv-chart {
  flex: 1;
  min-height: 180px;
  position: relative;
}

.dv-chart-wide {
  min-height: 220px;
}

.dv-chart svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  position: relative;
  z-index: 1;
}

/* Chart loading shimmer — subtle pulse before render */
.dv-chart::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0%,
    rgba(10, 10, 10, 0.015) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: dv-shimmer 3s ease-in-out infinite;
  z-index: 0;
  opacity: 1;
  transition: opacity 0.8s ease;
}

.dv-chart.loaded::before {
  opacity: 0;
}

@keyframes dv-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   CHART TOKENS — delicate monochrome system
   ============================================ */
.dv-chart {
  --c-primary: rgba(10, 10, 10, 0.75);
  --c-secondary: rgba(10, 10, 10, 0.4);
  --c-tertiary: rgba(10, 10, 10, 0.22);
  --c-quaternary: rgba(10, 10, 10, 0.12);
  --c-grid: rgba(10, 10, 10, 0.03);
  --c-axis: rgba(10, 10, 10, 0.12);
  --c-signal: var(--signal);
  --c-signal-bg: rgba(232, 93, 38, 0.05);
  --c-bg-band: rgba(10, 10, 10, 0.025);
}

/* SVG text styling — small, refined */
.dv-chart text {
  font-family: var(--font-mono);
  font-size: 9px;
  fill: var(--ink-40);
  letter-spacing: 0.02em;
}

.dv-chart .axis-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  fill: var(--ink-30);
}

.dv-chart .grid-line {
  stroke: var(--c-grid);
  stroke-width: 1;
}

.dv-chart .axis-line {
  stroke: var(--c-axis);
  stroke-width: 1;
}

.dv-chart .data-primary {
  fill: var(--c-primary);
  stroke: var(--c-primary);
}

.dv-chart .data-secondary {
  fill: var(--c-secondary);
  stroke: var(--c-secondary);
}

.dv-chart .data-tertiary {
  fill: var(--c-tertiary);
  stroke: var(--c-tertiary);
}

.dv-chart .data-signal {
  fill: var(--c-signal);
  stroke: var(--c-signal);
}

.dv-chart .data-line {
  fill: none;
  stroke-width: 1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dv-chart .signal-line {
  stroke: var(--c-signal);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.dv-chart .signal-band {
  fill: var(--c-signal-bg);
}

.dv-chart .reference-line {
  stroke: var(--c-axis);
  stroke-width: 1;
  stroke-dasharray: 1 3;
}

/* ============================================
   LEGEND — whisper small
   ============================================ */
.dv-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-50);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  max-width: 1360px;
  margin-left: auto;
  margin-right: auto;
  padding-top: 16px;
}

.dv-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: none;
  transition: opacity var(--dur-fast) var(--ease-standard);
}

.dv-legend-item:hover {
  opacity: 0.6;
}

.dv-legend-swatch {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.dv-legend-swatch.fill {
  background: rgba(10, 10, 10, 0.75);
}

.dv-legend-swatch.med {
  background: rgba(10, 10, 10, 0.4);
}

.dv-legend-swatch.light {
  background: rgba(10, 10, 10, 0.2);
}

.dv-legend-swatch.signal {
  background: var(--signal);
}

.dv-legend-swatch.hatched {
  background: repeating-linear-gradient(
    45deg,
    rgba(10, 10, 10, 0.6) 0,
    rgba(10, 10, 10, 0.6) 1px,
    transparent 1px,
    transparent 3px
  );
}

.dv-legend-swatch.dotted {
  background: var(--white);
  border: 1px solid rgba(10, 10, 10, 0.4);
}

.dv-legend-swatch.outlined {
  background: transparent;
  border: 1px solid rgba(10, 10, 10, 0.4);
}

/* ============================================
   BALANCE OF POWER STRIP — hairline dividers
   ============================================ */
.dv-bop-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  padding-top: 24px;
  border-top: 0.5px solid rgba(10, 10, 10, 0.06);
}

.dv-bop-item {
  padding: 16px 20px 0 0;
  border-right: 0.5px solid rgba(10, 10, 10, 0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dv-bop-item:last-child {
  border-right: none;
}

.dv-bop-value {
  font-family: var(--font-display);
  font-size: var(--text-large);
  font-weight: var(--weight-light);
  line-height: 1;
  color: var(--ink-80);
}

.dv-bop-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-40);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================
   METHODOLOGY SECTION
   ============================================ */
.dv-methodology {
  padding: 120px var(--grid-margin);
  border-top: 2px solid rgba(10, 10, 10, 0.12);
}

.dv-methodology .dv-module-header {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* ============================================
   CHART-SPECIFIC STYLES
   ============================================ */

/* Seat dots — smooth transitions */
.dv-chart .seat-dot {
  transition: opacity var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-expo);
  transform-origin: center;
  transform-box: fill-box;
}

.dv-chart .seat-dot.dim {
  opacity: 0.1;
}

/* Tooltip — minimal black */
.dv-tooltip {
  position: fixed;
  pointer-events: none;
  z-index: var(--z-focus-panel);
  background: var(--black);
  color: var(--white);
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(12px, 12px);
  transition: opacity var(--dur-fast) var(--ease-out);
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.dv-tooltip.visible {
  opacity: 1;
}

.dv-tooltip-title {
  font-weight: var(--weight-bold);
  margin-bottom: 4px;
}

.dv-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: rgba(250, 250, 247, 0.6);
}

.dv-tooltip-row span:last-child {
  color: var(--white);
}

.dv-tooltip-signal {
  color: var(--signal) !important;
}

/* ============================================
   PRELOADER CANVAS — generative data matrix
   ============================================ */
.preloader-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991px) {
  .dv-col-4,
  .dv-col-5,
  .dv-col-6,
  .dv-col-7,
  .dv-col-8 {
    grid-column: span 12;
  }
  .dv-kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .dv-kpi:nth-child(2n) {
    border-right: none;
  }
  .dv-bop-strip {
    grid-template-columns: 1fr;
  }
  .dv-bop-item {
    border-right: none;
    border-bottom: 0.5px solid rgba(10, 10, 10, 0.06);
    padding-bottom: 16px;
  }
  .dv-module {
    padding: 80px var(--grid-margin);
  }
  .dv-card {
    padding: 32px 28px;
  }
  .dv-module-num {
    font-size: clamp(40px, 8vw, 72px);
  }
}

@media (max-width: 767px) {
  .dv-kpi-strip {
    grid-template-columns: 1fr;
  }
  .dv-kpi {
    border-right: none;
    border-bottom: 0.5px solid rgba(10, 10, 10, 0.06);
  }
  .dv-kpi:last-child {
    border-bottom: none;
  }
  .dashboard-title {
    font-size: clamp(28px, 10vw, 48px);
  }
  .dv-module {
    padding: 60px var(--grid-margin);
  }
  .dv-card {
    padding: 28px 20px;
  }
  .dv-module-num {
    font-size: clamp(32px, 12vw, 56px);
  }
  .dv-module-header > div:first-child {
    padding-bottom: 16px;
    margin-bottom: 20px;
  }
}
