*, *::before, *::after { box-sizing: border-box; }

:root {
  --navy:    #1a1a2e;
  --navy-80: rgba(26, 26, 46, 0.82);
  --accent:  #6366f1;
  --accent-h:#4f52e0;
  --green:   #16a34a;
  --amber:   #d97706;
  --red:     #dc2626;
  --gray-50: #f8f9fc;
  --gray-100:#f3f4f6;
  --gray-200:#e5e7eb;
  --gray-400:#9ca3af;
  --gray-600:#4b5563;
  --gray-900:#111827;
  --text:    #1f2937;
  --radius:  10px;
  --shadow:  0 2px 12px rgba(0,0,0,.08);
  --shadow-md:0 4px 24px rgba(0,0,0,.12);
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* ── Loading & Error ──────────────────────────────────────────────────────── */
.screen-loading {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; z-index: 999;
}
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.screen-error {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 20px; background: var(--gray-50);
}
.screen-error-inner { text-align: center; max-width: 420px; }
.error-icon {
  width: 56px; height: 56px; border-radius: 50%;
  background: #fee2e2; color: var(--red);
  font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.screen-error h1 { font-size: 22px; margin: 0 0 8px; }
.screen-error p  { color: var(--gray-600); margin: 0 0 24px; }
.btn-primary {
  display: inline-block; padding: 10px 24px;
  background: var(--accent); color: #fff;
  border-radius: 8px; text-decoration: none;
  font-weight: 600; font-size: 14px;
}
.mt-lg { margin-top: 24px; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.ev-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 0 24px;
  background: transparent;
  transition: background .25s, box-shadow .25s;
}
.ev-header-scrolled {
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--gray-200);
}
.ev-header-inner {
  max-width: 1160px; margin: 0 auto;
  height: 60px;
  display: flex; align-items: center; gap: 16px;
}
.ev-logo img { height: 28px; display: block; }
.ev-header-event {
  flex: 1; font-size: 15px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .2s;
  color: var(--gray-900);
}
.ev-header-scrolled .ev-header-event { opacity: 1; }
.ev-header-link {
  flex-shrink: 0;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}
.ev-header-link:hover { color: #fff; background: rgba(255,255,255,.1); }
.ev-header-scrolled .ev-header-link { color: var(--gray-600); }
.ev-header-scrolled .ev-header-link:hover { color: var(--accent); background: rgba(99,102,241,.06); }
.ev-header-link.active { color: #fff; background: rgba(255,255,255,.12); }
.ev-header-scrolled .ev-header-link.active { color: var(--accent); background: rgba(99,102,241,.06); }

@media (max-width: 640px) { .ev-nav-link { display: none; } }

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.ev-hero {
  position: relative;
  min-height: 520px;
  display: flex; align-items: flex-end;
  overflow: hidden;
}
@media (min-width: 768px) { .ev-hero { min-height: 600px; } }

.ev-hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  background-color: var(--navy);
  transform: scale(1.04);
  transition: transform 8s ease-out;
}
.ev-hero-bg-gradient {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 40%, #0f3460 100%);
}
.ev-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(
    to top,
    rgba(10,10,24,.88) 0%,
    rgba(10,10,24,.45) 55%,
    rgba(10,10,24,.18) 100%
  );
}
.ev-hero-content {
  position: relative; z-index: 1;
  width: 100%; max-width: 1160px; margin: 0 auto;
  padding: 80px 24px 52px;
  color: #fff;
}
.ev-hero-eyebrow {
  margin: 0 0 8px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 2px;
  color: #a5b4fc;
}
.ev-hero-title {
  margin: 0 0 20px;
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 800; line-height: 1.1;
  letter-spacing: -.5px;
}
.ev-hero-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  margin-bottom: 20px;
}
.ev-hero-meta-item {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: rgba(255,255,255,.8);
}
.ev-hero-year-badge { min-height: 28px; }
.ev-hero-circuit-badge {
  display: inline-block;
  padding: 4px 14px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: rgba(99,102,241,.25);
  color: #c7d2fe;
  border: 1px solid rgba(99,102,241,.4);
  letter-spacing: .3px;
}

/* ── Sections ─────────────────────────────────────────────────────────────── */
.ev-container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.ev-section { padding: 64px 0; }
.ev-section-alt { background: var(--gray-50); }
.ev-section-title {
  font-size: 22px; font-weight: 700;
  margin: 0 0 40px;
  color: var(--gray-900);
}

