/* ═══════════════════════════════════════════════════════════════
   HOME ADVANTAGE ATLAS — Pitch Noir Design System
   Cinematic dark stadium aesthetic · Electric chartreuse accent
   Warm amber data highlights · Film grain atmosphere · Bold condensed type
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* Core palette — stadium at night */
  --void: #0A0A0C;
  --surface: #111114;
  --surface-raised: #18181C;
  --surface-glass: rgba(24, 24, 28, 0.7);
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);

  /* Accent — pitch under floodlights */
  --lime: #CCFF00;
  --lime-dim: rgba(204, 255, 0, 0.15);
  --lime-glow: rgba(204, 255, 0, 0.06);

  /* Secondary — warm amber broadcast tint */
  --amber: #FF9F1C;
  --amber-dim: rgba(255, 159, 28, 0.15);

  /* Tertiary — cool steel for contrast */
  --steel: #5B8DEF;
  --steel-dim: rgba(91, 141, 239, 0.15);

  /* Neutrals */
  --ink: #F0F0F2;
  --ink-muted: #8A8A96;
  --ink-faint: #55555F;

  /* Type scale */
  --fs-hero: clamp(3.6rem, 11vw, 8.5rem);
  --fs-stat: clamp(2.6rem, 7vw, 4.8rem);
  --fs-h2: clamp(0.78rem, 1.2vw, 0.92rem);
  --fs-body: clamp(0.88rem, 1.05vw, 0.98rem);
  --fs-caption: 0.7rem;
  --fs-num: clamp(0.68rem, 0.9vw, 0.78rem);

  /* Spacing */
  --section-pad: clamp(1.4rem, 3.5vw, 2.4rem);
  --page-width: min(1320px, calc(100vw - 2.4rem));
  --card-radius: 10px;
}

/* ─── Reset ─────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: var(--fs-body);
  color: var(--ink);
  background: var(--void);
  line-height: 1.55;
}

/* ─── Skip link ─────────────────────────────────────────────── */

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 120;
  background: var(--lime);
  color: var(--void);
  padding: 0.5rem 0.75rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 4px;
}

.skip-link:focus-visible {
  top: 1rem;
}

/* ─── Atmospheric backgrounds ─────────────────────────────────── */

.bg-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.bg-glow {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  border-radius: 50%;
  filter: blur(120px);
}

.bg-glow--top {
  width: 600px;
  height: 600px;
  top: -200px;
  right: -100px;
  background: radial-gradient(circle, rgba(204, 255, 0, 0.07) 0%, transparent 70%);
}

.bg-glow--bottom {
  width: 500px;
  height: 500px;
  bottom: -150px;
  left: -100px;
  background: radial-gradient(circle, rgba(255, 159, 28, 0.05) 0%, transparent 70%);
}

.bg-line {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  background: var(--border);
}

.bg-line--1 {
  width: 1px;
  height: 100vh;
  top: 0;
  left: 12%;
}

.bg-line--2 {
  width: 1px;
  height: 100vh;
  top: 0;
  right: 18%;
}

/* Hide old Bauhaus elements */
.geo-stripe,
.geo-block-red,
.geo-block-blue,
.bg-aurora,
.bg-grid {
  display: none;
}

/* ─── Page container ─────────────────────────────────────────── */

.hero,
main,
footer {
  width: var(--page-width);
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

/* ─── Hero ──────────────────────────────────────────────────── */

.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 4vw, 3rem);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.hero-inner {
  flex: 1;
  min-width: 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-caption);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--lime);
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(204, 255, 0, 0.3);
  border-radius: 3px;
  background: var(--lime-dim);
  margin-bottom: 1.2rem;
}

h1 {
  font-family: "Oswald", Impact, sans-serif;
  font-size: var(--fs-hero);
  font-weight: 700;
  line-height: 0.88;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0;
}

.hero-line {
  display: block;
}

.hero-line--2 {
  color: var(--ink-faint);
  -webkit-text-stroke: 1.5px var(--ink-muted);
  paint-order: stroke fill;
  color: transparent;
}

.accent-lime {
  color: var(--lime);
}

.accent-amber {
  color: var(--amber);
}

.subtitle {
  margin: 1.6rem 0 0;
  max-width: 52ch;
  color: var(--ink-muted);
  line-height: 1.65;
  font-size: var(--fs-body);
}

.meta {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-strong);
  font-family: "JetBrains Mono", monospace;
  font-size: var(--fs-num);
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}

/* Hero SVG decoration — pitch diagram motif */
.hero-decoration {
  flex-shrink: 0;
  width: clamp(120px, 15vw, 200px);
  padding-top: 2rem;
  opacity: 0.12;
}

.hero-ring {
  width: 100%;
  height: auto;
}

.hero-ring circle,
.hero-ring line {
  fill: none;
  stroke: var(--lime);
  stroke-width: 1.5;
}

.hero-ring circle:last-of-type {
  fill: var(--lime);
}

/* ─── Typography ─────────────────────────────────────────────── */

h2 {
  font-family: "Oswald", Impact, sans-serif;
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-strong);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.section-num {
  font-family: "JetBrains Mono", monospace;
  font-size: var(--fs-num);
  font-weight: 500;
  color: var(--lime);
  letter-spacing: 0.05em;
  opacity: 0.7;
}

/* ─── Main layout ─────────────────────────────────────────────── */

