/*
 * megamenu.css
 * Mi Portfolio — Estilos del Mega Menú principal
 * Paleta: #e5cdff (card/hover) · #0c0946 (active/dark)
 */

/* ─────────────────────────────────────────
   TOKENS / VARIABLES
───────────────────────────────────────── */
:root {
  --bg:      #e8e8ec;
  --surface: #f2f2f5;
  --card:    #e5cdff;   /* lavanda suave — hover de ítems  */
  --active:  #0c0946;   /* azul noche   — estado activo    */
  --text:    #1a1a1a;
  --muted:   #999;
  --border:  rgba(0,0,0,0.07);
  --nav-h:   56px;
  --accent:  #0c0946;   /* mismo tono que --active         */
}

/* ─────────────────────────────────────────
   RESET BASE (solo para el menú)
───────────────────────────────────────── */
.navbar *,
.navbar *::before,
.navbar *::after,
#megaMenu *,
#megaMenu *::before,
#megaMenu *::after {
  box-sizing: border-box;
}

/* ─────────────────────────────────────────
   NAVBAR
───────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

body {
  padding-top: var(--nav-h);
}

.navbar-logo {
  display: flex; align-items: center; gap: 7px;
  font-family: 'Geist', sans-serif;
  font-weight: 600; font-size: 0.9rem;
  letter-spacing: -0.02em;
  color: var(--text); text-decoration: none; flex-shrink: 0;
}
.navbar-sep { width: 1px; height: 18px; background: var(--border); flex-shrink: 0; }

/* ── Botón disparador del menú ── */
#menuTrigger {
  display: flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer;
  font-family: 'Geist', sans-serif;
  font-size: 0.875rem; font-weight: 500;
  color: var(--text); padding: 6px 10px; border-radius: 10px;
  transition: background 0.15s, color 0.15s; white-space: nowrap;
}
#menuTrigger:hover { background: rgba(0,0,0,0.05); }
#menuTrigger.open  { background: var(--active); color: #fff; }
#menuTrigger.open svg { stroke: #fff; }
#menuTrigger .chevron { transition: transform 0.3s cubic-bezier(.4,0,.2,1); }
#menuTrigger.open .chevron { transform: rotate(180deg); }

/* ── Links secundarios en la navbar ── */
.navbar-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.navbar-link {
  font-family: 'Geist', sans-serif;
  font-size: 0.825rem; color: var(--muted); text-decoration: none;
  padding: 5px 10px; border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.navbar-link:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.navbar-cta {
  background: var(--active); color: #fff;
  font-family: 'Geist', sans-serif;
  font-size: 0.825rem;
  font-weight: 500; padding: 7px 16px; border-radius: 10px;
  text-decoration: none; margin-left: 8px; transition: opacity 0.15s;
}
.navbar-cta:hover { opacity: 0.85; }

/* ── Responsive navbar ── */
@media (max-width: 640px) {
  #menuTrigger .chevron,
  #menuTrigger .label { display: none; }
  .navbar-link { display: none; }
  .navbar-cta  { margin-left: auto; padding: 6px 14px; font-size: 0.8rem; }
}

/* ─────────────────────────────────────────
   OVERLAY (fondo oscuro en móvil)
───────────────────────────────────────── */
#menuOverlay {
  position: fixed; inset: 0; z-index: 190;
  background: transparent; transition: background 0.3s;
}
#menuOverlay[hidden] { display: none; }
#menuOverlay.dimmed  { background: rgba(12,9,70,0.3); }

/* ─────────────────────────────────────────
   MEGAMENÚ CONTENEDOR
───────────────────────────────────────── */
#megaMenu {
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  z-index: 195;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(12,9,70,0.10), 0 2px 8px rgba(12,9,70,0.06);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px 28px 20px;
  animation: menuDown 0.3s cubic-bezier(.4,0,.2,1) both;
  font-family: 'Geist', sans-serif;
}
#megaMenu[hidden] { display: none; }

@keyframes menuDown {
  from { opacity: 0; transform: translateY(-10px); clip-path: inset(0 0 100% 0); }
  to   { opacity: 1; transform: translateY(0);     clip-path: inset(0 0 0% 0); }
}

@media (max-width: 640px) {
  #megaMenu {
    top: var(--nav-h); bottom: 0;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    grid-template-columns: 1fr; gap: 0; padding: 0;
    border-bottom: none; box-shadow: none;
    animation: menuUp 0.32s cubic-bezier(.4,0,.2,1) both;
  }
}

