/* =============================================================
   APEX Theme — design tokens + utility classes
   Sibling design system to drift-akademi.com and theapexmaster.com
   Palette: #E8000E red · #0A0A0A black · #C9A84C gold
   ============================================================= */

/* Global stretch-proof baseline for <img>.
   :where() keeps specificity at 0 so any class with object-fit:cover
   (card media, heroes, portraits) still wins. */
:where(img) {
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

:root {
  --apex-red: #E8000E;
  --apex-red-400: #FF1A26;
  --apex-red-600: #C4000C;
  --apex-red-700: #9D000A;
  --apex-red-900: #5a0008;
  --apex-red-glow: rgba(232, 0, 14, 0.4);

  --apex-black: #0A0A0A;
  --apex-black-800: #111111;
  --apex-black-700: #1A1A1A;
  --apex-void: #050505;

  --apex-gold: #C9A84C;
  --apex-smoke: #2A2A2A;

  --gradient-hero: linear-gradient(180deg, #0A0A0A 0%, transparent 40%, #0A0A0A 100%);
  --gradient-red: linear-gradient(135deg, #E8000E 0%, #9D000A 100%);
  --border-racing: 1px solid rgba(232, 0, 14, 0.3);
  --glow-red: 0 0 30px rgba(232, 0, 14, 0.5), 0 0 60px rgba(232, 0, 14, 0.2);
  --glow-white: 0 0 15px rgba(255, 255, 255, 0.2);
}

/* Base ------------------------------------------------------------- */
html {
  scroll-behavior: smooth;
  /* Mobile safety net: some iOS/Android browsers ignore body's overflow-x
     when descendants use position:fixed or large translateX (e.g. the e46/gt86
     scrolling cars). Clipping at the document root prevents horizontal sway. */
  overflow-x: clip;
}

body.apex-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--apex-black);
  color: #ffffff;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

html, body {
  scrollbar-width: thin;
  scrollbar-color: var(--apex-red-700) #0a0a0a;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb {
  background: var(--apex-red-700);
  border-radius: 6px;
  border: 2px solid #0a0a0a;
}
::-webkit-scrollbar-thumb:hover { background: var(--apex-red); }
::-webkit-scrollbar-corner { background: #0a0a0a; }

/* Typography ------------------------------------------------------- */
.font-display { font-family: 'Anton', Impact, 'Arial Black', sans-serif; letter-spacing: 0.02em; }
.font-body    { font-family: 'Inter', system-ui, sans-serif; }

.apex-heading {
  font-family: 'Anton', Impact, sans-serif;
  font-size: clamp(1.6rem, 3.5vw, 2.75rem);
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #fff;
}

.apex-eyebrow {
  font-size: 11px;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--apex-red);
  font-weight: 600;
}

.apex-subtitle {
  font-size: clamp(0.95rem, 1.2vw, 1.1rem);
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

.text-glow-red  { text-shadow: 0 0 20px rgba(232, 0, 14, 0.8), 0 0 40px rgba(232, 0, 14, 0.4); }
.text-stroke    { -webkit-text-stroke: 1px #fff; color: transparent; }

/* Surfaces --------------------------------------------------------- */
.carbon-fiber {
  background-color: #111111;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.06) 1px, transparent 0);
  background-size: 20px 20px;
}

.grid-lines {
  background-image:
    linear-gradient(rgba(232, 0, 14, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 0, 14, 0.05) 1px, transparent 1px);
  background-size: 80px 80px;
}

.grid-lines-subtle {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
}

.clip-diagonal-bottom { clip-path: polygon(0 0, 100% 0, 100% 92%, 0 100%); }
.clip-diagonal-top    { clip-path: polygon(0 4%, 100% 0, 100% 100%, 0 100%); }

/* Glows + borders -------------------------------------------------- */
.glow-red      { box-shadow: var(--glow-red); }
.border-racing { border: 1px solid rgba(232, 0, 14, 0.3); }

/* Cards ------------------------------------------------------------ */
.apex-card {
  background: rgba(17, 17, 17, 0.85);
  border: 1px solid rgba(232, 0, 14, 0.15);
  border-radius: 8px;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
  position: relative;
}

.apex-card:hover {
  border-color: rgba(232, 0, 14, 0.6);
  box-shadow: 0 0 30px rgba(232, 0, 14, 0.2), 0 20px 40px rgba(0, 0, 0, 0.5);
  transform: translateY(-4px);
}

.apex-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}
.apex-card:hover::before { transform: scaleX(1); }

.apex-card-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: #0a0a0a;
}
.apex-card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.apex-card:hover .apex-card-media img { transform: scale(1.08); }

/* Driver cards — portrait visually overflows the TOP edge ONLY.
   - clip-path on the media cuts sides & bottom so the image can never
     bleed laterally or downward, but top overflow remains free.
   - aspect-ratio !important overrides the list.html inline stylesheet
     that otherwise forces 1:1 and breaks the fixed-height math.
   - Card body (or home's .apex-mini-meta) sits on z-index:3 so its
     opaque backdrop always paints over the bottom of the image. */
.apex-card--driver-overflow { overflow: visible; }
.apex-card--driver-overflow .apex-card-media,
.apex-card--driver-overflow .apex-card-media--tall {
  overflow: visible;
  aspect-ratio: auto !important;
  height: clamp(110px, 16vw, 170px);
  background: rgba(20,20,20,.7);
  position: relative;
  clip-path: inset(-100% 0 0 0);
}
.apex-card--driver-overflow .apex-card-body,
.apex-card--driver-overflow .apex-mini-meta {
  position: relative;
  background: rgba(17, 17, 17, 0.96);
}
.apex-card--driver-overflow:hover {
  z-index: 5;
}
.apex-card--driver-overflow .apex-card-media img {
  width: 100%;
  height: calc(100% + 2.8rem);
  object-fit: cover;
  object-position: center top;
  transform-origin: center bottom;
  transform: translateY(-1.6rem);
}
.apex-card--driver-overflow:hover .apex-card-media img,
.apex-card:hover .apex-card--driver-overflow .apex-card-media img {
  transform: translateY(-2rem) scale(1.03);
}

/* Stat tiles ------------------------------------------------------- */
.apex-stat-tile {
  background: rgba(17, 17, 17, 0.85);
  border: 1px solid rgba(232, 0, 14, 0.2);
  border-radius: 6px;
  padding: clamp(0.65rem, 1.4vw, 1rem);
  text-align: center;
  transition: border-color 0.3s ease;
}
.apex-stat-tile:hover { border-color: rgba(232, 0, 14, 0.5); }

.apex-stat-number {
  font-family: 'Anton', Impact, sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1;
  color: var(--apex-red);
  text-shadow: 0 0 20px rgba(232, 0, 14, 0.5);
}

.apex-stat-label {
  display: block;
  margin-top: 0.3rem;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}

/* Hero ------------------------------------------------------------- */
.apex-hero {
  position: relative;
  min-height: clamp(320px, 52vh, 560px);
  overflow: hidden;
  background: var(--apex-black);
}

.apex-hero-media {
  position: absolute; inset: 0;
  overflow: hidden;
}
.apex-hero-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  will-change: transform;
}

/* Ken Burns — active slide slowly zooms + drifts */
.apex-hero-media img.is-active {
  animation: kenBurns 9s ease-out forwards;
}

@keyframes kenBurns {
  0%   { transform: scale(1.0) translate3d(0, 0, 0); }
  100% { transform: scale(1.12) translate3d(-2%, -1.5%, 0); }
}

.apex-hero-gradient {
  position: absolute; inset: 0;
  background: var(--gradient-hero);
}

.apex-hero-content {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 3vw, 1.75rem);
}