main {
  display: grid;
  gap: 1.2rem;
  padding-bottom: 1.2rem;
}

/* ─── Card ─────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: var(--section-pad);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.015) 0%,
    transparent 60%
  );
  pointer-events: none;
  border-radius: inherit;
}

.card p {
  margin: 0.6rem 0 1.4rem;
  color: var(--ink-muted);
  font-size: var(--fs-body);
  max-width: 64ch;
}

/* ─── Verdict card ──────────────────────────────────────────── */

.card--verdict {
  border-left: 3px solid var(--lime);
  background: linear-gradient(135deg, var(--lime-glow) 0%, var(--surface) 40%);
}

.card--verdict .card-accent {
  display: none;
}

.card--verdict h2 {
  border-bottom-color: rgba(204, 255, 0, 0.2);
}

.card--verdict #verdict-text {
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.6;
  max-width: 65ch;
}

.card--verdict ul {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
  list-style: none;
}

.card--verdict li {
  margin: 0.5rem 0;
  line-height: 1.6;
  color: var(--ink-muted);
  padding-left: 0.8rem;
  position: relative;
}

.card--verdict li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 4px;
  height: 4px;
  background: var(--lime);
  border-radius: 1px;
}

/* ─── KPI Grid ─────────────────────────────────────────────── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.2rem;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: clamp(1rem, 2.5vw, 1.6rem);
  position: relative;
  overflow: hidden;
}

.kpi::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.kpi:nth-child(1)::before { background: var(--lime); }
.kpi:nth-child(2)::before { background: var(--amber); }
.kpi:nth-child(3)::before { background: var(--steel); }
.kpi:nth-child(4)::before { background: var(--lime); }

.kpi:nth-child(1) .value { color: var(--lime); }
.kpi:nth-child(2) .value { color: var(--amber); }
.kpi:nth-child(3) .value { color: var(--steel); }
.kpi:nth-child(4) .value { color: var(--lime); }

.kpi .label {
  font-family: "JetBrains Mono", monospace;
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 0.5rem;
}

.kpi .value {
  font-family: "Oswald", Impact, sans-serif;
  font-size: var(--fs-stat);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  display: block;
}

/* Glow behind KPI value */
.kpi:nth-child(1) { background: linear-gradient(160deg, var(--lime-glow) 0%, var(--surface) 50%); }
.kpi:nth-child(2) { background: linear-gradient(160deg, var(--amber-dim) 0%, var(--surface) 50%); background-size: 200% 200%; background-position: 100% 0%; }
.kpi:nth-child(4) { background: linear-gradient(160deg, var(--lime-glow) 0%, var(--surface) 50%); }

/* ─── Charts ──────────────────────────────────────────────────── */

.chart {
  height: 440px;
  border-radius: 6px;
}

/* ─── Panel head (fortress section) ──────────────────────────── */

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.selector {
  display: grid;
  gap: 0.3rem;
}

.selector-label {
  font-family: "JetBrains Mono", monospace;
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

select {
  appearance: none;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-size: var(--fs-body);
  font-weight: 500;
  padding: 0.45rem 2rem 0.45rem 0.7rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' fill='none' stroke='%238A8A96' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 0.6rem) center;
  transition: border-color 0.2s;
}

select:hover {
  border-color: var(--lime);
}

/* ─── Tables ──────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  margin-top: 1.2rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-body);
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

th {
  font-family: "JetBrains Mono", monospace;
  font-size: var(--fs-caption);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border-strong);
  position: sticky;
  top: 0;
}

td:first-child {
  font-weight: 700;
  color: var(--ink);
}

tr:hover td {
  background: rgba(204, 255, 0, 0.03);
}

tr:last-child td {
  border-bottom: none;
}

/* ─── Notes card ─────────────────────────────────────────────── */

.card--notes {
  background: var(--surface-raised);
  border-color: var(--border-strong);
}

.card--notes h2 {
  border-bottom-color: var(--border-strong);
}

.card--notes ul {
  margin: 0.6rem 0 0;
  padding-left: 0;
  list-style: none;
}

.card--notes li {
  margin: 0.55rem 0;
  color: var(--ink-muted);
  line-height: 1.65;
  padding-left: 1rem;
  position: relative;
}

.card--notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 4px;
  height: 4px;
  background: var(--amber);
  border-radius: 1px;
}

code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.86em;
  background: rgba(204, 255, 0, 0.08);
  padding: 0.12rem 0.4rem;
  border: 1px solid rgba(204, 255, 0, 0.15);
  border-radius: 3px;
  color: var(--lime);
}

/* ─── Footer ──────────────────────────────────────────────────── */

footer {
  padding: 1.8rem 0 calc(2rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--fs-caption);
  color: var(--ink-faint);
}

.footer-mark {
  font-family: "Oswald", Impact, sans-serif;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ─── Reveal animation ────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: rise-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Subtle shimmer on cards */
.card {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

/* ─── Focus ──────────────────────────────────────────────────── */

:is(a, button, select, [tabindex]):focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

/* ─── Reduced motion ─────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 900px) {
  .hero {
    flex-direction: column;
  }

  .hero-decoration {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart {
    height: 350px;
  }

  .bg-line--1,
  .bg-line--2 {
    display: none;
  }
}

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

  .hero {
    padding-top: 2rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ─── Scrollbar styling ──────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--void);
}

::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ink-muted);
}
