/* ============================================================
   JOMPLAN — TOOLS MEGA-MENU (CUSTOMER-FACING TOOL DISCOVERY)
   Styles the top navigation's "Tools" item: a single panel headed
   "Tools" with a short supporting line, presenting featured
   customer-facing tools as compact cards. One config array in
   assets/js/mega-nav.js drives both the desktop click-to-reveal
   panel and the mobile in-menu accordion — add a tool there and
   it appears in both places automatically.

   JOMPLAN — TOOLS MEGA-MENU REFINEMENT (2026-09-22): previously
   this styled two named link-list groups (Financial Tools /
   Insurance Operations, the latter left empty after Policy
   Application's public retirement earlier the same day).
   Restructured into card styles (.da-tools-card and children) so
   the panel no longer shows an empty operational-looking column.

   Reuses design-system.css tokens (--navy-*, --gold-*, --t-*, --s-*,
   --r-*) so it matches the existing nav exactly — no new colors,
   fonts, radii, or spacing scale introduced.
   ============================================================ */

/* ── Primary nav trigger (the "Tools" button in .da-nav-links) ── */
.da-nav-trigger {
  appearance: none;
  background: none;
  border: none;
  font: inherit;
  font-size: var(--t-sm);
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.01em;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px; /* was 5px — a touch more breathing room before the caret */
  transition: color var(--t-fast);
  position: relative;
}

.da-nav-trigger:hover { color: var(--white); }

.da-nav-caret-sm {
  width: 9px;
  height: 9px;
  flex-shrink: 0;
  transition: transform var(--t-fast);
  opacity: 0.65;
}

.da-nav-trigger[aria-expanded="true"] { color: var(--white); }
.da-nav-trigger[aria-expanded="true"] .da-nav-caret-sm { transform: rotate(180deg); opacity: 1; }

.da-nav-trigger.da-active {
  color: var(--white);
  font-weight: 700; /* brighter/more prominent active state — same white, more weight */
}

/* Same -4px offset as .da-nav-links a.da-active::after in
   design-system.css, so the Tools trigger's active underline sits at
   the same height as every plain nav link's — not the old orphaned
   file's -22px, which sat far enough below the text to look
   disconnected from the nav bar entirely. */
.da-nav-trigger.da-active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--gold-400);
  border-radius: 2px;
}

/* ── Desktop panel: backdrop + panel shell (Apple/MS-Docs style
   click-to-reveal, not hover) ── */
.da-mega-backdrop {
  position: fixed;
  inset: 0;
  top: var(--nav-h);
  background: rgba(3, 10, 26, 0.38);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 280ms ease, visibility 280ms ease;
  z-index: 210;
}

.da-mega-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.da-mega-panel {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  z-index: 220;
  background: rgba(5, 15, 34, 0.98);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 260ms ease, transform 260ms ease, visibility 260ms ease;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}

.da-mega-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.da-mega-inner {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding: clamp(28px, 3.5vw, 44px) clamp(var(--s-5), 5vw, var(--s-12));
}

.da-mega-eyebrow {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-300);
  margin-bottom: 10px;
}

.da-mega-subtitle {
  font-size: var(--t-sm, 0.9rem);
  line-height: 1.6;
  color: rgba(255,255,255,0.55);
  max-width: 46ch;
  margin-bottom: 24px;
}

/* ── Tools cards: featured customer-facing tools, side-by-side on
   desktop (a compact "tool discovery" surface, not an operational
   link directory) ── */
.da-tools-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(16px, 2vw, 22px);
}

.da-tools-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-lg);
  padding: clamp(18px, 2vw, 22px);
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}

.da-tools-card:hover,
.da-tools-card:focus-visible {
  border-color: rgba(212,175,90,0.45);
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
  outline: none;
}

.da-tools-card-category {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--gold-300);
}

.da-tools-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  margin-top: 2px;
}

.da-tools-card-desc {
  font-size: 0.86rem;
  line-height: 1.55;
  color: rgba(255,255,255,0.6);
  flex-grow: 1;
  margin: 2px 0 4px;
}

.da-tools-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--gold-300);
}

.da-tools-card-arrow {
  transition: transform var(--t-fast);
  flex-shrink: 0;
}

.da-tools-card:hover .da-tools-card-arrow,
.da-tools-card:focus-visible .da-tools-card-arrow {
  transform: translateX(3px);
}

.da-tools-card.is-current {
  border-color: var(--gold-400);
}

/* ── Mobile: accordion toggle + nested panel inside #mobile-menu ── */
/* Deliberately NOT sharing the .mobile-nav-link class here — each
   page's inline hamburger script attaches a "close the whole
   overlay" click handler to every .mobile-nav-link, which is right
   for a real link but wrong for this in-place accordion toggle.
   Styled to match .da-mobile-menu a exactly instead (see
   design-system.css) so it's visually indistinguishable. */
.da-mobile-tools-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  font-size: var(--t-2xl);
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  padding: var(--s-4) 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transition: color var(--t-fast);
}

.da-mobile-tools-toggle:hover { color: var(--gold-300); }

.da-mobile-tools-toggle .da-nav-caret-sm {
  width: 13px;
  height: 13px;
  opacity: 0.55;
}

.da-mobile-tools-toggle[aria-expanded="true"] { color: var(--white); }
.da-mobile-tools-toggle[aria-expanded="true"] .da-nav-caret-sm { transform: rotate(180deg); opacity: 1; }

.da-mobile-tools-panel {
  padding: var(--s-3) var(--s-4) var(--s-4);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.da-mobile-tools-panel[hidden] { display: none; }

.da-mega-subtitle--mobile {
  margin-bottom: var(--s-3);
  max-width: none;
}

/* Mobile accordion is one narrow column, so cards always stack —
   same .da-tools-card the desktop panel uses, just in a single
   column and with the current-item dot re-added (the mobile
   accordion previously showed it on the old plain-link rows). */
.da-tools-cards--mobile {
  grid-template-columns: 1fr;
  gap: var(--s-3);
}

.da-tools-card--mobile .da-tools-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.da-tools-card--mobile.is-current .da-tools-card-title::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-400);
  flex-shrink: 0;
}

/* ── Responsive: desktop panel only above the same 768px breakpoint
   where .da-nav-links (and its Tools trigger) is visible; the
   mobile accordion lives inside #mobile-menu, which only exists
   below that breakpoint — see design-system.css's .da-nav-links /
   .da-nav-toggle media rule. ── */
@media (max-width: 768px) {
  .da-mega-backdrop,
  .da-mega-panel { display: none; }
}

@media (max-width: 900px) {
  .da-tools-cards { grid-template-columns: 1fr; gap: 16px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .da-mega-panel, .da-mega-backdrop, .da-nav-caret-sm, .da-tools-card, .da-tools-card-arrow {
    transition-duration: 0.01ms !important;
  }
}
