/* header-submenu — second level of the primary menu (Figma 1574:15197).
   Loaded site-wide after index.css; the frozen bundle has no sub-menu rules.
   Colours are literals like in index.css: _tokens.css is not loaded on the homepage.
   Burger (base): items aligned left, a chevron button next to each parent opens its
   sub-menu under it, the parent link still opens its page (Figma 441:30257 closed,
   441:30181 Industries open; Vlad, 2026-10-23: items 22 px, sub-items 18 px at 80 %,
   only the current page green, the panel hugs its content and scrolls when taller
   than the screen, contacts and buttons scroll with it). Opening animates height and
   margin, 500 ms ease (assets/js/header-submenu.js).
   Desktop (> 75em, the bundle's burger breakpoint): dropdown under the
   parent on hover / keyboard focus (Figma 397:38340, 397:38377); on touch screens the first
   tap on the parent opens it, the second opens the page (Matt, 2026-11-02). */

/* .menu__list — burger: left, 20 px from the panel edge, 46 px between the items' baselines
   (22 px line boxes 24 px apart), the first one 5 px higher than the bundle's 25 px top padding gave */
.menu__list {
  gap: 1.5rem;
  padding-top: 1.25rem;
  padding-inline: 1.25rem;
  text-align: left;
}

/* .menu__item--has-children — burger: link | 40 px chevron column at the right edge (Figma) */
.menu__item--has-children {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.5rem;
  align-items: center;
}

/* .menu__toggle — 40 px tap target that does not grow the 22 px row */
.menu__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-block: -0.5625rem;
  color: #fff;
  transition: color 0.3s;

  /* .menu__toggle:focus-visible */
  &:focus-visible {
    outline: 0.125rem solid #a8d95f;
    outline-offset: -0.125rem;
  }
}

/* .menu__toggle-icon */
.menu__toggle-icon {
  transition: rotate 0.5s ease;
}

/* .menu__item--open > .menu__toggle — green, pointing up */
.menu__item--open > .menu__toggle {
  color: #a8d95f;

  /* .menu__item--open > .menu__toggle .menu__toggle-icon */
  & .menu__toggle-icon {
    rotate: 180deg;
  }
}

/* .sub-menu — burger: closed until its toggle opens it; 18 px items 43 px apart */
.menu__item--has-children > .sub-menu {
  display: none;
  flex-direction: column;
  grid-column: 1 / -1;
  overflow: hidden;
  margin-top: 0;
  transition: height 0.5s ease, margin-top 0.5s ease, margin-bottom 0.5s ease;
}

/* .menu__item--open > .sub-menu, .menu__item--closing > .sub-menu — shown while open or closing */
.menu__item--open > .sub-menu,
.menu__item--closing > .sub-menu {
  display: flex;
}

/* .menu__item--open > .sub-menu — the first sub-item 45 px under the parent, the next parent
   45 px under the last sub-item (the 43 px line boxes add half-leading on both ends) */
.menu__item--open > .sub-menu {
  margin-top: 0.75rem;
  margin-bottom: -0.75rem;
}

/* .sub-menu .menu__link — 18 px at 80 % (Figma 441:30181) */
.sub-menu .menu__link {
  font-size: 1.125rem;
  line-height: 2.4;
  color: rgb(255 255 255 / 0.8);
  white-space: nowrap;
}

/* @media (width <= 75em) — the bundle's burger breakpoint: rules that must not reach the
   desktop row (Figma 441:30257 / 441:30181, Vlad 2026-10-23) */
@media (width <= 75em) {
  /* .menu__link — 22 px items */
  .menu__link {
    font-size: 1.375rem;
  }

  /* .menu__item--current > .menu__link — only the current page is green */
  .menu__item--current > .menu__link {
    color: #a8d95f;
  }

  /* .menu__body — the panel hugs its content and scrolls inside when taller than the screen;
     the blur sits on the panel itself, so it covers the buttons too (index.css put it on a
     ::before that only spanned the first screen — Matt, mobile issue 1) */
  .menu__body {
    height: auto;
    max-height: calc(100svh - 1.25rem);
    padding-bottom: 1.25rem;
    -webkit-backdrop-filter: blur(1.25rem);
    backdrop-filter: blur(1.25rem);
  }

  /* .menu__body::before */
  .menu__body::before {
    content: none;
  }

  /* .menu__contacts — 32 px under the list, text → phone 25 px between the glyphs */
  .menu__contacts {
    gap: 1rem;
    padding-top: 2rem;
  }

  /* .menu__contacts-actions — full-width buttons 27 px under the phone */
  .menu__contacts-actions {
    align-items: stretch;
    padding-top: 0.625rem;
  }

  /* .menu__contacts-actions .button — the bundle sets .button to max-content from 425 px, which kept the
     buttons 290 px on larger phones (Figma M 18:22721: full width; Vlad 2026-11-18) */
  .menu__contacts-actions .button {
    width: auto;
  }

  /* @media (width >= 48em) .menu__contacts-actions — tablets (no frame): the buttons centred, not
     stretched across the whole panel */
  @media (width >= 48em) {
    .menu__contacts-actions {
      align-items: center;
    }
  }
}

/* @media (prefers-reduced-motion: reduce) — open and close at once */
@media (prefers-reduced-motion: reduce) {
  .menu__toggle-icon,
  .menu__item--has-children > .sub-menu {
    transition: none;
  }
}

@media (width > 75em) {
  .menu__list {
    gap: 1.6875rem;
    padding: 0;
  }

  .menu__item--has-children {
    display: block;
    position: relative;
  }

  .menu__toggle {
    display: none;
  }

  .menu__item--has-children:is(:hover, :focus-within, .menu__item--tapped) > .menu__link {
    color: #a8d95f;
  }

  .menu__item--has-children > .sub-menu {
    display: flex;
    position: absolute;
    top: calc(100% + 1.75rem);
    left: 50%;
    z-index: 10;
    gap: 0.75rem;
    overflow: visible;
    margin-top: 0;
    padding: 1.0625rem 1.875rem 1.25rem;
    border-radius: 0.625rem;
    background: #132132;
    text-align: center;
    translate: -50% 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
  }

  /* Hover bridge over the gap between the link and the panel */
  .menu__item--has-children > .sub-menu::before {
    content: "";
    position: absolute;
    inset: -1.75rem 0 100%;
  }

  /* Diamond under the parent link */
  .menu__item--has-children > .sub-menu::after {
    content: "";
    position: absolute;
    top: -1.1875rem;
    left: calc(50% - 0.1875rem);
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 0.0625rem;
    background: #a8d95f;
    rotate: 45deg;
  }

  /* .menu__item--tapped — opened by the first tap on a touch screen (assets/js/header-submenu.js) */
  .menu__item--has-children:is(:hover, :focus-within, .menu__item--tapped):not(.menu__item--dismissed) > .sub-menu {
    opacity: 1;
    visibility: visible;
  }

  .sub-menu .menu__item {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgb(255 255 255 / 0.1);
    transition: border-color 0.3s;
  }

  .sub-menu .menu__link {
    display: block;
    font-size: 1.25rem;
    line-height: 100%;
  }

  .sub-menu .menu__item:is(:hover, :focus-within) {
    border-color: #a8d95f;
  }

  .sub-menu .menu__link:is(:hover, :focus-visible) {
    color: #a8d95f;
  }

  /* .sub-menu .menu__item--current > .menu__link — the current page in green, as in the burger
     (Vlad, 2026-11-18); hover adds the green line under it */
  .sub-menu .menu__item--current > .menu__link {
    color: #a8d95f;
  }
}
