/* ==========================================================================
   KWN mobile navigation (full-screen editorial overlay)

   Shared by index.html (ES) and en/index.html (EN). Both pages load different
   main stylesheets (style.min.css vs style.css), so this component lives in
   its own file to keep a single source of truth.

   IMPORTANT: style.css / style.min.css contain a blanket
   `@media (max-width: 767px) { * { animation: none !important;
   transition: none !important; transform: none !important; } }`
   Every animated property below therefore needs !important plus a class
   selector, so it outranks that universal rule.
   ========================================================================== */

:root {
  --kwn-mnav-ease: cubic-bezier(0.16, 0.84, 0.34, 1);
  --kwn-mnav-z-panel: 10050;
  --kwn-mnav-z-toggle: 10060;
  --kwn-mnav-z-progress: 10070;
}

/* Retire the legacy slide-in nav that main.js still injects. It has had no
   visible trigger for a while, and its off-screen links stayed keyboard
   focusable. */
#mobile-nav,
#mobile-nav-toggle,
#mobile-body-overly {
  display: none !important;
}

/* The whole component is mobile-only: #header is hidden at <= 768px. */
.kwn-mnav-progress,
.kwn-mnav-toggle,
.kwn-mnav-panel {
  display: none;
}

/* --------------------------------------------------------------------------
   Reading progress bar
   -------------------------------------------------------------------------- */

.kwn-mnav-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  max-width: 100%;
  background: linear-gradient(90deg, var(--primary-green, #6ED02F), #b6f06a);
  box-shadow: 0 0 12px rgba(110, 208, 47, 0.55);
  z-index: var(--kwn-mnav-z-progress);
  pointer-events: none;
  border-bottom-right-radius: 3px;
  border-top-right-radius: 3px;
}

/* --------------------------------------------------------------------------
   Trigger button
   -------------------------------------------------------------------------- */

.kwn-mnav-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  background: rgba(0, 24, 108, 0.55);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 8, 51, 0.35);
  cursor: pointer;
  z-index: var(--kwn-mnav-z-toggle);
  -webkit-tap-highlight-color: transparent;
}

.kwn-mnav-toggle:focus-visible {
  outline: 3px solid var(--primary-green, #6ED02F);
  outline-offset: 3px;
}

.kwn-mnav-toggle-box {
  position: relative;
  display: block;
  width: 24px;
  height: 14px;
  margin: 0 auto;
}

.kwn-mnav-toggle-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transition: transform 0.4s var(--kwn-mnav-ease), background-color 0.3s ease !important;
}

.kwn-mnav-toggle-line:nth-child(1) {
  top: 0;
}

.kwn-mnav-toggle-line:nth-child(2) {
  bottom: 0;
  width: 70%;
}

/* Morph into an X. */
body.kwn-mnav-open .kwn-mnav-toggle-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg) !important;
  background: var(--primary-green, #6ED02F);
}

body.kwn-mnav-open .kwn-mnav-toggle-line:nth-child(2) {
  width: 100%;
  transform: translateY(-6px) rotate(-45deg) !important;
  background: var(--primary-green, #6ED02F);
}

/* --------------------------------------------------------------------------
   Full-screen panel
   -------------------------------------------------------------------------- */

.kwn-mnav-panel {
  position: fixed;
  inset: 0;
  z-index: var(--kwn-mnav-z-panel);
  padding: 22px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 12% 16%, rgba(0, 101, 255, 0.55), transparent 55%),
    radial-gradient(circle at 88% 6%, rgba(110, 208, 47, 0.16), transparent 45%),
    linear-gradient(160deg, #001a5c 0%, #000833 100%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-100%) !important;
  transition: transform 0.55s var(--kwn-mnav-ease), opacity 0.35s ease, visibility 0.55s step-end !important;
}

body.kwn-mnav-open .kwn-mnav-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) !important;
  transition: transform 0.55s var(--kwn-mnav-ease), opacity 0.3s ease, visibility 0s step-start !important;
}

.kwn-mnav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 34px;
  /* Clear the fixed trigger button. */
  padding-right: 60px;
}

.kwn-mnav-logo img {
  display: block;
  width: auto;
  max-height: 46px;
}

