/* Site header (template-parts/header/site-header.php): logo, the primary menu with dropdowns
   from 1001px, the "Menu" button below that. Sticky; js/site.js adds .is-scrolled (glass
   background) after the first screenful of pixels and .is-hidden while scrolling down. */

/* style.css clips .site with overflow: hidden, which turns it into a scroll container and stops
   position: sticky. clip cuts the overflow the same way without that side effect. */
body .site {
  overflow: visible;
  overflow-x: clip;
}

.gtp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  color: #fff;
  transition: transform 0.45s var(--ease), background-color 0.35s, box-shadow 0.35s;
}

.gtp-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(23, 44, 82, 0.82);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow: 0 1px 0 var(--line);
  opacity: 0;
  transition: opacity 0.35s;
}

.gtp-header.is-scrolled::before {
  opacity: 1;
}

/* Hidden while scrolling down, never while its menu is in use. */
.gtp-header.is-hidden:not(:focus-within):not(.has-open-submenu) {
  transform: translateY(-100%);
}

.admin-bar .gtp-header {
  top: var(--wp-admin--admin-bar--height, 32px);
}

.gtp-header__bar {
  display: flex;
  align-items: center;
  gap: 32px;
  height: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.gtp-header__logo {
  display: block;
  flex: none;
  margin-right: auto;
  color: #fff;
  line-height: 0;
}

.gtp-logo {
  display: block;
  width: clamp(150px, 12vw, 184px);
  height: auto;
  overflow: visible;
}

.gtp-logo__gt {
  transition: fill 0.3s;
}

.gtp-header__logo:hover .gtp-logo__gt {
  fill: #fff;
}

/* ---------- Desktop menu ---------- */

.gtp-nav {
  height: 100%;
}

.gtp-nav__menu {
  display: flex;
  align-items: stretch;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gtp-nav__menu > li {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
}

.gtp-nav__menu > li > a {
  position: relative;
  display: block;
  padding: 10px 6px 10px 14px;
  color: #fff;
  font-family: var(--ff-text);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.gtp-nav__menu > li:not(.menu-item-has-children) > a {
  padding-right: 14px;
}

/* Accent line that grows under the hovered and the current item. */
.gtp-nav__menu > li > a::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 6px;
  bottom: 2px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s var(--ease);
}

.gtp-nav__menu > li:not(.menu-item-has-children) > a::after {
  right: 14px;
}

.gtp-nav__menu > li:hover > a::after,
.gtp-nav__menu > li.is-open > a::after,
.gtp-nav__menu > li > a:focus-visible::after,
.gtp-nav__menu > .current-menu-item > a::after,
.gtp-nav__menu > .current-menu-ancestor > a::after,
.gtp-nav__menu > .current-menu-parent > a::after,
.gtp-nav__menu > .current_page_parent > a::after,
.gtp-nav__menu > .current-page-ancestor > a::after {
  transform: scaleX(1);
}

.gtp-nav__menu > .current-menu-item > a,
.gtp-nav__menu > .current-menu-ancestor > a,
.gtp-nav__menu > .current-menu-parent > a {
  color: #fff;
}

.gtp-nav__sub-toggle,
button.gtp-nav__sub-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin: 0 6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.gtp-nav__sub-toggle:hover,
button.gtp-nav__sub-toggle:hover,
.gtp-nav__menu > li:hover > .gtp-nav__sub-toggle {
  background: transparent;
  color: var(--accent);
}

.gtp-nav__sub-toggle svg {
  transition: transform 0.3s var(--ease);
}

.gtp-nav__menu > li.is-open > .gtp-nav__sub-toggle svg {
  transform: rotate(180deg);
}

/* Dropdown panel: an accent rule on its left edge and numbered items, the language of the mobile
   menu (css/mobile-nav.css). */
.gtp-nav .sub-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 2;
  width: max-content;
  min-width: 300px;
  max-width: 420px;
  margin: 0;
  padding: 14px 0 16px;
  list-style: none;
  counter-reset: gtp-nav-sub;
  background: var(--navy-deep);
  border-left: 2px solid var(--accent);
  box-shadow: 0 28px 56px rgba(6, 16, 36, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s var(--ease), transform 0.35s var(--ease), visibility 0s linear 0.35s;
}

.gtp-nav .sub-menu.is-flipped {
  left: auto;
  right: 0;
}

/* Longer submenus (Usługi) in two columns. */
.gtp-nav .sub-menu:has(> li:nth-child(6)) {
  display: grid;
  grid-template-columns: repeat(2, minmax(250px, 1fr));
  max-width: none;
}

@media (hover: hover) {
  .gtp-nav__menu > li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
  }
}

.gtp-nav__menu > li.is-open > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}

.gtp-nav .sub-menu li {
  margin: 0;
  padding: 0;
  counter-increment: gtp-nav-sub;
}

/* An item: small accent number on the first line of the title, the arrow pushed to the right. */
.gtp-nav .sub-menu a {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 11px 26px 11px 24px;
  color: #fff;
  font-family: var(--ff-text);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}

.gtp-nav .sub-menu a::before {
  content: counter(gtp-nav-sub, decimal-leading-zero);
  flex: none;
  min-width: 1.5rem;
  margin-top: 5px; /* centred on the first line of the 16px/1.4 title */
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1;
  transition: color 0.2s;
}

