/* Phase 25b — Mega Menu */
.hf-mega {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 201;
}
.hf-mega__btn {
  list-style: none;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700 !important;
  color: #0d9488 !important;
}
.hf-mega__btn::-webkit-details-marker { display: none; }
.hf-mega__chev { font-size: 0.7em; opacity: 0.7; }
.hf-mega[open] .hf-mega__chev { transform: rotate(180deg); }

.hf-mega__panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 200;
  width: min(920px, calc(100vw - 1.5rem));
  max-height: min(78vh, 560px);
  overflow: auto;
  padding: 0.85rem 1rem 1rem;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.16);
}
[dir="rtl"] .hf-mega__panel { right: auto; left: 0; }

.hf-mega__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid #f1f5f9;
}
.hf-mega__head strong {
  font-size: 0.8rem;
  letter-spacing: -0.01em;
  color: #0f172a;
}
.hf-mega__head a {
  font-size: 0.75rem;
  font-weight: 800;
  color: #0f766e;
  text-decoration: none;
}

.hf-mega__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}
@media (max-width: 900px) {
  .hf-mega__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hf-mega__panel { width: min(100vw - 1rem, 520px); }
}
@media (max-width: 560px) {
  .hf-mega__grid { grid-template-columns: 1fr; }
}

.hf-mega__card {
  border: 1px solid #eef2f7;
  border-radius: 0.75rem;
  background: #f8fafc;
  padding: 0.55rem 0.65rem 0.45rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hf-mega__card:hover {
  border-color: #99f6e4;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.08);
  background: #fff;
}
.hf-mega__card-main {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
}
.hf-mega__ico {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0b1f3a, #0d9488);
  color: #fff;
  font-size: 1rem;
}
.hf-mega__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.hf-mega__text em {
  font-style: normal;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #475569; /* was #64748b — stronger body contrast */
}
.hf-mega__subs {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0.35rem 0 0 2.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.55rem;
  border-top: 1px dashed #e2e8f0;
}
.hf-mega__subs a {
  font-size: 0.7rem;
  font-weight: 700;
  color: #0f172a; /* WCAG: dark on white — was faint teal #0f766e */
  text-decoration: none;
  padding: 0.12rem 0.35rem;
  border-radius: 0.35rem;
  background: #f1f5f9;
}
.hf-mega__subs a:hover {
  background: #ccfbf1;
  color: #115e59;
  text-decoration: none;
}
.hf-mega__head a {
  font-size: 0.75rem;
  font-weight: 800;
  color: #0f766e;
  text-decoration: none;
}
.hf-mega__text strong {
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.015em;
}

/* Unified global search extras */
.hf-gsearch {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 28rem;
}
.hf-gsearch__form {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 0;
}
.hf-gsearch__tools {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}
.hf-gsearch__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 0.45rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 0;
}
.hf-gsearch__tool:hover { background: #f0fdfa; border-color: #99f6e4; color: #0f766e; }
.hf-gsearch__tool.is-active { background: #0d9488; border-color: #0f766e; color: #fff; }
.hf-gsearch__file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

body.theme-navy_blue .hf-mega__panel,
body.theme-black_gold .hf-mega__panel,
body.theme-dark_green .hf-mega__panel,
body.theme-crystal_glass .hf-mega__panel {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.25);
}
body.theme-navy_blue .hf-mega__card,
body.theme-black_gold .hf-mega__card,
body.theme-dark_green .hf-mega__card,
body.theme-crystal_glass .hf-mega__card {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.2);
}
body.theme-navy_blue .hf-mega__text strong,
body.theme-black_gold .hf-mega__text strong,
body.theme-dark_green .hf-mega__text strong,
body.theme-crystal_glass .hf-mega__text strong { color: #e2e8f0; }
body.theme-navy_blue .hf-mega__text em,
body.theme-black_gold .hf-mega__text em,
body.theme-dark_green .hf-mega__text em,
body.theme-crystal_glass .hf-mega__text em { color: #94a3b8; }
body.theme-navy_blue .hf-mega__head strong,
body.theme-black_gold .hf-mega__head strong,
body.theme-dark_green .hf-mega__head strong,
body.theme-crystal_glass .hf-mega__head strong { color: #e2e8f0; }
body.theme-navy_blue .hf-mega__subs a,
body.theme-black_gold .hf-mega__subs a,
body.theme-dark_green .hf-mega__subs a,
body.theme-crystal_glass .hf-mega__subs a {
  color: #f1f5f9;
  background: rgba(148, 163, 184, 0.18);
}
body.theme-navy_blue .hf-mega__head a,
body.theme-black_gold .hf-mega__head a,
body.theme-dark_green .hf-mega__head a,
body.theme-crystal_glass .hf-mega__head a { color: #5eead4; }
@media (max-width: 1023px) {
  .hf-gsearch {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }
  .header-second-inner {
    flex-wrap: wrap;
    min-width: 0;
  }
}