/* ── Otras ediciones ──────────────────────────────────────────────────────── */
.ev-editions-list { display: flex; flex-wrap: wrap; gap: 10px; }
.ev-edition-link {
  padding: 8px 20px;
  border-radius: 24px;
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-900);
  font-size: 14px; font-weight: 600;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.ev-edition-link:hover { border-color: var(--accent); color: var(--accent); }

/* ── Timeline ─────────────────────────────────────────────────────────────── */
.circuit-timeline {
  position: relative;
  padding-left: 0;
  max-width: 760px;
}

.circuit-timeline::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 24px;
  bottom: 24px;
  width: 2px;
  background: var(--gray-200);
}

.tl-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding-bottom: 36px;
}
.tl-item:last-child { padding-bottom: 0; }

/* Dot column */
.tl-dot-wrap {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  justify-content: center;
  padding-top: 14px;
  position: relative;
  z-index: 1;
}
.tl-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gray-200);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--gray-200);
  transition: background .2s, box-shadow .2s;
}
.tl-next .tl-dot {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px rgba(99,102,241,.18);
}
.tl-past .tl-dot {
  background: var(--gray-200);
  box-shadow: 0 0 0 2px var(--gray-200);
}

/* Date column */
.tl-date-col {
  flex-shrink: 0;
  width: 52px;
  text-align: center;
  padding-top: 8px;
}
.tl-day {
  display: block;
  font-size: 26px; font-weight: 800;
  line-height: 1;
  color: var(--gray-900);
}
.tl-month {
  display: block;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--accent);
  margin-top: 2px;
}
.tl-year {
  display: block;
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
}
.tl-past .tl-day   { color: var(--gray-400); }
.tl-past .tl-month { color: var(--gray-400); }
.tl-next .tl-day   { color: var(--accent); }

/* Body */
.tl-body {
  flex: 1;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, border-color .2s;
}
.tl-next .tl-body {
  border-color: rgba(99,102,241,.3);
  box-shadow: 0 2px 16px rgba(99,102,241,.1);
}
.tl-past .tl-body {
  background: var(--gray-50);
  box-shadow: none;
}

.tl-race-name {
  font-size: 17px; font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
}
.tl-past .tl-race-name { color: var(--gray-600); }

.tl-badge-past {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  background: var(--gray-100);
  color: var(--gray-400);
  vertical-align: middle;
}

.tl-event-name {
  font-size: 13px; color: var(--gray-600);
  margin-top: 3px;
}
.tl-long-date {
  font-size: 12px; color: var(--gray-400);
  margin-top: 2px;
}
.tl-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: color .15s, gap .15s;
}
.tl-link:hover { color: var(--accent-h); gap: 8px; }
.tl-past .tl-link { color: var(--gray-400); }
.tl-past .tl-link:hover { color: var(--gray-600); }

.tl-empty {
  color: var(--gray-400); font-style: italic;
  padding: 20px 0;
}

/* ── Hero actions ─────────────────────────────────────────────────────────── */
.ev-hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
}

.ev-hero-regulation {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 12px;
  padding: 4px 12px; border-radius: 999px;
  background: rgba(255,255,255,.12); color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.2);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.ev-hero-regulation:hover { background: rgba(255,255,255,.22); color: #fff; }

.hero-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: default;
  transition: background .15s;
}

.hero-action-reg {
  cursor: pointer;
}
.hero-action-reg.is-open {
  background: rgba(22,163,74,.15);
  color: #4ade80;
  border: 1px solid rgba(22,163,74,.3);
}
.hero-action-reg.is-open:hover {
  background: rgba(22,163,74,.25);
}
.hero-action-reg.is-closed {
  background: rgba(156,163,175,.1);
  color: rgba(255,255,255,.5);
  border: 1px solid rgba(255,255,255,.1);
  cursor: default;
  pointer-events: none;
}
.hero-action-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.hero-action-reg.is-open .hero-action-dot {
  box-shadow: 0 0 0 3px rgba(74,222,128,.25);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
  50%       { box-shadow: 0 0 0 6px rgba(74,222,128,.08); }
}

.hero-action-soon {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.45);
  border: 1px solid rgba(255,255,255,.1);
}
.hero-action-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.35);
}

