/* Merch page. Shared tokens, fonts, logo and the circle menu come from
   styles.css; this file only adds the shop layout.
   Values taken from Figma frame "Merch - section" (1920 × 1080). */

.merch-page {
  --sidebar-w: clamp(220px, calc(390 / var(--frame-w) * 100vw), 390px);
  --shop-pad-l: calc(40 / var(--frame-w) * 100vw);
  --shop-pad-r: calc(100 / var(--frame-w) * 100vw);
  --sidebar-pad: clamp(32px, calc(100 / var(--frame-w) * 100vw), 100px);
  --filter-pad: clamp(20px, calc(43 / var(--frame-w) * 100vw), 43px);
  --filter-green: #016b00;
}

.shop {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100svh;
  background:
    linear-gradient(0deg, var(--white) 0%, var(--cream) 73.558%, var(--green-light) 100%),
    var(--white);
}

/* ---------- Sidebar ---------- */
.shop-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  background: var(--green-lime);
  display: flex;
  flex-direction: column;
  padding-top: clamp(136px, calc(16.5vh + 20px), 198px);
  overflow-y: auto;
  scrollbar-width: none;
  z-index: 2;
}

.shop-sidebar::-webkit-scrollbar {
  display: none;
}

/* Same logo as the landing page at 70% size, centred in the sidebar
   and nudged 15px left for optical balance. The "Femdoc" wordmark
   (centre 51.34 of 74 in the artwork) stays centred on the page
   title line (y = 74). */
.shop-logo {
  width: calc(212px * 0.7);
  height: calc(74px * 0.7);
  left: calc((var(--sidebar-w) - 212px * 0.7) / 2 - 15px);
  top: calc(var(--header-top) + 38px - 51.34px * 0.7);
}

.shop-categories {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(26px, 7.4vh, 80px);
  margin: clamp(32px, 9vh, 100px) 0 48px var(--sidebar-pad);
}

/* ---------- Filter ("sort by") ----------
   Collapsible list of checkboxes, styled after the Figma: dark green
   text, pale green boxes, thin light-green rule under the heading. */
.shop-filter {
  margin: 0 var(--filter-pad);
  color: var(--filter-green);
}

.shop-filter__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 0 6px;
  border: 0;
  border-bottom: 1.5px solid #96d825;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.84px;
  text-align: left;
  cursor: pointer;
}

