/* ==========================================================================
   Rodolfo Auto Import — layout.css
   Pantalla de carga, barra superior, header, navegación, menú móvil,
   footer y acciones flotantes.
   ========================================================================== */

/* ====================================================== pantalla de carga */
.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: var(--bg-900);
}

/* Red de seguridad en CSS puro: si el JS no llega a ejecutarse, la capa se
   retira sola a los 5 s. Va en :not(.is-hidden) a propósito — una animación
   pesa más que las reglas normales en la cascada, así que si se aplicara
   siempre le ganaría al ocultado por JS y la capa no se iría nunca. */
.loader:not(.is-hidden) {
  animation: loader-failsafe .45s linear 5s forwards;
}

.loader::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(52% 42% at 50% 46%, rgba(202, 6, 13, .3), rgba(117, 2, 8, .16) 45%, transparent 72%);
  pointer-events: none;
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  /* pointer-events se aplica sin esperar a la transición: durante el medio
     segundo de desvanecido la capa ya no intercepta clics */
  pointer-events: none;
  transition: opacity .5s var(--ease), visibility .5s;
}

/* Se retira del flujo cuando la salida ha terminado. El JS la pone siempre,
   así que la capa desaparece incluso si la transición no llega a correr
   (pestaña en segundo plano, motor sin composición continua). */
.loader.is-gone { display: none; }

@keyframes loader-failsafe {
  to { opacity: 0; visibility: hidden; }
}

.loader__inner {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1.6rem;
  padding-inline: 1.5rem;
  text-align: center;
}

/* Envoltorio del logo. En el resto del sitio no hace nada: solo la portada lo
   usa como carril por el que pasa el logo. */
.loader__pista {
  display: grid;
  place-items: center;
}

.loader__estelas { display: none; }

.loader__logo {
  width: min(300px, 62vw);
  height: auto;
  animation: loader-pulse 1.8s ease-in-out infinite;
}

@keyframes loader-pulse {
  0%, 100% { transform: scale(1);    opacity: .75; }
  50%      { transform: scale(1.07); opacity: 1; }
}

/* ------------------------------- portada: el logo entra a toda velocidad -- */

/* El carril recorta la pasada para que el logo no desborde la pantalla. */
.loader--carrera .loader__pista {
  position: relative;
  width: min(660px, 94vw);
  overflow: hidden;
  isolation: isolate;
}

/* Barrido: acelera de golpe, se planta un instante en el centro y se va. */
.loader--carrera .loader__logo {
  animation: loader-carrera 1.15s cubic-bezier(.72, .02, .28, 1) infinite;
  will-change: transform, filter, opacity;
}

@keyframes loader-carrera {
  0% {
    transform: translate3d(-135%, 0, 0) skewX(-20deg) scale(.88);
    opacity: 0;
    filter: blur(12px);
  }
  20% { opacity: 1; filter: blur(4px); }
  44% {
    transform: translate3d(0, 0, 0) skewX(-5deg) scale(1);
    filter: blur(0);
  }
  /* Frenada: el logo se asienta un momento antes de volver a salir. */
  58% { transform: translate3d(0, 0, 0) skewX(0deg) scale(1.03); filter: blur(0); }
  70% {
    transform: translate3d(5%, 0, 0) skewX(-9deg) scale(1);
    filter: blur(1.5px);
    opacity: 1;
  }
  100% {
    transform: translate3d(145%, 0, 0) skewX(-22deg) scale(.9);
    opacity: 0;
    filter: blur(13px);
  }
}

/* Líneas de velocidad corriendo por detrás, en sentido contrario al logo. */
.loader--carrera .loader__estelas {
  display: block;
  position: absolute;
  inset: 8% -40%;
  z-index: -1;
  background: repeating-linear-gradient(90deg,
    transparent 0 38px,
    rgba(255, 255, 255, .085) 38px 45px,
    transparent 45px 104px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
  animation: loader-estelas .45s linear infinite;
}

@keyframes loader-estelas {
  to { transform: translate3d(-104px, 0, 0); }
}

/* Trepidación de motor: muy corta y de amplitud mínima, lo justo para que la
   pantalla no se sienta quieta. */
.loader--carrera .loader__inner {
  animation: loader-trepidar .085s linear infinite;
}

@keyframes loader-trepidar {
  0%, 100% { transform: translate3d(0, 0, 0); }
  25%      { transform: translate3d(.8px, -.7px, 0); }
  50%      { transform: translate3d(-.7px, .5px, 0); }
  75%      { transform: translate3d(.5px, .7px, 0); }
}

/* El resplandor rojo del fondo late al ritmo de las pasadas. */
.loader--carrera::before {
  animation: loader-fogonazo .575s ease-in-out infinite alternate;
}

@keyframes loader-fogonazo {
  from { opacity: .55; }
  to   { opacity: 1; }
}

/* La barra corre más que en el resto del sitio, a juego con el logo. */
.loader--carrera .loader__bar::after {
  animation-duration: .8s;
  animation-timing-function: cubic-bezier(.55, 0, .45, 1);
}

.loader__text {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--txt-2);
}

