/* F1 Suomi-Sarja */
:root {
  --bg: #070b14;
  --bg-2: #0d1424;
  --surface: #121b2f;
  --surface-2: #18233b;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8edf6;
  --muted: #8d9bb5;
  --blue: #1f5bb8;
  --blue-light: #4d8cf0;
  --white: #fff;
  --gold: #f5c542;
  --silver: #c9d1dc;
  --bronze: #d08a52;
  --live: #38d27a;
  --radius: 14px;
  --font-head: "Saira Condensed", "Arial Narrow", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue-light); text-decoration: none; }
a:hover { color: var(--white); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.05; margin: 0 0 .4em; letter-spacing: .01em; text-transform: uppercase; }
h1 { font-size: clamp(2.6rem, 7vw, 5rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h3 { font-size: 1.5rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }
.gold { color: var(--gold); }
.silver { color: var(--silver); }
.bronze { color: var(--bronze); }
.eyebrow {
  font: 600 .75rem/1.2 var(--font-body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--blue-light);
  margin: 0 0 .6em;
}
:focus-visible { outline: 2px solid var(--blue-light); outline-offset: 3px; border-radius: 4px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(7, 11, 20, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--white); font: 700 1.5rem/1 var(--font-head); text-transform: uppercase; letter-spacing: .02em; }
.brand:hover { color: var(--white); }
.brand img { width: 40px; height: 40px; }
.brand b { color: var(--blue-light); }
.main-nav { display: flex; align-items: center; gap: 20px; }
.main-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.main-nav ul a {
  display: block; padding: 8px 12px; border-radius: 8px;
  color: var(--muted); font-weight: 500; font-size: .95rem; white-space: nowrap;
}
.main-nav ul a:hover { color: var(--white); background: var(--surface); }
.main-nav ul a[aria-current="page"] { color: var(--white); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--blue-light); }
.nav-toggle { display: none; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; transition: transform .2s, opacity .2s; }

@media (max-width: 1000px) {
  .nav-toggle { display: block; }
  .main-nav {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 12px;
    padding: 12px 16px 20px;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    display: none;
  }
  .site-header.open .main-nav { display: flex; }
  .main-nav ul { flex-direction: column; }
  .main-nav ul a { padding: 12px; font-size: 1.05rem; }
  .site-header.open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .site-header.open .nav-toggle span:nth-child(2) { opacity: 0; }
  .site-header.open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em;
  padding: 12px 22px; border-radius: 10px; border: 1px solid transparent;
  background: var(--blue); color: var(--white);
  font-weight: 600; font-size: 1rem; cursor: pointer;
  transition: background .15s, transform .15s;
}
.btn:hover { background: #2a6ad0; color: var(--white); transform: translateY(-1px); }
.btn-ghost { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.18); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-small { padding: 8px 14px; font-size: .9rem; }
.link-arrow { font-weight: 600; display: inline-flex; gap: .5em; align-items: center; }
.link-arrow i { transition: transform .15s; }
.link-arrow:hover i { transform: translateX(3px); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(72px, 12vw, 140px) 0 clamp(56px, 8vw, 96px);
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(7,11,20,.9) 40%, rgba(7,11,20,.55) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 40%),
    url("/assets/img/suomisarja.webp") center right / cover no-repeat;
}
.hero::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 4px;
  background: linear-gradient(90deg, var(--blue) 0 33%, var(--white) 33% 66%, var(--blue) 66%);
  opacity: .9;
}
.hero h1 { max-width: 12ch; }
.hero h1 span { color: var(--blue-light); }
.hero .lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: #c6d0e2; max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.page-hero {
  padding: clamp(48px, 8vw, 88px) 0 clamp(28px, 4vw, 40px);
  background: radial-gradient(ellipse at 80% 0%, rgba(31,91,184,.28), transparent 60%);
  border-bottom: 1px solid var(--line);
}
.page-hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.page-hero p { color: var(--muted); max-width: 60ch; margin: 0; }

