/* =========================================================
   WRC Fan Site — Stylesheet
   ========================================================= */

:root {
  --bg:         #0a0a0c;
  --bg-alt:     #111116;
  --bg-card:    #16161d;
  --bg-card-hi: #1c1c25;
  --line:       #24242f;
  --text:       #f4f4f6;
  --text-mute:  #a0a0ad;
  --text-dim:   #6b6b78;
  --accent:     #e10600;
  --accent-hi:  #ff1f14;
  --gold:       #f3c04a;
  --blue:       #1a56db;
  --green:      #14a36a;

  --surface-gravel:  #c27b2a;
  --surface-asphalt: #4a6da7;
  --surface-snow:    #cfe3ef;
  --surface-mixed:   #8e6bb3;

  --radius:   14px;
  --radius-s: 8px;
  --shadow:   0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-hi: 0 18px 44px rgba(225, 6, 0, 0.18), 0 10px 24px rgba(0,0,0,0.5);

  --container: 1200px;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: "Rajdhani", "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  margin: 0 0 0.4em;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* =========================================================
   NAV
   ========================================================= */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(10, 10, 12, 0.72);
  border-bottom: 1px solid var(--line);
}
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav__brand {
  font-family: "Racing Sans One", "Rajdhani", sans-serif;
  font-size: 28px;
  letter-spacing: 0.06em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.nav__brand::before {
  content: "";
  display: inline-block;
  width: 10px; height: 22px;
  background: var(--accent);
  transform: skewX(-18deg);
  box-shadow: 14px 0 0 var(--text), 28px 0 0 var(--accent);
  margin-right: 28px;
}
.nav__links {
  display: flex;
  gap: 28px;
}
.nav__links a {
  color: var(--text-mute);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color .2s ease;
  position: relative;
}
.nav__links a:hover { color: var(--text); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease;
}
.nav__links a:hover::after { transform: scaleX(1); }

@media (max-width: 720px) {
  .nav__links { display: none; }
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}
.hero__bg {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(10,10,12,.1) 0%, rgba(10,10,12,.55) 55%, var(--bg) 100%),
    url("https://upload.wikimedia.org/wikipedia/commons/thumb/a/a2/Kalle_Rovanper%C3%A4_Rally_Finland_2025_Ouninpohja_%28cropped%29.jpg/1920px-Kalle_Rovanper%C3%A4_Rally_Finland_2025_Ouninpohja_%28cropped%29.jpg") center/cover no-repeat,
    #181820;
  z-index: -2;
  transform: scale(1.05);
  animation: slowZoom 22s ease-out forwards;
}
.hero__grain {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(225,6,0,0.22), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(255,255,255,0.05), transparent 60%);
  z-index: -1;
  pointer-events: none;
}
@keyframes slowZoom {
  from { transform: scale(1.12); }
  to   { transform: scale(1.0);  }
}

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px; border: 1px solid rgba(225,6,0,0.6);
  color: var(--accent-hi);
  background: rgba(225,6,0,0.08);
  border-radius: 999px;
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 600;
}
.hero__eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-hi);
  box-shadow: 0 0 0 4px rgba(225,6,0,0.2);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(225,6,0,0.2); }
  50%      { box-shadow: 0 0 0 10px rgba(225,6,0,0);  }
}
.hero__title {
  font-family: "Racing Sans One", "Rajdhani", sans-serif;
  font-size: clamp(48px, 9vw, 128px);
  line-height: 0.95;
  margin: 22px 0 12px;
  text-transform: uppercase;
  text-shadow: 0 4px 30px rgba(0,0,0,0.6);
}
.hero__title .accent { color: var(--accent); }
.hero__sub {
  max-width: 620px;
  font-size: clamp(16px, 1.6vw, 20px);
  color: var(--text-mute);
  margin-bottom: 36px;
}
.hero__cta {
  display: inline-flex; align-items: center; gap: 12px;
  background: var(--accent);
  color: #fff;
  padding: 14px 26px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 14px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
  box-shadow: 0 10px 28px rgba(225,6,0,0.35);
}
.hero__cta:hover { transform: translateY(-2px); background: var(--accent-hi); box-shadow: 0 14px 32px rgba(225,6,0,0.5); }
.hero__cta::after {
  content: "→";
  transition: transform .18s ease;
}
.hero__cta:hover::after { transform: translateX(4px); }