.loader__text span {
  animation: loader-dot 1.4s infinite;
  opacity: .2;
}

.loader__text span:nth-child(2) { animation-delay: .2s; }
.loader__text span:nth-child(3) { animation-delay: .4s; }

@keyframes loader-dot {
  0%, 60%, 100% { opacity: .2; }
  30%           { opacity: 1; }
}

/* Barra de progreso indeterminada bajo el texto */
.loader__bar {
  position: relative;
  width: min(220px, 50vw);
  height: 3px;
  border-radius: 99px;
  background: var(--bg-600);
  overflow: hidden;
}

.loader__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: 99px;
  background: var(--grad-red);
  animation: loader-bar 1.5s ease-in-out infinite;
}

@keyframes loader-bar {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  .loader__logo { animation: none; opacity: 1; }
  .loader__bar::after { animation: none; width: 100%; }
  .loader__text span { animation: none; opacity: 1; }

  /* La carrera se retira entera: es justo el tipo de movimiento que molesta a
     quien pide menos animación. */
  .loader--carrera .loader__logo { transform: none; filter: none; }
  .loader--carrera .loader__estelas,
  .loader--carrera .loader__inner,
  .loader--carrera::before { animation: none; }
}

/* ============================================================== topbar == */
.topbar {
  position: relative;
  z-index: 60;
  background: var(--bg-800);
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
  color: var(--txt-2);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: var(--topbar-h);
}

.topbar__group {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.topbar__item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  white-space: nowrap;
  transition: color .25s var(--ease);
}

a.topbar__item:hover { color: var(--txt); }

.topbar__item i { color: var(--red-hi); font-size: 1.05rem; }

/* Indicador abierto/cerrado calculado en JS según la hora del visitante */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--txt-3);
  flex: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .06);
}

.status--open .status-dot {
  background: #2fd06a;
  box-shadow: 0 0 0 3px rgba(47, 208, 106, .18);
  animation: pulse 2.4s infinite;
}

.status--closed .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(202, 6, 13, .2);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(47, 208, 106, .18); }
  50%      { box-shadow: 0 0 0 7px rgba(47, 208, 106, 0); }
}

@media (max-width: 900px) {
  .topbar { display: none; }
}

/* ============================================================== header == */
.header {
  position: sticky;
  top: 0;
  z-index: 70;
  background: rgba(11, 10, 12, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}

.header.is-stuck {
  background: rgba(11, 10, 12, .96);
  box-shadow: 0 10px 34px rgba(0, 0, 0, .5);
  border-bottom-color: var(--line-2);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  margin-right: auto;
}

/* El PNG está recortado a su contenido, así que estos 72px son de logo
   visible: no hay margen transparente que se coma la altura. */
.brand img {
  height: 72px;
  width: auto;
  transition: transform .35s var(--ease);
}

.brand:hover img { transform: scale(1.04); }

@media (max-width: 480px) {
  :root { --header-h: 92px; }
  .brand img { height: 60px; }
  .header__inner { gap: 1rem; }
}

/* --------------------------------------------------------- nav desktop -- */
.nav {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.nav__link {
  position: relative;
  display: inline-block;
  padding: .55rem .9rem;
  font-family: var(--font-title);
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--txt-2);
  transition: color .25s var(--ease);
}

.nav__link::after {
  content: '';
  position: absolute;
  left: .9rem;
  right: .9rem;
  bottom: .28rem;
  height: 2px;
  background: var(--red);
  transform: skewX(-20deg) scaleX(0);
  transform-origin: left;
  transition: transform .32s var(--ease);
}

.nav__link:hover { color: var(--txt); }
.nav__link:hover::after { transform: skewX(-20deg) scaleX(1); }

.nav__link.is-active { color: var(--txt); }
.nav__link.is-active::after { transform: skewX(-20deg) scaleX(1); }

.header__cta { flex: none; }

/* Se cualifica con .header para ganarle a `.btn { display: inline-flex }`,
   que vive en componentes.css y por tanto se aplica después en la cascada. */
@media (max-width: 1080px) {
  .header .nav,
  .header .header__cta { display: none; }
}

/* ------------------------------------------------------- botón de menú -- */
.burger {
  display: none;
  position: relative;
  z-index: 110;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--bg-700);
  flex: none;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}