/* Red-corner bracket motif — disabled (too visually noisy on hero sections). */
.apex-brackets {
  position: relative;
}
.apex-brackets::before,
.apex-brackets::after { content: none; }

/* Buttons ---------------------------------------------------------- */
.apex-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-family: 'Anton', Impact, sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
  border: 0;
}
.apex-btn-primary {
  background: var(--gradient-red);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232, 0, 14, 0.3);
}
.apex-btn-primary:hover {
  box-shadow: var(--glow-red);
  transform: translateY(-2px);
}
/* F1 fog-light strobe: rapid bursts then a pause, repeating */
.apex-btn--foglight {
  animation: foglight-strobe 2.4s infinite;
}
@keyframes foglight-strobe {
  /* burst 1 — 5 quick flashes */
  0%    { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  2%    { box-shadow: 0 0 24px 10px rgba(232,0,14,1), 0 0 55px 14px rgba(232,0,14,.6); }
  4%    { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  6%    { box-shadow: 0 0 24px 10px rgba(232,0,14,1), 0 0 55px 14px rgba(232,0,14,.6); }
  8%    { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  10%   { box-shadow: 0 0 24px 10px rgba(232,0,14,1), 0 0 55px 14px rgba(232,0,14,.6); }
  12%   { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  14%   { box-shadow: 0 0 24px 10px rgba(232,0,14,1), 0 0 55px 14px rgba(232,0,14,.6); }
  16%   { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  18%   { box-shadow: 0 0 24px 10px rgba(232,0,14,1), 0 0 55px 14px rgba(232,0,14,.6); }
  20%   { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  /* pause */
  55%   { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  /* burst 2 — 3 quick flashes */
  57%   { box-shadow: 0 0 24px 10px rgba(232,0,14,1), 0 0 55px 14px rgba(232,0,14,.6); }
  59%   { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  61%   { box-shadow: 0 0 24px 10px rgba(232,0,14,1), 0 0 55px 14px rgba(232,0,14,.6); }
  63%   { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  65%   { box-shadow: 0 0 24px 10px rgba(232,0,14,1), 0 0 55px 14px rgba(232,0,14,.6); }
  67%   { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
  /* long pause until next cycle */
  100%  { box-shadow: 0 4px 16px rgba(232,0,14,.3); }
}

.apex-btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.apex-btn-ghost:hover {
  border-color: var(--apex-red);
  background: rgba(232, 0, 14, 0.08);
}

/* Navbar ----------------------------------------------------------- */
.apex-nav {
  position: sticky;
  top: 0;
  z-index: 70; /* must stay above the mobile drawer (z:60) so the burger
                  button is still tappable to close it */
  background: linear-gradient(135deg, rgba(232, 0, 14, 0.95) 0%, rgba(157, 0, 10, 0.95) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(232, 0, 14, 0.5);
  transition: background 0.25s ease, border-color 0.25s ease, padding 0.25s ease;
}
.apex-nav.is-scrolled {
  background: var(--gradient-red);
  border-bottom-color: rgba(232, 0, 14, 0.75);
}

.apex-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem clamp(0.75rem, 2.5vw, 1.5rem);
  transition: padding 0.25s ease;
}
.apex-nav.is-scrolled .apex-nav-inner { padding-top: 0.4rem; padding-bottom: 0.4rem; }

.apex-nav-brand {
  font-family: 'Anton', Impact, sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
}
.apex-nav-brand .apex-brand-accent { color: var(--apex-red); }

.apex-nav-links {
  display: none;
  gap: 0.6rem;
  list-style: none;
}
@media (min-width: 900px) { .apex-nav-links { display: flex; } }

.apex-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: #fff;
  font-family: 'Anton', Impact, sans-serif;
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 0.92;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.55rem 1rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: color 0.25s ease, opacity 0.25s ease, transform 0.25s cubic-bezier(.2,.8,.2,1);
  opacity: 0.92;
  isolation: isolate;
}
/* Parallelogram background — top shifted right via skewX */
.apex-nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  transform: skewX(-15deg);
  transform-origin: center;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}
.apex-nav-link:hover,
.apex-nav-link.is-active { opacity: 1; transform: translateY(-1px); }
.apex-nav-link:hover::before,
.apex-nav-link.is-active::before {
  background: rgba(0, 0, 0, 0.35);
  border-color: #fff;
  box-shadow:
    0 6px 16px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.apex-nav-actions { display: flex; align-items: center; gap: 0.8rem; }

.apex-icon-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.apex-icon-btn:hover {
  border-color: var(--apex-red);
  color: var(--apex-red);
  background: rgba(232, 0, 14, 0.08);
}

.apex-burger {
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px; height: 16px;
  cursor: pointer;
  background: transparent;
  border: 0;
}
.apex-burger span {
  display: block;
  height: 2px; width: 100%;
  background: #fff;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
@media (min-width: 900px) { .apex-burger-wrap { display: none; } }

/* Desktop/tablet "more" dropdown — surfaces items the nav can't fit */
.apex-desk-more-wrap { display: none; position: relative; }
@media (min-width: 900px) { .apex-desk-more-wrap { display: inline-flex; } }

.apex-desk-more {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  margin: 0;
  padding: 0.35rem 0;
  list-style: none;
  background: rgba(10, 10, 10, 0.96);
  border: 1px solid rgba(232, 0, 14, 0.25);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 70;
}
.apex-desk-more.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.apex-desk-more li { margin: 0; }
.apex-desk-more a {
  display: block;
  padding: 0.55rem 1rem;
  font-family: 'Anton', Impact, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.apex-desk-more a:hover,
.apex-desk-more a:focus-visible {
  background: rgba(232, 0, 14, 0.15);
  color: #fff;
}

/* ── Crew expandable — desktop more dropdown ─────────────────────────────── */
.apex-more-crew-item { padding: 0; }
.apex-more-crew-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.55rem 1rem;
  font-family: 'Anton', Impact, sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.88);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
  gap: 0.5rem;
}
.apex-more-crew-btn:hover { background: rgba(232,0,14,0.15); color: #fff; }
.apex-more-crew-btn[aria-expanded="true"] { color: var(--apex-red); }
.apex-crew-chevron { transition: transform .2s ease; flex-shrink: 0; }
.apex-more-crew-btn[aria-expanded="true"] .apex-crew-chevron { transform: rotate(180deg); }
.apex-more-crew-panel {
  display: flex;
  flex-direction: column;
  border-top: 1px solid rgba(232,0,14,0.15);
  padding: 0.3rem 0;
}
.apex-more-crew-panel[hidden] { display: none; }
.apex-crew-tag-link {
  display: block;
  padding: 0.4rem 1.4rem;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  transition: color .15s ease, background .15s ease;
}
.apex-crew-tag-link:hover { color: var(--apex-red); background: rgba(232,0,14,0.08); }

/* ── Crew expandable — mobile drawer ────────────────────────────────────── */
.apex-drawer-crew-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 0;
  font-family: 'Anton', Impact, sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.88);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: color .15s ease;
}
.apex-drawer-crew-btn:hover { color: var(--apex-red); }
.apex-drawer-crew-btn[aria-expanded="true"] { color: var(--apex-red); }
.apex-drawer-crew-btn[aria-expanded="true"] .apex-crew-chevron { transform: rotate(180deg); }
.apex-drawer-crew-panel {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0 0.75rem 1rem;
  border-left: 2px solid rgba(232,0,14,0.4);
  margin-bottom: 0.5rem;
}
.apex-drawer-crew-panel[hidden] { display: none; }
.apex-drawer-crew-panel a {
  font-size: 1rem;
  color: rgba(255,255,255,0.55);
  text-decoration: none;
  padding: 0.3rem 0;
  transition: color .15s ease;
}
.apex-drawer-crew-panel a:hover { color: var(--apex-red); }

.apex-drawer {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 5, 0.98);
  backdrop-filter: blur(8px);
  z-index: 60;
  padding: clamp(4rem, 10vh, 6rem) 1.5rem 2rem;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow-y: auto;
}
.apex-drawer.is-open { transform: translateY(0); }
/* Desktop: drawer is the mobile menu — fully remove it from rendering */
@media (min-width: 900px) {
  .apex-drawer { display: none !important; }
}
.apex-drawer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.apex-drawer-list a {
  display: block;
  padding: 0.75rem 0;
  font-family: 'Anton', Impact, sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.apex-drawer-list a:hover { color: var(--apex-red); }

#apex-main { flex: 1; }

/* Footer ----------------------------------------------------------- */
.apex-footer {
  position: relative;
  z-index: 1;
  background: #E8000E;
  background-image: var(--gradient-red);
  border-top: 2px solid rgba(232, 0, 14, 0.85);
  padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1rem, 3vw, 1.75rem) 1rem;
  color: rgba(255, 255, 255, 0.78);
}
.apex-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .apex-footer-inner { grid-template-columns: 2fr 1fr 1fr 1fr; }
}
.apex-footer-col h4 {
  font-family: 'Anton', Impact, sans-serif;
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 0.6rem;
}
.apex-footer-col a {
  display: block;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  padding: 0.18rem 0;
  font-size: 0.88rem;
  transition: color 0.2s ease;
}
.apex-footer-col a:hover { color: #fff; }
.apex-footer-bottom {
  max-width: 1280px;
  margin: 1.5rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.8rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
}
.apex-footer-bottom > :nth-child(1) { justify-self: start; }
.apex-footer-bottom > :nth-child(2) { justify-self: center; text-align: center; }
.apex-footer-bottom > :nth-child(3) { justify-self: end; text-align: right; }
@media (max-width: 640px) {
  .apex-footer-bottom {
    grid-template-columns: 1fr;
  }
  .apex-footer-bottom > :nth-child(1),
  .apex-footer-bottom > :nth-child(2),
  .apex-footer-bottom > :nth-child(3) {
    justify-self: center;
    text-align: center;
  }
}
.footer-by-sandel {
  display: inline-block;
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}
.footer-by-sandel:hover {
  color: #fff;
  text-shadow: 0 0 12px rgba(232, 0, 14, 0.6);
}

/* Section scaffold ------------------------------------------------- */
.apex-section {
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 1.75rem);
  position: relative;
}
.apex-section-inner {
  max-width: 1280px;
  margin: 0 auto;
}

.apex-section-header {
  margin-bottom: clamp(1rem, 2vw, 1.5rem);
  text-align: left;
}
.apex-section-header.centered { text-align: center; }

/* Filter chips ----------------------------------------------------- */
.apex-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem;
  margin: 0.15rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}
.apex-chip:hover,
.apex-chip.is-active {
  background: rgba(232, 0, 14, 0.15);
  border-color: var(--apex-red);
  color: #fff;
}

/* Red tag variant — for static category/feature labels on detail pages
   (individual categories, tuner categories, circuit tags, race weather,
   vehicle turbo/NOS). Not interactive, no hover swap. */
.apex-chip--tag {
  background: rgba(232, 0, 14, 0.88);
  border-color: rgba(232, 0, 14, 1);
  color: #fff;
}
.apex-chip--tag:hover,
.apex-chip--tag.is-active {
  background: rgba(232, 0, 14, 1);
  border-color: rgba(255, 80, 80, 1);
  color: #fff;
}

/* Trapezoid chip variant — matches the skewed action-box aesthetic */
.apex-chip--trap {
  border-radius: 0;
  transform: skewX(-15deg);
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%);
  border: 2px solid #dc2626;
  color: #fff;
  font-family: 'Orbitron', 'Arial Black', sans-serif;
  font-weight: 900;
  font-style: italic;
  box-shadow: 0 4px 15px rgba(185,28,28,.3), inset 0 1px 0 rgba(255,255,255,.2);
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
}
.apex-chip--trap .apex-chip__label {
  display: inline-block;
  transform: skewX(15deg);
}
.apex-chip--trap:hover,
.apex-chip--trap.is-active {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border-color: #ef4444;
  color: #fff;
  box-shadow: 0 8px 22px rgba(220,38,38,.45), inset 0 1px 0 rgba(255,255,255,.28);
}
@media (max-width: 640px) {
  .apex-chip--trap {
    padding: 0.18rem 0.5rem;
    font-size: 0.52rem;
    letter-spacing: 0.02em;
    border-width: 1px;
  }
}

/* Plain trapezoid chip — skewed shape but keeps the neutral chip colors */
.apex-chip--trap-plain {
  border-radius: 0;
  transform: skewX(-15deg);
  padding: 0.35rem 0.9rem;
}
.apex-chip--trap-plain .apex-chip__label {
  display: inline-block;
  transform: skewX(15deg);
}

/* Mini trapezoid — clip-path trapezoid for card badge use */
.apex-chip--mini {
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  border-radius: 0;
  border: none;
  padding: 0.25rem 1.1rem;
  font-family: 'Anton', Impact, sans-serif;
  letter-spacing: 0.07em;
  font-size: 0.68rem;
  margin: 0.1rem 0.05rem;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.8);
  cursor: default;
}
.apex-chip--mini:hover {
  background: rgba(232,0,14,0.2);
  border-color: transparent;
  color: #fff;
}

/* Reveal-on-scroll ------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1),
              transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
  /* Safety net: if JS fails to attach .is-visible (cached/blocked on
     some hosts), auto-reveal after a short delay so content never
     stays hidden. The JS path still wins when it runs on time. */
  animation: apex-reveal-fallback 0s linear 1.4s forwards;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); animation: none; }

@keyframes apex-reveal-fallback {
  to { opacity: 1; transform: translateY(0); }
}

/* No-JS fallback — show everything immediately if scripts are off */
html.no-js .reveal { opacity: 1; transform: none; animation: none; }

.reveal-stagger > * { transition-delay: var(--stagger-delay, 0ms); }

/* Scroll progress bar --------------------------------------------- */
.apex-scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--gradient-red);
  z-index: 100;
  transition: width 80ms linear;
}