.kwn-mnav-eyebrow {
  color: var(--primary-green, #6ED02F);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 26px;
  display: block;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */

.kwn-mnav-list {
  list-style: none;
  margin: 0 0 34px;
  padding: 0;
}

.kwn-mnav-item {
  opacity: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  transform: translateY(16px) !important;
  transition: opacity 0.45s var(--kwn-mnav-ease), transform 0.45s var(--kwn-mnav-ease) !important;
}

.kwn-mnav-item:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

body.kwn-mnav-open .kwn-mnav-item {
  opacity: 1;
  transform: translateY(0) !important;
}

/* Staggered reveal. Delay has to be declared separately: the !important
   shorthand above resets transition-delay. */
body.kwn-mnav-open .kwn-mnav-item:nth-child(1) { transition-delay: 0.14s !important; }
body.kwn-mnav-open .kwn-mnav-item:nth-child(2) { transition-delay: 0.20s !important; }
body.kwn-mnav-open .kwn-mnav-item:nth-child(3) { transition-delay: 0.26s !important; }
body.kwn-mnav-open .kwn-mnav-item:nth-child(4) { transition-delay: 0.32s !important; }
body.kwn-mnav-open .kwn-mnav-item:nth-child(5) { transition-delay: 0.38s !important; }
body.kwn-mnav-open .kwn-mnav-item:nth-child(6) { transition-delay: 0.44s !important; }

.kwn-mnav-link {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 0;
  color: #fff;
  font-family: 'Poppins', 'Montserrat', sans-serif;
  font-size: clamp(30px, 9.5vw, 46px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.kwn-mnav-link:hover,
.kwn-mnav-link:focus {
  color: #fff;
  text-decoration: none;
}

.kwn-mnav-link:focus-visible {
  outline: 3px solid var(--primary-green, #6ED02F);
  outline-offset: 4px;
}

.kwn-mnav-index {
  flex: 0 0 auto;
  color: var(--primary-green, #6ED02F);
  font-family: 'Poppins', 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  opacity: 0.75;
}

/* Green rule that draws in on the section you are currently reading. */
.kwn-mnav-rule {
  position: absolute;
  left: 0;
  bottom: 12px;
  height: 3px;
  width: 100%;
  border-radius: 3px;
  background: var(--primary-green, #6ED02F);
  transform: scaleX(0) !important;
  transform-origin: left center;
  transition: transform 0.45s var(--kwn-mnav-ease) !important;
}

.kwn-mnav-link[aria-current="true"] {
  color: var(--primary-green, #6ED02F);
}

.kwn-mnav-link[aria-current="true"] .kwn-mnav-index {
  opacity: 1;
}

.kwn-mnav-link[aria-current="true"] .kwn-mnav-rule,
.kwn-mnav-link:active .kwn-mnav-rule {
  transform: scaleX(1) !important;
}

/* --------------------------------------------------------------------------
   Language switch
   -------------------------------------------------------------------------- */

.kwn-mnav-foot {
  opacity: 0;
  transition: opacity 0.4s ease !important;
  transition-delay: 0.42s !important;
}

body.kwn-mnav-open .kwn-mnav-foot {
  opacity: 1;
}

.kwn-mnav-lang {
  display: inline-flex;
  align-items: stretch;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(0, 8, 51, 0.5);
}

.kwn-mnav-lang > * {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 9px 4px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.kwn-mnav-lang-current {
  background: var(--primary-green, #6ED02F);
  color: var(--dark-blue, #00186C);
}

.kwn-mnav-lang-link {
  color: rgba(255, 255, 255, 0.82);
}

.kwn-mnav-lang-link:hover,
.kwn-mnav-lang-link:focus {
  color: #fff;
  text-decoration: none;
}

.kwn-mnav-lang-link:focus-visible {
  outline: 3px solid var(--primary-green, #6ED02F);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Scroll lock. Beats the `html, body { overflow-x: hidden !important; }`
   mobile rule in the main stylesheets.
   -------------------------------------------------------------------------- */

html.kwn-mnav-lock,
html.kwn-mnav-lock body {
  overflow: hidden !important;
}

/* --------------------------------------------------------------------------
   Activation
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {

  .kwn-mnav-progress {
    display: block;
  }

  .kwn-mnav-toggle {
    display: block;
  }

  .kwn-mnav-panel {
    display: block;
  }
}

/* --------------------------------------------------------------------------
   Reduced motion: keep the state changes, drop the movement.
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

  .kwn-mnav-panel,
  body.kwn-mnav-open .kwn-mnav-panel,
  .kwn-mnav-item,
  body.kwn-mnav-open .kwn-mnav-item,
  .kwn-mnav-toggle-line,
  body.kwn-mnav-open .kwn-mnav-toggle-line:nth-child(1),
  body.kwn-mnav-open .kwn-mnav-toggle-line:nth-child(2),
  .kwn-mnav-rule,
  .kwn-mnav-link[aria-current="true"] .kwn-mnav-rule,
  .kwn-mnav-foot {
    transition: none !important;
    transition-delay: 0s !important;
  }

  .kwn-mnav-panel,
  body.kwn-mnav-open .kwn-mnav-panel,
  .kwn-mnav-item,
  body.kwn-mnav-open .kwn-mnav-item {
    transform: none !important;
  }

  /* The X still needs its rotation to read as a close button. */
  body.kwn-mnav-open .kwn-mnav-toggle-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg) !important;
  }

  body.kwn-mnav-open .kwn-mnav-toggle-line:nth-child(2) {
    transform: translateY(-6px) rotate(-45deg) !important;
  }
}

/* ==========================================================================
   Compact sticky header (mobile)

   #header was hidden below 768px by five separate rules in the main
   stylesheets (display:none !important at style.css ~3762 and ~4501, plus
   position:relative at ~3632). This file loads last and uses the same #id
   specificity, so it wins on order without editing those files.

   The bar gives the hamburger a home, removes the duplicated hero logo, and
   pushes the hero block down so the content sits balanced between the bar and
   the white curve instead of hugging the top.
   ========================================================================== */

@media (max-width: 768px) {

  #header {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    /* The desktop header is a floating pill: left/right 5%, width 90%,
       border-radius 3rem. All of that has to be unwound for a full-bleed bar. */
    width: 100% !important;
    max-width: 100% !important;
    height: var(--kwn-bar-height, 64px) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 12, 58, 0.72) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 6px 24px rgba(0, 8, 51, 0.22) !important;
  }

  /* main.js toggles .header-scrolled on scroll; keep the bar visually stable. */
  #header.header-scrolled {
    top: 0 !important;
    height: var(--kwn-bar-height, 64px) !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }

  #header .container-fluid {
    display: flex !important;
    align-items: center;
    height: 100%;
    /* Right padding reserves room for the fixed trigger button. */
    padding: 0 70px 0 18px !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  #header #logo {
    float: none !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 0;
  }

  #header #logo a {
    display: block;
    line-height: 0;
  }

  #header #logo img {
    display: block;
    max-height: 34px !important;
    width: auto !important;
    margin: 0 !important;
  }

  /* The nav links live in the overlay panel, not in the bar. */
  #nav-menu-container {
    display: none !important;
  }

  /* The hero used to carry its own large logo because the header was hidden.
     The bar now owns the branding, so drop the duplicate. */
  #mobile-inline-logo {
    display: none !important;
  }

  /* Clear the bar and balance the hero block in the blue area above the curve.
     Tune with --kwn-hero-offset if the crop of the curve ever changes. */
  /* Measured on a 390x844 viewport: the white curve of the wrapper background
     crosses the left edge (where the copy sits) at about y=592, not at the
     bottom of #intro. Centring the block between the bar and that line is what
     makes the hero read balanced. */
  #intro .intro-container {
    padding-top: var(--kwn-hero-offset, clamp(90px, 23vh, 210px)) !important;
  }

  /* Anchor targets must not land underneath the fixed bar. */
  body > section[id],
  .hero-impact-wrapper > section[id] {
    scroll-margin-top: calc(var(--kwn-bar-height, 64px) + 6px);
  }

  /* Sit the trigger centred inside the bar. 44px keeps a comfortable
     tap target. */
  .kwn-mnav-toggle {
    top: 10px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  /* Read the progress as the bottom edge of the bar. */
  .kwn-mnav-progress {
    top: calc(var(--kwn-bar-height, 64px) - 2px);
    height: 2px;
  }

  /* The panel covers the bar, so the progress bar would float on top of it. */
  body.kwn-mnav-open .kwn-mnav-progress {
    opacity: 0;
  }

  /* Match the bar's logo box exactly, so the mark appears to stay put while
     the panel wipes in. */
  .kwn-mnav-panel {
    /* padding-top 0 so the head box spans exactly the bar's 64px and both
       logos share the same centre line. */
    padding-top: 0;
    padding-left: 18px;
    padding-right: 18px;
  }

  .kwn-mnav-head {
    height: var(--kwn-bar-height, 64px);
    margin-bottom: 22px;
    padding-right: 60px;
  }

  .kwn-mnav-logo img {
    max-height: 34px;
  }
}