.burger:hover { border-color: var(--red); }

.burger { transition: background .25s var(--ease), border-color .25s var(--ease), opacity .25s var(--ease); }

.burger span {
  position: absolute;
  left: 50%;
  width: 20px;
  height: 2px;
  background: var(--txt);
  border-radius: 2px;
  transform: translateX(-50%);
}

.burger span:nth-child(1) { top: 16px; }
.burger span:nth-child(2) { top: 22px; width: 14px; left: calc(50% - 3px); }
.burger span:nth-child(3) { top: 28px; }

/* Con el menú abierto manda el botón de cierre del panel: la hamburguesa
   se retira para no dejar dos controles superpuestos en la misma esquina */
.burger.is-open {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 1080px) {
  .burger { display: block; }
}

/* ---------------------------------------------------------- menú móvil -- */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--header-h) + 2rem) var(--gutter) 2rem;
  background: var(--bg-900);
  visibility: hidden;
  opacity: 0;
  /* La visibilidad se retrasa hasta el final al cerrar y cambia al instante
     al abrir: así el panel es interactivo desde el primer momento sin
     esperar a que termine el desvanecido. */
  transition: opacity .35s var(--ease), visibility 0s linear .35s;
  overflow-y: auto;
}

.mobile-nav.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity .35s var(--ease), visibility 0s linear 0s;
}

.mobile-nav::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 50% at 85% 12%, rgba(202, 6, 13, .22), transparent 70%),
    radial-gradient(50% 40% at 10% 90%, rgba(202, 6, 13, .12), transparent 70%);
  pointer-events: none;
}

/* Botón de cierre propio del panel: el usuario no tiene por qué volver a
   buscar la hamburguesa para salir del menú */
.mobile-nav__close {
  position: absolute;
  z-index: 3;
  top: calc(var(--header-h) / 2 - 25px);
  right: var(--gutter);
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--bg-700);
  color: var(--txt);
  font-size: 1.6rem;
  transition: background .28s var(--ease), border-color .28s var(--ease), transform .28s var(--ease);
}

.mobile-nav__close:hover {
  background: var(--grad-red);
  border-color: transparent;
  transform: rotate(90deg);
}

.mobile-nav__list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  margin-bottom: 2.5rem;
}

.mobile-nav__link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: .5rem 0;
  font-family: var(--font-title);
  font-size: clamp(2rem, 9vw, 2.9rem);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.12;
  color: var(--txt-2);
  border-bottom: 1px solid var(--line);
  transition: color .25s var(--ease), padding-left .3s var(--ease);
}

.mobile-nav__link span {
  font-family: var(--font-body);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--red-hi);
}

.mobile-nav__link:hover,
.mobile-nav__link.is-active {
  color: var(--txt);
  padding-left: .7rem;
}

.mobile-nav__foot {
  position: relative;
  display: grid;
  gap: .9rem;
}

.mobile-nav__contact {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: var(--txt-2);
  font-size: .95rem;
}

.mobile-nav__contact i { color: var(--red-hi); font-size: 1.25rem; }

body.no-scroll { overflow: hidden; }

/* ============================================================== footer == */
.footer {
  position: relative;
  background: var(--bg-800);
  border-top: 1px solid var(--line);
  padding-top: clamp(3rem, 6vw, 4.5rem);
  overflow: hidden;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red-deep), var(--red) 22%, transparent 60%);
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: clamp(2rem, 5vw, 4rem);
  padding-bottom: 3rem;
}

@media (max-width: 860px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__col--brand { grid-column: 1 / -1; }
}

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

.footer__logo {
  height: 54px;
  width: auto;
  margin-bottom: 1.1rem;
}

