:root {
  color-scheme: light;
  --page-background: #d1d1d1;
  --surface: #ffffff;
  --surface-muted: #f2f2f2;
  --text: #111111;
  --muted: #6b6b6b;
  --accent: #ff5f1f;
  --accent-hover: #faa14d;
  --success: #2e7d32;
  --error: #8b2525;
  --border: 1px solid #e7e7e7;
  --radius: 10px;
  --radius-large: 18px;
  --shadow: 0 2px 8px rgb(0 0 0 / 0.06);
  --shadow-raised: 0 8px 22px rgb(0 0 0 / 0.14);
  --container-padding: 24px;
  --grid-gap: 16px;
  --footer-height: 24px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page-background);
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 0 0 calc(var(--footer-height) + 12px);
  overflow-x: hidden;
  background: var(--page-background);
  color: var(--text);
  font: 400 14px/1.6 "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent-hover);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(100%, 1800px);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

h1,
h2 {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.2px;
}

h1 {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.25;
}

h2 {
  font-size: clamp(19px, 2vw, 26px);
  font-weight: 400;
  line-height: 1.35;
}

h3 {
  margin: 0;
  font-size: 16px;
  font-style: italic;
  line-height: 1.4;
}

p {
  margin: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 164px;
  isolation: isolate;
  overflow: visible;
  background: #6b6b6b;
  color: #ffffff;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.1);
}

.site-header__background {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("/assets/images/content/header-background.webp") center / cover no-repeat;
  opacity: 0.56;
}

.site-navigation {
  display: flex;
  height: 164px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  flex: 0 0 auto;
}

.brand img {
  width: auto;
  height: 140px;
}

.site-navigation nav {
  min-width: 0;
}

.menu {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgb(107 107 107 / 0.78);
  color: #ffffff;
  text-align: center;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, transform 120ms ease;
}

.menu a:hover {
  background: var(--accent-hover);
  color: #111111;
}

.menu a.active {
  background: var(--accent);
  color: #ffffff;
}

.menu a:active {
  transform: translateY(1px);
}

.menu-toggle {
  display: none;
  width: 48px;
  height: 48px;
  padding: 9px;
  border: 0;
  border-radius: 8px;
  background: rgb(71 71 71 / 0.72);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  height: 2px;
  margin: 6px 0;
  border-radius: 2px;
  background: #ffffff;
}

.page-hero {
  position: relative;
  min-height: 92px;
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 48%, var(--page-background) 100%);
}

.page-hero__inner {
  padding-top: 8px;
  padding-bottom: 24px;
}

.page-hero p {
  margin-top: 8px;
  color: var(--muted);
}

.page {
  padding-top: 18px;
  padding-bottom: 28px;
}

.card {
  min-width: 0;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat-grid,
.home-cta-grid,
.event-grid,
.standings-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
}

.stat-card {
  position: relative;
  min-height: 150px;
  padding: 20px;
  overflow: hidden;
  isolation: isolate;
  color: #ffffff;
}

.stat-card::before,
.stat-card::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  border-radius: inherit;
}

.stat-card::before {
  background-position: center;
  background-size: cover;
  filter: saturate(105%) contrast(105%) brightness(0.9);
}

.stat-card::after {
  background: linear-gradient(180deg, rgb(0 0 0 / 0.16), rgb(0 0 0 / 0.42));
}

.stat-card--drivers::before {
  background-image: url("/assets/images/content/bg-driver.png");
}

.stat-card--teams::before {
  background-image: url("/assets/images/content/bg-team.png");
}

.stat-card--event::before {
  background-image: url("/assets/images/content/bg-event.png");
}

.stat-card h2 {
  font: italic 700 16px/1.4 "Montserrat", sans-serif;
}

.stat-card__value {
  margin-top: 10px;
  font-family: "Orbitron", sans-serif;
  font-size: 28px;
  line-height: 1.2;
}

.stat-card__value--countdown {
  font-size: clamp(20px, 2.1vw, 28px);
}

.stat-card__meta {
  margin-top: 10px;
  color: rgb(255 255 255 / 0.84);
}

.intro-card {
  margin-top: var(--grid-gap);
  padding: 22px;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 0.96) 0%, rgb(255 255 255 / 0.83) 58%, rgb(255 255 255 / 0.62) 100%),
    url("/assets/images/content/bg-reglement.png") center / cover no-repeat;
}

.intro-card p + p {
  margin-top: 14px;
}

.home-cta-grid {
  margin-top: 22px;
}

.home-cta {
  position: relative;
  display: flex;
  min-height: 300px;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgb(255 255 255 / 0.14);
  border-radius: var(--radius-large);
  background: #1b2029;
  color: #ffffff;
  box-shadow: var(--shadow-raised);
}

