/* ================================
   CRT Navigation (polished v2)
   ================================ */

/* Nav-scoped variables + z-index scale */
.site-header{
  --bg:#0b1b2b;
  --bg-2:#0f253a;
  --text:#f2f6fa;
  --muted:#bcd0e0;
  --brand:#ff7a1a;
  --brand-ink:#22160b;
  --line:rgba(255,255,255,.08);
  --ring:2px solid #7cc4ff;

  --z-header: 5000;
  --z-scrim:  5100;
  --z-drawer: 5200;
}

*{ box-sizing:border-box; }

/* Header base */
.site-header{
  position:fixed; top:0; left:0; right:0; width:100%;
  background:linear-gradient(180deg,var(--bg),var(--bg-2));
  color:var(--text);
  border-bottom:1px solid var(--line);
  z-index:var(--z-header);
}

/* Accessibility */
.skip-link{ position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden; }
.skip-link:focus{ left:8px; top:8px; padding:8px 12px; background:#fff; color:#000; border-radius:10px; }

/* Bar layout */
.nav-bar{
  display:flex; align-items:center; justify-content:space-between;
  min-height:70px; gap:16px; padding:5px;
  transition:min-height .18s ease;
}
.crt-polymer-badge {
  background: #ffffff;
  position: fixed;
  color: #1d2b3a;
  border-radius: 30px;
  padding: 8px 16px;
  display: inline-flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  animation: crtBadgeFloat 4s ease-in-out infinite;
  z-index: 999;

  /* NEW: position on screen */
  top: 7vw;       /* vertical offset – adjust as needed */
  right: 0.5vw;     /* distance from right edge */
  left: auto;     /* make sure it's not constrained on the left */
  margin: 0;      /* margin-top no longer needed */
}

.crt-badge-images {
  display: flex;
  align-items: flex-start;   /* TOP-align all items in the row */
  justify-content: center;
  gap: 10px;
}

.crt-badge-img {
  margin: 0;
  text-align: center;
  display: flex;             /* stack image + caption vertically */
  flex-direction: column;
  align-items: center;
}

.crt-badge-img img {
  display: block;

  height: 32px;              /* fixed height so both sides match */
  object-fit: cover;
  border-radius: 6px;
}

.crt-badge-img figcaption {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
  margin-top: 2px;
}

/* Make VS sit in a box the same height as the images and center vertically */
.crt-badge-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;              /* same as img height */
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
}

.crt-badge-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crt-badge-title {
  font-size: 13px;
  font-weight: 700;
}

.crt-badge-sub {
  font-size: 11px;
  opacity: 0.85;
}

.crt-badge-btn {
  margin-top: 4px;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: #0A3458;   /* CRT navy */
  color: #ffffff;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.crt-badge-btn:hover {
  background: #06263f;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.18);
}

@keyframes crtBadgeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@media (max-width: 700px) {
  .crt-polymer-badge {
    width: 100%;
    border-radius: 12px;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    margin-top:8vw;
  }
  .crt-badge-text {
    align-items: center;
  }
  .crt-badge-btn {
    align-self: center;
  }
}
.brand{ display:inline-flex; align-items:center; padding:8px 0; margin-right:8px; }
.brand img{ display:block; height:74px; width:auto; transition:height .18s ease; }
body.scrolled .nav-bar{ min-height:56px; }
body.scrolled .brand img{ height:45px; }

/* Toggle (mobile) */
.nav-toggle{ display:grid; gap:5px; padding:10px; border:0; background:transparent; cursor:pointer; border-radius:10px; }
.nav-toggle .bar{ width:26px; height:2px; background:var(--text); border-radius:2px; transition:transform .25s ease, opacity .2s; }
.nav-toggle:focus-visible{ outline:var(--ring); outline-offset:2px; }

/* Drawer (mobile) */
.primary-nav{
  position:fixed; inset:0 0 0 auto;
  width:min(92vw,360px);
  translate:100% 0;
  background:var(--bg-2);
  overflow:auto;
  transition:translate .28s ease;
  z-index:var(--z-drawer);
}
.scrim{
  position:fixed; inset:0;
  background:rgba(0,0,0,.45);
  backdrop-filter:saturate(120%) blur(2px);
  display:none;
  z-index:var(--z-scrim);
}

/* Menu structure */
.menu-root{ list-style:none; margin:16px 0 0; padding:0; display:grid; gap:2px; }
.menu-root>li{ display:block; }

.nav-link,.sub-toggle{
  font:600 16px/1.2 Inter, Lato, system-ui, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color:var(--text); text-decoration:none; padding:12px 12px;
  border-radius:10px; display:flex; align-items:center; gap:.5rem;
  background:transparent; position:relative;
}
.nav-link:hover,.sub-toggle:hover{ background:rgba(255,255,255,.06); }
.nav-link:focus-visible,.sub-toggle:focus-visible{ outline:var(--ring); }
.nav-link.is-active::after{
  content:""; position:absolute; left:10px; right:10px; bottom:6px; height:2px;
  background:var(--brand); border-radius:2px; opacity:.9;
}