@keyframes menuUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────
   COLUMNAS
───────────────────────────────────────── */
.menu-col {
  padding: 12px 8px;
  opacity: 0; transform: translateY(6px);
  animation: colIn 0.35s cubic-bezier(.4,0,.2,1) forwards;
}
.menu-col:nth-child(1) { animation-delay: 0.04s; }
.menu-col:nth-child(2) { animation-delay: 0.10s; }
.menu-col:nth-child(3) { animation-delay: 0.16s; }
.menu-col:nth-child(4) { animation-delay: 0.22s; }

@keyframes colIn { to { opacity: 1; transform: translateY(0); } }

.menu-col + .menu-col { border-left: 1px solid var(--border); padding-left: 20px; }

@media (max-width: 640px) {
  .menu-col { padding: 16px 20px; border-left: none !important; }
  .menu-col + .menu-col { border-top: 1px solid var(--border); padding-left: 20px; }
  .menu-col:nth-child(1) { animation-delay: 0.05s; }
  .menu-col:nth-child(2) { animation-delay: 0.10s; }
  .menu-col:nth-child(3) { animation-delay: 0.15s; }
  .menu-col:nth-child(4) { animation-delay: 0.20s; }
}

.col-label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); padding: 0 10px 10px;
}

/* ─────────────────────────────────────────
   ÍTEM NORMAL
───────────────────────────────────────── */
.menu-col-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 12px;
  text-decoration: none; color: var(--text);
  font-size: 0.875rem; font-weight: 400;
  transition: background 0.14s, box-shadow 0.14s; cursor: pointer;
  width: 100%; background: none; border: none;
  font-family: 'Geist', sans-serif;
  text-align: left;
}
.menu-col-item:hover {
  background: var(--card);                        /* #e5cdff */
  box-shadow: 0 1px 4px rgba(12,9,70,0.08);
}
.menu-col-item:hover .item-icon {
  background: var(--active);                      /* #0c0946 */
  color: #fff;
}

/* ── Ítem destacado (featured) ── */
.menu-col-item.featured { background: var(--active); color: #fff; }
.menu-col-item.featured .item-icon { background: rgba(229,205,255,0.18); color: #e5cdff; }
.menu-col-item.featured .item-desc { color: rgba(229,205,255,0.6); }
.menu-col-item.featured:hover { background: #1a1464; }

/* ── Icono del ítem ── */
.item-icon {
  width: 32px; height: 32px; border-radius: 9px;
  background: rgba(0,0,0,0.05);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; color: var(--text);
  transition: background 0.14s, color 0.14s;
}
.item-text { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.item-name { font-size: 0.875rem; font-weight: 500; line-height: 1.2; }
.item-desc { font-size: 0.75rem; color: var(--muted); font-weight: 300; }

/* ── Badge ── */
.item-badge {
  flex-shrink: 0; font-size: 0.62rem; font-weight: 600;
  padding: 2px 7px; border-radius: 20px;
  background: var(--active); color: #fff;        /* #0c0946 */
}
.menu-col-item.featured .item-badge {
  background: rgba(229,205,255,0.2);
  color: #e5cdff;
}

/* ─────────────────────────────────────────
   PIE DEL MENÚ
───────────────────────────────────────── */
.menu-footer {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding: 12px 8px 4px;
  display: flex; align-items: center; justify-content: space-between;
  opacity: 0;
  animation: colIn 0.35s cubic-bezier(.4,0,.2,1) 0.26s forwards;
}
.menu-footer-links { display: flex; gap: 4px; flex-wrap: wrap; }
.footer-link {
  font-family: 'Geist', sans-serif;
  font-size: 0.78rem; color: var(--muted); text-decoration: none;
  padding: 5px 10px; border-radius: 8px;
  transition: background 0.14s, color 0.14s;
}
.footer-link:hover { background: var(--card); color: var(--active); }
.menu-footer-tag {
  font-family: 'Geist Mono', monospace;
  font-size: 0.68rem; color: var(--muted); opacity: 0.4;
}

@media (max-width: 640px) {
  .menu-footer {
    padding: 16px 20px 28px;
    flex-direction: column; align-items: flex-start; gap: 10px;
  }
  .menu-footer-tag { display: none; }
}