@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,700&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --ink: #e2e8f0;
  --paper: #0f172a;
  --card: rgba(30, 41, 59, 0.92);
  --line: #334155;
  --accent: #14b8a6;
  --accent-2: #38bdf8;
  --ls: #60a5fa;
  --ps: #f87171;
  --cs: #fbbf24;
  --goss: #a78bfa;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  min-height: 100vh;
}

.background-layer {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(96, 165, 250, 0.1) 0, transparent 35%),
    radial-gradient(circle at 85% 12%, rgba(248, 113, 113, 0.08) 0, transparent 38%),
    radial-gradient(circle at 75% 80%, rgba(20, 184, 166, 0.1) 0, transparent 40%);
  pointer-events: none;
}

.layout-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  gap: 1rem;
}

.sidebar {
  position: sticky;
  top: 2rem;
  align-self: flex-start;
  width: 220px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.2rem 1rem;
}

.sidebar-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.app-shell {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1rem;
}

.hero {
  display: grid;
  gap: 0.75rem;
  animation: reveal 500ms ease-out;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
  color: #38bdf8;
}

h1,
h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1.1;
}

h2 {
  font-size: 1.32rem;
}

a {
  color: #fb923c;
}

a:hover {
  color: #fdba74;
}

.subtitle {
  margin: 0;
  max-width: 72ch;
}

.card {
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px;
  padding: 1rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
  animation: reveal 650ms ease-out;
}

.tab-button {
  border: 1px solid #475569;
  border-radius: 10px;
  padding: 0.6rem 0.9rem;
  background: #1e293b;
  color: #cbd5e1;
  font-weight: 600;
  cursor: pointer;
  transition: all 150ms ease;
  text-align: left;
  width: 100%;
  font-size: 0.95rem;
}

.tab-button:hover {
  background: #334155;
}

.tab-button.is-active {
  border-color: transparent;
  background: linear-gradient(130deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.2);
}

.controls {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.control-group {
  display: grid;
  gap: 0.45rem;
}

.control-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
}

.series-controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.series-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid #475569;
  border-radius: 999px;
  padding: 0.34rem 0.62rem;
  background: #1e293b;
}

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

label,
select {
  font: inherit;
}

select {
  width: 100%;
  padding: 0.58rem 0.7rem;
  border-radius: 10px;
  border: 1px solid #475569;
  background: #1e293b;
  color: #e2e8f0;
}

.chart-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
}

#timeSeriesChart,
#shockChart {
  width: 100%;
  min-width: 700px;
  height: auto;
  border-radius: 12px;
  background: linear-gradient(180deg, #1e293b 0%, #162032 100%);
}

.chart-caption {
  margin: 0.4rem 0 1rem;
  color: #94a3b8;
}

.chart-help {
  margin: 0.75rem 0 0;
  color: #64748b;

  font-size: 0.88rem;
}

.chart-tooltip {
  position: absolute;
  min-width: 180px;
  max-width: 260px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-size: 0.83rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.28);
}

.chart-tooltip-title {
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 0.65rem;
}

.range-slider-wrap {
  margin-top: 0.75rem;
  padding: 0.5rem 0;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.range-slider {
  position: relative;
  height: 28px;
}

.range-slider input[type="range"] {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  pointer-events: none;
}

.range-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: #475569;
}

.range-slider input[type="range"]#rangeEnd::-webkit-slider-runnable-track {
  background: transparent;
}

.range-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(130deg, var(--accent) 0%, var(--accent-2) 100%);
  border: 2px solid #1e293b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  margin-top: -7px;
  pointer-events: auto;
  cursor: grab;
}

.range-slider input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #475569;
  border: none;
}

.range-slider input[type="range"]#rangeEnd::-moz-range-track {
  background: transparent;
}

.range-slider input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(130deg, var(--accent) 0%, var(--accent-2) 100%);
  border: 2px solid #1e293b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  pointer-events: auto;
  cursor: grab;
}

.range-reset-btn {
  margin-top: 0.4rem;
  border: 1px solid #475569;
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: #1e293b;
  color: #cbd5e1;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease;
}

.range-reset-btn:hover {
  background: #334155;
}

.latest-cards {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.latest-card {
  border-radius: 12px;
  border: 1px solid #334155;
  padding: 0.8rem;
  background: #1e293b;
}

.latest-label {
  margin: 0;
  font-size: 0.83rem;
  color: #94a3b8;
}

.latest-value {
  margin: 0.2rem 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.45rem;
}

.latest-delta {
  margin: 0.2rem 0 0;
  font-size: 0.83rem;
  color: #94a3b8;
}

.table-card {
  overflow: hidden;
}

.table-wrapper {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 0.58rem 0.68rem;
  border-bottom: 1px solid #334155;
  font-size: 0.9rem;
}

th {
  position: sticky;
  top: 0;
  background: #1e293b;
  z-index: 1;
}

.home-features-table td:first-child {
  width: 120px;
}

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

@media (max-width: 820px) {
  .layout-wrapper {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    width: 100%;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .sidebar-nav {
    flex-direction: row;
    gap: 0.5rem;
  }

  .tab-button {
    width: auto;
  }

  .chart-tooltip {
    min-width: 160px;
  }
}
