/* ---------------------------------------------------------------------------
   Responsive layer.

   The design artifact is desktop-only and styles everything with inline `style`
   attributes, which a stylesheet can only override with !important. These rules
   live OUTSIDE design-source/ on purpose: re-exporting the artifact overwrites
   homepage.dc.html, and mobile support must not vanish when that happens.

   Selectors lean on inline-style substrings (the artifact has almost no classes).
   That is brittle by nature, so build.mjs asserts on a real 390px viewport that
   the page does not overflow — if a re-export changes these declarations, the
   build fails loudly instead of shipping a broken layout.
   --------------------------------------------------------------------------- */

/* Decorative glows/SVGs are absolutely positioned far wider than the viewport
   (e.g. width:1000px centred with translate(-50%)). body already hides overflow,
   but the document still scrolled sideways — html is the scroll container. */
html {
  overflow-x: hidden;
}

img,
svg,
canvas {
  max-width: 100%;
}

/* ---------- Mobile nav (markup built by mobile-nav.js) ---------------------- */

.bw-mobilebar,
.bw-menu {
  display: none;
}

.bw-burger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; /* 44px keeps the tap target at the accessible minimum */
  height: 44px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid #1C2740;
  border-radius: 6px;
  cursor: pointer;
}

.bw-burger span {
  display: block;
  height: 2px;
  width: 100%;
  background: #EEF3FB;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.bw-burger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.bw-burger.is-open span:nth-child(2) { opacity: 0; }
.bw-burger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.bw-menu-link {
  display: block;
  padding: 14px 4px;
  font-size: 16px;
  color: #EEF3FB;
  border-bottom: 1px solid #14203A;
  font-family: 'Manrope', sans-serif;
}

.bw-menu-link.bw-menu-cta {
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  padding: 15px 18px;
  text-align: center;
  font-weight: 700;
  color: #04121B;
  background: linear-gradient(90deg, #2EC5C5, #2F6FE0);
}

@media (max-width: 900px) {
  nav {
    padding: 10px 16px !important;
  }

  /* Hide the desktop rows; the mobile bar + menu replace them. */
  nav > div:not(.bw-mobilebar):not(.bw-menu) {
    display: none !important;
  }

  .bw-mobilebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  .bw-menu[data-open='true'] {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 10px 16px 22px;
    /* Fully opaque: the nav sits over the hero, and even 0.97 let the headline
       show through behind the menu links. */
    background: #090D17;
    border-bottom: 1px solid #14203A;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }

  /* Consistent gutters. Vertical rhythm is left to the artifact. */
  section[style],
  footer[style] {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* Side-by-side content columns stack. The Open Source comparison is handled
     separately below — collapsing it would break the Community/Cloud pairing. */
  #cloud [style*='grid-template-columns: 1fr 1fr'],
  #enterprise [style*='grid-template-columns: 1fr 1fr'],
  #early [style*='grid-template-columns: 1fr 1fr'],
  [style*='grid-template-columns: 1.3fr 1fr'] {
    grid-template-columns: 1fr !important;
  }

  /* Footer: brand column + 4 link columns -> 2 columns. */
  [style*='grid-template-columns: 1.4fr repeat(4, 1fr)'] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 30px 20px !important;
  }

  /* The comparison table stays two-up; only the spacing tightens. */
  #opensource [style*='grid-template-columns: 1fr 1fr'] > div {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* Inputs and buttons: 16px avoids iOS zoom-on-focus. */
  input,
  select,
  textarea,
  button {
    font-size: 16px !important;
  }
}

@media (min-width: 901px) {
  .bw-mobilebar,
  .bw-menu,
  .bw-burger {
    display: none !important;
  }
}

@media (max-width: 560px) {
  section[style],
  footer[style] {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  /* Wide mockup panels (Mission Control etc.) would otherwise force a sideways
     scroll; let them scroll inside their own box instead of the page. */
  [style*='grid-template-columns: repeat(auto-fill, minmax(340px, 1fr))'],
  [style*='grid-template-columns: repeat(auto-fill, minmax(300px, 1fr))'] {
    grid-template-columns: 1fr !important;
  }

  [style*='grid-template-columns: 1.4fr repeat(4, 1fr)'] {
    grid-template-columns: 1fr !important;
  }
}

/* ---------- Early-access form (enhanced by enhance-form.js) ---------------- */

/* Honeypot: off-screen rather than display:none, which some bots skip. */
.bw-pot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.bw-chip {
  user-select: none;
}

.bw-chip:focus-visible {
  outline: 2px solid #2EC5C5;
  outline-offset: 2px;
}

/* The chips carry inline borders/colours, so the selected state must outrank them. */
.bw-chip-on {
  border-color: #2EC5C5 !important;
  color: #04121B !important;
  background: #2EC5C5 !important;
  font-weight: 700 !important;
}

.bw-status {
  margin: 14px 0 0;
  font-size: 14.5px;
  min-height: 1.2em;
}

.bw-status.bw-ok {
  color: #34D399;
}

.bw-status.bw-err {
  color: #F5B544;
}

.bw-form.bw-done input,
.bw-form.bw-done .bw-chip {
  opacity: 0.55;
  pointer-events: none;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid #2EC5C5;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .bw-burger span {
    transition: none;
  }
}