/* Prose container for CKEditor5 body ------------------------------- */
.apex-prose {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 72ch;
  margin: 0 auto;
}
.apex-prose h1,
.apex-prose h2,
.apex-prose h3 {
  font-family: 'Anton', Impact, sans-serif;
  color: #fff;
  margin-top: 1.3em;
  margin-bottom: 0.45em;
  line-height: 1.15;
}
.apex-prose h2 { font-size: 1.65rem; }
.apex-prose h3 { font-size: 1.3rem; color: var(--apex-red); }
.apex-prose p  { margin-bottom: 0.7em; }
.apex-prose a  { color: var(--apex-red); text-decoration: underline; text-underline-offset: 3px; }
.apex-prose a:hover { color: var(--apex-red-400); }
.apex-prose img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  border: 1px solid rgba(232, 0, 14, 0.25);
}
.apex-prose blockquote {
  border-left: 3px solid var(--apex-red);
  padding-left: 1.25rem;
  margin: 1.5em 0;
  color: rgba(255, 255, 255, 0.75);
  font-style: italic;
}
.apex-prose ul, .apex-prose ol { padding-left: 1.5rem; margin-bottom: 1.1em; }
.apex-prose li { margin-bottom: 0.3em; }

/* Focus-visible (accessibility) ----------------------------------- */
.apex-body :focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(232, 0, 14, 0.6);
}