/* ── Timeline link row ────────────────────────────────────────────────────── */
.tl-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}
.tl-link-soon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  cursor: default;
}
.tl-soon-badge {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: var(--gray-100);
  color: var(--gray-400);
}

.tl-link-circuit {
  color: #c47d0e;
  font-weight: 600;
}
.tl-link-circuit:hover { color: #a36100; }

/* ── Sponsors ─────────────────────────────────────────────────────────────── */
.ev-sponsors-section {
  padding: 80px 0;
  background: var(--navy);
}

.ev-sponsors-header {
  text-align: center;
  margin-bottom: 52px;
}
.ev-sponsors-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: #a5b4fc;
  margin-bottom: 12px;
}
.ev-sponsors-title {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin: 0 0 16px;
  letter-spacing: -.3px;
}
.ev-sponsors-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.ev-sponsors-divider::before,
.ev-sponsors-divider::after {
  content: "";
  height: 1px;
  width: 60px;
  background: rgba(255,255,255,.15);
}
.ev-sponsors-divider-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.sponsors-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.sponsor-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 36px 20px;
  background: #fff;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  min-width: 180px;
  min-height: 96px;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
}
a.sponsor-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.sponsor-logo {
  max-height: 56px;
  max-width: 180px;
  object-fit: contain;
  display: block;
}
.sponsor-name-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-400);
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
}

/* ── Description ──────────────────────────────────────────────────────────── */
.ev-desc-layout { max-width: 760px; }
.ev-description { font-size: 16px; line-height: 1.75; color: #374151; }
.ev-description p  { margin: 0 0 1em; }
.ev-description p:last-child { margin-bottom: 0; }
.ev-description strong { font-weight: 700; }
.ev-description em { font-style: italic; }
.ev-description ul, .ev-description ol { padding-left: 24px; margin: 0 0 1em; }
.ev-description li { margin-bottom: .3em; }
.ev-description a  { color: var(--accent); text-decoration: underline; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.cr-footer {
  background: var(--navy);
  color: rgba(255,255,255,.55);
  padding: 52px 0 0;
  font-size: 14px;
  line-height: 1.6;
}
.cr-footer-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 24px 44px;
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.7fr;
  gap: 48px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.cr-footer-heading {
  font-size: 12px; font-weight: 700;
  letter-spacing: 1.2px; text-transform: uppercase;
  color: #fff; margin: 0 0 18px;
}
.cr-footer-heading span { color: #a5b4fc; }
.cr-footer-col p { margin: 0; font-size: 13px; line-height: 1.75; color: rgba(255,255,255,.5); }
.cr-footer-nav { display: flex; flex-direction: column; gap: 9px; }
.cr-footer-nav a { color: rgba(255,255,255,.55); text-decoration: none; font-size: 13px; transition: color .15s; }
.cr-footer-nav a:hover { color: #fff; }
.cr-footer-social { display: flex; gap: 10px; margin-top: 4px; }
.cr-footer-social-link {
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: background .15s, color .15s;
}
.cr-footer-social-link:hover { background: rgba(255,255,255,.16); color: #fff; }
.cr-footer-bottom {
  max-width: 1160px; margin: 0 auto;
  padding: 16px 24px;
  font-size: 12px; color: rgba(255,255,255,.3);
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .cr-footer-inner { grid-template-columns: 1fr; gap: 32px; }

  .ev-sponsors-section { padding: 56px 0; }
  .ev-sponsors-title { font-size: 22px; }
  .sponsor-item { min-width: 140px; min-height: 80px; padding: 20px 24px; }
  .sponsor-logo { max-height: 44px; max-width: 130px; }

  .circuit-timeline::before { left: 15px; }

  .tl-dot-wrap { width: 32px; }

  .tl-date-col { width: 44px; }
  .tl-day { font-size: 20px; }

  .tl-body { padding: 12px 14px; }
  .tl-race-name { font-size: 15px; }
}

/* ── Modality tabs ───────────────────────────────────────────────────────── */
.modality-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.modality-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 2px solid var(--gray-200);
  border-radius: 100px;
  background: #fff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .15s;
}

.modality-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modality-tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.modality-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0,0,0,.12);
}

.modality-tab.active .modality-tab-count {
  background: rgba(255,255,255,.25);
}

.modality-panel-desc {
  font-size: 14px;
  color: var(--gray-600);
  margin: 0 0 20px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.modality-panel.hidden { display: none; }