.shop-filter__chevron {
  width: 16px;
  height: 16px;
  margin-right: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.shop-filter__toggle[aria-expanded="false"] .shop-filter__chevron {
  transform: rotate(-90deg);
}

.shop-filter__toggle:focus-visible {
  outline: 2px solid var(--filter-green);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Smooth open/close: the panel's row animates between 0 and auto. */
.shop-filter__panel {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.shop-filter__toggle[aria-expanded="false"] + .shop-filter__panel {
  grid-template-rows: 0fr;
}

.shop-filter__options {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
}

.shop-filter__option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0.78px;
  cursor: pointer;
  user-select: none;
}

/* The real checkbox stays for keyboard/screen readers, but is invisible. */
.shop-filter__option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.shop-filter__box {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #85c849;
  border-radius: 2px;
  background: #e0fcce;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.shop-filter__check {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #aedd27;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
  transition: stroke-dashoffset 0.3s cubic-bezier(0.65, 0, 0.35, 1);
}

.shop-filter__option input:checked + .shop-filter__box .shop-filter__check {
  stroke-dashoffset: 0;
}

.shop-filter__option:hover .shop-filter__box {
  border-color: var(--filter-green);
}

.shop-filter__option input:focus-visible + .shop-filter__box {
  outline: 2px solid var(--filter-green);
  outline-offset: 2px;
}

.shop-filter__count {
  margin-left: -5px;
  opacity: 0.7;
}

.shop-categories a {
  --kink-color: var(--ink);
  position: relative;
  font-size: 16px;
  line-height: 20px;
  letter-spacing: 0.96px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition:
    font-size 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    letter-spacing 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.shop-categories a[aria-current="page"] {
  font-size: 20px;
  line-height: 25px;
  letter-spacing: 1.2px;
}

.shop-categories a:focus-visible {
  outline: none;
}

/* Hover: a thin line draws in from the left, like the landing nav.
   It sits at the same height as the selected item's kink line. */
.shop-categories a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.shop-categories a:not([aria-current="page"]):hover::after,
.shop-categories a:not([aria-current="page"]):focus-visible::after {
  transform: scaleX(1);
}

/* Selected: the zigzag kink line from the landing page carousel title. */
.shop-categories .kink-line {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
}

/* ---------- Main column ---------- */
.shop-main {
  position: relative;
  padding: 170px var(--shop-pad-r) 96px var(--shop-pad-l);
}

.shop-header {
  position: absolute;
  inset: var(--header-top) 0 auto 0;
  height: var(--header-h);
  z-index: 3;
}

/* Title text sits at x = 478, y = 60 in the frame. */
.shop-title {
  position: absolute;
  top: calc(var(--header-top) + 24px);
  left: calc(88 / var(--frame-w) * 100vw);
  margin: 0;
  font-family: "Aero", "Sora", sans-serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 28px;
  letter-spacing: 1.92px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text);
}

/* Circle menu: its right edge lines up with the product grid's right
   edge (the 48px circle sits 13px inside its 74px button). */
.merch-page .menu-button {
  right: calc(var(--shop-pad-r) - 13px);
}

.merch-page .menu-panel {
  right: var(--shop-pad-r);
}

/* Search · profile · cart, 82px apart, kept the Figma distance (131px
   at 1920) to the left of the circle. */
.shop-icons {
  position: absolute;
  top: 0;
  right: calc(var(--shop-pad-r) + 48px + 131 / var(--frame-w) * 100vw);
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: clamp(24px, calc(82 / var(--frame-w) * 100vw), 82px);
}

.shop-icon {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Figma's 48px icons at 53% (search 25.6, profile 25, cart 28.8 × 25.6). */
.shop-icon svg {
  display: block;
  overflow: visible;
  width: auto;
  height: 25.6px;
}

.shop-icon--profile svg {
  height: 24.96px;
}

.shop-icon:hover {
  transform: scale(1.08);
}

.shop-icon:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: 6px;
}

/* ---------- Products: 3 columns, 60px / 20px gaps ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: clamp(24px, calc(60 / var(--frame-w) * 100vw), 60px);
  row-gap: 20px;
}

.product {
  padding: 2px 0;
}

.product__link {
  display: block;
  color: var(--text);
  text-decoration: none;
}

.product__img {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 423 / 348;
  padding: 0;
  border: 0;
  background: #f4f4f4;
  font: inherit;
  transition: background-color 0.3s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

button.product__img {
  cursor: zoom-in;
}

.product:hover .product__img,
.product__img:focus-visible {
  transform: translateY(-4px);
}

/* Empty boxes darken a touch; photo boxes stay the photo's grey. */
.product:hover div.product__img {
  background-color: #ececec;
}

.product__img:focus-visible,
.product__link:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 6px;
}

/* Product photo, framed by thumbZoom (width) and thumbFocus (the point
   placed at the box's centre) from merch-data.js. Photos are on the
   same #f4f4f4 grey as the box, so any edge melts into it. */
.product__img img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: auto;
  max-width: none;
  display: block;
}

/* Sale badge, top-left of the photo, in the brand lime. */
.product__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 10px 5px;
  border-radius: 999px;
  background: var(--green-lime);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.72px;
  text-transform: uppercase;
}

/* Sold out: photo fades back and a dark badge replaces any sale badge. */
.product.is-sold-out .product__img > :not(.product__badge) {
  opacity: 0.45;
}

.product.is-sold-out .product__img {
  background: #f8f8f8;
}

.product__badge--sold-out {
  background: var(--ink);
  color: var(--white);
}

.product.is-sold-out .product__price {
  color: var(--desc-grey);
}

.product__desc {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.84px;
  color: var(--desc-grey);
}

.product__name {
  margin: 6px 0 0;
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.96px;
  text-transform: capitalize;
}

.product__price {
  margin: 2px 0 0;
  font-weight: 400;
  font-size: 16px;
  line-height: 25px;
  letter-spacing: 1.2px;
}

.product__price-was {
  margin-left: 8px;
  font-size: 16px;
  color: var(--desc-grey);
}

.product-grid__empty {
  grid-column: 1 / -1;
  margin: 40px 0 0;
  font-size: 16px;
  letter-spacing: 0.96px;
  color: var(--desc-grey);
}

/* ---------- Photo zoom (opened by clicking a product photo) ---------- */
.product-zoom {
  position: fixed;
  inset: 0;
  z-index: 60;
  cursor: zoom-out;
}

.product-zoom[hidden] {
  display: none;
}

