/* ─── AT Developers — Nav Dropdowns ─── */

/* CSS vars para calcular el top correcto según estado del header */
#header { --hpad-b: 28px; }
#header.scrolled { --hpad-b: 18px; }

/* header-nav debe estirarse al alto del header para que nav-item-wrap pueda hacer lo mismo */
#header .header-nav {
  align-self: stretch;
  display: flex;
  align-items: center;
}

.nav-item-wrap {
  position: relative;
  display: flex;
  align-items: center;
  align-self: stretch; /* se estira al alto de header-nav → top 100% llega al borde del header */
}

/* Proyectos: position static → containing block sube a #header (position: fixed)
   Así el dropdown puede ocupar el ancho completo del header */
.nav-item-wrap.dd-wide {
  position: static;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + var(--hpad-b) + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: rgba(10, 18, 28, 0.50);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 22px 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease-out, transform 0.28s ease-out, visibility 0s linear 0.28s;
  z-index: 200;
  white-space: nowrap;
}

/* Estado abierto: controlado por JS con .is-open */
.nav-item-wrap.is-open .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.28s ease-out, transform 0.28s ease-out;
}

/* Wide (Proyectos): override de posición y transform */
.nav-item-wrap.dd-wide .nav-dropdown {
  left: 0;
  right: 0;
  top: 100%;
  transform: translateY(-6px);
  padding: 22px 6%;
  border-radius: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-left: none;
  border-right: none;
  border-bottom: none;
}

.nav-item-wrap.dd-wide.is-open .nav-dropdown {
  transform: translateY(0);
}

.nav-item-wrap.dd-wide .nav-dropdown::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 24px;
  background: linear-gradient(to bottom, transparent, rgba(10, 18, 28, 0.30));
  pointer-events: none;
}

/* Nav link activo cuando el dropdown está abierto */
.nav-item-wrap.is-open > a {
  color: #ffffff !important;
}

/* ── Overlay sutil al abrir cualquier dropdown ── */
#dd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease-out;
}

#dd-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Shared CTA link ── */
.dd-cta {
  display: inline-block;
  color: rgba(255, 255, 255, 0.55);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
  margin-top: 4px;
}
.dd-cta:hover { color: rgba(255, 255, 255, 0.9); }

/* ── Dropdown: Nosotros ── */
.dropdown-nosotros {
  min-width: 270px;
  max-width: 300px;
}

.dropdown-nosotros .dd-title {
  font-family: 'Orpheus Pro', Georgia, serif;
  color: #fff;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 8px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.dropdown-nosotros .dd-desc {
  color: rgba(255, 255, 255, 0.52);
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  line-height: 1.65;
  white-space: normal;
  margin: 0 0 16px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.dropdown-nosotros .dd-cta {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out, color 0.2s;
}

/* Fade secuencial al abrir — delays aplicados por JS */
.nav-item-wrap.is-open .dropdown-nosotros .dd-title,
.nav-item-wrap.is-open .dropdown-nosotros .dd-desc,
.nav-item-wrap.is-open .dropdown-nosotros .dd-cta {
  opacity: 1;
  transform: translateY(0);
}

/* ── Dropdown: Proyectos ── */
.dd-projects-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px 16px;
}

/* Items: estado base oculto para stagger */
.nav-item-wrap.dd-wide .dd-project {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.nav-item-wrap.dd-wide.is-open .dd-project {
  opacity: 1;
  transform: translateY(0);
}

.dd-project {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden;
  border-radius: 5px;
}

.dd-project img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.28s ease-out;
  display: block;
}

.dd-project:hover img {
  opacity: 1;
  transform: scale(1.04);
}

.dd-project span {
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: none;
  transition: color 0.2s;
  padding: 0 2px;
}

.dd-project:hover span { color: rgba(255, 255, 255, 1); }

/* ── Dropdown: Equipo ── */
.dropdown-equipo {
  display: flex;
  align-items: center;
  gap: 48px;
  left: auto;
  right: 0;
  transform: translateY(-6px);
}

.nav-item-wrap.is-open .dropdown-equipo {
  transform: translateY(0);
}

.dd-team-list {
  display: flex;
  flex-direction: row;
  gap: 40px;
  margin-bottom: 0;
}

