:root {
  /* Design tokens keep colours, shadows, and spacing consistent across charts */
  --bg: linear-gradient(180deg, #f7fbff 0%, #eef2f8 100%);
  --card-bg: #ffffff;
  --card-border: rgba(148, 163, 184, 0.18);
  --text: #1f2933;
  --muted: #52606d;
  --muted-strong: #354154;
  --accent: #2ca66d;
  --accent-dark: #1d6e48;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --border-radius: 20px;
  --focus: #1c64f2;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-radius: 8px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  z-index: 1000;
  font-weight: 600;
}

.skip-link:focus {
  left: 16px;
}

.hero {
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(135deg, #38b36f, #2c7a54);
  color: #ffffff;
  padding: clamp(3rem, 6vw, 5rem) clamp(1.5rem, 8vw, 8rem);
}

.hero__content {
  max-width: 820px;
  display: grid;
  gap: 1.5rem;
}

.hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  margin: 0;
  opacity: 0.85;
}

.hero h1 {
  font-size: clamp(2.55rem, 6vw, 3.8rem);
  line-height: 1.08;
  margin: 0;
}

.hero__lede {
  margin: 0;
  opacity: 0.94;
  font-size: 1.05rem;
}

.hero__metrics {
  margin: 0;
  padding: 1.25rem clamp(1rem, 2.5vw, 1.75rem);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.25rem;
}

.hero__metric {
  display: grid;
  gap: 0.25rem;
}

.hero__metric dt {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.76;
  margin: 0;
}

.hero__metric dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.dashboard {
  display: grid;
  gap: clamp(1.75rem, 3vw, 2.75rem);
  grid-template-columns: minmax(0, 1fr);
  padding: clamp(2.5rem, 4vw, 4.5rem) clamp(1.5rem, 6vw, 6.5rem);
  max-width: min(1240px, 100%);
  margin: 0 auto clamp(3.5rem, 6vw, 5rem);
}

.chart-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  border: 1px solid var(--card-border);
  padding: clamp(1.5rem, 3vw, 2.2rem);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.chart-card:focus-within,
.chart-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 26px 60px rgba(15, 23, 42, 0.12);
}

.chart-figure {
  display: grid;
  gap: 1.5rem;
}

.chart-header h2 {
  font-size: 1.38rem;
  margin: 0 0 0.6rem;
  color: var(--muted-strong);
}

.chart-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.97rem;
}

.chart-container {
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: clamp(280px, 32vw, 360px);
  position: relative;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(226, 232, 240, 0.3), rgba(226, 232, 240, 0));
  overflow: hidden;
}

.chart-container svg {
  width: 100%;
  height: 100%;
}

.chart-container::after {
  content: "Loading visual…";
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  transition: opacity 160ms ease;
}

.chart-container.is-ready::after {
  opacity: 0;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
}

.chart-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.chart-legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 2.75rem 1.5rem 3.5rem;
}

@media (max-width: 960px) {
  .hero {
    padding-bottom: clamp(2.5rem, 6vw, 3.5rem);
  }

  .hero__metrics {
    background: rgba(255, 255, 255, 0.18);
  }
}

@media (min-width: 960px) {
  .dashboard {
    grid-template-columns: repeat(2, minmax(320px, 1fr));
  }
}

@media (max-width: 720px) {
  .chart-container {
    min-height: 260px;
    aspect-ratio: 4 / 4.3;
  }

  .dashboard {
    padding-inline: clamp(1.1rem, 4vw, 1.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