/* Keyframes -------------------------------------------------------- */
@keyframes pulseSlow {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.6; }
}
@keyframes raceLine {
  0%, 100% { transform: scaleX(0); transform-origin: left; }
  50%      { transform: scaleX(1); transform-origin: left; }
}
@keyframes speedLine {
  0%   { transform: translateX(-100%); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateX(200%); opacity: 0; }
}
@keyframes shimmerMove {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.animate-pulse-slow { animation: pulseSlow 4s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-race-line  { animation: raceLine 2s ease-in-out infinite; }
.animate-speed-line { animation: speedLine 1.5s ease-in-out infinite; }

.shimmer {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  background-size: 200% 100%;
  animation: shimmerMove 2.4s infinite;
}

/* List pages ------------------------------------------------------ */
.apex-list-hero {
  position: relative;
  min-height: clamp(200px, 28vh, 320px);
  display: flex; align-items: flex-end;
  padding: 3.5rem 1rem 1.5rem;
  overflow: hidden;
  background: var(--apex-black);
  isolation: isolate;
}
.apex-list-hero__bg {
  position: absolute; inset: 0;
  z-index: -1;
  overflow: hidden;
}
.apex-list-hero__bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.45;
  filter: grayscale(10%) contrast(1.05);
}
.apex-list-hero::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(70% 55% at 20% 10%, rgba(232,0,14,0.22) 0%, transparent 55%),
    linear-gradient(180deg, rgba(10,10,10,0.45) 0%, rgba(10,10,10,0.98) 85%);
  z-index: -1;
  pointer-events: none;
}
.apex-list-hero__inner {
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}
.apex-list-hero__title {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin: 0.25rem 0 0.75rem;
}
.apex-profile-divider {
  height: 2px;
  margin-top: -2rem;
  background: linear-gradient(90deg, transparent 0%, var(--apex-red, #e8000e) 30%, var(--apex-red, #e8000e) 70%, transparent 100%);
  opacity: 0.75;
  position: relative;
  z-index: 1;
}

.apex-list-count {
  font-family: 'Anton', Impact, sans-serif;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 70px; padding: 0.25rem 1rem;
  background: var(--gradient-red);
  color: #fff;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  letter-spacing: 0.04em;
  clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0 100%);
  box-shadow: var(--glow-red);
}

.apex-list-filters-wrap {
  padding: 1rem 0 0.6rem;
  background: linear-gradient(180deg, var(--apex-black) 0%, var(--apex-black-800) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.apex-chip-group {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
  justify-content: center;
}
.apex-chip-group .apex-chip { cursor: pointer; user-select: none; }

.apex-list-section {
  padding: 1.75rem 1rem 2.5rem;
  background: var(--apex-black);
}

.apex-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}
.apex-grid--tall {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.apex-grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.apex-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--apex-black-800);
}
.apex-card-media--tall { aspect-ratio: 3 / 4; }
.apex-card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 700ms cubic-bezier(0.2, 0.8, 0.2, 1), filter 400ms ease;
  filter: saturate(0.9) contrast(1.05);
}
.apex-card:hover .apex-card-media img {
  transform: scale(1.08);
  filter: saturate(1.1) contrast(1.1);
}
.apex-card-media__fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 30%, rgba(232,0,14,0.18), transparent 60%), var(--apex-black-800);
  color: rgba(255,255,255,0.25);
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.2em;
  font-size: 1.4rem;
}
.apex-card-eyebrow {
  position: absolute;
  top: 0.85rem; left: 0.85rem;
  padding: 0.25rem 0.65rem;
  background: rgba(10,10,10,0.8);
  border: 1px solid var(--apex-red);
  color: #fff;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: 'Anton', sans-serif;
  backdrop-filter: blur(4px);
}
.apex-card-body {
  padding: 0.5rem 0.65rem 0.7rem;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.apex-card-title {
  font-family: 'Anton', Impact, sans-serif;
  font-size: 1rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0;
  text-transform: uppercase;
  min-height: 2.2em;
}
.apex-card:hover .apex-card-title { color: var(--apex-red); }
.apex-card-subtitle {
  font-size: 0.76rem;
  color: rgba(255,255,255,0.72);
  margin: 0;
  line-height: 1.25;
}
.apex-card-meta {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: auto;
}

/* Article cards — pin date/author to the bottom of the card regardless
   of how long the title or excerpt is. !important beats the Tailwind
   CDN `block` utility that otherwise forces display:block on the <a>. */
.apex-card--article {
  display: flex !important;
  flex-direction: column;
  height: 100%;
}
.apex-card--article .apex-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.apex-card--article .apex-card-meta {
  margin-top: auto;
  text-align: left;
  align-self: flex-start;
}
.apex-card-badges {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  margin-top: 0.35rem;
}
.apex-chip--mini {
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}
.apex-card--flat::before { display: none !important; }

/* ============================================================
   Race cards — image fills the card; text overlays on top.
   Grid uses auto-fill so the browser decides column count based
   on available width. Cards stay ~280–360px wide at every
   viewport, so the shape is consistent without fixed column
   rules. The !important is only there to beat the global
   .apex-grid 4-col mobile override at apex-theme.css:1633.
   ============================================================ */
.apex-grid:has(.apex-card--race) {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  gap: clamp(0.75rem, 1.5vw, 1.1rem);
}

/* Season sections — each season gets its own block with a
   heading and a centered flex container for its cards.
   Cards stay ~280–320px wide and center within the row, so a
   partial last row doesn't feel left-aligned. */
.apex-season-section {
  width: 100%;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}
.apex-season-section:last-child { margin-bottom: 0; }
.apex-season-section__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.75rem, 1.5vw, 1.1rem);
}
.apex-season-section__grid > .apex-card--race {
  flex: 0 1 320px;
  min-width: 260px;
  max-width: 360px;
}
@media (max-width: 560px) {
  .apex-season-section__grid > .apex-card--race {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

.apex-card--race {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 2px;
  isolation: isolate;
  background: var(--apex-black-800);
  text-decoration: none;
}

/* Media fills the whole card */
.apex-card--race__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.apex-card--race__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1),
              filter 400ms ease;
  filter: saturate(0.95) contrast(1.05);
}
.apex-card--race:hover .apex-card--race__media img {
  transform: scale(1.06);
  filter: saturate(1.1) contrast(1.1);
}
.apex-card--race .apex-card-media__fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 30%, rgba(232,0,14,0.18), transparent 60%), var(--apex-black-800);
  color: rgba(255,255,255,0.25);
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.2em;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
}

