/* ==========================================================================
   HOME (index) — ajustes sobre main.css, solo para la página de inicio
   ========================================================================== */

:root {
  --navy: #0B132B;
  --navy-deep: #080e21;
  --lima: #D4FF00;
  --paper: #F5F5F1;
  --bar-h: 60px;
}

html { scroll-behavior: smooth; }

/* Clases que el HTML usaba pero no existían en main.css */
.text-lima { color: var(--lima); }

.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin-bottom: 30px;
  color: var(--paper);
}
.section-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 3px;
  margin-top: 12px;
  background: var(--lima);
  box-shadow: 0 0 10px var(--lima);
}

.hero-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.btn-geo--ghost {
  color: var(--paper);
  border-color: rgba(245, 245, 241, 0.5);
}
.btn-geo--ghost::before { background: var(--paper); }
.btn-geo--ghost:hover { box-shadow: 0 0 25px rgba(245, 245, 241, 0.35); }

/* Accesibilidad: foco visible con teclado y enlace para saltar el menú */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--lima);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 10px;
  z-index: 2000;
  padding: 10px 16px;
  background: var(--lima);
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { left: 10px; }

/* --------------------------------------------------------------------------
   HERO — imagen optimizada (antes 412 KB inline)
   -------------------------------------------------------------------------- */
.page-index .hero-section {
  background-image:
    linear-gradient(to right, rgba(11, 19, 43, 0.95) 25%, rgba(11, 19, 43, 0.7) 55%, rgba(11, 19, 43, 0.35) 100%),
    url("../img/home/hero.jpg");
  background-position: 70% 45%;
}

/* --------------------------------------------------------------------------
   MENÚ — escritorio
   -------------------------------------------------------------------------- */
.hud-menu { background: rgba(11, 19, 43, 0.8); }
.hud-menu.scrolled { background: rgba(11, 19, 43, 0.95); }

/* Con teclado también se expande, no solo con el mouse */
.hud-menu:focus-within {
  width: 260px;
  padding-left: 10px;
}
.hud-menu:focus-within span { display: inline-block !important; }

.nav-toggle,
.only-mobile { display: none; }

/* --------------------------------------------------------------------------
   BENTO — tarjetas clicables con imagen perezosa
   -------------------------------------------------------------------------- */
.bento-grid a.bento-item {
  display: block;
  color: inherit;
  text-decoration: none;
}

.bento-grid .bento-item > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: transform 0.6s ease;
}
.bento-grid a.bento-item:hover > img { transform: scale(1.06); }

.bento-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-family: "Skyrox", sans-serif;
  font-size: 0.8rem;
  letter-spacing: 2px;
  color: var(--lima);
  opacity: 0.75;
  transition: opacity 0.3s, gap 0.3s;
}
.bento-grid a.bento-item:hover .bento-more,
.bento-grid a.bento-item:focus-visible .bento-more {
  opacity: 1;
  gap: 14px;
}

/* Visor Potree: portada con botón hasta que se carga */
.potree-card {
  background:
    radial-gradient(circle at 50% 50%, rgba(212, 255, 0, 0.12), transparent 60%),
    repeating-linear-gradient(0deg, rgba(212, 255, 0, 0.06) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(212, 255, 0, 0.06) 0 1px, transparent 1px 40px),
    #000 !important;
}
.potree-card .potree-iframe { opacity: 0; transition: opacity 0.6s; }
.potree-card.is-loaded .potree-iframe { opacity: 1; }

.potree-launch {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--lima);
  font-family: "Skyrox", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 2px;
  cursor: pointer;
}
.potree-launch i {
  font-size: 3rem;
  filter: drop-shadow(0 0 12px var(--lima));
  animation: potree-pulse 2.4s ease-in-out infinite;
}
.potree-launch small {
  font-family: "Gotham", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0;
  color: rgba(245, 245, 241, 0.6);
}
.potree-card.is-loaded .potree-launch { display: none; }

@keyframes potree-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.08); opacity: 1; }
}

.potree-full {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--lima);
  border-radius: 5px;
  background: rgba(11, 19, 43, 0.8);
  color: var(--lima);
  backdrop-filter: blur(5px);
}
.potree-full:hover { background: var(--lima); color: var(--navy); }

/* --------------------------------------------------------------------------
   BANDA DE CONTACTO
   -------------------------------------------------------------------------- */