/* ---------- Sections ---------- */
.section { padding: clamp(48px, 7vw, 80px) 0; }
.section + .section { padding-top: 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: -40px; position: relative; z-index: 2; }
.stat { background: var(--bg-2); padding: 22px 20px; display: flex; flex-direction: column; }
.stat-num { font: 700 2.4rem/1 var(--font-head); color: var(--white); }
.stat-label { color: var(--muted); font-size: .85rem; margin-top: 6px; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.card, .champ-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px;
}
.champ-card h3 { font-size: 2.2rem; margin-bottom: .2em; }
.champ-card { position: relative; overflow: hidden; }
.champ-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), transparent);
}

.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.video {
  position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden;
  background: #000 center / cover no-repeat; cursor: pointer; border: 1px solid var(--line);
}
.video::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.25); transition: background .2s; }
.video:hover::before { background: rgba(0,0,0,.05); }
.video .play {
  position: absolute; inset: 0; margin: auto; width: 76px; height: 76px; border-radius: 50%;
  background: var(--blue); color: #fff; border: 0; display: grid; place-items: center; font-size: 1.6rem;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); cursor: pointer; pointer-events: none;
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.socials { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; padding: 0; margin: 0; }
.socials a {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 1.1rem;
  transition: background .15s, color .15s, transform .15s;
}
.socials a:hover { background: var(--blue); color: #fff; transform: translateY(-2px); }
.socials-big a { width: 54px; height: 54px; font-size: 1.35rem; }
.socials-small a { width: 38px; height: 38px; font-size: .95rem; }

.cta {
  background: linear-gradient(120deg, var(--blue) 0%, #163f82 100%);
  border-radius: calc(var(--radius) + 4px); padding: clamp(28px, 5vw, 48px);
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.cta h2 { margin: 0 0 .2em; }
.cta p { margin: 0; color: #d4e2fb; }
.cta .btn { background: #fff; color: var(--blue); }
.cta .btn:hover { background: #e9f0fd; color: var(--blue); }

/* ---------- Series / standings ---------- */
.tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin;
  padding: 6px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 28px;
}
.tabs button {
  flex: 0 0 auto; border: 0; background: transparent; color: var(--muted);
  font: 600 .95rem var(--font-body); padding: 10px 16px; border-radius: 8px; cursor: pointer;
}
.tabs button:hover { color: var(--white); background: var(--surface); }
.tabs button[aria-selected="true"] { background: var(--blue); color: #fff; }

.season-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.season-head h2 { margin: 0; }
.season-champ { background: var(--surface); border: 1px solid var(--line); padding: 10px 16px; border-radius: 999px; font-size: .95rem; }
.season-champ.live { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px rgba(56,210,122,.2); }

.standings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.standing { margin: 0; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.standing-wide { grid-column: 1 / -1; }
.standing figcaption { padding: 12px 16px; font-weight: 600; border-bottom: 1px solid var(--line); font-size: .95rem; }
.standing a { display: block; position: relative; }
.standing a::after {
  content: "\f00e"; font: var(--fa-font-solid); position: absolute; right: 12px; bottom: 12px;
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px;
  background: rgba(0,0,0,.6); color: #fff; opacity: 0; transition: opacity .15s;
}
.standing a:hover::after { opacity: 1; }
.standing img { width: 100%; }
@media (max-width: 760px) { .standings-grid { grid-template-columns: 1fr; } }

.lightbox {
  border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 96vh;
  overflow: visible;
}
.lightbox::backdrop { background: rgba(3,6,12,.92); }
.lightbox img { max-width: 96vw; max-height: 88vh; width: auto; border-radius: 10px; }
.lightbox-caption { color: var(--muted); text-align: center; margin: 10px 0 0; }
.lightbox-close {
  position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--surface-2); color: #fff; font-size: 1.6rem; cursor: pointer;
}

/* ---------- Hall of Fame ---------- */
.hof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.hof-card {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.hof-card:first-child { border-color: rgba(245,197,66,.45); box-shadow: 0 0 0 1px rgba(245,197,66,.15), 0 12px 40px rgba(245,197,66,.06); }
.hof-card > header { display: flex; justify-content: space-between; align-items: center; }
.season-badge { font: 700 1.4rem/1 var(--font-head); text-transform: uppercase; }
.game { font-size: .8rem; color: var(--muted); border: 1px solid var(--line); padding: 3px 10px; border-radius: 999px; }
.podium { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.podium li { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: rgba(255,255,255,.03); border-radius: 8px; }
.podium li:first-child { background: rgba(245,197,66,.08); font-weight: 700; font-size: 1.1rem; }
.hof-team { border-top: 1px solid var(--line); padding-top: 14px; margin-top: auto; }
.hof-team-row { display: flex; gap: 12px; align-items: center; }
.hof-team-row img { width: 40px; height: 40px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.hof-car { margin-top: 12px; width: 100%; max-height: 80px; object-fit: contain; }

.data-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table thead th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.data-table tbody tr:hover { background: rgba(255,255,255,.025); }
.table-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
@media (max-width: 600px) { .hide-sm { display: none; } .data-table th, .data-table td { padding: 10px; } }

/* ---------- Records ---------- */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.input, .select {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 11px 14px; border-radius: 10px; font: inherit;
}
.input { flex: 1 1 260px; }
.input:focus, .select:focus { outline: none; border-color: var(--blue-light); }
.records-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
@media (max-width: 960px) { .records-layout { grid-template-columns: 1fr; } }
.track { display: flex; align-items: center; gap: 12px; font-weight: 600; white-space: nowrap; }
.track img { width: 28px; height: 21px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.1); }
.rec { display: grid; line-height: 1.3; }
.rec-time { font: 700 1.25rem/1.1 var(--font-head); font-variant-numeric: tabular-nums; color: var(--white); }
.rec-driver { font-weight: 500; }
.rec-meta { font-size: .78rem; color: var(--muted); }
.records-table th[scope="row"] { font-weight: 600; }
.leader-list { list-style: none; margin: 0; padding: 0; }
.leader-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.leader-list li:last-child { border-bottom: 0; }
.leader-list .rank { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; background: var(--surface-2); font-size: .8rem; font-weight: 700; }
.leader-list li:first-child .rank { background: var(--gold); color: #1a1300; }
.leader-list .name { flex: 1; font-weight: 600; }
.leader-list .count { font: 700 1.3rem var(--font-head); }

/* ---------- Signup ---------- */
.form-frame { width: 100%; height: 3000px; border: 0; border-radius: var(--radius); background: #fff; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.steps .card { padding: 20px; }
.steps .num { font: 700 2rem/1 var(--font-head); color: var(--blue-light); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--bg-2); margin-top: 48px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; padding: 32px 0; }
.footer-inner p { color: var(--muted); margin: 10px 0 0; font-size: .9rem; max-width: 46ch; }
.footer-bottom { border-top: 1px solid var(--line); padding: 16px 0 24px; font-size: .8rem; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Mobiili: rataennätykset kortteina */
@media (max-width: 640px) {
  .records-table thead { display: none; }
  .records-table, .records-table tbody, .records-table tr { display: block; }
  .records-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; padding: 14px; border-bottom: 1px solid var(--line); }
  .records-table th[scope="row"] { grid-column: 1 / -1; padding: 0; border: 0; }
  .records-table td { padding: 0; border: 0; }
  .records-table td::before { display: block; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--blue-light); margin-bottom: 2px; }
  .records-table td:nth-of-type(1)::before { content: "Sarja F1"; }
  .records-table td:nth-of-type(2)::before { content: "Sarja F2"; }
  .records-table td[colspan]::before { content: none; }
  .records-table td[colspan] { grid-column: 1 / -1; }
}
.records-layout > * { min-width: 0; }
