/* mega-menu.css — shared mega navigation styles
   Include on any page: <link rel="stylesheet" href="mega-menu.css"> (root)
   or <link rel="stylesheet" href="../mega-menu.css"> (modules/) */

/* ─── NAV ITEMS ─── */
/* Colors use page-level CSS variables so both dark and light themes
   work without requiring [data-theme] attributes or media query parity. */
.nav-item {
  position: relative;
  height: 48px;
  display: flex;
  align-items: center;
}
.nav-item-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, rgba(255,255,255,0.55));
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: default;
  padding: 0 20px;
  height: 48px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.nav-item:hover .nav-item-label,
.nav-item.active .nav-item-label { color: var(--text-primary, #fff); }

.nav-cta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #fff);
  text-decoration: none;
  letter-spacing: 0.3px;
  padding: 6px 14px;
  border: 1px solid var(--border-mid, var(--border, rgba(255,255,255,0.12)));
  border-radius: 20px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-cta:hover { background: var(--text-primary, #fff); color: var(--bg, #0a0a0a); }

/* ─── IDEA nav item (link with subtitle) ─── */
.nav-idea {
  text-decoration: none;
  position: relative;
  padding-right: 4px;
}
.nav-idea .nav-item-label {
  padding-right: 6px;
}
.nav-idea-sub {
  display: inline-block;
  font-size: 9px;
  font-weight: 500;
  color: var(--accent, #e85d04);
  letter-spacing: 0.5px;
  text-transform: none;
  font-style: italic;
  padding-right: 16px;
  border-right: 1px solid var(--border-mid, var(--border, rgba(255,255,255,0.12)));
  margin-right: 6px;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.nav-idea:hover .nav-item-label,
.nav-idea.active .nav-item-label { color: var(--text-primary); }
.nav-idea:hover .nav-idea-sub { opacity: 1; }
.nav-idea.active .nav-idea-sub { opacity: 1; }
@media (max-width: 1100px) {
  .nav-idea-sub { display: none; }
}

/* ─── Light mode nav ─── */
[data-theme="light"] .nav-item-label { color: var(--nav-label, rgba(0,0,0,0.45)); }
[data-theme="light"] .nav-item:hover .nav-item-label,
[data-theme="light"] .nav-item.active .nav-item-label { color: #111; }
[data-theme="light"] .nav-cta { border-color: rgba(0,0,0,0.12); }

/* ─── SYSTEM hover dropdown ─── */
.nav-system { position: static; }
.mega-dropdown-system {
  position: fixed; top: 48px; left: 0; width: 100%;
  background: var(--glass-bg-heavy, rgba(10,10,10,0.96));
  backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
  padding: 24px 48px 28px 0;
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.2s ease, visibility 0.2s, transform 0.2s ease;
  z-index: 998;
}
.nav-system:hover .mega-dropdown-system {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.mega-inner { display: flex; align-items: center; }
.mega-video-side {
  flex: 0 0 auto;
  padding: 0 40px 0 48px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.mega-video-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mega-video-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.2);
  font-style: italic;
}
.mega-wireframes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 200px;
  max-width: 100%;
}
.mega-wireframe-cell {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  min-width: 0;
}
.mega-wireframe-cell picture {
  position: absolute;
  inset: 0;
  display: block;
}
.mega-wireframe-cell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.mega-cols { display: flex; gap: 64px; }
.mega-col { display: flex; flex-direction: column; gap: 8px; min-width: 120px; }
.mega-col-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-secondary, rgba(255,255,255,0.5));
  margin-bottom: 10px;
}
/* legacy link cols (unused now but kept for safety) */
.mega-col a {
  font-size: 13px; font-weight: 400; color: var(--text-secondary, rgba(255,255,255,0.5));
  text-decoration: none; transition: color 0.12s;
}
.mega-col a:hover { color: var(--text-primary); }

/* spec-sheet col */
.mega-col-spec { gap: 0; min-width: 180px; }
.mega-spec-line {
  display: flex; gap: 16px; align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle, var(--border, rgba(255,255,255,0.06)));
}
.mega-col-spec .mega-spec-line:last-child { border-bottom: none; }
.mega-spec-key {
  font-size: 10px; font-weight: 500; letter-spacing: 0.4px;
  text-transform: lowercase; color: var(--text-secondary, rgba(255,255,255,0.45));
  min-width: 68px; flex-shrink: 0;
}
.mega-spec-val {
  font-size: 12px; font-weight: 500; letter-spacing: 0.1px;
  color: var(--text-primary, #fff);
}

/* ─── MODUŁY click panel ─── */
.mega-panel-moduły {
  position: fixed; top: 48px; left: 0; width: 100%;
  background: var(--glass-bg-heavy, rgba(10,10,10,0.96));
  backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px);
  border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.08));
  padding: 36px 48px 40px; z-index: 997;
  opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity 0.22s ease, visibility 0.22s, transform 0.22s ease;
}
.mega-panel-moduły.open { opacity: 1; visibility: visible; transform: translateY(0); }

.mega-module-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 14px; max-width: 1200px; margin: 0 auto 24px;
}
.mega-module-card {
  background: var(--surface-faint, rgba(255,255,255,0.04)); border-radius: 14px;
  padding: 28px 16px 22px; display: flex; flex-direction: column;
  align-items: center; text-align: center; text-decoration: none;
  transition: transform 0.2s, background 0.15s, box-shadow 0.2s;
}
.mega-module-card:hover {
  transform: translateY(-4px);
  background: var(--surface-faint-hover, rgba(255,255,255,0.08));
  box-shadow: 0 12px 32px rgba(0,0,0,0.13);
}
.mega-module-card picture { display: block; margin-bottom: 16px; }
.mega-module-card img {
  width: 96px; height: 96px; object-fit: contain;
  display: block; transition: transform 0.2s;
}
.mega-module-card:hover img { transform: scale(1.07); }
.mega-module-name {
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--text-primary); margin-bottom: 6px;
}
.mega-module-price {
  font-size: 11px; font-weight: 600; color: var(--accent);
  margin-top: auto; padding-top: 4px;
}
.mega-panel-footer {
  display: flex; justify-content: center; padding-top: 4px;
  max-width: 1200px; margin: 0 auto;
}
.mega-panel-cta {
  font-size: 13px; font-weight: 600; color: var(--accent);
  text-decoration: none; letter-spacing: 0.3px; transition: opacity 0.15s;
}
.mega-panel-cta:hover { opacity: 0.75; }

