:root {
  color-scheme: dark;
  --bg: #050505;
  --bg-2: #0b0b0d;
  --panel: #111114;
  --panel-2: #19191d;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #f4f4f5;
  --muted: #a9abb2;
  --faint: #757983;
  --red: #e02222;
  --red-2: #ff4a35;
  --cyan: #20c7d8;
  --gold: #f4b942;
  --green: #60d394;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(224, 34, 34, 0.14), transparent 360px),
    radial-gradient(circle at 12% 10%, rgba(32, 199, 216, 0.16), transparent 34%),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-hero {
  position: relative;
  min-height: clamp(560px, 78vh, 720px);
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  isolation: isolate;
}

.site-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background-image: url("../assets/images/tt5000-hero.png");
  background-size: cover;
  background-position: center 54%;
}

.site-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(5, 5, 5, 0.92) 0%, rgba(5, 5, 5, 0.72) 38%, rgba(5, 5, 5, 0.14) 78%),
    linear-gradient(180deg, rgba(5, 5, 5, 0.32) 0%, rgba(5, 5, 5, 0.18) 56%, #050505 100%);
}

.topbar {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  min-width: max-content;
}

.brand-badge {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-left: 4px solid var(--red);
  background: rgba(10, 10, 12, 0.8);
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark strong,
.brand-mark small {
  display: block;
}

.brand-mark strong {
  font-size: 0.98rem;
  letter-spacing: 0.08em;
}

.brand-mark small {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-button,
.season-button,
.table-action {
  min-height: 40px;
  border: 1px solid var(--line);
  background: rgba(12, 12, 15, 0.72);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 0 14px;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-button:hover,
.season-button:hover,
.table-action:hover {
  color: var(--text);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.nav-button.is-active,
.season-button.is-active {
  color: #fff;
  border-color: rgba(224, 34, 34, 0.8);
  background: linear-gradient(135deg, rgba(224, 34, 34, 0.95), rgba(255, 74, 53, 0.8));
}

.hero-copy {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(38px, 7vw, 96px) 0 76px;
  align-self: end;
}

.eyebrow {
  width: fit-content;
  border-left: 4px solid var(--cyan);
  padding-left: 10px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  max-width: 860px;
  font-size: clamp(2.45rem, 7vw, 5.75rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero-lede {
  max-width: 660px;
  color: #dadce2;
  font-size: clamp(1.04rem, 2.1vw, 1.28rem);
  line-height: 1.55;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  max-width: 860px;
  margin-top: 28px;
}

.stat-tile,
.record-card,
.driver-card,
.manufacturer-card,
.champion-card,
.schedule-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(25, 25, 29, 0.95), rgba(12, 12, 15, 0.95));
  box-shadow: var(--shadow);
}

.stat-tile {
  min-height: 110px;
  padding: 18px;
}

.stat-label,
.card-label,
.table-kicker {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 9px;
  max-width: 100%;
  font-size: clamp(1.65rem, 3.2vw, 2.8rem);
  line-height: 1;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.stat-value.is-text-value {
  font-size: clamp(1.35rem, 2.25vw, 2.05rem);
  line-height: 1.06;
  word-break: normal;
}

.stat-value.is-long-value {
  font-size: clamp(1.2rem, 1.85vw, 1.72rem);
}

.stat-note {
  margin-top: 8px;
  color: var(--faint);
  font-size: 0.88rem;
}

.view-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 68px;
}

.view-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin-bottom: 22px;
}

.view-title {
  margin-bottom: 8px;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.view-subtitle {
  margin-bottom: 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.6;
}

.section-band {
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.grid {
  display: grid;
  gap: 14px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.record-card,
.driver-card,
.manufacturer-card,
.champion-card,
.schedule-card {
  padding: 18px;
}

.record-card strong,
.champion-card strong,
.manufacturer-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.28rem, 2.4vw, 1.8rem);
  line-height: 1.1;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.fit-name {
  font-size: clamp(1.08rem, 2vw, 1.68rem);
  line-height: 1.08;
  word-break: normal;
  hyphens: auto;
}

.record-card small,
.champion-card small,
.manufacturer-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.callout-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 16px;
  align-items: stretch;
}

.feature-panel {
  border: 1px solid rgba(244, 185, 66, 0.28);
  border-radius: var(--radius);
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(244, 185, 66, 0.14), transparent 46%),
    linear-gradient(180deg, rgba(24, 18, 8, 0.96), rgba(13, 12, 11, 0.96));
}

.feature-panel h3,
.table-panel h3,
.driver-card h3,
.schedule-card h3 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.feature-panel p {
  margin-bottom: 0;
  color: #d9d1bc;
  line-height: 1.6;
}

.season-switcher {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(14, 14, 17, 0.86);
}

.table-heading {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-heading h3 {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.035);
}

td {
  color: #e8e8eb;
}

tbody tr:hover {
  background: rgba(32, 199, 216, 0.055);
}

.rank-cell {
  color: var(--gold);
  font-weight: 900;
}

.driver-name {
  font-weight: 800;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.82rem;
}

.tag.gold {
  border-color: rgba(244, 185, 66, 0.42);
  color: #f7d68d;
}

.tag.cyan {
  border-color: rgba(32, 199, 216, 0.42);
  color: #91edf5;
}

.tag.red {
  border-color: rgba(224, 34, 34, 0.45);
  color: #ffb1a9;
}

.driver-tools {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.search-box {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.search-box:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(32, 199, 216, 0.16);
}

.driver-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.driver-card {
  position: relative;
  isolation: isolate;
  min-height: 210px;
  border-color: var(--flag-border, rgba(32, 199, 216, 0.34));
  background: linear-gradient(180deg, rgba(25, 25, 29, 0.96), rgba(12, 12, 15, 0.96));
}

.driver-card::before,
.driver-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.driver-card::before {
  inset: -12%;
  background: linear-gradient(135deg, rgba(117, 121, 131, 0.32), rgba(32, 199, 216, 0.12));
  opacity: 0.4;
}

.driver-card::after {
  background:
    radial-gradient(circle at 76% 22%, var(--flag-glow, rgba(32, 199, 216, 0.24)), transparent 33%),
    linear-gradient(90deg, rgba(7, 7, 10, 0.96) 0%, rgba(10, 10, 13, 0.86) 54%, rgba(10, 10, 13, 0.64) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.34));
}

.flag-bg-image {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.42;
  filter: saturate(1.16) contrast(1.05);
  transform: rotate(-3deg) scale(1.16);
  transform-origin: center;
  pointer-events: none;
}

.driver-card h3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.driver-title {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.country-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  max-width: 150px;
  min-height: 26px;
  border: 1px solid var(--flag-border, rgba(32, 199, 216, 0.34));
  border-radius: 999px;
  padding: 0 9px;
  color: #fff;
  background:
    linear-gradient(135deg, var(--flag-glow, rgba(32, 199, 216, 0.18)), rgba(255, 255, 255, 0.04)),
    rgba(0, 0, 0, 0.34);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-flag {
  width: 20px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.mini-stat {
  min-width: 0;
  min-height: 66px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.035);
}

.mini-stat strong {
  display: block;
  font-size: 1.25rem;
  overflow-wrap: anywhere;
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  margin-top: 4px;
}

.profile-note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.schedule-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.schedule-card {
  display: grid;
  gap: 14px;
}

.race-line {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.race-number {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(32, 199, 216, 0.34);
  border-radius: var(--radius);
  color: #a9f5fb;
  font-weight: 900;
}

.race-line strong,
.race-line span {
  display: block;
}

.race-line strong {
  overflow-wrap: anywhere;
}

.race-line span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 42px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.86rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.site-footer a:hover {
  color: var(--text);
}

.loading-panel {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: rgba(18, 18, 21, 0.75);
}

.loading-line,
.skeleton-block {
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
  background-size: 220% 100%;
  animation: shimmer 1.4s infinite;
}

.loading-line {
  height: 24px;
  max-width: 540px;
  margin-bottom: 14px;
}

.loading-line.short {
  max-width: 340px;
}

.skeleton-block {
  min-height: 110px;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

@keyframes shimmer {
  to {
    background-position: -220% 0;
  }
}

@media (max-width: 980px) {
  .topbar,
  .view-header,
  .callout-strip,
  .driver-tools {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: stretch;
  }

  .nav-actions,
  .season-switcher {
    justify-content: flex-start;
  }

  .hero-stats,
  .grid.four,
  .grid.three,
  .driver-grid,
  .schedule-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-hero {
    min-height: 690px;
  }

  .topbar,
  .hero-copy,
  .view-shell,
  .site-footer {
    width: min(100% - 24px, 1180px);
  }

  .nav-button {
    flex: 1 1 30%;
    padding: 0 10px;
  }

  .hero-stats,
  .grid.two,
  .grid.three,
  .grid.four,
  .driver-grid,
  .schedule-list {
    grid-template-columns: 1fr;
  }

  .stat-tile,
  .skeleton-block {
    min-height: 88px;
  }

  .view-header {
    display: block;
  }

  .season-switcher {
    margin-top: 16px;
  }

  .site-footer {
    display: grid;
  }

  table {
    min-width: 760px;
  }
}
