/* ============================================================
   WebtasticAI — shared navigation system
   Mega-menu (desktop) + accordion drawer (mobile) + breadcrumbs.
   Loads AFTER the page's own stylesheet so it can refine .nav-links.
   Consumes existing design tokens only — defines none of its own.
   ============================================================ */

/* Mega panels anchor to the container, not the pill, so they can be wide. */
.nav-inner { position: relative; }

/* ---- Trigger ---- */
.nav-links .has-mega { position: static; }
.nav-links .nav-trigger {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.5rem 0.75rem 0.5rem 0.85rem;
}
.nav-trigger .chev {
  width: 13px; height: 13px; opacity: 0.65; flex: none;
  transition: transform var(--dur-fast) var(--ease-out-quart);
}
.has-mega[data-open="true"] > .nav-trigger { color: var(--purple); background: var(--bg-tint); }
.has-mega[data-open="true"] .chev { transform: rotate(180deg); opacity: 1; }

/* ---- Mega panel ---- */
.mega {
  position: absolute; top: calc(100% + 0.65rem); left: 50%;
  transform: translateX(-50%) translateY(-8px);
  width: min(1000px, calc(100vw - 2.5rem));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: 0 28px 70px -24px rgba(21, 11, 51, 0.38);
  padding: 1.5rem 1.6rem 1.2rem;
  z-index: var(--z-menu);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out-quart),
              transform var(--dur-fast) var(--ease-out-quart),
              visibility var(--dur-fast);
}
[data-theme="dark"] .mega {
  background: var(--surface-2);
  box-shadow: 0 28px 70px -24px rgba(0, 0, 0, 0.8);
}
.has-mega[data-open="true"] .mega {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.mega-grid { display: grid; gap: 1.15rem 1.5rem; }
.mega-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mega-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.mega-col h4 {
  font-family: var(--font-display); font-weight: 800;
  font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-dimmer); margin: 0 0 0.45rem 0.55rem;
}
.mega-col a {
  display: block; padding: 0.4rem 0.55rem; border-radius: var(--r-xs);
  font-size: 0.9rem; font-weight: 600; color: var(--text-dim); line-height: 1.35;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.mega-col a:hover, .mega-col a:focus-visible { background: var(--bg-tint); color: var(--purple); }
.mega-col a small { display: block; font-weight: 500; font-size: 0.76rem; color: var(--text-dimmer); margin-top: 0.08rem; }

.mega-foot {
  margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.mega-foot p { font-size: 0.85rem; color: var(--text-dimmer); margin: 0; }
.mega-all {
  font-weight: 700; font-size: 0.9rem; color: var(--purple);
  display: inline-flex; align-items: center; gap: 0.35rem; white-space: nowrap;
}
.mega-all:hover { text-decoration: underline; }
.mega-all svg { width: 15px; height: 15px; }

/* ---- Mobile drawer accordion ---- */
.m-acc { border-bottom: 1px solid var(--border); }
.m-acc > summary {
  padding: 0.95rem 0.5rem; cursor: pointer; list-style: none;
  font-family: var(--font-display); font-weight: 600; font-size: 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.m-acc > summary::-webkit-details-marker { display: none; }
.m-acc > summary .chev { transition: transform var(--dur-fast) var(--ease-out-quart); width: 16px; height: 16px; opacity: 0.6; }
.m-acc[open] > summary { color: var(--purple); }
.m-acc[open] > summary .chev { transform: rotate(180deg); opacity: 1; }
.m-acc-body { display: flex; flex-direction: column; padding: 0 0 0.75rem; }
.mobile-menu .m-acc-body a {
  font-family: var(--font-body); font-size: 0.98rem; font-weight: 600;
  padding: 0.5rem 0.6rem; border-bottom: 0; border-radius: var(--r-xs);
  color: var(--text-dim);
}
.mobile-menu .m-acc-body a:hover { background: var(--bg-tint); color: var(--purple); }
.m-acc-body h5 {
  font-family: var(--font-display); font-weight: 800;
  font-size: 0.66rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-dimmer); margin: 0.7rem 0 0.15rem 0.6rem;
}

/* ---- Footer: five columns now that Domenii and Blog have their own ---- */
.footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr 1.15fr; gap: 2rem 1.6rem; }
.footer-col h3 { margin-bottom: 0.9rem; }
.footer-col ul { gap: 0.55rem; }
.footer-col .fc-more { color: var(--purple); font-weight: 700; }
@media (max-width: 1060px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---- Breadcrumb (safe re-declaration for pages whose CSS lacks it) ---- */
.breadcrumb { display: flex; align-items: center; gap: 0.5rem; font-size: 0.86rem; color: var(--text-dimmer); margin-bottom: 1.2rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--text-dimmer); font-weight: 600; }
.breadcrumb a:hover { color: var(--purple); text-decoration: underline; }
.breadcrumb span[aria-current] { color: var(--text-dim); font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .nav-links .nav-trigger { padding-inline: 0.6rem; }
  .nav-links a { font-size: 0.9rem; }
}
@media (max-width: 960px) {
  .mega { display: none; }
}
@media (min-width: 961px) {
  .m-acc { display: none; }
}
@media (max-width: 620px) {
  .mega-3, .mega-2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .mega, .chev { transition: none; }
}