/* Dual gradient: stronger at bottom (text area), light at top (chips) */
.apex-card--race::before,
.apex-card--race::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  pointer-events: none;
  z-index: 1;
}
.apex-card--race::before {
  top: 0;
  height: 40%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), transparent);
}
.apex-card--race::after {
  bottom: 0;
  height: 65%;
  background: linear-gradient(to top,
    rgba(0,0,0,0.92) 0%,
    rgba(0,0,0,0.75) 35%,
    rgba(0,0,0,0.25) 75%,
    transparent 100%);
}

/* Top bar: round badge + status pill */
.apex-card--race__top {
  position: absolute;
  top: clamp(0.55rem, 1.6vw, 0.9rem);
  left: clamp(0.55rem, 1.6vw, 0.9rem);
  right: clamp(0.55rem, 1.6vw, 0.9rem);
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.apex-card--race__rd {
  flex-shrink: 1;
  min-width: 0;
  padding: 0.28rem clamp(0.5rem, 1.2vw, 0.7rem);
  background: rgba(10,10,10,0.82);
  border: 1px solid var(--apex-red);
  color: #fff;
  font-family: 'Anton', sans-serif;
  font-size: clamp(0.62rem, 1vw, 0.74rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  line-height: 1.2;
  white-space: nowrap;
}
.apex-card--race__status {
  flex-shrink: 0;
  padding: 0.28rem clamp(0.45rem, 1.1vw, 0.65rem);
  font-family: 'Anton', sans-serif;
  font-size: clamp(0.6rem, 1vw, 0.7rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  backdrop-filter: blur(4px);
  line-height: 1.2;
  border: 1px solid transparent;
  white-space: nowrap;
}
.apex-card--race__status.is-final {
  background: rgba(10,10,10,0.82);
  border-color: rgba(255,255,255,0.25);
}
.apex-card--race__status.is-upcoming {
  background: rgba(232,0,14,0.85);
  border-color: rgba(232,0,14,0.95);
}
.apex-card--race__status.is-today {
  background: rgba(232,0,14,0.92);
  border-color: rgba(255,255,255,0.55);
  box-shadow: 0 0 0 0 rgba(232,0,14,0.7);
  animation: apex-today-pulse 1.6s ease-in-out infinite;
}
.apex-card--race__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-top: -2px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45)) drop-shadow(0 1px 1px rgba(0,0,0,0.35));
  transition: transform 0.25s ease, filter 0.25s ease;
}
.apex-card--race__icon svg {
  display: block;
}
.apex-card:hover .apex-card--race__icon {
  transform: translateY(-1px) scale(1.04);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5)) drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.apex-card--race__icon.is-upcoming {
  filter: drop-shadow(0 2px 5px rgba(232,0,14,0.35)) drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}
