/* ==========================================================================
   TRACK MOTO CHILE - ESTILOS PRINCIPALES (MAIN.CSS)
   Identidad visual: Taller de alta precisión, modernidad y velocidad
   ========================================================================== */

:root {
  /* Paleta Oficial */
  --bg-carbon: #090B0D;
  --bg-graphite: #161A1E;
  --bg-graphite-elevated: #1F242A;
  --text-smoke: #F3F4F5;
  --text-steel: #87919A;
  --text-muted: #626B74;
  --red-primary: #E32636;
  --red-dark: #941B27;
  --red-glow: rgba(227, 38, 54, 0.25);
  --green-wa: #25D366;
  --green-wa-dark: #1EBE5D;
  --border-subtle: rgba(135, 145, 154, 0.16);
  --border-active: rgba(227, 38, 54, 0.6);

  /* Tipografía */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Espaciado */
  --header-height: 96px;
  --container-max: 1200px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Sombras y Luces */
  --shadow-sm: 0 2px 8px 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-red: 0 6px 20px rgba(227, 38, 54, 0.35);

  /* Transiciones */
  --transition-instant: 120ms ease-out;
  --transition-fast: 150ms ease-out;
  --transition-normal: 170ms ease-out;
  --transition-smooth: 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset y caja */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--bg-carbon);
  color: var(--text-smoke);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Sutil textura diagonal de pista de carreras y profundidad lumínica */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background-image: 
    radial-gradient(circle at 75% 18%, rgba(227, 38, 54, 0.055) 0%, transparent 55%),
    radial-gradient(circle at 18% 70%, rgba(227, 38, 54, 0.035) 0%, transparent 45%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.012) 0px, rgba(255, 255, 255, 0.012) 1px, transparent 1px, transparent 28px);
  z-index: -1;
}

/* Enlace de accesibilidad para saltar al contenido */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--red-primary);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  z-index: 10000;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 1rem;
  outline: 3px solid #ffffff;
}

/* Contenedor centralizado */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Tipografía de Encabezados */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-smoke);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
}

p {
  color: var(--text-steel);
  font-size: 1.05rem;
  line-height: 1.65;
}

p.lead {
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  color: var(--text-smoke);
  max-width: 680px;
}

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--red-primary);
  outline-offset: 3px;
}

/* ==========================================================================
   HEADER PRINCIPAL Y NAVEGACIÓN
   ========================================================================== */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--header-height);
  background-color: rgba(9, 11, 13, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1000;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.site-header.scrolled {
  background-color: rgba(9, 11, 13, 0.97);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-bottom-color: rgba(227, 38, 54, 0.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logotipo Oficial Track Moto Chile */
.brand-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 3px 0;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 84px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: brightness(1.1) contrast(1.12) saturate(1.12) drop-shadow(0 0 1px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 10px rgba(227, 38, 54, 0.22));
  transition: transform 150ms ease-out, filter 150ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
  .brand-logo:hover .brand-logo-img {
    transform: scale(1.02);
    filter: drop-shadow(0 0 2px rgba(227, 38, 54, 0.85)) drop-shadow(0 0 8px rgba(227, 38, 54, 0.35));
  }
}

.footer-logo-img {
  height: 96px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.75)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
  margin-bottom: 1.25rem;
  transition: transform 150ms ease-out;
}

@media (hover: hover) and (pointer: fine) {
  .footer-brand .brand-logo:hover .footer-logo-img {
    transform: scale(1.02);
  }
}

@media (max-width: 992px) {
  .brand-logo-img {
    height: 72px;
  }
}

@media (max-width: 600px) {
  .brand-logo-img {
    height: 62px;
  }
  .footer-logo-img {
    height: 78px;
  }
}

/* Navegación Desktop */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 1.75rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-steel);
  position: relative;
  padding: 0.5rem 0;
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-smoke);
}

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

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--red-primary);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--red-primary);
}

/* Botón Hamburguesa Móvil */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  gap: 5px;
  color: var(--text-smoke);
  z-index: 1002;
}

.menu-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--text-smoke);
  transition: transform var(--transition-normal), opacity var(--transition-normal);
  border-radius: 2px;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
  background-color: var(--red-primary);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
  background-color: var(--red-primary);
}

/* Menú Móvil Drawer */
.mobile-nav {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(85vw, 360px);
  height: 100vh;
  background-color: var(--bg-graphite);
  border-left: 1px solid var(--border-subtle);
  padding: calc(var(--header-height) + 1.5rem) 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 1001;
  transition: right var(--transition-smooth);
  box-shadow: var(--shadow-lg);
  visibility: hidden;
}

.mobile-nav.open {
  right: 0;
  visibility: visible;
}

.mobile-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.mobile-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  padding: 0.85rem 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-steel);
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: background-color 150ms ease-out, color 150ms ease-out, border-color 150ms ease-out;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
  color: #ffffff;
  background-color: var(--bg-graphite-elevated);
  border-left-color: var(--red-primary);
}

.mobile-contact-info {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--text-steel);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  background-color: #0b0e11;
  border-top: 1px solid var(--border-subtle);
  padding-top: 4rem;
  padding-bottom: 2rem;
  margin-top: auto;
  position: relative;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--red-primary) 50%, transparent 100%);
  opacity: 0.4;
}

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

.footer-brand p {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  max-width: 320px;
  font-size: 0.95rem;
}

.footer-heading {
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ffffff;
  margin-bottom: 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-heading::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 24px;
  height: 2px;
  background-color: var(--red-primary);
}

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

.footer-nav-link {
  color: var(--text-steel);
  font-size: 0.95rem;
  transition: color var(--transition-fast), transform var(--transition-fast);
  display: inline-block;
}

.footer-nav-link:hover {
  color: var(--text-smoke);
  transform: translateX(4px);
}

.footer-info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text-steel);
  font-size: 0.95rem;
}

.footer-info-item svg {
  width: 20px;
  height: 20px;
  color: var(--red-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.footer-social-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-graphite);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-steel);
  transition: background-color 150ms ease-out, color 150ms ease-out, transform 150ms ease-out, border-color 150ms ease-out;
}

.social-link:hover {
  background-color: var(--red-primary);
  color: #ffffff;
  border-color: var(--red-primary);
  transform: translateY(-2px);
}

.social-link svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Disclaimer legal obligatorio y créditos */
.footer-disclaimer {
  background-color: rgba(22, 26, 30, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.88rem;
  color: var(--text-steel);
  line-height: 1.5;
  text-align: center;
}

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

.author-link {
  color: var(--text-smoke);
  font-weight: 600;
  transition: color var(--transition-fast);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.author-link:hover {
  color: var(--red-primary);
}

/* ==========================================================================
   RESPONSIVE LAYOUT BREAKPOINTS
   ========================================================================== */

@media (max-width: 992px) {
  :root {
    --header-height: 84px;
  }
  .nav-desktop {
    display: none;
  }
  .menu-toggle {
    display: flex;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 600px) {
  :root {
    --header-height: 74px;
  }
  .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* Reducción de movimiento para accesibilidad */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
