/* CloviTek Premium Mega Menu — Original Asymmetric Design */
/* Not a clone. Distinctive layout, icon treatment, Startup HQ positioning */

:root {
  --mega-animation: 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* HAMBURGER BUTTON (Mobile Only) */
#mega-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  gap: 6px;
}

#mega-hamburger span {
  width: 22px;
  height: 2px;
  background: var(--ink-2);
  border-radius: 1px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center;
}

#mega-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translateY(10px);
}

#mega-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

#mega-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translateY(-10px);
}

/* MOBILE DRAWER */
#mega-drawer {
  display: none;
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  z-index: 50;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

#mega-drawer[data-open="true"] {
  display: block;
  opacity: 1;
  visibility: visible;
}

.mega-drawer-inner {
  max-width: 100%;
  padding: 24px;
}

/* MAIN NAV CONTAINER */
.nav-mega {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

/* SVG Icon Belt-and-Suspenders: Ensure all SVG icons are constrained to 20px */
.nav-mega svg {
  width: 20px !important;
  height: 20px !important;
  flex: none;
}

.nav-mega > a {
  color: var(--ink-2);
  transition: color 0.12s;
  text-decoration: none;
}

.nav-mega > a:hover {
  color: var(--brand);
}

/* MEGA ITEM WRAPPER */
.mega-item {
  position: relative;
}

/* TRIGGER BUTTON — Founder-First */
.mega-trigger {
  font: inherit;
  font-weight: 600;
  color: var(--ink-2);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color 0.12s;
  white-space: nowrap;
  font-size: 14px;
}

.mega-trigger:hover {
  color: var(--brand);
}

.mega-trigger[aria-expanded="true"] {
  color: var(--brand);
}

.mega-trigger .caret {
  font-size: 11px;
  opacity: 0.6;
  transition: transform 0.16s var(--mega-animation);
}

.mega-trigger[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

/* MEGA PANEL — Clean, Minimal */
.mega-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(14, 26, 43, 0.15);
  padding: 24px 32px;
  min-width: 680px;
  max-width: 95vw;
  opacity: 0;
  visibility: hidden;
  z-index: 70;
  transition: opacity var(--mega-animation), visibility var(--mega-animation), transform var(--mega-animation);
  pointer-events: none;
  transform: translateY(-8px);
}

.mega-panel[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

:root[data-theme="dark"] .mega-panel {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}

/* ASYMMETRIC GRID — 4 Columns for Services, 3 for others */
.mega-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 36px;
  position: relative;
}

/* Services mega-menu: 3 titled columns (Build / Run Your Business / Delivery Models) */
.mega-item:first-of-type .mega-grid {
  grid-template-columns: repeat(3, 1fr);
}

/* OUR WORK PANEL — Special Layout: Col 1 + Right Container (Cols 2–3) */
.mega-grid-owwork {
  grid-template-columns: 1fr 1fr 1fr;
}

.ow-right {
  grid-column: 2 / -1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.ow-right .mega-col {
  flex-shrink: 0;
}

.ow-image {
  flex: 1;
  aspect-ratio: unset;
  min-height: 200px;
}

.mega-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mega-col-label {
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 4px;
  padding: 0;
}

/* LINK ITEM — Integrated Icon + Text */
.mega-link {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: flex-start;
  padding: 8px;
  margin: -8px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  transition: all 0.12s;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.mega-link:hover {
  background: var(--bg-3);
}

.mega-link:hover .mega-link-icon {
  color: var(--brand);
  opacity: 1;
}

.mega-link:hover .mega-link-title {
  color: var(--brand);
}

.mega-link:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ICON — FIXED SIZE (Critical Fix) */
.mega-link-icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.65;
  transition: opacity 0.12s, color 0.12s;
}

svg.mega-link-icon {
  display: block;
}

/* CONTENT */
.mega-link-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mega-link-title {
  font-weight: 600;
  color: var(--ink);
  transition: color 0.12s;
}

.mega-link-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  word-wrap: break-word;
}

.mega-link-tag {
  display: inline-block;
  background: var(--gold);
  color: var(--ink);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* FEATURED ROW — Feature Visual + Promo Cell */
.mega-featured-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

/* FEATURE VISUAL CELL */
.mega-feature-visual {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-3);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: flex-end;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}

/* Clickable (anchor) version */
.mega-feature-visual[href] {
  cursor: pointer;
}

.mega-feature-visual[href]:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

:root[data-theme="dark"] .mega-feature-visual[href]:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.mega-feature-visual img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.mega-feature-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
  z-index: 1;
  border-radius: 10px;
}

.mega-feature-caption {
  position: relative;
  z-index: 2;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 12px 14px;
  width: 100%;
}

/* Dark theme gradient adjustment */
:root[data-theme="dark"] .mega-feature-visual::before {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.5) 100%);
}

/* STARTUP HQ PROMO CELL — Gold Accent, Founder-First */
.mega-featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dk) 100%);
  border-radius: 10px;
  padding: 20px 24px;
  color: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  margin-top: 8px;
  position: relative;
  overflow: hidden;
}

/* Gold accent bar on left */
.mega-featured::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gold);
}