.gtp-nav .sub-menu a::after {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  margin-left: auto;
  align-self: center;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s, transform 0.3s var(--ease);
}

.gtp-nav .sub-menu a:hover,
.gtp-nav .sub-menu a:focus-visible,
.gtp-nav .sub-menu .current-menu-item > a {
  background: rgba(255, 255, 255, 0.04);
  color: var(--accent);
}

.gtp-nav .sub-menu a:hover::before,
.gtp-nav .sub-menu a:focus-visible::before,
.gtp-nav .sub-menu .current-menu-item > a::before {
  color: #fff;
}

.gtp-nav .sub-menu a:hover::after,
.gtp-nav .sub-menu a:focus-visible::after,
.gtp-nav .sub-menu .current-menu-item > a::after {
  opacity: 1;
  transform: none;
}

/* "Kontakt" (the page with the contact template) as an outlined button. */
.gtp-nav__menu > .menu-item--cta {
  margin-left: 12px;
}

/* li.… outweighs the 14px right padding of the plain items above. */
.gtp-nav__menu > li.menu-item--cta > a {
  padding: 11px 20px;
  border: 1px solid var(--line-accent);
  transition: background-color 0.25s var(--ease), border-color 0.25s, color 0.25s;
}

.gtp-nav__menu > .menu-item--cta > a::after {
  content: none;
}

.gtp-nav__menu > .menu-item--cta > a:hover,
.gtp-nav__menu > .menu-item--cta > a:focus-visible,
.gtp-nav__menu > .menu-item--cta.current-menu-item > a {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--navy);
}

/* Filled once the header has turned to glass (js/site.js adds .is-scrolled), so it reads at a
   glance over photos and white bands; hover lightens it then. */
.gtp-header.is-scrolled .gtp-nav__menu > .menu-item--cta > a {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--navy);
}

.gtp-header.is-scrolled .gtp-nav__menu > .menu-item--cta > a:hover,
.gtp-header.is-scrolled .gtp-nav__menu > .menu-item--cta > a:focus-visible {
  background: var(--accent-light);
  border-color: var(--accent-light);
}

/* Language switcher (Polylang adds its items to the menu): "PL / ENG" after a divider. */
.gtp-nav__menu > .lang-item > a {
  padding: 10px 7px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
}

.gtp-nav__menu > .lang-item > a::after {
  left: 7px;
  right: 7px;
}

.gtp-nav__menu > .lang-item > a:hover {
  color: #fff;
}

.gtp-nav__menu > .lang-item.current-lang > a {
  color: var(--accent);
}

.gtp-nav__menu > .lang-item-first {
  margin-left: 18px;
  padding-left: 12px;
}

.gtp-nav__menu > .lang-item-first::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 22px;
  margin-top: -11px;
  background: var(--line);
}

.gtp-nav__menu > .lang-item.current-lang > a::after {
  transform: scaleX(0);
}

/* ---------- Up to 1000px: the "Menu" button (js/mobile-nav.js) ---------- */

.mobile-nav__toggle,
button.mobile-nav__toggle,
.mobile-nav__close,
button.mobile-nav__close {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  margin-right: -10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: #fff;
  font-family: var(--ff-text);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  cursor: pointer;
}

.mobile-nav__toggle:hover,
button.mobile-nav__toggle:hover,
.mobile-nav__close:hover,
button.mobile-nav__close:hover {
  background: transparent;
  color: var(--accent);
}

.mobile-nav__toggle-icon {
  position: relative;
  display: block;
  width: 26px;
  height: 12px;
}

.mobile-nav__toggle-icon > span {
  position: absolute;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.4s var(--ease), width 0.3s var(--ease), top 0.3s var(--ease);
}

.mobile-nav__toggle-icon > span:first-child {
  top: 0;
  width: 100%;
}

.mobile-nav__toggle-icon > span:last-child {
  top: 10.5px;
  width: 65%;
}

.mobile-nav__toggle:hover .mobile-nav__toggle-icon > span:last-child {
  width: 100%;
}

.mobile-nav__toggle-icon.is-open > span {
  top: 5.25px;
  width: 100%;
}

.mobile-nav__toggle-icon.is-open > span:first-child {
  transform: rotate(45deg) scaleX(0.85);
}

.mobile-nav__toggle-icon.is-open > span:last-child {
  transform: rotate(-45deg) scaleX(0.85);
}

@media (min-width: 1001px) {
  .mobile-nav__toggle,
  button.mobile-nav__toggle {
    display: none;
  }
}

@media (max-width: 1000px) {
  .gtp-nav {
    display: none;
  }
}

@media (max-width: 1180px) and (min-width: 1001px) {
  .gtp-header__bar {
    gap: 16px;
  }

  .gtp-nav__menu > li > a {
    padding-left: 10px;
  }

  .gtp-nav__menu > li > a::after {
    left: 10px;
  }

  .gtp-nav__menu > .menu-item--cta {
    margin-left: 6px;
  }

  .gtp-nav__menu > .lang-item-first {
    margin-left: 10px;
    padding-left: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gtp-header,
  .gtp-nav .sub-menu {
    transition: none;
  }
}