.home-cta::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
}

.home-cta--rules::after {
  background:
    linear-gradient(135deg, rgb(255 122 26 / 0.36), rgb(17 24 39 / 0.92)),
    url("/assets/images/content/bg-reglement.png") center / cover;
}

.home-cta--instagram::after {
  background:
    radial-gradient(circle at 15% 15%, rgb(255 214 0 / 0.34), transparent 31%),
    radial-gradient(circle at 100% 100%, rgb(131 58 180 / 0.38), transparent 40%),
    linear-gradient(135deg, rgb(64 93 230 / 0.62), rgb(193 53 132 / 0.72) 55%, rgb(245 96 64 / 0.5));
}

.home-cta--partner::after {
  background: linear-gradient(145deg, #767d89 0%, #323843 48%, #111720 100%);
}

.home-cta__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.home-cta__kicker,
.chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.14);
  color: rgb(255 255 255 / 0.94);
  font-size: 12px;
  font-weight: 700;
}

.home-cta__kicker {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-cta__icon {
  display: inline-flex;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgb(255 255 255 / 0.14);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.12);
}

.home-cta__icon img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.home-cta__icon--instagram {
  padding: 5px;
  background: linear-gradient(135deg, #f9ce34, #ee2a7b 52%, #6228d7);
}

.home-cta__icon--instagram img {
  width: 100%;
  height: 100%;
}

.home-cta > p {
  margin-top: 34px;
  color: rgb(255 255 255 / 0.88);
  font-size: 16px;
  line-height: 1.5;
}

.home-cta__bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: auto;
  padding-top: 22px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 12px;
  background: #ff7a1a;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 8px 20px rgb(0 0 0 / 0.18);
  transition: transform 150ms ease, background 150ms ease;
}

.button:hover {
  background: #ff8b39;
  transform: translateY(-1px);
}

.partner-link {
  display: flex;
  min-height: 190px;
  flex: 1;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
}

.partner-link img {
  width: min(100%, 330px);
  max-height: 130px;
  object-fit: contain;
}

.event-card {
  position: relative;
  overflow: hidden;
}

.event-card--past::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  background: rgb(107 107 107 / 0.48);
  content: "";
  pointer-events: none;
}

.event-card--next {
  box-shadow: 0 0 14px 4px rgb(255 95 31 / 0.45);
}

.event-card__media {
  position: relative;
  height: 145px;
  overflow: hidden;
  border-radius: var(--radius) var(--radius) 0 0;
  background: #b9b9b9;
}

.event-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.event-card__status {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgb(30 30 30 / 0.82);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
}

.event-card__status--aborted {
  background: var(--error);
}

.event-card__body {
  padding: 16px;
}

.event-card__eyebrow,
.event-card__date {
  color: var(--muted);
  font-size: 12px;
}

.event-card__date {
  margin-top: 1px;
}

.event-card h2 {
  margin-top: 3px;
}

.event-card__meta {
  margin-top: 9px;
  color: var(--muted);
}

.event-card__actions {
  margin-top: 14px;
}

.text-link {
  color: #b33a0c;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgb(179 58 12 / 0.38);
  text-underline-offset: 3px;
}

.state-card,
.notice {
  grid-column: 1 / -1;
  padding: 22px;
}

.state-card p,
.notice {
  color: var(--muted);
}

.state-card p {
  margin-top: 8px;
}

.notice {
  margin-top: 16px;
  border: 1px solid #dfb2b2;
  border-radius: var(--radius);
  background: #fff6f6;
  color: var(--error);
}

.regulation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.print-button {
  border: 0;
  cursor: pointer;
}

.regulation-card {
  padding: clamp(22px, 4vw, 48px);
}

.regulation-card h2,
.regulation-card h3,
.regulation-card h4 {
  margin: 1.6em 0 0.55em;
  font-family: "Orbitron", sans-serif;
  font-weight: 400;
  line-height: 1.35;
}

.regulation-card h2:first-child,
.regulation-card p:first-child {
  margin-top: 0;
}

.regulation-card h3 {
  font-size: 20px;
  font-style: normal;
}

.regulation-card h4 {
  font-size: 17px;
}

.regulation-card p + p {
  margin-top: 12px;
}

.regulation-card ul,
.regulation-card ol {
  margin: 10px 0 16px;
  padding-left: 24px;
}

.regulation-card li + li {
  margin-top: 5px;
}

.regulation-table-wrap {
  margin: 14px 0 18px;
  overflow-x: auto;
  border: var(--border);
  border-radius: var(--radius);
}

.regulation-table {
  min-width: 520px;
}

.season-picker {
  margin-bottom: 16px;
}

.season-picker select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #cccccc;
  border-radius: 8px;
  background: #ffffff;
  color: #111111;
}