.product-zoom__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 253, 238, 0.92); /* --cream */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.product-zoom__frame {
  position: fixed;
  overflow: hidden;
  background: #f4f4f4;
  box-shadow: 0 18px 50px rgba(21, 21, 21, 0.12);
}

.product-zoom__frame img {
  position: absolute;
  height: auto;
  max-width: none;
  display: block;
}

.product-zoom__caption {
  position: fixed;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--text);
}

.product-zoom__caption .product__name {
  margin: 0;
}

.product-zoom__close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(21, 21, 21, 0.1);
}

.product-zoom__close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.product-zoom__close:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tablets: keep the title clear of the icons. */
@media (min-width: 768px) and (max-width: 1000px) {
  .shop-title {
    font-size: 24px;
    line-height: 24px;
    top: calc(var(--header-top) + 25px);
  }

  .shop-icons {
    gap: 18px;
  }
}

/* Phones: the sidebar becomes a green top bar holding the logo, the
   icons, the circle menu and a swipeable row of categories. */
@media (max-width: 767px) {
  /* Header row sits high on the green bar; the icons and circle centre
     on one line (header top + 37px) and the logo's wordmark sits on it. */
  .merch-page {
    --header-top: 10px;
    --row-center: calc(var(--header-top) + var(--header-h) / 2);
  }

  .shop {
    display: block;
  }

  .shop-sidebar {
    position: relative;
    height: auto;
    overflow: visible;
    padding: 90px 0 0;
  }

  /* 90% of the previous small-screen logo (148 × 52). Like the landing
     page, the "Femdoc" wordmark (centre 51.34 of 74 in the artwork) is
     what lines up with the icons, so the logo reads as centred. */
  .shop-logo {
    width: 133.6px;
    height: 46.6px;
    left: 16px;
    top: calc(var(--row-center) - 51.34px * 46.6 / 74);
  }

  /* 36px of green below the category names (the selected item's
     zigzag sits inside that space). */
  .shop-categories {
    order: 1;
    margin: 0;
    flex-direction: row;
    align-items: baseline;
    gap: 28px;
    padding: 0 16px 36px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .shop-categories::-webkit-scrollbar {
    display: none;
  }

  .shop-categories a {
    font-size: 16px;
    line-height: 20px;
  }

  .shop-categories a[aria-current="page"] {
    font-size: 19px;
    line-height: 24px;
  }

  .shop-categories a:not([aria-current="page"]):hover,
  .shop-categories a:focus-visible {
    transform: none;
  }

  /* Filter sits under the category row, collapsed until tapped; the
     options wrap across the bar. */
  .shop-filter {
    order: 2;
    margin: -16px 16px 20px;
  }

  .shop-filter__toggle {
    font-size: 13px;
    line-height: 16px;
  }

  .shop-filter__chevron {
    width: 15px;
    height: 15px;
  }

  .shop-filter__options {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px 20px;
    padding-top: 12px;
  }

  .shop-filter__option {
    gap: 8px;
    font-size: 12px;
  }

  .shop-filter__box {
    width: 16px;
    height: 16px;
  }

  /* Header and menu panel position against the whole page here. */
  .shop-main {
    position: static;
    padding: 28px 16px 64px;
  }

  .merch-page .menu-button {
    right: 3px; /* circle's right edge on the 16px page margin */
  }

  .merch-page .menu-panel {
    right: 16px;
  }

  /* Icons keep 32px of space before the circle (circle's left edge is
     3 + 13 + 48 = 64px from the right). */
  .shop-icons {
    right: calc(64px + 32px);
    gap: 18px;
  }

  .shop-icon svg,
  .shop-icon--profile svg {
    height: 26px;
  }

  .shop-title {
    position: static;
    margin-bottom: 24px;
    font-size: 26px;
    line-height: 26px;
  }

  .product-grid {
    column-gap: 16px;
    row-gap: 24px;
  }

  .product__name {
    margin-top: 10px;
    font-size: 14px;
    line-height: 18px;
  }

  .product__price {
    margin-top: 4px;
    font-size: 16px;
    line-height: 20px;
  }
}

/* Room for the logo, icons and circle side by side on small phones. */
@media (max-width: 600px) {
  .shop-icons {
    gap: 14px;
  }

  .shop-icon svg,
  .shop-icon--profile svg {
    height: 22px;
  }
}

@media (max-width: 380px) {
  .shop-logo {
    width: 115px;
    height: 40px;
    top: calc(var(--row-center) - 51.34px * 40 / 74);
  }
}