.page-index .main-content > .cta-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  flex-wrap: wrap;
  margin: 100px auto 0;
  padding: 50px 5%;
  border: 1px solid rgba(212, 255, 0, 0.25);
  border-radius: 20px;
  background: linear-gradient(120deg, rgba(212, 255, 0, 0.08), transparent 60%);
  max-width: calc(1400px - 10%);
}
.cta-band h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  margin-bottom: 10px;
}
.cta-band p {
  color: rgba(245, 245, 241, 0.75);
  max-width: 520px;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   CELULAR / TABLET (≤ 992px)
   Antes: barra abajo con 7 íconos sin texto y 80 px de hueco a la izquierda.
   Ahora: barra superior con logo + menú desplegable.
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .page-index .main-content {
    padding-left: 0;
    padding-top: var(--bar-h);
  }

  .hud-menu {
    top: 0 !important;
    bottom: auto !important;
    height: var(--bar-h);
    justify-content: space-between !important;
    padding: 0 16px !important;
    border-top: none !important;
    border-bottom: 1px solid rgba(212, 255, 0, 0.2);
    overflow: visible;
  }
  .hud-menu:hover,
  .hud-menu:focus-within { padding-left: 16px; }

  .hud-menu .logo-container {
    display: flex !important;
    width: auto;
    margin: 0;
  }
  .hud-menu .mini-logo,
  .hud-menu:hover .mini-logo { width: 40px; }

  .nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid rgba(212, 255, 0, 0.4);
    border-radius: 8px;
    color: var(--lima);
    font-size: 1.3rem;
    cursor: pointer;
  }

  .hud-menu .nav-links {
    display: none !important;
    position: fixed;
    top: var(--bar-h);
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: column;
    justify-content: flex-start !important;
    padding: 20px 16px;
    background: var(--navy);
    overflow-y: auto;
  }
  .hud-menu.is-open .nav-links { display: flex !important; }

  .hud-menu .nav-links li a {
    padding: 16px 12px !important;
    font-size: 16px;
    border-bottom: 1px solid rgba(212, 255, 0, 0.08);
  }
  .hud-menu.is-open .nav-links li a span {
    display: inline-block !important;
  }
  .hud-menu .only-mobile { display: block; margin-top: 12px; }
  .hud-menu .only-mobile a {
    border: 1px solid var(--lima);
    border-radius: 8px;
  }

  body.menu-open { overflow: hidden; }

  .hero-section .hero-content { padding: 40px 16px; }
  .hero-btns .btn-geo { flex: 1 1 220px; text-align: center; }

  .bento-grid .bento-item.potree-card { height: 340px; }

  .page-index .main-content > .cta-band {
    margin: 60px 16px 0;
    padding: 32px 20px;
    max-width: none;
  }
  .cta-band .btn-geo { width: 100%; text-align: center; }

  .main-footer { padding: 50px 16px 20px; }
}

/* Menos movimiento si el usuario lo pidió en su sistema */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* La etiqueta del visor va abajo para no tapar los controles de Potree */
.potree-card .bento-tag {
  top: auto;
  bottom: 15px;
}

@media (max-width: 992px) {
  /* backdrop-filter hace que el menú "fixed" se recorte dentro de la barra */
  .hud-menu { backdrop-filter: none; background: rgba(11, 19, 43, 0.97); }
  .hero-section::after { display: none; }
  .hero-btns .btn-geo { letter-spacing: 1px; padding: 15px 20px; }
}

/* Últimos proyectos (vienen del blog) */
.page-index .main-content > .home-news { margin-top: 90px; }
.home-news[hidden] { display: none; }
.home-news__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
@media (max-width: 992px) {
  .page-index .main-content > .home-news { margin-top: 60px; padding-left: 16px; padding-right: 16px; }
}

/* Tarjeta a todo lo ancho (cierra la cuadrícula de servicios) */
.bento-grid .bento-item.item-full { grid-column: 1 / -1; }

/* --------------------------------------------------------------------------
   PÁGINAS INTERIORES (agro, nosotros, obras, sig) en celular / tablet
   main.css les deja 80 px de padding + 60 px de margen a la izquierda
   (pensados para la barra lateral). Aquí usan la misma barra superior
   que el inicio, así que el contenido ocupa todo el ancho.
   -------------------------------------------------------------------------- */
.hud-menu .nav-links a[aria-current="page"] { color: var(--lima); }

@media (max-width: 992px) {
  body:not(.page-index) .main-content {
    margin-left: 0 !important;
    padding-left: 0;
    padding-top: var(--bar-h);
  }
  body:not(.page-index) .main-content > section,
  body:not(.page-index) .main-content > header:not(.hero-section) {
    padding-left: 16px;
    padding-right: 16px;
  }
  body:not(.page-index) .hero-section .hero-content h1 {
    font-size: clamp(1.7rem, 8vw, 2.5rem) !important;
    overflow-wrap: break-word;
  }
}