.hero__scroll {
  position: absolute;
  bottom: 28px; left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 10px;
}
.hero__scroll::after {
  content: ""; width: 32px; height: 1px; background: var(--text-dim);
  animation: slide 2s ease-in-out infinite;
}
@keyframes slide {
  0%, 100% { transform: translateY(0) scaleX(1); opacity: .6; }
  50%      { transform: translateY(6px) scaleX(1.4); opacity: 1; }
}

/* =========================================================
   SECTIONS
   ========================================================= */
section {
  padding: 120px 0;
  position: relative;
}
.section--alt { background: var(--bg-alt); }
.section__eyebrow {
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 10px;
}
.section__eyebrow::before {
  content: ""; width: 28px; height: 2px; background: var(--accent);
}
.section__title {
  font-size: clamp(32px, 5vw, 56px);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.section__lede {
  max-width: 720px;
  color: var(--text-mute);
  font-size: 17px;
  margin-bottom: 56px;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================================
   ABOUT / META STATS
   ========================================================= */
.about {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 64px;
  align-items: center;
}
.about p {
  color: var(--text-mute);
  font-size: 17px;
  line-height: 1.75;
  margin: 0 0 18px;
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.meta-tile {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  transition: transform .25s ease, border-color .25s ease;
}
.meta-tile:hover { transform: translateY(-4px); border-color: var(--accent); }
.meta-tile__num {
  font-family: "Racing Sans One", "Rajdhani", sans-serif;
  font-size: 52px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 6px;
}
.meta-tile__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-mute);
}

@media (max-width: 820px) {
  .about { grid-template-columns: 1fr; gap: 40px; }
}

/* =========================================================
   STANDINGS TABLE
   ========================================================= */
.standings {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.standings__table {
  width: 100%;
  border-collapse: collapse;
}
.standings__table th,
.standings__table td {
  padding: 16px 20px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}
.standings__table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  background: var(--bg-card-hi);
  font-weight: 600;
}
.standings__table tbody tr {
  transition: background .18s ease;
}
.standings__table tbody tr:hover { background: var(--bg-card-hi); }
.standings__table tbody tr:last-child td { border-bottom: 0; }

.rank {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 15px;
  background: var(--bg-card-hi);
  border: 1px solid var(--line);
  color: var(--text-mute);
}
.rank--1 { background: var(--accent); color: #fff; border-color: var(--accent); }
.rank--2 { background: #2b2b36; color: #fff; border-color: #3a3a48; }
.rank--3 { background: #2b2013; color: var(--gold); border-color: #4a3820; }

.driver-cell {
  display: flex; align-items: center; gap: 14px;
}
.driver-cell .flag { font-size: 22px; line-height: 1; }
.driver-cell .name { font-weight: 600; font-size: 16px; }
.driver-cell .team {
  display: block; color: var(--text-dim); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.12em; margin-top: 2px;
}
.num-cell { font-family: "Rajdhani", sans-serif; font-weight: 600; font-size: 20px; }
.num-cell--points { color: var(--accent); }

/* Responsive stack under 640 */
@media (max-width: 640px) {
  .standings__table thead { display: none; }
  .standings__table, .standings__table tbody, .standings__table tr, .standings__table td {
    display: block; width: 100%;
  }
  .standings__table tr {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
  }
  .standings__table td { padding: 6px 0; border: 0; }
  .standings__table td::before {
    content: attr(data-label);
    display: inline-block;
    width: 96px;
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
  }
  .driver-cell { display: inline-flex; }
}

/* Manufacturers — same base + bar */
.mfg-bar {
  display: inline-block;
  vertical-align: middle;
  width: 120px; height: 8px;
  background: var(--bg-card-hi);
  border-radius: 999px;
  margin-left: 10px;
  overflow: hidden;
}
.mfg-bar__fill {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

/* =========================================================
   CALENDAR GRID
   ========================================================= */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}
.rally-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
  display: flex; flex-direction: column;
}
.rally-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hi);
}
.rally-card__img {
  position: relative;
  height: 170px;
  background: #22222c center/cover no-repeat;
  overflow: hidden;
}
.rally-card__img::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,12,0) 30%, rgba(10,10,12,0.75) 100%);
}
.rally-card__round {
  position: absolute;
  top: 14px; left: 14px; z-index: 1;
  background: rgba(10,10,12,0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px; letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text);
}
.rally-card__surface {
  position: absolute;
  top: 14px; right: 14px; z-index: 1;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: #0a0a0c;
}
.surface--Gravel  { background: var(--surface-gravel); }
.surface--Asphalt { background: var(--surface-asphalt); color: #fff; }
.surface--Snow    { background: var(--surface-snow); }
.surface--Mixed   { background: var(--surface-mixed); color: #fff; }

.rally-card__body { padding: 20px; }
.rally-card__name {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700; font-size: 22px;
  line-height: 1.15;
  margin: 0 0 8px;
}
.rally-card__meta {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--text-mute); font-size: 13px;
}
.rally-card__country { display: inline-flex; align-items: center; gap: 6px; }
.rally-card__country .flag { font-size: 18px; }
.rally-card__date { color: var(--text-dim); font-size: 12px; letter-spacing: 0.05em; }

.rally-card__winner {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex; align-items: baseline; gap: 10px;
}
.rally-card__winner-label {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.rally-card__winner-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.rally-card__upcoming {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.rally-card--done { position: relative; }
.rally-card--done::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--gold);
  z-index: 2;
}

/* =========================================================
   ANALYTICS
   ========================================================= */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
.chart-grid > .chart--wide { grid-column: 1 / -1; }

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.chart-card__title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px;
  gap: 16px;
}
.chart-card__title h3 {
  font-family: "Rajdhani", sans-serif;
  font-size: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
}
.chart-card__title .hint {
  color: var(--text-dim); font-size: 12px;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.chart-card__canvas-wrap {
  position: relative;
  height: 320px;
}
.chart--wide .chart-card__canvas-wrap { height: 360px; }

@media (max-width: 820px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-card__canvas-wrap,
  .chart--wide .chart-card__canvas-wrap { height: 280px; }
}

/* =========================================================
   HISTORICAL CHAMPIONS TIMELINE
   ========================================================= */
.timeline {
  position: relative;
  display: flex; flex-direction: column;
  gap: 22px;
  padding-left: 32px;
}
.timeline::before {
  content: "";
  position: absolute;
  top: 8px; bottom: 8px; left: 9px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--line) 80%);
}
.champ {
  position: relative;
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 20px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
  transition: transform .25s ease, border-color .25s ease;
}
.champ:hover { transform: translateX(4px); border-color: var(--accent); }
.champ::before {
  content: "";
  position: absolute;
  left: -27px; top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-50%);
  box-shadow: 0 0 0 4px var(--bg);
}
.champ__year {
  font-family: "Racing Sans One", "Rajdhani", sans-serif;
  font-size: 32px;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.champ__driver {
  font-size: 18px; font-weight: 600; margin: 0;
}
.champ__meta {
  font-size: 13px; color: var(--text-mute);
  margin-top: 2px;
}
.champ__flag {
  font-size: 32px;
}
@media (max-width: 560px) {
  .champ { grid-template-columns: 72px 1fr; padding: 14px 16px; }
  .champ__flag { display: none; }
  .champ__year { font-size: 26px; }
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer {
  border-top: 1px solid var(--line);
  padding: 48px 0;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
.footer strong { color: var(--text-mute); }
.footer__brand {
  font-family: "Racing Sans One", "Rajdhani", sans-serif;
  font-size: 22px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  display: inline-block;
}

/* =========================================================
   UTILITIES
   ========================================================= */
.muted { color: var(--text-mute); }
.dim   { color: var(--text-dim); }