.apex-card:hover .apex-card--race__icon.is-upcoming {
  filter: drop-shadow(0 4px 10px rgba(232,0,14,0.5)) drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* "Today" cards: red border glow that pulses, and a top-left badge that
   reuses the same chip styling as the detail-page TODAY chip. Applies to
   both the homepage Upcoming Events cards and the race-list cards. */
.apex-card--today,
.apex-card--race.apex-card--today {
  position: relative;
  border: 1px solid rgba(232,0,14,0.85);
  box-shadow: 0 0 0 0 rgba(232,0,14,0.55), 0 8px 26px rgba(232,0,14,0.18);
  animation: apex-today-card-glow 1.8s ease-in-out infinite;
}
.apex-card--today__badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.55rem 0.28rem 1.4rem;
  font-family: 'Anton', Impact, sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  color: #fff;
  background: rgba(232,0,14,0.92);
  border: 1px solid rgba(255,255,255,0.55);
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(232,0,14,0.7);
  animation: apex-today-pulse 1.6s ease-in-out infinite;
}
.apex-card--today__badge::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
  animation: apex-today-blink 1.2s ease-in-out infinite;
}
@keyframes apex-today-card-glow {
  0%   { box-shadow: 0 0 0 0   rgba(232,0,14,0.55), 0 8px 26px rgba(232,0,14,0.18); }
  70%  { box-shadow: 0 0 0 12px rgba(232,0,14,0),    0 8px 26px rgba(232,0,14,0.18); }
  100% { box-shadow: 0 0 0 0   rgba(232,0,14,0),    0 8px 26px rgba(232,0,14,0.18); }
}
.apex-chip.apex-chip--live {
  position: relative;
  padding-left: 1.4rem;
  animation: apex-today-pulse 1.6s ease-in-out infinite;
}
.apex-chip.apex-chip--live::before {
  content: "";
  position: absolute;
  left: 0.55rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #fff;
  transform: translateY(-50%);
  box-shadow: 0 0 6px rgba(255,255,255,0.9);
  animation: apex-today-blink 1.2s ease-in-out infinite;
}
@keyframes apex-today-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(232,0,14,0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(232,0,14,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,0,14,0); }
}
@keyframes apex-today-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.25; }
}

/* Bottom content stack */
.apex-card--race__content {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 2;
  padding: clamp(0.7rem, 2vw, 1.1rem);
  display: flex;
  flex-direction: column;
  gap: clamp(0.2rem, 0.6vw, 0.35rem);
}
.apex-card--race__series {
  font-family: 'Anton', sans-serif;
  font-size: clamp(0.62rem, 1.1vw, 0.72rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--apex-red);
  line-height: 1.2;
}
.apex-card--race__title {
  font-family: 'Anton', Impact, sans-serif;
  font-size: clamp(0.95rem, 2vw, 1.3rem);
  line-height: 1.12;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0;
  text-transform: uppercase;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.apex-card--race:hover .apex-card--race__title {
  color: var(--apex-red);
  transition: color 200ms ease;
}
.apex-card--race__meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
  font-size: clamp(0.66rem, 1.2vw, 0.76rem);
  color: rgba(255,255,255,0.82);
  letter-spacing: 0.04em;
}
.apex-card--race__circuit {
  font-weight: 500;
}
.apex-card--race__dot {
  color: rgba(255,255,255,0.4);
}
.apex-card--race__date {
  font-family: 'Anton', sans-serif;
  font-size: clamp(0.66rem, 1.2vw, 0.76rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}

/* Empty state ----------------------------------------------------- */
.apex-empty {
  padding: 4rem 1rem;
  text-align: center;
  border: 1px dashed rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.55);
  background: rgba(255,255,255,0.02);
}
.apex-empty h3 {
  font-family: 'Anton', sans-serif;
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 0.5rem;
}

/* Pagination ------------------------------------------------------ */
.apex-pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 0.5rem; margin-top: 3rem;
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.08em;
}
.apex-pagination a,
.apex-pagination span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; height: 40px;
  padding: 0 0.75rem;
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.02);
  transition: all 200ms ease;
}
.apex-pagination a:hover {
  border-color: var(--apex-red);
  color: var(--apex-red);
}
.apex-pagination .current {
  background: var(--gradient-red);
  border-color: var(--apex-red);
  color: #fff;
}

/* Filter panels (search form) ------------------------------------ */
.apex-filter-panel {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  display: flex; flex-wrap: wrap; gap: 0.75rem;
  align-items: center;
}
.apex-filter-panel input[type="search"],
.apex-filter-panel input[type="text"],
.apex-filter-panel select {
  flex: 1 1 220px;
  background: var(--apex-black);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  padding: 0.6rem 0.85rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: border-color 180ms ease;
}
.apex-filter-panel input:focus,
.apex-filter-panel select:focus {
  outline: none;
  border-color: var(--apex-red);
  box-shadow: 0 0 0 2px rgba(232,0,14,0.2);
}
.apex-filter-panel button {
  background: var(--gradient-red);
  color: #fff;
  border: none;
  padding: 0.6rem 1.25rem;
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.12em;
  cursor: pointer;
  text-transform: uppercase;
}
.apex-filter-panel button:hover { box-shadow: var(--glow-red); }