.mega-featured-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 8px;
}

.mega-featured-eyebrow {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.9;
}

.mega-featured-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.2;
}

.mega-featured-desc {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  line-height: 1.4;
}

.mega-featured-cta {
  background: #fff;
  color: var(--brand-dk);
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.mega-featured-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(62, 111, 176, 0.25);
}

.mega-featured-cta::after {
  content: "→";
  font-size: 14px;
}

/* DESKTOP HOVER */
@media (min-width: 1041px) {
  .mega-item:hover .mega-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .mega-item::after {
    content: "";
    position: absolute;
    top: calc(100% + 0px);
    left: -16px;
    right: -16px;
    height: 16px;
    pointer-events: none;
  }

  .mega-item:hover::after {
    pointer-events: auto;
  }
}

/* MOBILE DRAWER */
@media (max-width: 1040px) {
  #mega-hamburger {
    display: flex;
  }

  .nav-mega {
    display: none;
  }

  #mega-drawer {
    border-top: 1px solid var(--line);
  }

  .mega-panel {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
    max-width: none;
    min-width: auto;
  }

  .mega-panel[data-open="false"] {
    display: none;
  }

  .mega-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .mega-col {
    gap: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-2);
  }

  .mega-col:last-child {
    border-bottom: none;
  }

  .mega-col-label {
    margin-bottom: 8px;
  }

  .mega-link {
    padding: 10px 0;
    margin: 0;
    border-radius: 0;
  }

  .mega-feature-visual {
    aspect-ratio: 16 / 9;
    display: none;
  }

  .ow-right {
    grid-column: 1;
    flex-direction: row;
    gap: 12px;
    height: auto;
  }

  .ow-right .mega-col {
    flex-shrink: 0;
    width: 100%;
  }

  .ow-image {
    display: none;
  }

  .mega-featured {
    grid-column: 1;
    grid-template-columns: 1fr;
    text-align: center;
    margin-top: 12px;
    padding: 16px 12px;
  }

  .mega-featured-cta {
    width: 100%;
    justify-content: center;
  }
}

/* KEYBOARD NAV */
.mega-panel[data-open="true"] .mega-link:first-of-type {
  outline-offset: -2px;
}

/* MOBILE DRAWER ACCORDION */
.mega-drawer-item {
  border-bottom: 1px solid var(--line-2);
}

.mega-drawer-item:last-child {
  border-bottom: none;
}

.mega-drawer-trigger {
  width: 100%;
  padding: 16px 0;
  background: none;
  border: none;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: color 0.2s;
}

.mega-drawer-trigger:hover {
  color: var(--brand);
}

.mega-drawer-trigger::after {
  content: "▾";
  font-size: 11px;
  opacity: 0.6;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 8px;
}

.mega-drawer-trigger[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.mega-drawer-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s, opacity 0.3s;
}

.mega-drawer-panel[data-open="true"] {
  max-height: 2000px;
  opacity: 1;
}

.mega-drawer-panel .mega-col {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-2);
}

.mega-drawer-panel .mega-col:last-child {
  border-bottom: none;
}

.mega-drawer-panel .mega-col-label {
  font-size: 11px;
  margin-bottom: 6px;
}

.mega-drawer-panel .mega-link {
  padding: 8px 0;
  margin: 0;
  font-size: 13px;
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  .mega-trigger .caret,
  .mega-panel,
  .mega-link,
  .mega-featured-cta,
  #mega-hamburger span,
  .mega-drawer-trigger::after,
  .mega-drawer-panel {
    transition: none !important;
  }
}

/* ACCESSIBILITY */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ── clean BUILT menu feature visuals (on-brand, not screenshots) ── */
.mega-feature-built{background:transparent}
.mega-feature-built::before{display:none !important}
.mega-feature-built .mviz{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--bg-3),#d8e6f8);border-radius:10px;overflow:hidden}
:root[data-theme="dark"] .mega-feature-built .mviz{background:linear-gradient(135deg,#0f1a30,#1c3057)}
.mega-feature-built .mviz::after{content:"";position:absolute;inset:0;background:radial-gradient(circle at 72% 22%,rgba(62,111,176,.18),transparent 58%);pointer-events:none}
.mega-feature-built .mviz svg{width:54px !important;height:54px !important;color:var(--brand);opacity:.92;position:relative;z-index:1}
.mega-feature-built .mega-feature-caption{position:relative;z-index:2;background:none;color:var(--ink-2);font-weight:700}

/* ── gold secondary accent on primary CTA bands (site-wide) ── */
.finalcta{position:relative;overflow:hidden}
.finalcta::before{content:"";position:absolute;top:0;left:50%;transform:translateX(-50%);width:88px;height:5px;background:var(--gold);border-radius:0 0 6px 6px}
.finalcta .eyebrow{color:var(--gold)!important}
.finalcta .eyebrow::before{background:var(--gold)!important}
.finalcta .btn{background:var(--gold)!important;color:#241a06!important;font-weight:700!important;box-shadow:0 8px 22px -8px rgba(199,154,62,.6)}
.finalcta .btn:hover{background:#d8ac52!important;transform:translateY(-1px)}
