/* Codivium Topbar Component (site-wide)
   Consolidated: components/topbar-landing.css + core topbar locks (CVD-WEB-0008/0017/0018)
*/

@layer components {

  /* === CVD-WEB-0019 topbar determinism: lock background base + prevent page-level masking === */
  .topbar,
  .topbar * {
    box-sizing: border-box;
  }

  /* ===== Fixed top nav ===== */
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 50;
    height: var(--cv-topbar-h);
    background-color: #030a18;
    /* base layer to prevent page-to-page blend variance */
    background:
      radial-gradient(900px 420px at -12% 8%, rgba(120, 180, 255, 0.12), rgba(120, 180, 255, 0.00) 55%),
      radial-gradient(900px 420px at 112% 8%, rgba(120, 180, 255, 0.12), rgba(120, 180, 255, 0.00) 55%),
      linear-gradient(180deg, rgba(14, 16, 26, 0.95) 0%, rgba(9, 9, 12, 0.92) 100%);
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
  }

  .topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 10px;
    background:
      linear-gradient(180deg,
        rgba(255, 255, 255, 0.00),
        rgba(255, 255, 255, 0.10),
        rgba(0, 0, 0, 0.60),
        rgba(0, 0, 0, 0.00));
    pointer-events: none;
    opacity: 0.60;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 22px;
    /* ↑ more space between cube and text */
    text-decoration: none;
    color: inherit;
    user-select: none;
  }

  .brand:hover .brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.05;
  }

  .brand-name {
    font-family: var(--serif);
    font-weight: 700;
    letter-spacing: 0.10em;
    font-size: 34px;
    color: rgba(233, 244, 255, 0.96);
    text-transform: uppercase;
  }

  /* tagline removed (and now also removed from logo markup) */
  .brand-tagline {
    display: none;
  }

  .navlinks {
    display: flex;
    align-items: center;
    justify-content: center;
    /* symmetric about center */
    gap: 1.2cm;
    /* +20% spacing */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: min(1180px, 94vw);
    /* never wider than central content area */
    max-width: 1180px;
    padding: 0 22px;
    /* avoid blocking clicks on brand underneath if overlapping */
  }

  .navlinks a {
    pointer-events: auto;
  }

  .navlinks a {
    flex: 0 1 auto;
    white-space: nowrap;
    font-family: var(--serif);
    font-size: 14px;
    letter-spacing: 0.08em;
    text-decoration: none;
    color: rgba(241, 241, 251, 0.84);
    padding: 10px 10px;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(0);
    transition: transform 180ms ease, box-shadow 180ms ease;
    user-select: none;
    border: none;
  }

  .navlinks a:hover {
    transform: none;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
  }

  .navlinks a:active {
    transform: none;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.40) inset;
  }

  .cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.07);
    color: rgba(241, 241, 251, 0.92);
    text-decoration: none;
    font-family: var(--sans);
    font-weight: 720;
    letter-spacing: 0.02em;
    transform: translateY(0);
    transition: transform 180ms ease, box-shadow 180ms ease;
    user-select: none;
  }

  .cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  }

  .cta:active {
    transform: translateY(6px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45) inset;
  }

  @media (max-width: 1080px) {
    .topbar-inner {
      grid-template-columns: 1fr;
      gap: 10px;
    }

    .navlinks {
      position: static;
      transform: none;
      width: 100%;
      justify-content: center;
      gap: 17px;
      flex-wrap: wrap;
      pointer-events: auto;
      padding: 0;
      margin-left: auto;
    }

    .navlinks a {
      pointer-events: auto;
    }

    .topbar {
      flex-wrap: wrap;
      gap: 10px;
    }

    .brand-name {
      font-size: 28px;
    }
  }

  /* Topbar layering: ensure logo hover always receives pointer events */
  .topbar {
    position: fixed;
  }

  .topbar-inner {
    position: relative;
  }

  .brand {
    position: relative;
    z-index: 80;
    pointer-events: auto;
  }

  .navlinks {
    z-index: 70;
  }

  /* === CVD-WEB-0005 nav active no-flicker === */
  .navlinks a:active {
    transform: none;
  }

  /* === CVD-WEB-0006 nav active matches hover (prevents click-jump) === */
  /* Keep the hover lift; ensure :active does not drop back down. */
  .navlinks a:hover {
    transform: none;
  }

  .navlinks a:active {
    transform: none;
  }

  /* === CVD-WEB-0007 cta active matches hover (prevents click-jump) === */
  .cta:hover {
    transform: translateY(-2px);
  }

  .cta:active {
    transform: translateY(-2px) !important;
  }

  /* === CVD-WEB-0008 ensure serif var === */
  .navlinks a {
    font-family: var(--serif);
  }

  /* === CVD-WEB-0012 compositor stability (reduces intermittent transform jitter) === */
  .navlinks a,
  .cta {
    will-change: transform;
  }

  /* === CVD-WEB-0013 no-transform-transition (eliminates rare hover-load flicker) === */
  /* Keep the hover lift, but don't animate transform; only animate visual properties. */
  .navlinks a {
    transition: box-shadow 180ms ease, color 180ms ease, opacity 180ms ease, background-color 180ms ease, border-color 180ms ease !important;
  }

  .cta {
    transition: box-shadow 180ms ease, color 180ms ease, opacity 180ms ease, background-color 180ms ease, border-color 180ms ease !important;
  }

  /* === CVD-WEB-0014 no-hover-lift-no-press (removes transform motion on hover/click) === */
  .navlinks a:hover,
  .navlinks a:active,
  .navlinks a:focus-visible {
    transform: none;
  }

  .cta:hover,
  .cta:active,
  .cta:focus-visible {
    transform: none !important;
  }

  /* === CVD-WEB-0015 nav-only no-hover-lift (topbar links never move) === */
  /* Scope strictly to the navigation bar links inside the topbar. */
  .topbar .navlinks a:hover,
  .topbar .navlinks a:active,
  .topbar .navlinks a:focus-visible {
    transform: none;
  }

  /* === CVD-WEB-0017 topbar nav alignment lock (prevents 1px drift across pages) === */
  .topbar {
    height: var(--cv-topbar-h);
  }

  .topbar .navlinks {
    height: 100%;
    display: flex;
    align-items: center;
  }

  .topbar .navlinks a {
    display: inline-flex;
    align-items: center;
    /* Lock vertical metrics so baseline rounding cannot vary page-to-page */
    line-height: 1;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  /* Ensure active/current styling never changes layout dimensions */
  .topbar .navlinks a {
    border-bottom: 1px solid transparent;
  }

  .topbar .navlinks a[aria-current="page"],
  .topbar .navlinks a.is-active {
    border-bottom-color: var(--cv-accent);
  }

  /* If any hover/active effects exist elsewhere, keep them non-dimensional */
  .topbar .navlinks a:hover,
  .topbar .navlinks a:active {
    border-bottom-color: currentColor;
  }

  /* === CVD-WEB-0018 remove active underline (no bottom rule under nav items) === */
  .topbar .navlinks a,
  .topbar .navlinks a[aria-current="page"],
  .topbar .navlinks a.is-active,
  .topbar .navlinks a:hover,
  .topbar .navlinks a:active,
  .topbar .navlinks a:focus-visible {
    border-bottom: none !important;
    box-shadow: none !important;
    /* guard if any inset underline is used elsewhere */
  }

  /* ===== Consolidated topbar locks (moved from codivium-core.css) ===== */
  /* === CVD-WEB-0008 topbar font lock (ensures uniform topbar across pages) === */
  .topbar,
  .topbar .navlinks a,
  .topbar .cta,
  .topbar a.brand,
  .topbar .brand-title,
  .topbar .brand-sub {
    font-family: var(--serif) !important;
  }


  /* === CVD-WEB-0017 topbar nav alignment lock (site-wide guard) === */
  .topbar .navlinks {
    display: flex;
    align-items: center;
  }

  .topbar .navlinks a {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  .topbar .navlinks a {
    border-bottom: 1px solid transparent;
  }
}