.footer__about {
  color: var(--txt-2);
  font-size: .95rem;
  max-width: 38ch;
  margin-bottom: 1.4rem;
}

.footer__title {
  font-family: var(--font-title);
  font-size: 1.22rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 1.15rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.footer__title::after {
  content: '';
  position: absolute;
  left: 0; bottom: -1px;
  width: 42px; height: 2px;
  background: linear-gradient(90deg, var(--red), var(--red-deep));
}

.footer__links {
  display: grid;
  gap: .6rem;
}

.footer__links a {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--txt-2);
  font-size: .95rem;
  transition: color .25s var(--ease), transform .25s var(--ease);
}

.footer__links a::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--red);
  transform: skewX(-20deg);
  flex: none;
  opacity: .55;
  transition: opacity .25s var(--ease);
}

.footer__links a:hover {
  color: var(--txt);
  transform: translateX(4px);
}

.footer__links a:hover::before { opacity: 1; }

.footer__contact {
  display: grid;
  gap: 1rem;
}

.footer__contact-item {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  color: var(--txt-2);
  font-size: .94rem;
  line-height: 1.5;
  transition: color .25s var(--ease);
}

a.footer__contact-item:hover { color: var(--txt); }

.footer__contact-item i {
  color: var(--red-hi);
  font-size: 1.3rem;
  flex: none;
  margin-top: .05rem;
}

/* Igual que en las tarjetas de contacto: el correo debe poder partirse */
.footer__contact-item > span,
.mobile-nav__contact { min-width: 0; overflow-wrap: anywhere; }

.footer__contact-item b {
  display: block;
  color: var(--txt);
  font-weight: 600;
  font-size: .9rem;
}

.footer__hours {
  display: grid;
  gap: .35rem;
  margin-top: .2rem;
  font-size: .9rem;
  color: var(--txt-2);
}

.footer__hours div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: .35rem;
  border-bottom: 1px dashed var(--line);
}

.footer__hours span:last-child { color: var(--txt); font-weight: 500; }

.footer__bottom {
  border-top: 1px solid var(--line);
  padding-block: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  font-size: .85rem;
  color: var(--txt-3);
}

.footer__bottom a { color: var(--txt-2); }
.footer__bottom a:hover { color: var(--red-hi); }

/* =================================================== acciones flotantes == */
.float-wa {
  position: fixed;
  right: clamp(1rem, 3vw, 1.9rem);
  bottom: clamp(1rem, 3vw, 1.9rem);
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1.25rem;
  border-radius: 99px;
  background: #25d366;
  color: #06301a;
  font-weight: 600;
  font-size: .95rem;
  box-shadow: 0 12px 30px rgba(37, 211, 102, .32);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}

.float-wa i { font-size: 1.5rem; }

.float-wa:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(37, 211, 102, .42);
}

.float-wa__text { display: inline; }

@media (max-width: 620px) {
  .float-wa { padding: .9rem; }
  .float-wa__text { display: none; }
  .float-wa i { font-size: 1.7rem; }
}

/* Botón volver arriba */
.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 1.9rem);
  bottom: calc(clamp(1rem, 3vw, 1.9rem) + 68px);
  z-index: 79;
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-600);
  border: 1px solid var(--line-2);
  color: var(--txt);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all .3s var(--ease);
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.to-top:hover {
  background: var(--red);
  border-color: var(--red);
}

/* ================================================ cabecera de página == */
.page-hero {
  position: relative;
  padding-block: clamp(3.2rem, 8vw, 6rem);
  background:
    radial-gradient(70% 100% at 100% 0%, rgba(202, 6, 13, .24), rgba(117, 2, 8, .2) 38%, transparent 66%),
    linear-gradient(180deg, var(--bg-800), var(--bg-900));
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.page-hero__inner { position: relative; }

.page-hero h1 { margin-bottom: .8rem; }

.page-hero p {
  color: var(--txt-2);
  max-width: 60ch;
  font-size: 1.05rem;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  font-size: .86rem;
  color: var(--txt-3);
  margin-bottom: 1.1rem;
}

.breadcrumb a { color: var(--txt-2); transition: color .2s var(--ease); }
.breadcrumb a:hover { color: var(--red-hi); }
.breadcrumb i { font-size: .95rem; opacity: .6; }
.breadcrumb [aria-current] { color: var(--txt); }