/* Group headings (categories on drivers page) -------------------- */
.apex-group-heading {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1.25rem 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.apex-group-heading h2 {
  font-family: 'Anton', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  color: #fff;
  margin: 0;
  text-transform: uppercase;
}
.apex-group-heading__accent {
  display: inline-block; width: 40px; height: 3px;
  background: var(--apex-red);
}

/* Detail shapes -------------------------------------------------- */
.apex-detail-hero,
.apex-event-hero,
.apex-tech-hero,
.apex-editorial-hero,
.apex-org-hero {
  position: relative;
  padding: 4.5rem 1.5rem 2rem;
  overflow: hidden;
  background: var(--apex-black);
  isolation: isolate;
  min-height: clamp(260px, 38vh, 440px);
  display: flex; align-items: flex-end;
}
.apex-detail-hero__bg,
.apex-event-hero__bg,
.apex-tech-hero__bg,
.apex-editorial-hero__bg,
.apex-org-hero__bg {
  position: absolute; inset: 0; z-index: -1; overflow: hidden;
}
.apex-detail-hero__bg img,
.apex-event-hero__bg img,
.apex-tech-hero__bg img,
.apex-editorial-hero__bg img,
.apex-org-hero__bg img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0.4;
  filter: grayscale(15%) contrast(1.08);
}
.apex-detail-hero::after,
.apex-event-hero::after,
.apex-tech-hero::after,
.apex-editorial-hero::after,
.apex-org-hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(70% 55% at 20% 10%, rgba(232,0,14,0.22) 0%, transparent 55%),
    linear-gradient(180deg, rgba(10,10,10,0.45) 0%, rgba(10,10,10,0.98) 85%);
  pointer-events: none;
}

.apex-detail-hero__inner,
.apex-event-hero__inner,
.apex-tech-hero__inner,
.apex-org-hero__inner {
  max-width: 1240px; width: 100%; margin: 0 auto;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(180px, 280px) 1fr;
  align-items: end;
}
.apex-detail-hero__inner {
  grid-template-columns: minmax(260px, 440px) 1fr;
}
.apex-editorial-hero__inner {
  max-width: 900px; width: 100%; margin: 0 auto;
}

.apex-detail-hero__portrait,
.apex-org-hero__logo {
  aspect-ratio: 1 / 1;
  background: var(--apex-black-800);
  border: 1px solid rgba(255,255,255,0.1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 40px rgba(232,0,14,0.18);
}
.apex-detail-hero__portrait {
  background: transparent;
  border: none;
  box-shadow: none;
  aspect-ratio: 4 / 3;
}
.apex-detail-hero__portrait img,
.apex-org-hero__logo img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.apex-org-hero__logo {
  background: #050505;
}
.apex-org-hero__logo img { object-fit: contain; padding: 12%; }

.apex-tech-hero__inner {
  grid-template-columns: 1fr minmax(280px, 520px);
}
.apex-tech-hero__art {
  aspect-ratio: 4 / 3;
  background: radial-gradient(circle at 50% 60%, rgba(232,0,14,0.15), transparent 60%), var(--apex-black-800);
  border: 1px solid rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}
.apex-tech-hero__art img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 5%;
}

.apex-event-hero__side {
  align-self: end;
}

.apex-event-hero__title,
.apex-editorial-hero__title {
  line-height: 1.05;
  margin-bottom: 0.75rem;
}

.apex-editorial-byline {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  font-family: 'Inter', sans-serif;
}

/* Stat row -------------------------------------------------------- */
.apex-detail-stats {
  padding: 2.5rem 1rem;
  background: linear-gradient(180deg, var(--apex-black-800) 0%, var(--apex-black) 100%);
  border-top: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.apex-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  max-width: 1240px; margin: 0 auto;
}
.apex-stat-row .apex-stat-tile {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 1.25rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color 220ms ease;
}
.apex-stat-row .apex-stat-tile::before {
  content: ''; position: absolute;
  top: 0; left: 0; width: 100%; height: 2px;
  background: var(--gradient-red);
  transform: scaleX(0); transform-origin: left;
  transition: transform 400ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.apex-stat-row .apex-stat-tile:hover {
  border-color: var(--apex-red);
}
.apex-stat-row .apex-stat-tile:hover::before {
  transform: scaleX(1);
}
.apex-stat-row .apex-stat-number {
  font-family: 'Anton', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.75rem);
  color: #fff;
  line-height: 1;
  letter-spacing: 0.02em;
}
.apex-stat-row .apex-stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-top: 0.4rem;
  font-family: 'Inter', sans-serif;
}

/* Detail body layout --------------------------------------------- */
.apex-detail-body { padding: 3.5rem 1rem 4rem; background: var(--apex-black); }
.apex-detail-grid {
  max-width: 1240px; margin: 0 auto;
  display: grid;
  gap: 3rem;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
}
.apex-detail-main { min-width: 0; }
.apex-detail-main.apex-prose { margin: 0; max-width: none; }
.apex-detail-side { font-family: 'Inter', sans-serif; font-size: 0.9rem; }
.apex-detail-side h3 {
  font-family: 'Anton', sans-serif;
  font-size: 1.1rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: #fff;
  margin: 0 0 0.75rem; padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--apex-red);
}
.apex-detail-side + .apex-detail-side,
.apex-detail-side .apex-side-block + .apex-side-block { margin-top: 2rem; }
.apex-detail-side dl {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
}
.apex-detail-side dt {
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
}
.apex-detail-side dd { margin: 0; color: rgba(255,255,255,0.9); }
.apex-detail-side a { color: var(--apex-red-400); }
.apex-detail-side a:hover { color: var(--apex-red); text-decoration: underline; }

/* Editorial body (article prose centered) ----------------------- */
.apex-editorial-body { padding: 3.5rem 1rem 4rem; background: var(--apex-black); }
.apex-editorial-container { max-width: 780px; margin: 0 auto; }
.apex-editorial-container .apex-prose { font-size: 1.05rem; }