/* ─── Overlay ─── */
.mega-overlay {
  display: none; position: fixed; top: 48px; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 996;
}
.mega-overlay.open { display: block; }

/* ─── Active nav state ─── */
.nav-moduły.active .nav-item-label { color: var(--text-primary); }

/* ─── Light mode ─── */
[data-theme="light"] .mega-dropdown-system,
[data-theme="light"] .mega-panel-moduły {
  background: rgba(245,245,245,0.97);
  border-bottom-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .mega-module-card { background: rgba(0,0,0,0.02); }
[data-theme="light"] .mega-module-card:hover { background: rgba(0,0,0,0.05); }

/* ─── MOBILE (≤767px) ─── */
@media (max-width: 767px) {
  /* Hide desktop nav items + desktop panels */
  .nav-moduły,
  .nav-system,
  .nav-idea,
  .mega-panel-moduły,
  .mega-overlay { display: none !important; }

  /* topbar-nav fills space so hamburger stays left, cart stays right */
  .topbar-nav { flex: 1; }

  /* Tighten gap between brand and hamburger on mobile */
  .topbar-brand { margin-right: 6px !important; }

  /* Hamburger — adaptive color, idle nudge animation */
  @keyframes mm-idle-nudge {
    0%, 88%, 100% { transform: rotate(0deg); }
    92%           { transform: rotate(12deg); }
    96%           { transform: rotate(-8deg); }
  }
  .mm-hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    background: none; border: none; cursor: pointer; padding: 0;
    flex-shrink: 0;
    color: #e8e8e8;
  }
  .mm-hamburger svg {
    display: block;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: mm-idle-nudge 5s ease-in-out 2s infinite;
  }
  .mm-hamburger.open svg {
    transform: rotate(45deg);
    animation: none;
  }

  /* Fullscreen overlay — dark default */
  .mm-overlay {
    display: flex; flex-direction: column;
    position: fixed; inset: 0; z-index: 9999;
    background: #0a0a0a;
    transform: translateY(-100%);
    transition: transform 0.32s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  .mm-overlay.open { transform: translateY(0); }

  .mm-overlay-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; height: 48px; flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .mm-overlay-brand {
    font-size: 16px; font-weight: 700; letter-spacing: -0.5px;
    color: #fff; text-decoration: none;
  }
  .mm-overlay-close {
    width: 44px; height: 44px; display: flex; align-items: center;
    justify-content: center; background: none; border: none;
    cursor: pointer; color: #fff;
    font-size: 22px; line-height: 1;
  }

  .mm-overlay-body { flex: 1; overflow-y: auto; padding: 24px 20px 48px; }

  /* Section label */
  .mm-section-label {
    font-size: 10px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    margin-bottom: 4px;
  }

  /* Module card strip — horizontal scroll */
  .mm-card-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    margin: 8px -20px 0;
    padding: 0 20px 12px;
  }
  .mm-card-strip::-webkit-scrollbar { display: none; }
  .mm-card {
    flex: 0 0 130px;
    scroll-snap-align: start;
    background: rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 20px 12px 16px;
    display: flex; flex-direction: column;
    align-items: center; text-align: center; text-decoration: none;
  }
  .mm-card picture { display: block; margin-bottom: 12px; }
  .mm-card img { width: 72px; height: 72px; object-fit: contain; display: block; }
  .mm-card-name {
    font-size: 10px; font-weight: 700; letter-spacing: 0.7px;
    text-transform: uppercase; color: #fff;
    margin-bottom: 4px;
  }
  .mm-card-price {
    font-size: 11px; font-weight: 600; color: #e85d04;
    margin-top: auto; padding-top: 4px;
  }

  /* System spec section */
  .mm-spec-section { margin-top: 28px; }
  .mm-spec-section .mm-section-label { margin-bottom: 10px; }
  .mm-spec-section .mega-spec-line { padding: 5px 0; }
  .mm-spec-group + .mm-spec-group { margin-top: 12px; }

  /* IDEA mobile link — mars-hero background + big habitat word */
  .mm-idea-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    padding: 34px 22px 28px;
    margin: -24px -20px 24px;
    background:
      linear-gradient(135deg, rgba(10,5,4,0.60) 0%, rgba(10,5,4,0.32) 45%, rgba(10,5,4,0.85) 100%),
      url('img/mars-hero.webp') center 58% / cover no-repeat;
    border-top: 1px solid rgba(232,93,4,0.28);
    border-bottom: 1px solid rgba(232,93,4,0.28);
    position: relative;
    overflow: hidden;
  }
  .mm-idea-label {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: clamp(40px, 13vw, 56px);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.05em;
    line-height: 0.9;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: flex-end;
    gap: 0.08em;
    text-shadow: 0 4px 28px rgba(0,0,0,0.55), 0 0 16px rgba(255,140,58,0.15);
  }
  .mm-idea-dot {
    width: 0.2em;
    height: 0.2em;
    flex-shrink: 0;
    margin-bottom: 0.1em;
    filter: drop-shadow(0 2px 8px rgba(255,255,255,0.2));
  }
  .mm-idea-sub {
    font-size: 12px;
    font-weight: 500;
    color: #ff8c3a;
    letter-spacing: 0.3px;
    font-style: italic;
  }

  /* CTA */
  .mm-cta {
    display: block; margin-top: 28px;
    background: #fff; color: #0a0a0a;
    text-align: center; text-decoration: none;
    font-size: 12px; font-weight: 700; letter-spacing: 1px;
    text-transform: uppercase; padding: 16px;
    border-radius: 8px;
  }
}

