/* stylelint-disable selector-class-pattern */

:root {
  /* Sticky bar sizing. Height = logo height (logo ratio 926x967) + vertical padding. */
  --p-header-bar-logo: 3.5rem;
  --p-header-bar-padding: 0.6rem;
  --p-header-bar-height: calc(var(--p-header-bar-logo) * 967 / 926 + var(--p-header-bar-padding) * 2);
}

/* ---------- Initial state: big logo over the hero ---------- */

.p-header__logo {
  display: block;
  text-decoration: none;
}

.p-header__logo img {
  display: block;
  width: 100%;
  height: auto;
}

.p-header > .p-header__logo {
  position: absolute;
  z-index: 300;
  top: 1.5rem;
  left: var(--v-layout-container-padding);
  width: 7rem;
  transition: var(--v-transition-default);
}

body.is-scrolled .p-header > .p-header__logo {
  opacity: 0;
  visibility: hidden;
}

/* ---------- Sticky state: collection | logo | cart ---------- */

.p-header__bar {
  position: fixed;
  z-index: 310;
  inset: 0 0 auto 0;
  background-color: var(--v-color-7);
  transform: translateY(-100%);
  visibility: hidden;
  transition: var(--v-transition-default);
}

body.is-scrolled .p-header__bar {
  transform: translateY(0);
  visibility: visible;
}

/* Product + checkout pages: bar always visible (no big logo state), content starts below it */
body.single-product,
body.woocommerce-checkout {
  padding-top: var(--p-header-bar-height);
}

body.single-product .p-header > .p-header__logo,
body.woocommerce-checkout .p-header > .p-header__logo {
  display: none;
}

body.single-product .p-header__bar,
body.woocommerce-checkout .p-header__bar {
  transform: none;
  visibility: visible;
}

body.admin-bar .p-header__bar {
  top: 46px;
}

.p-header__bar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: var(--v-layout-container-size-md);
  margin: 0 auto;
  padding: var(--p-header-bar-padding) var(--v-layout-container-padding);
}

.p-header__bar-right {
  display: flex;
  justify-content: flex-end;
}

.p-header__logo--small {
  width: var(--p-header-bar-logo);
}

.p-header__link {
  font-family: var(--v-font-family-alt1);
  font-weight: var(--v-font-weight-bold);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  color: var(--v-color-1);
  transition: var(--v-transition-default);
}

.p-header__link:hover {
  color: var(--v-color-1--alt4);
  text-decoration-color: transparent;
}

.p-header__icon-cart {
  display: inline-block;
  position: relative;
  text-decoration: none;
  fill: var(--v-color-1);
}

.p-header__icon-cart svg {
  display: block;
  width: 2rem;
  height: auto;
}

.p-header__icon-cart-count {
  position: absolute;
  z-index: 10;
  right: -0.6rem;
  bottom: -0.4rem;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--v-color-2);
  color: var(--v-color-1);
  font-size: 0.8rem;
  line-height: 1;
  transition: var(--v-transition-default);
}

.p-header__icon-cart:hover .p-header__icon-cart-count {
  background-color: var(--v-color-1);
  color: var(--v-color-2);
}

@media (min-width: 700px) {
  .p-header > .p-header__logo {
    top: 2rem;
    width: 10rem;
  }

  .p-header__link {
    font-size: 1.1rem;
  }

  .p-header__icon-cart svg {
    width: 2.5rem;
  }

  .p-header__icon-cart-count {
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.95rem;
  }
}

@media (min-width: 783px) {
  body.admin-bar .p-header__bar {
    top: 32px;
  }
}

@media (min-width: 72rem) {
  .p-header > .p-header__logo {
    left: 50%;
    transform: translateX(calc((var(--v-layout-container-size-md) / 2) * -1 + var(--v-layout-container-padding)));
  }
}

@media (min-width: 1400px) {
  .p-header > .p-header__logo {
    top: 3rem;
    width: 16rem;
  }
}

/* Sticky bar 25% higher on large screens (logo + padding x1.25) */
@media (min-width: 1600px) {
  :root {
    --p-header-bar-logo: 4.375rem;
    --p-header-bar-padding: 0.75rem;
  }
}

/* Product + checkout pages: sticky bar 25% higher than on other pages (offsets using --p-header-bar-height follow) */
body.single-product,
body.woocommerce-checkout {
  --p-header-bar-logo: calc(3.5rem * 1.25);
  --p-header-bar-padding: calc(0.6rem * 1.25);

  /* re-declared here so it is computed from the values above (custom properties inherit their computed value) */
  --p-header-bar-height: calc(var(--p-header-bar-logo) * 967 / 926 + var(--p-header-bar-padding) * 2);
}

@media (min-width: 1600px) {
  body.single-product,
  body.woocommerce-checkout {
    --p-header-bar-logo: calc(4.375rem * 1.25);
    --p-header-bar-padding: calc(0.75rem * 1.25);
  }
}