.standings-summary-grid {
  align-items: stretch;
}

.leader-card,
.team-ranking-card,
.overall-card {
  padding: 18px;
}

.leader-card {
  display: flex;
  min-height: 330px;
  flex-direction: column;
}

.leader-card__media {
  height: 190px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #dedede;
}

.leader-card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.leader-card__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 10px;
}

.leader-card__body strong {
  font-style: italic;
}

.team-ranking-card h2,
.overall-card h2 {
  margin-bottom: 10px;
}

.overall-card {
  margin-top: var(--grid-gap);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
}

.data-table th,
.data-table td {
  padding: 8px;
  border-bottom: 1px solid #dddddd;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f8f8f8;
  font-weight: 700;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-table .total {
  font-weight: 700;
}

.compact-label,
.compact-column {
  display: none;
}

.team-stack {
  display: grid;
  gap: var(--grid-gap);
}

.team-card {
  padding: 20px;
}

.team-card__header {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.team-card__logo {
  display: flex;
  width: clamp(58px, 10vw, 122px);
  height: clamp(58px, 10vw, 122px);
  flex: 0 1 122px;
  align-items: center;
  justify-content: center;
}

.team-card__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.team-card__title {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 10px;
}

.team-card__title h2 {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-card__meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.driver-card {
  display: flex;
  min-width: 0;
  min-height: 330px;
  flex-direction: column;
  padding: 12px;
}

.driver-card__media {
  position: relative;
  height: 200px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #dedede;
}

.driver-card__media > img:first-child {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.driver-card__organizer {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.driver-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  padding: 8px 4px 0;
}

.driver-card__body h3 {
  margin-bottom: 4px;
}

.driver-card__vehicle,
.driver-card__switch,
.driver-card__empty {
  color: var(--muted);
}

.driver-card__switch {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
}

.award-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: auto 0 0;
  padding: 18px 0 0;
  list-style: none;
}

.award-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.award-item img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.site-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  height: var(--footer-height);
  border-top: 1px solid #dddddd;
  background: var(--surface-muted);
  color: #333333;
  font-size: 10px;
  line-height: var(--footer-height);
  text-align: center;
}

.site-footer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 900px) {
  .stat-grid,
  .home-cta-grid,
  .event-grid,
  .standings-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-toggle {
    display: block;
  }

  .site-navigation nav {
    position: absolute;
    top: 154px;
    right: var(--container-padding);
    z-index: 1100;
  }

  .menu {
    display: none;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .menu.is-open {
    display: flex;
  }

  .menu a {
    min-width: 156px;
    padding: 10px 16px;
    background: #6b6b6b;
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.2);
  }

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

@media (max-width: 700px) {
  :root {
    --container-padding: 16px;
    --grid-gap: 14px;
  }

  .page-hero__inner {
    padding-top: 10px;
  }

  .stat-grid,
  .home-cta-grid,
  .event-grid,
  .standings-summary-grid,
  .driver-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stat-card {
    min-height: 126px;
  }

  .home-cta {
    min-height: 300px;
  }

  .team-card {
    padding: 14px;
  }

  .team-card__title {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .team-card__meta {
    white-space: normal;
  }

  .regulation-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .regulation-actions .button {
    width: 100%;
  }
}

@media (max-width: 767px) {
  .overall-table .wide-column,
  .wide-label {
    display: none;
  }

  .overall-table .compact-column,
  .compact-label {
    display: table-cell;
  }

  span.compact-label {
    display: inline;
  }

  .overall-table th,
  .overall-table td {
    padding-inline: 6px;
  }
}

@media (max-width: 420px) {
  .brand img {
    height: 122px;
  }

  .site-navigation {
    gap: 12px;
  }

  .page-hero {
    min-height: 104px;
  }

  .page-hero p {
    font-size: 12px;
  }

  body[data-page="teams_driver"] .page-hero h1,
  body[data-page="teams_driver"] .page-hero p {
    max-width: 260px;
  }

  .team-card__header {
    gap: 10px;
  }

  .team-card__logo {
    width: 58px;
    height: 58px;
    flex-basis: 58px;
  }

  .team-card__title h2 {
    font-size: 18px;
  }

  .data-table {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    padding-bottom: 0;
    background: #ffffff;
  }

  .site-header,
  .site-footer,
  .menu-toggle,
  .home-cta-grid {
    display: none !important;
  }

  .regulation-actions {
    display: none !important;
  }

  .page-hero {
    min-height: 0;
    background: #ffffff;
  }

  .container {
    width: 100%;
    max-width: none;
    padding-inline: 0;
  }

  .card {
    break-inside: avoid;
    border-color: #cccccc;
    box-shadow: none;
  }
}