/* Light mode mobile overrides — use @media to match OS preference,
   scoped with html:not([data-theme="dark"]) so forced-dark pages (idea.html) aren't affected */
@media (max-width: 767px) and (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .mm-overlay { background: #f5f5f5; }
  html:not([data-theme="dark"]) .mm-overlay-header { border-bottom-color: rgba(0,0,0,0.07); }
  html:not([data-theme="dark"]) .mm-overlay-brand { color: #111; }
  html:not([data-theme="dark"]) .mm-overlay-close { color: #111; }
  html:not([data-theme="dark"]) .mm-section-label { color: rgba(0,0,0,0.35); }
  html:not([data-theme="dark"]) .mm-card { background: rgba(0,0,0,0.04); }
  html:not([data-theme="dark"]) .mm-card-name { color: #111; }
  html:not([data-theme="dark"]) .mm-cta { background: #111; color: #f5f5f5; }
  /* .mm-idea-link keeps mars-hero bg + white text in both themes (dark photo bg) */
  /* SYSTEM spec section inside overlay — ensure contrast on light bg */
  html:not([data-theme="dark"]) .mm-overlay .mega-col-title { color: rgba(0,0,0,0.5); }
  html:not([data-theme="dark"]) .mm-overlay .mega-spec-key { color: rgba(0,0,0,0.45); }
  html:not([data-theme="dark"]) .mm-overlay .mega-spec-val { color: #111; }
  html:not([data-theme="dark"]) .mm-overlay .mega-spec-line { border-bottom-color: rgba(0,0,0,0.08); }
}

/* Keep legacy [data-theme="light"] attribute support for pages that explicitly force light */
@media (max-width: 767px) {
  [data-theme="light"] .mm-overlay { background: #f5f5f5; }
  [data-theme="light"] .mm-overlay-header { border-bottom-color: rgba(0,0,0,0.07); }
  [data-theme="light"] .mm-overlay-brand { color: #111; }
  [data-theme="light"] .mm-overlay-close { color: #111; }
  [data-theme="light"] .mm-section-label { color: rgba(0,0,0,0.35); }
  [data-theme="light"] .mm-card { background: rgba(0,0,0,0.04); }
  [data-theme="light"] .mm-card-name { color: #111; }
  [data-theme="light"] .mm-cta { background: #111; color: #f5f5f5; }
}

/* Hide hamburger + overlay on desktop */
@media (min-width: 768px) {
  .mm-hamburger, .mm-overlay { display: none !important; }
}

/* ─── Video placeholder light mode ─── */
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .mega-video-placeholder {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.08);
  }
  html:not([data-theme="dark"]) .mega-video-label { color: rgba(0,0,0,0.2); }
}
[data-theme="light"] .mega-video-placeholder {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .mega-video-label { color: rgba(0,0,0,0.2); }

/* ─── Wireframe cells light mode (invert) ─── */
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .mega-wireframe-cell img { filter: invert(1); }
}
[data-theme="light"] .mega-wireframe-cell img { filter: invert(1); }

/* ─── SYSTEM LIGHT MODE (via OS preference) ───
   Scoped with :not([data-theme="dark"]) so pages that force dark (idea.html)
   aren't affected when the user's OS is in light mode. */
@media (prefers-color-scheme: light) {
  html:not([data-theme="dark"]) .mm-hamburger { color: #1a1a18; }
  html:not([data-theme="dark"]) .nav-item-label { color: rgba(0,0,0,0.55); }
  html:not([data-theme="dark"]) .nav-item:hover .nav-item-label,
  html:not([data-theme="dark"]) .nav-item.active .nav-item-label { color: #111; }
  html:not([data-theme="dark"]) .nav-idea-sub { border-right-color: rgba(0,0,0,0.12); }

  html:not([data-theme="dark"]) .mega-dropdown-system,
  html:not([data-theme="dark"]) .mega-panel-moduły {
    background: rgba(245, 245, 245, 0.97);
    border-bottom-color: rgba(0, 0, 0, 0.08);
  }
  html:not([data-theme="dark"]) .mega-col-title { color: rgba(0, 0, 0, 0.5); }
  html:not([data-theme="dark"]) .mega-spec-key { color: rgba(0, 0, 0, 0.45); }
  html:not([data-theme="dark"]) .mega-spec-val { color: #111; }
  html:not([data-theme="dark"]) .mega-spec-line { border-bottom-color: rgba(0, 0, 0, 0.08); }
  html:not([data-theme="dark"]) .mega-module-card {
    background: rgba(0, 0, 0, 0.03);
  }
  html:not([data-theme="dark"]) .mega-module-card:hover {
    background: rgba(0, 0, 0, 0.06);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  }
  html:not([data-theme="dark"]) .mega-module-name { color: #111; }
  html:not([data-theme="dark"]) .mega-overlay { background: rgba(0, 0, 0, 0.25); }
}