.has-sub .chev{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; opacity:.9; transition:transform .2s ease; }
.submenu{ display:none; list-style:none; margin:4px 0 8px 10px; padding:8px 0 8px 10px; border-left:2px solid var(--line); }
.submenu a{ display:block; padding:8px 4px; color:var(--muted); text-decoration:none; border-radius:8px; }
.submenu a:hover,.submenu a:focus{ background:rgba(255,255,255,.06); color:var(--text); }

/* CTA */
.btn-cta{
  display:inline-flex; align-items:center; gap:.5rem; background:var(--brand); color:var(--brand-ink);
  text-decoration:none; padding:10px 16px; border-radius:999px; font-weight:800; letter-spacing:.2px;
  border:1px solid rgba(0,0,0,.12); box-shadow:0 4px 14px rgba(0,0,0,.25); transition:padding .18s ease, transform .18s ease;
}
.btn-cta:hover{ filter:brightness(1.05); transform:translateY(-1px); }
body.scrolled .btn-cta{ padding:8px 14px; }
.cta-li{ margin-left:6px; }

/* Open states (mobile, applied by JS) */
.site-header[data-open="true"] .primary-nav{ translate:0 0; }
.site-header[data-open="true"] .scrim{ display:block; pointer-events:auto; }
.site-header[data-open="true"] .nav-toggle .bar:nth-child(1){ transform:translateY(7px) rotate(45deg); }
.site-header[data-open="true"] .nav-toggle .bar:nth-child(2){ opacity:0; }
.site-header[data-open="true"] .nav-toggle .bar:nth-child(3){ transform:translateY(-7px) rotate(-45deg); }
.site-header[data-open] .sub-toggle[aria-expanded="true"] + .submenu{ display:block; }
.site-header[data-open] .sub-toggle[aria-expanded="true"] .chev{ transform:rotate(180deg); }

/* ==================
   Desktop refinements
   ================== */
@media (min-width:960px){
  .nav-toggle{ display:none; }
  .primary-nav{ position:static; translate:0; width:auto; background:transparent; box-shadow:none; padding:0; overflow:visible; }
  .scrim{ display:none; }

  .menu-root{ display:flex; align-items:center; gap:6px; margin:0; }
  .menu-root > li{ position:relative; }

  .sub-toggle{ background:transparent; padding:12px 10px; border:1px solid transparent; }
  .sub-toggle:hover{ background:rgba(255,255,255,.06); border-color:rgba(255,255,255,.08); }

  .has-sub{ position:relative; }
  .has-sub::after{ content:""; position:absolute; left:0; right:0; top:100%; height:12px; }

  /* FIRST-LEVEL panel only (scoped) */
  .menu-root > .has-sub > .submenu{
    position:absolute; left:0; top:calc(100% + 10px);
    min-width:240px; background:var(--bg-2);
    border:1px solid var(--line); border-radius:12px;
    box-shadow:0 10px 30px rgba(0,0,0,.35);
    padding:8px; margin:0; display:none; z-index:5300;

    /* let flyouts render outside this box */
    overflow:visible;
  }

  .has-sub:hover > .submenu,
  .has-sub:focus-within > .submenu{ display:block; }

  .submenu a{ white-space:nowrap; display:block; }

  /* ===========
     2nd-level flyouts (desktop only)
     =========== */
  .submenu .has-sub{ position:relative; }

  .submenu .has-sub > .submenu{
    position:absolute;
    top:-8px;
    left:calc(100% + 10px);        /* default open right */
    min-width:220px;
    background:var(--bg-2);
    border:1px solid var(--line);
    border-radius:12px;
    box-shadow:0 10px 30px rgba(0,0,0,.35);
    padding:8px; margin:0; display:none;
    z-index:5400;
    overflow:visible;
  }

  .submenu .has-sub:hover > .submenu,
  .submenu .has-sub:focus-within > .submenu{ display:block; }

  /* hover bridge so the pointer doesn't "fall" */
  .submenu .has-sub::after{
    content:"";
    position:absolute;
    top:-10px; left:100%;
    width:14px; height:calc(100% + 20px);
  }

  /* optional flip-left variant if JS adds .open-left */
  .submenu .has-sub.open-left > .submenu{ left:auto; right:calc(100% + 10px); }
  .submenu .has-sub.open-left::after{ left:auto; right:100%; }
}

/* Motion safety */
@media (prefers-reduced-motion:reduce){
  .primary-nav{ transition:none; }
  .nav-toggle .bar{ transition:none; }
}

/* ============================
   Mobile nested submenus (accordion)
   ============================ */
@media (max-width:959.98px){
  /* inner submenus should be in normal flow, not absolute */
  .submenu .has-sub > .submenu{
    position:static;
    display:none;
    margin:6px 0 8px 10px;
    padding:6px 0 6px 10px;
    border-left:2px solid var(--line);
    box-shadow:none;
    background:transparent;
  }

  /* show when the toggler is expanded (JS sets aria-expanded) */
  .site-header[data-open] .sub-toggle[aria-expanded="true"] + .submenu{
    display:block;
  }

  /* remove desktop hover-bridge so it doesn’t block taps */
  .submenu .has-sub::after{ content:none; }
}