/* ==========================================================================
   CNE MÉXICO - CAMPEONATO NACIONAL DE ENDURO
   Main Design System & Global Stylesheet
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:ital,wght@0,400;0,600;0,700;1,700&family=Inter:wght@300;400;500;600;700&family=Oswald:wght@500;700&display=swap');

@font-face {
  font-family: 'DirtyEgo';
  src: url('../fonts/DIRTYEGO.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Color Palette - Dark Carbon & Motorsport Off-Road */
  --bg-deep: #07090c;
  --bg-primary: #0c1017;
  --bg-surface: #131822;
  --bg-surface-elevated: #1a2230;
  --bg-card: rgba(19, 24, 34, 0.75);
  --bg-card-hover: rgba(26, 34, 48, 0.9);
  --bg-glass: rgba(12, 16, 23, 0.85);

  /* Motorsport Adrenaline Accents */
  --accent-lime: #00e676;
  --accent-lime-light: #69f0ae;
  --accent-lime-dark: #00b248;
  --accent-lime-glow: rgba(0, 230, 118, 0.35);

  --accent-orange: #ff5722;
  --accent-orange-light: #ff8a50;
  --accent-orange-glow: rgba(255, 87, 34, 0.35);

  --accent-gold: #ffd600;

  /* Typography Colors */
  --text-main: #ffffff;
  --text-body: #cfd8dc;
  --text-muted: #8092a0;
  --text-dark: #07090c;

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(0, 230, 118, 0.3);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* Typography Stacks */
  --font-display: 'Chakra Petch', sans-serif;
  --font-racing: 'Oswald', 'Chakra Petch', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-grungy: 'DirtyEgo', 'Oswald', sans-serif;

  /* Elevation Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.8);
  --shadow-glow-lime: 0 0 25px rgba(0, 230, 118, 0.25);
  --shadow-glow-orange: 0 0 25px rgba(255, 87, 34, 0.25);

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset & Cross-Platform Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg-deep);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--text-body);
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(0, 230, 118, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 85% 60%, rgba(255, 87, 34, 0.03) 0%, transparent 40%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.01) 0, rgba(255,255,255,0.01) 1px, transparent 0, transparent 50px);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Custom Scrollbar for Desktop (Windows, Mac, Linux) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #07090c;
}
::-webkit-scrollbar-thumb {
  background: #1a2230;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-lime);
}
* {
  scrollbar-width: thin;
  scrollbar-color: #1a2230 #07090c;
}

/* Carbon Grain Overlay */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.02'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
  line-height: 1.15;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--accent-lime);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-lime-light);
}

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

/* Containers */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-narrow {
  max-width: 960px;
}

.section-padding {
  padding: 5rem 0;
}

@media (max-width: 768px) {
  .section-padding {
    padding: 3.5rem 0;
  }
}

/* Section Header Component */
.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
  position: relative;
}

.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-racing);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-lime);
  background: rgba(0, 230, 118, 0.1);
  border: 1px solid rgba(0, 230, 118, 0.25);
  padding: 0.35rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}

.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--text-main);
  margin-bottom: 0.75rem;
}

.section-title span.highlight {
  color: var(--accent-lime);
  text-shadow: 0 0 20px var(--accent-lime-glow);
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto;
}

/* Main Navigation Header */
.main-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  transition: all var(--transition-smooth);
}

.main-header.scrolled {
  background: rgba(7, 9, 12, 0.95);
  border-bottom-color: rgba(0, 230, 118, 0.25);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

/* Brand Identity */
.brand-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.brand-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-main-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.05em;
  line-height: 1;
}

.brand-sub-badge {
  font-family: var(--font-racing);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent-lime);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Navigation Links */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-item-link {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-body);
  position: relative;
  padding: 0.5rem 0;
  transition: color var(--transition-fast);
}

.nav-item-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent-lime);
  box-shadow: 0 0 10px var(--accent-lime);
  transition: width var(--transition-fast);
}

.nav-item-link:hover,
.nav-item-link.active {
  color: #ffffff;
}

.nav-item-link:hover::after,
.nav-item-link.active::after {
  width: 100%;
}

/* Inscription CTA Header Button */
.nav-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: linear-gradient(135deg, var(--accent-lime), var(--accent-lime-dark));
  color: var(--text-dark);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 4px;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
  box-shadow: 0 0 15px var(--accent-lime-glow);
  transition: all var(--transition-fast);
}

.nav-cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 230, 118, 0.5);
  color: #000;
}

/* Mobile Menu Toggle */
.mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.6rem;
  color: var(--text-main);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.mobile-toggle svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-main);
}

/* Mobile Navigation Backdrop */
.nav-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 998;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.nav-backdrop.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 992px) {
  .nav-container {
    height: 70px;
  }

  .brand-logo-img {
    height: 40px;
  }

  .brand-main-title {
    font-size: 1.05rem;
  }

  .brand-sub-badge {
    font-size: 0.65rem;
  }

  .mobile-toggle {
    display: flex;
    min-width: 44px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-accent);
    border-radius: 6px;
    cursor: pointer;
    touch-action: manipulation;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(85vw, 320px);
    height: 100vh;
    height: 100dvh;
    background: rgba(10, 13, 18, 0.98);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    flex-direction: column;
    align-items: stretch;
    padding: max(2rem, env(safe-area-inset-top)) 1.75rem max(2rem, env(safe-area-inset-bottom));
    gap: 1.25rem;
    border-left: 1px solid var(--border-accent);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.85);
    transition: right var(--transition-smooth);
    z-index: 999;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-menu.open {
    right: 0;
  }

  .nav-item-link {
    font-size: 1.1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    width: 100%;
    display: block;
  }

  .nav-cta-btn {
    width: 100%;
    justify-content: center;
    padding: 0.85rem;
    font-size: 0.95rem;
    margin-top: 0.5rem;
  }
}

/* Global Footer */
.main-footer {
  background: #05070a;
  border-top: 1px solid var(--border-subtle);
  padding: 4.5rem 0 max(2.5rem, calc(1.5rem + env(safe-area-inset-bottom)));
  position: relative;
}

.main-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-lime), transparent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3.5rem;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 600px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 1rem;
  max-width: 320px;
}

.footer-col-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: #ffffff;
  margin-bottom: 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-col-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background: var(--accent-lime);
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}

.footer-links a:hover {
  color: var(--accent-lime);
  padding-left: 5px;
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-copy-block {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  line-height: 1.5;
}

.footer-credit-sep {
  color: var(--border-strong);
  margin: 0 0.2rem;
  opacity: 0.6;
}

.footer-myteam-credit {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.myteam-footer-link {
  color: var(--accent-lime);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.myteam-footer-link:hover {
  color: #ffffff;
  text-shadow: 0 0 10px var(--accent-lime);
  text-decoration: underline;
}

.footer-admin-link {
  color: var(--text-muted);
  font-size: 0.8rem;
  opacity: 0.5;
  transition: opacity var(--transition-fast);
}

.footer-admin-link:hover {
  opacity: 1;
  color: var(--accent-lime);
}