.dd-member {
  display: flex;
  align-items: center;
  gap: 13px;
}

/* Stagger de entrada */
.dropdown-equipo .dd-member,
.dropdown-equipo .dd-cta {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.nav-item-wrap.is-open .dropdown-equipo .dd-member,
.nav-item-wrap.is-open .dropdown-equipo .dd-cta {
  opacity: 1;
  transform: translateY(0);
}

.dd-member img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center top;
  opacity: 0.88;
  flex-shrink: 0;
}

.dd-member-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dd-member-name {
  color: rgba(255, 255, 255, 0.88);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.dd-member-role {
  color: rgba(255, 255, 255, 0.42);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Header: adopta el mismo fondo glass del dropdown al abrirse ── */
#header.header--dropdown-open {
  background: rgba(10, 18, 28, 0.50);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
}
/* Glass prevalece sobre el fondo scrolled */
#header.scrolled.header--dropdown-open {
  background: rgba(10, 18, 28, 0.50) !important;
  backdrop-filter: blur(20px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(120%) !important;
}

/* ── Mobile: ocultar dropdowns ── */
@media (max-width: 768px) {
  .nav-dropdown { display: none !important; }
  #dd-overlay { display: none !important; }
}

/* ── Dropdown: Consultar ── */
.dropdown-consultar {
  left: auto;
  right: 0;
  transform: translateY(-6px);
  min-width: 480px;
  white-space: normal;
}

.nav-item-wrap.is-open .dropdown-consultar {
  transform: translateY(0);
}

.dd-consultar-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 40px;
  align-items: center;
}

