:root {
  --product-section-max-width:1140px;
  --primary-color: #3f3931;
}

main.products-archive {
  width: 100%;
  position: relative;
  z-index: 0;
  padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 50px);
  padding-bottom: 60px;
  padding-left: 20px;
  padding-right: 20px;
  color: #3f3931;
  font-family: futura-pt;

  @media (min-width: 768px) {
    padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 60px);
    padding-bottom: 80px;
  }

  @media (min-width: 1024px) {
    padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 100px);
    padding-bottom: 120px;
  }

  & .product__list-header {
    margin: 64px auto 38px auto;
    max-width: var(--product-section-max-width);
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    justify-content: center;
    text-align: center;

    @media (min-width: 1024px) {
      gap: 24px;
      margin-bottom: 48px;
    }

    & .product__list-title {
      font-size: 32px;
      font-weight: 600;
      line-height: 1.2;
      color: var(--primary-color);
      font-family: futura-pt;
      text-align: center;
      line-height: 130%;

      @media (min-width: 1024px) {
        font-size: 42px;
        text-align: center;
        font-size: 48px;
        line-height: 120%;
      }
    }

    & .product__list-description {
      font-size: 16px;
      font-weight: 400;
      line-height: 1.5;
      color: var(--primary-color);
      font-family: futura-pt;
    }
  }

  & .product__list-component {
    & .filter-group {
      display: grid;
      grid-template-columns: 1fr auto;
      grid-template-rows: auto auto;
      gap: 8px;
      flex-wrap: wrap;

      /* remove default margins and colors */
      & input,
      & select {
        -webkit-appearance: none; /* Safari/Chrome */
        -moz-appearance: none; /* Firefox */
        appearance: none;
        background: none; /* remove background gradients, arrows, etc */
        border: none; /* or style your own border */
        margin: 0;
        padding: 8px 12px 8px 12px;
        font: inherit; /* match surrounding font */
        color: inherit;
        border-bottom: 1px solid #c4a67d;
      }

      & select {
        background: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M16.293 8.29297L12 12.586L7.70697 8.29297L6.29297 9.70697L12 15.414L17.707 9.70697L16.293 8.29297Z' fill='%233F3931'/></svg>")
          no-repeat right 0.5em center;
        background-size: 24px 24px;
      }

      & input:focus,
      & select:focus {
        outline: none;
        box-shadow: none;
      }

      & label {
        order: 1;
        justify-self: start;
      }

      & button {
        order: 2;
        justify-self: end;
        text-decoration: underline;
      }

      & select,
      & input,
      & .input-holder {
        width: 100%;
        order: 3;
        grid-column: 1 / -1;
      }

      & select:has(option.placeholder:checked) {
        color: #3f3931bf;
      }
      & select[name='wc_order'] {
        padding-right: 30px;
      }
      & select option,
      & input {
        color: #3f3931;
      }
      & select option:disabled {
        text-decoration: line-through;
        color: #3f39316b;
      }

      & .input-holder {
        position: relative;
        display: inline-flex;
        align-items: center;
        gap: 0.5em;

        & input {
          flex: 1;
          line-height: 1.2;
          font-size: 1rem;
          padding-right: 45px;
        }
        & svg {
          position: absolute;
          top: 50%;
          right: 0.5em;
          transform: translateY(-50%);
          flex: 0 0 auto;
          width: 24px;
          height: 24px;
          vertical-align: middle;
        }
      }
    }
  }

  & .wc-product-filter-form {
    display: none;

    @media (min-width: 1024px) {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 20px;
      margin-bottom: 40px;
    }
  }

  & .wc-product-filter-form.main-form {
    display: none;

    @media (min-width: 1024px) {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      grid-template-rows: auto;
      column-gap: 30px;
      row-gap: 14px;
    }

    @media (min-width: 1280px) {
      /* grid-template-columns: repeat(4, 255px); */
      max-width: var(--product-section-max-width);
      margin: 0 auto 40px auto;
      column-gap: 40px;
    }

    & .filter-group {
      width: 100%;
    }

    & .bottom-filters {
      display: flex;
      justify-content: space-between;
      align-items: end;
      grid-column: 1 / -1;

      & .filter-group {
        width: max-content;
        & select {
          border-bottom: 1px solid transparent;
        }
      }

      & .product-count {
        padding-bottom: 8px;
      }
    }
  }

  & .wc-product-filter-form.drawer-form {
    display: flex;
    flex-direction: column;
    gap: 24px;

    @media (min-width: 1024px) {
      display: none;
    }
  }

  & .mobile-filter-drawer {
    display: block;

    @media (min-width: 1024px) {
      display: none;
    }
  }

  & .drawer-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    z-index: 9999;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

    @media (min-width: 1024px) {
      display: none;
    }
  }

  & .drawer-panel.drawer-panel--open {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: all;
  }

  & .drawer-panel__form-holder {
    display: flex;
    flex-direction: column;
    background: #fff;
    width: 100%;
    max-width: 400px;
    height: 100%;
    margin: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
  }

  & .drawer-panel.drawer-panel--open .drawer-panel__form-holder {
    transform: translateX(0);
  }

  & .mobile-drawer__controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;

    & .drawer-toggle {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 16px;
      color: var(--primary-color);
      font-family: futura-pt;
      cursor: pointer;
    }

    & .product-count {
      font-size: 14px;
      color: var(--primary-color);
      font-family: futura-pt;
    }
  }

  & .drawer-panel__form-holder {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    height: 100%;

    & .drawer-panel__header {
      display: flex;
      justify-content: space-between;
      align-items: start;

      & .drawer-panel__title {
        font-size: 18px;
        font-weight: 600;
        line-height: 1.2;
        color: var(--primary-color);
        font-family: abril-text;
      }

      & .drawer-close {
        padding-top: 3px;
      }
    }

    & .drawer-form {
      max-height: calc(100% - 41px - 40px);
      padding-bottom: 32px;
      overflow-y: auto;
    }

    & .drawer-apply-selection {
      display: inline-block;
      padding: 10px 12px;
      text-align: center;
      text-transform: uppercase;
      font-size: 14px;
      font-weight: 400;
      color: #fff;
      background: var(--primary-color);
      border-radius: 9999px;
      width: 100%;
      cursor: pointer;
    }
  }

  & .wc-product-list {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 24px;
    grid-auto-rows: 425px;

    @media (min-width: 768px) {
      grid-template-columns: repeat(2, 1fr);
      row-gap: 30px;
      column-gap: 24px;
    }

    @media (min-width: 1024px) {
      grid-template-columns: repeat(3, 1fr);
      grid-auto-rows: 375px;
      row-gap: 40px;
      column-gap: 24px;
    }

    @media (min-width: 1280px) {
      grid-template-columns: repeat(4, 1fr);
      column-gap: 32px;
      max-width: var(--product-section-max-width);
      margin: 0 auto;
    }

    & .product__list-item {
      width: 100%;
      max-width: 400px;
      height: 100%;
      margin: 0 auto;
    }

    & .product {
      display: flex;
      position: relative;
      z-index: 0;
      flex-direction: column;
      justify-content: space-between;
      height: 100%;
      width: 100%;
      padding: 0;
      margin: 0;
      background: #fff;
      border: 1px solid #c4a67d;
      overflow: hidden;

      & .product__image-holder {
        position: relative;
        width: 100%;
        height: 335px;
        z-index: 1;

        @media (min-width: 1024px) {
          height: 260px;
        }

        & .product__image {
          display: block;
          width: 100%;
          height: 100%;
          object-fit: cover;
          object-position: center;
        }

        & .product__tag {
          position: absolute;
          top: 8px;
          left: 8px;
          padding: 6px 20px;
          font-size: 16px;
          font-weight: 400;
          text-align: center;
          text-transform: uppercase;
          color: var(--primary-color);
          border-radius: 9999px;
        }
      }

      & .product__title-content {
        background: #fff;
        z-index: 5;
        display: flex;
        flex-direction: column;
        flex: 1;
        gap: 8px;
        justify-content: center;
        align-items: center;

        & .product__title {
          font-size: 16px;
          font-weight: 600;
          line-height: 1.2;
          color: var(--primary-color);
          text-align: center;
        }

        & .product__subtitle {
          font-size: 14x;
          font-weight: 400;
          line-height: 1.5;
          color: var(--primary-color);
          font-family: futura-pt;
          text-align: center;
        }
      }

      & .product__raw-info {
        z-index: 3;
        display: flex;
        flex-direction: column;
        width: 100%;
        height: 335px;
        position: absolute;
        top: 0;
        left: 0;
        background: #fff;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;

        @media (min-width: 1024px) {
          height: 260px;
        }

        & .product__raw-picture {
          height: 100%;
          height: 280px;

          @media (min-width: 1024px) {
           height: 207px;
          }
        }

        & .product__raw-text {
          padding: 10px 70px 16px 16px;
          font-size: 14px;
          font-weight: 400;
          line-height: 1.5;
          color: var(--primary-color);

          @media (min-width: 1024px) {
            padding: 10px 16px 16px 16px;
          }
        }
      }

      & .product__raw-info.hidden {
        display: none !important;
      }

      & .product__raw-material-toggle {
        position: absolute;
        z-index: 10;
        right: 16px;
        top: calc(335px - 16px - 48px);
        width: 48px;
        height: 48px;
        transform: rotate(0deg);
        transition: transform 0.3s ease-in-out;

        @media (min-width: 1024px) {
          display: none;
          transform: rotate(0deg);
        }
      }

      & .product__raw-info.hidden {
        display: none !important;
      }
    }

    @media (hover: hover) {
      & .product:hover .product__raw-info {
        transform: translateY(0);
      }

      & .product:hover .product__raw-material-toggle {
        transform: rotate(180deg);
      }
    }

    & .product.product--active .product__raw-info {
      transform: translateY(0);
    }

    & .product.product--active .product__raw-material-toggle {
      transform: rotate(180deg);
    }
  }

  & .wc-product-list-container__not-found {
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--primary-color);
    font-family: futura-pt;
    margin: 32px auto;

    @media (min-width: 1024px) {
      font-size: 24px;
      margin: 64px auto;
    }
  }
}

/* z-index fix for open filter drawer */
main.products-archive:has(.drawer-panel.drawer-panel--open) {
  z-index: 10001;

  @media (min-width: 1024px) {
    z-index: 0;
  }
}

/* scroll hide on open filter drawer */
html:has(.drawer-panel.drawer-panel--open),
body:has(.drawer-panel.drawer-panel--open) {
  overflow: hidden;

  @media (min-width: 1024px) {
    overflow: auto;
  }
}