/* Spec grid (tech detail) --------------------------------------- */
.apex-spec-grid {
  max-width: 1240px; margin: 0 auto 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0;
  border: 1px solid rgba(255,255,255,0.06);
}
.apex-spec-grid__cell {
  padding: 1rem 1.25rem;
  border-right: 1px solid rgba(255,255,255,0.06);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.apex-spec-grid__cell dt {
  font-family: 'Inter', sans-serif;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  margin-bottom: 0.35rem;
}
.apex-spec-grid__cell dd {
  margin: 0;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
}

/* Related content strip ----------------------------------------- */
.apex-detail-related { padding: 3.5rem 1rem; background: var(--apex-black-800); }
.apex-detail-related h2 {
  font-family: 'Anton', sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 1.5rem;
  max-width: 1240px;
  margin-left: auto; margin-right: auto;
  display: flex; align-items: center; justify-content: center; gap: 1rem;
}
.apex-detail-related h2::before,
.apex-detail-related h2::after {
  content: ''; width: 36px; height: 3px;
  background: var(--apex-red);
}

/* Prose (CKEditor5 content) ------------------------------------- */
.apex-prose { color: rgba(255,255,255,0.85); line-height: 1.75; font-size: 1rem; }
.apex-prose h1, .apex-prose h2 {
  font-family: 'Anton', sans-serif;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 2.5rem 0 1rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.1;
}
.apex-prose h3 {
  font-family: 'Anton', sans-serif;
  color: #fff;
  margin: 2rem 0 0.75rem;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.apex-prose h4 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--apex-red);
  margin: 1.75rem 0 0.5rem;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.apex-prose p { margin: 0 0 1.25rem; }
.apex-prose a { color: var(--apex-red-400); text-decoration: underline; text-underline-offset: 3px; }
.apex-prose a:hover { color: var(--apex-red); }
.apex-prose strong { color: #fff; font-weight: 600; }
.apex-prose em { color: #fff; }
.apex-prose ul, .apex-prose ol { margin: 0 0 1.25rem 1.5rem; padding: 0; }
.apex-prose li { margin-bottom: 0.4rem; }
.apex-prose blockquote {
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--apex-red);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.95);
  font-style: italic;
}
.apex-prose img, .apex-prose figure img {
  max-width: 100%; height: auto;
  margin: 1.5rem 0;
  border: 1px solid rgba(255,255,255,0.06);
}
.apex-prose figure { margin: 1.5rem 0; }
.apex-prose figcaption {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  text-align: center;
  margin-top: 0.5rem;
}
.apex-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.92rem;
}
.apex-prose th {
  background: var(--apex-black-800);
  color: #fff;
  font-family: 'Anton', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75rem 1rem;
  text-align: left;
  border: 1px solid rgba(255,255,255,0.1);
}
.apex-prose td {
  padding: 0.75rem 1rem;
  border: 1px solid rgba(255,255,255,0.06);
}
.apex-prose code {
  background: rgba(255,255,255,0.06);
  padding: 0.1em 0.35em;
  font-size: 0.92em;
  color: var(--apex-red-400);
}
.apex-prose hr {
  border: 0; border-top: 1px solid rgba(255,255,255,0.1);
  margin: 2.5rem 0;
}

/* Date tile (events) -------------------------------------------- */
.apex-date-tile {
  background: linear-gradient(145deg, rgba(232,0,14,0.14), rgba(232,0,14,0.03));
  border: 1px solid rgba(232,0,14,0.4);
  padding: 1.5rem 2rem;
  text-align: center;
  min-width: 200px;
  box-shadow: var(--glow-red);
}
.apex-date-tile__day {
  font-family: 'Anton', sans-serif;
  font-size: 3.5rem;
  line-height: 1;
  color: #fff;
}
.apex-date-tile__month {
  font-family: 'Anton', sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.2em;
  color: var(--apex-red-400);
  text-transform: uppercase;
}
.apex-date-tile__year {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: rgba(255,255,255,0.5);
}

/* Responsive helpers ---------------------------------------------- */
@media (max-width: 900px) {
  .apex-detail-grid { grid-template-columns: 1fr; gap: 2rem; }
  .apex-detail-hero__inner,
  .apex-event-hero__inner,
  .apex-tech-hero__inner,
  .apex-org-hero__inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .apex-detail-hero__meta { align-items: center; display: flex; flex-direction: column; position: relative; z-index: 1; }
  .apex-detail-hero__portrait {
    max-width: clamp(220px, 55vw, 320px);
    margin-bottom: -2.75rem;
    position: relative;
    z-index: 0;
  }
  .apex-org-hero__logo {
    max-width: clamp(220px, 55vw, 320px);
  }
}
@media (max-width: 640px) {
  .apex-nav-inner { padding: 0.35rem 0.55rem; gap: 0.4rem; }
  .apex-nav-actions { gap: 0.35rem; }
  .apex-nav-brand { flex: 0 1 auto; min-width: 0; }
  .apex-nav-brand img { height: 22px !important; max-width: 110px !important; }
  .apex-icon-btn { min-width: 36px; min-height: 36px; padding: 0 0.35rem; border-radius: 3px; }
  .apex-icon-btn svg { width: 16px; height: 16px; }
  .apex-drawer { padding: clamp(3.25rem, 8vh, 4.5rem) 1.1rem 1.5rem; }
  .apex-drawer-list { gap: 0.55rem; }
  .apex-drawer-list a { padding: 0.55rem 0; font-size: 1.1rem; letter-spacing: 0.1em; }
  .apex-section   { padding: 1.25rem 0.5rem; }
  .apex-heading   { font-size: clamp(1.4rem, 6vw, 2rem); }
  .apex-brackets::before,
  .apex-brackets::after { width: 18px; height: 18px; }
  .apex-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 0.35rem; }
  .apex-card-title { font-size: 0.82rem; line-height: 1.1; }
  .apex-card-subtitle { font-size: 0.68rem; line-height: 1.2; }
  .apex-card-body { padding: 0.45rem 0.45rem 0.6rem; gap: 0.15rem; }
  .apex-card-eyebrow { font-size: 0.62rem; padding: 0.15rem 0.35rem; top: 0.4rem; left: 0.4rem; letter-spacing: 0.08em; }
  .apex-card-media { aspect-ratio: 4 / 3; }
  .apex-detail-hero,
  .apex-event-hero,
  .apex-tech-hero,
  .apex-editorial-hero,
  .apex-org-hero { padding: 3.5rem 1rem 1.5rem; min-height: clamp(220px, 32vh, 360px); }
  .apex-empty { padding: 1.5rem 0.75rem; }
  .apex-detail-body { padding: 1.25rem 0.75rem 1.75rem; }
  .apex-detail-grid { gap: 1.25rem; }
  .apex-detail-side + .apex-detail-side,
  .apex-detail-side .apex-side-block + .apex-side-block { margin-top: 1rem; }
  .apex-editorial-body { padding: 1.25rem 0.75rem 1.75rem; }
  .apex-detail-related { padding: 1.5rem 0.75rem; }
  .apex-spec-grid__cell { padding: 0.6rem 0.75rem; }
  .apex-prose { font-size: 0.95rem; line-height: 1.55; }
  .apex-prose h1, .apex-prose h2 { font-size: clamp(1.3rem, 5vw, 1.75rem); margin: 1.25rem 0 0.6rem; }
  .apex-prose h3 { font-size: 1.1rem; margin: 1rem 0 0.5rem; }
}
@media (max-width: 400px) {
  .driver-standings-table th,
  .driver-standings-table td { padding: 0.5rem 0.5rem !important; font-size: 0.78rem; }
}