.dd-contact-rows {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dd-contact-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-decoration: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.nav-item-wrap.is-open .dd-contact-row {
  opacity: 1;
  transform: translateY(0);
}

.dd-contact-icon {
  color: rgba(255, 255, 255, 0.5);
  flex-shrink: 0;
  width: 18px;
  margin-top: 2px;
  transition: color 0.2s;
}

.dd-contact-label {
  color: rgba(255, 255, 255, 0.5);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 3px;
}

.dd-contact-value {
  color: rgba(255, 255, 255, 0.88);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  display: block;
  transition: color 0.2s;
}

.dd-contact-row:hover .dd-contact-value { color: rgba(255, 255, 255, 1); }
.dd-contact-row:hover .dd-contact-icon  { color: rgba(255, 255, 255, 0.8); }

.dd-consultar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.nav-item-wrap.is-open .dd-consultar-right {
  opacity: 1;
  transform: translateY(0);
}

.dd-consultar-tagline {
  color: rgba(255, 255, 255, 0.45);
  font-family: 'Orpheus Pro', Georgia, serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  text-align: right;
  margin: 0;
}

.dd-consultar-btn {
  display: inline-block;
  padding: 10px 20px;
  background: rgba(123, 158, 171, 0.15);
  border: 1px solid rgba(123, 158, 171, 0.4);
  color: rgba(255, 255, 255, 0.85);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.dd-consultar-btn:hover {
  background: rgba(123, 158, 171, 0.3);
  border-color: rgba(123, 158, 171, 0.6);
  color: #fff;
}

/* ── Dropdown: Novedades ── */
.dropdown-novedades {
  min-width: 280px;
  max-width: 310px;
  white-space: normal;
  left: auto;
  right: 0;
  transform: translateY(-6px);
}

.nav-item-wrap.is-open .dropdown-novedades {
  transform: translateY(0);
}

.dropdown-novedades:focus-within {
  background: rgba(10, 18, 28, 0.82);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}

.dropdown-novedades .dd-title {
  font-family: 'Orpheus Pro', Georgia, serif;
  color: #fff;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.3;
  margin: 0 0 8px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.dropdown-novedades .dd-desc {
  color: rgba(255, 255, 255, 0.52);
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  line-height: 1.65;
  white-space: normal;
  margin: 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.nav-item-wrap.is-open .dropdown-novedades .dd-title,
.nav-item-wrap.is-open .dropdown-novedades .dd-desc {
  opacity: 1;
  transform: translateY(0);
}

.dd-novedades-cta {
  display: inline-block;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(168, 196, 205, 0.9) !important;
  text-decoration: none;
  transition: color 0.2s;
}
.dd-novedades-cta:hover { color: #fff !important; }

.dd-nl-sep {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 14px 0 0;
}

.dd-nl-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease-out, transform 0.22s ease-out;
}

.nav-item-wrap.is-open .dd-nl-form {
  opacity: 1;
  transform: translateY(0);
}

.dd-nl-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
}

.dd-nl-input::placeholder { color: rgba(255, 255, 255, 0.35); }

.dd-nl-input:focus {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.12);
}

.dd-nl-btn {
  width: 100%;
  padding: 10px;
  background: rgba(123, 158, 171, 0.18);
  border: 1px solid rgba(123, 158, 171, 0.45);
  color: rgba(255, 255, 255, 0.88);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.dd-nl-btn:hover {
  background: rgba(123, 158, 171, 0.32);
  border-color: rgba(123, 158, 171, 0.65);
  color: #fff;
}

.dd-nl-msg {
  font-size: 12px;
  min-height: 16px;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'Inter', sans-serif;
  margin: 0;
  line-height: 1.4;
}

.dd-nl-msg.success { color: rgba(168, 196, 205, 1); }
.dd-nl-msg.error   { color: #fca5a5; }

/* ── Mobile overlay panel (inmersivo) ── */
@media (max-width: 768px) {
  #overlay {
    background: rgba(10, 18, 28, 0.96);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    z-index: 101;
    height: 100vh;
    height: 100svh; /* FIX: svh estable, sin baile al hacer scroll */
    min-height: unset;
    border-bottom: none;
    padding: 0;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 0;
  }

  /* Fila superior: logo + botón cierre */
  .ov-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 6%;
    flex-shrink: 0;
  }

  .ov-logo img {
    height: 44px;
    width: auto;
    border-radius: 4px;
  }

  #ov-close {
    background: none;
    border: 1px solid rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.85);
    width: 40px; height: 40px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .2s;
    flex-shrink: 0;
  }
  #ov-close:hover { border-color: rgba(255,255,255,0.65); }

  /* Nav: ocupa el espacio central */
  .ov-nav {
    flex: 1;
    gap: 0;
    width: 100%;
    padding: 8px 6% 0;
    justify-content: center;
    overflow: hidden;
  }

  /* Links: columna con número + label + subtítulo */
  .ov-link {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .4s ease, transform .4s cubic-bezier(.76,0,.24,1);
    text-decoration: none;
    color: inherit;
  }
  .ov-link:last-child { border-bottom: none; }

  .ov-num {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 400;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.14em;
    line-height: 1;
  }

  .ov-label {
    font-family: 'Orpheus Pro', Georgia, serif;
    font-size: clamp(26px, 7vw, 40px);
    font-weight: 400;
    color: rgba(255,255,255,0.85);
    line-height: 1.1;
    transition: color .22s;
  }
  .ov-link:hover .ov-label,
  .ov-link:active .ov-label { color: #fff; }

  .ov-sub {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255,255,255,0.28);
    letter-spacing: 0.02em;
    line-height: 1;
  }

  /* pointer-events: none no hereda — deshabilitar links/botones cuando overlay está cerrado */
  #overlay a, #overlay button { pointer-events: none; }
  #overlay.open a, #overlay.open button { pointer-events: auto; }

  /* Stagger de entrada */
  #overlay.open .ov-link:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0.08s; }
  #overlay.open .ov-link:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.14s; }
  #overlay.open .ov-link:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.20s; }
  #overlay.open .ov-link:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 0.26s; }
  #overlay.open .ov-link:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 0.32s; }

  /* Footer: social + ubicación */
  .ov-footer {
    padding: 18px 6% 32px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.06);
  }

  .ov-social {
    display: flex;
    gap: 20px;
  }

  .ov-social a {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.32);
    text-decoration: none;
    transition: color .2s;
  }
  .ov-social a:hover { color: rgba(255,255,255,0.7); }

  .ov-location {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    color: rgba(255,255,255,0.2);
    letter-spacing: 0.04em;
  }

  /* ── Fix: ov-proyectos-btn layout idéntico a ov-link ── */
  .ov-proyectos-btn {
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    gap: 3px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .ov-proyectos-btn .ov-chevron {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
    align-self: unset;
  }
  .ov-proyectos-btn.open .ov-chevron {
    transform: translateY(-50%) rotate(180deg);
  }
}
