/* megamenu.css — mega-menu para Ambientes en nav top
   Estilo editorial: sutil, aireado, con líneas finas en vez de bloques.
*/

.nav-item-mm { position: relative; display: inline-flex; align-items: center; }
.nav-item-mm .mm-trigger { display: inline-flex; align-items: center; gap: 6px; }
.nav-item-mm .mm-chevron {
  font-size: 10px;
  font-weight: 300;
  transform: rotate(90deg);
  transition: transform .25s ease, opacity .25s ease;
  display: inline-block;
  opacity: 0.35;
  position: relative; top: -1px;
}

/* ───────── Desktop: panel sutil ───────── */
@media (min-width: 901px) {
  .mm-panel {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    min-width: min(840px, calc(100vw - 80px));
    background: var(--cream);
    color: var(--dark);
    border-top: 1px solid rgba(33,28,24,0.08);
    box-shadow: 0 12px 40px rgba(33,28,24,0.06);
    padding: 40px 0 36px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .35s ease, transform .35s ease, visibility .35s linear;
  }
  .nav-item-mm.open .mm-panel,
  .nav-item-mm:hover .mm-panel,
  .nav-item-mm:focus-within .mm-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
    transition-delay: .05s;
  }
  .nav-item-mm.open .mm-chevron,
  .nav-item-mm:hover .mm-chevron {
    transform: rotate(-90deg);
    opacity: 0.7;
  }

  .mm-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0;
    padding: 0 40px;
  }
  .mm-col {
    padding: 0 24px;
    border-right: 1px solid rgba(33,28,24,0.06);
  }
  .mm-col:last-child { border-right: none; }

  .mm-col-head {
    display: block;
    text-decoration: none;
    color: var(--dark);
    margin-bottom: 16px;
  }
  .mm-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 5/4;
    background: var(--linen);
    background-size: cover;
    background-position: center;
    margin-bottom: 14px;
    filter: saturate(0.92);
    transition: filter 0.5s ease, transform 0.6s ease;
  }
  .mm-thumb-empty {
    background: linear-gradient(135deg, var(--linen) 0%, var(--sand) 100%);
  }
  .mm-col-head:hover .mm-thumb {
    filter: saturate(1.05);
    transform: scale(1.01);
  }
  .mm-col-title {
    font-family: var(--sans);
    font-weight: 300;
    font-size: 14px;
    color: var(--dark);
    letter-spacing: 0.04em;
    transition: color .25s ease;
  }
  .mm-col-head:hover .mm-col-title { color: var(--earth); }

  .mm-subs {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .mm-subs a {
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--earth);
    text-decoration: none;
    transition: color .2s ease;
    padding: 1px 0;
    position: relative;
    display: inline-block;
  }
  .mm-subs a::after {
    content: '';
    position: absolute;
    left: 0; right: 100%; bottom: -2px;
    height: 1px;
    background: var(--dark);
    transition: right .35s ease;
  }
  .mm-subs a:hover {
    color: var(--dark);
  }
  .mm-subs a:hover::after { right: 0; }

  /* Nav on-dark (página de ambientes detalle) */
  .nav.on-dark .mm-panel {
    color: var(--dark);
    border-top-color: rgba(33,28,24,0.10);
  }
}

/* ───────── Mobile (hamburger drawer): accordion delicado ───────── */
@media (max-width: 900px) {
  .nav-item-mm { display: block; width: 100%; }
  .nav-item-mm .mm-trigger {
    width: 100%;
    justify-content: space-between;
  }
  .mm-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
    background: rgba(33,28,24,.02);
    margin: 0 -16px;
  }
  .nav-item-mm.open .mm-panel { max-height: 1200px; }
  .nav-item-mm.open .mm-chevron { transform: rotate(-90deg); }
  .mm-inner {
    display: flex;
    flex-direction: column;
    padding: 4px 16px 14px;
  }
  .mm-col {
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid rgba(33,28,24,.06);
  }
  .mm-col:last-child { border-bottom: none; }
  .mm-thumb { display: none; }
  .mm-col-head {
    display: block;
    text-decoration: none;
    color: inherit;
    margin-bottom: 8px;
  }
  .mm-col-title {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.02em;
  }
  .mm-subs {
    list-style: none;
    margin: 4px 0 0;
    padding: 0 0 0 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .mm-subs a {
    font-size: 11px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--earth);
    text-decoration: none;
  }
}

/* ───────── Reduced motion ───────── */
@media (prefers-reduced-motion: reduce) {
  .mm-panel, .mm-chevron, .mm-thumb, .mm-subs a::after { transition: none; }
}
