:root {
  --bg: #f5f0e8;
  --bg-strong: #e7dccb;
  --panel: rgba(255, 253, 249, 0.78);
  --panel-border: rgba(72, 52, 30, 0.12);
  --text: #22170f;
  --muted: #6e5b4d;
  --accent-brent: #0d5c63;
  --accent-wti: #b85c38;
  --accent-glow: rgba(184, 92, 56, 0.18);
  --shadow: 0 20px 60px rgba(58, 38, 23, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 40%),
    linear-gradient(135deg, #fbf7f1 0%, #eadfce 50%, #d8c5ae 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0, rgba(255, 255, 255, 0.18) 1px, transparent 1px, transparent 100%),
    linear-gradient(rgba(255, 255, 255, 0.14) 0, rgba(255, 255, 255, 0.14) 1px, transparent 1px, transparent 100%);
  background-size: 80px 80px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.28), transparent 85%);
  pointer-events: none;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 48px 0 24px;
}

.hero {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: var(--space-5);
  align-items: end;
  margin-bottom: var(--space-5);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.24em;
  color: var(--muted);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(42px, 8vw, 78px);
  line-height: 0.94;
  letter-spacing: -0.06em;
}

h2 {
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.subtitle {
  margin-top: var(--space-4);
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.hero-stats,
.card-grid,
.ops-grid {
  display: grid;
  gap: var(--space-4);
}

.hero-stats {
  grid-template-columns: 1fr;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: var(--space-5);
}

.ops-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  margin-top: var(--space-5);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stat-panel,
.metric-card,
.ops-panel,
.chart-panel {
  padding: var(--space-4);
}

.stat-panel strong,
.metric-value {
  display: block;
  margin-top: 10px;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -0.06em;
}

.muted,
.metric-hint,
.axis-meta,
.stack small {
  color: var(--muted);
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card::after {
  content: "";
  position: absolute;
  right: -36px;
  top: -36px;
  width: 120px;
  height: 120px;
  border-radius: 999px;
  background: var(--accent-glow);
}

.metric-card[data-benchmark="brent"] {
  --accent-glow: rgba(13, 92, 99, 0.16);
}

.metric-card[data-benchmark="wti"] {
  --accent-glow: rgba(184, 92, 56, 0.18);
}

.metric-label,
.stat-label {
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-date {
  margin-top: var(--space-2);
  font-size: 14px;
  color: var(--muted);
}

.chart-panel {
  padding-bottom: var(--space-5);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.section-head.compact {
  margin-bottom: var(--space-3);
}

.legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.chart-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x pinch-zoom;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.12));
  border: 1px solid rgba(72, 52, 30, 0.08);
}

.positive {
  color: #0d7c45;
}

.negative {
  color: #b42318;
}

.neutral {
  color: var(--muted);
}

.chart-stage {
  position: relative;
  min-width: 720px;
}

#chart {
  width: 100%;
  height: auto;
  display: block;
}

.chart-bubble {
  position: absolute;
  top: 18px;
  left: 18px;
  width: min(300px, calc(100% - 24px));
  max-height: min(360px, calc(100% - 20px));
  padding: 12px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(24, 20, 18, 0.56), rgba(24, 20, 18, 0.44));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 36px rgba(17, 11, 8, 0.18);
  backdrop-filter: blur(10px);
  z-index: 2;
  color: #f5efe7;
  overflow: auto;
  overscroll-behavior: contain;
}

.chart-bubble[hidden] {
  display: none;
}

.chart-mobile-note,
.chart-mobile-details {
  display: none;
}

.chart-mobile-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.chart-mobile-details[hidden] {
  display: none;
}

.chart-bubble-date {
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(245, 239, 231, 0.72);
}

.chart-bubble-stack {
  display: grid;
  gap: 10px;
}

.chart-bubble-item {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.chart-bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.chart-bubble-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.chart-bubble-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.chart-bubble-price {
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.chart-bubble-meta {
  display: grid;
  gap: 4px;
  color: rgba(245, 239, 231, 0.72);
  font-size: 12px;
}

.chart-bubble-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-bubble-section-title {
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(245, 239, 231, 0.6);
}

.chart-bubble-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chart-bubble-tag {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 239, 231, 0.74);
  font-size: 11px;
}

.chart-bubble-factors {
  display: grid;
  gap: 8px;
}

.chart-bubble-empty {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(245, 239, 231, 0.76);
  font-size: 12px;
  line-height: 1.6;
}

.chart-bubble-factor {
  display: grid;
  gap: 4px;
}

.chart-bubble-factor a {
  color: #f5efe7;
  text-decoration: none;
  font-size: 12px;
  line-height: 1.4;
}

.chart-bubble-factor a:hover {
  text-decoration: underline;
}

.chart-bubble-factor-meta {
  color: rgba(245, 239, 231, 0.58);
  font-size: 11px;
}

.chart-crosshair {
  pointer-events: none;
}

.factor-marker,
.factor-marker-hitbox {
  cursor: pointer;
}

.chart-hitbox {
  cursor: pointer;
}

.chart-point {
  cursor: pointer;
  transition: r 160ms ease, stroke-width 160ms ease, opacity 160ms ease;
}

.chart-point:hover,
.chart-point.is-active {
  r: 6;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 2.5;
}

.chart-point.is-dimmed {
  opacity: 0.72;
}

.stack {
  display: grid;
  gap: var(--space-3);
}

.stack-row {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.46);
}

.stack-row strong {
  font-size: 16px;
}

.footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 0 16px 32px;
  color: var(--muted);
  font-size: 13px;
}

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

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 20px;
  }

  .section-head {
    flex-direction: column;
    align-items: start;
  }

  .panel,
  .stat-panel,
  .metric-card,
  .ops-panel,
  .chart-panel {
    border-radius: 22px;
  }

  .stat-panel,
  .metric-card,
  .ops-panel,
  .chart-panel {
    padding: 18px;
  }

  .subtitle {
    font-size: 16px;
    line-height: 1.55;
  }

  .stat-panel strong,
  .metric-value {
    font-size: 30px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .ops-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .legend {
    gap: 10px 14px;
  }

  .legend-item {
    font-size: 13px;
  }

  .chart-stage {
    min-width: 920px;
  }

  .chart-bubble {
    width: 280px;
    padding: 12px;
    max-height: 75%;
    overflow: auto;
  }

  .chart-mobile-note {
    display: block;
  }

  .chart-mobile-details {
    display: block;
    margin-top: 12px;
  }

  .chart-mobile-details .chart-bubble {
    position: static;
    width: 100%;
    max-width: none;
    max-height: none;
    left: auto;
    top: auto;
    padding: 14px;
    border-radius: 18px;
    box-shadow: 0 14px 26px rgba(17, 11, 8, 0.14);
  }

  .chart-mobile-details .chart-bubble-date {
    margin-bottom: 12px;
  }

  .footer {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
}

@media (max-width: 420px) {
  .shell {
    width: min(100vw - 16px, 1180px);
  }

  h1 {
    font-size: clamp(36px, 12vw, 52px);
  }

  .hero {
    gap: 20px;
    margin-bottom: 24px;
  }

  .chart-mobile-details .chart-bubble {
    padding: 12px;
    border-radius: 16px;
  }

  .axis-meta {
    font-size: 12px;
    line-height: 1.5;
  }

  .chart-bubble-price {
    font-size: 16px;
  }
}
