/* ==========================================================================
   product.css — product page layout (product.html)

   Gallery left (~60%) and a sticky info column right (~40%) on desktop;
   stacked on mobile, where the gallery becomes a swipe strip.
   Colours, fonts, spacing and timing all come from the tokens in base.css.

   Hover: the only hover on this page (besides .btn) is the size selector.
   Thumbnails, the "Size guide" button and the details list never react.
   ========================================================================== */


/* --- Page layout --------------------------------------------------------- */

.product-page {
  padding-top: var(--space-7);
}

.product {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  column-gap: clamp(var(--space-7), 6vw, var(--space-9));
  align-items: start;
}

/* Sticky info column (only when the window is tall enough to show it all) */
@media (min-width: 900px) and (min-height: 700px) {
  .product__info {
    position: sticky;
    top: calc(var(--header-h) + var(--space-7));
  }
}


/* --- Gallery ------------------------------------------------------------- */

.product-gallery {
  display: grid;
  grid-template-columns: clamp(56px, 5vw, 76px) minmax(0, 1fr);
  column-gap: var(--space-4);
  align-items: start;
}

.product-gallery--single {
  grid-template-columns: minmax(0, 1fr);
}

/* Thumbnails: a quiet vertical rail. Inactive ones are slightly faded. */
.product-gallery__thumbs {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.product-thumb {
  display: block;
  width: 100%;
  padding: 0 0 var(--space-2);
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  opacity: 0.55;
  position: relative;
  transition: opacity var(--dur-2) var(--ease);
}

.product-thumb .media {
  display: block;
}

/* Thin line under the active thumbnail */
.product-thumb::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--color-text);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--dur-2) var(--ease);
}

.product-thumb[aria-pressed="true"] {
  opacity: 1;
}

.product-thumb[aria-pressed="true"]::after {
  transform: scaleX(1);
}

.product-thumb:focus-visible {
  outline-offset: 3px;
}

/* Main image: all images stacked in one 4:5 frame, crossfading */
.product-gallery__stage {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--color-placeholder);
}

.product-gallery__stage:focus-visible {
  outline-offset: 3px;
}

.product-gallery__slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-in-out);
}

.product-gallery__slide.is-active {
  opacity: 1;
  z-index: 1;
}

/* Position indicator ("1 / 4"): mobile only */
.product-gallery__count {
  display: none;
}


/* --- Info column --------------------------------------------------------- */

.product-info {
  max-width: 440px;
}

.product-info__name {
  margin: var(--space-3) 0 0;
}

.product-info__price {
  margin: var(--space-3) 0 0;
}

.product-info__color {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-5) 0 0;
  color: var(--color-muted);
  font-size: 14px;
}

.product-info__dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--color-placeholder);
  box-shadow: inset 0 0 0 1px var(--color-line);
}

/* Colour selector: round swatches. The chosen one gets a thin black ring.
   No hover effect, by design. */
.product-info__colours {
  margin: var(--space-6) 0 0;
}

.product-info__colour-name {
  margin-left: var(--space-2);
  color: var(--color-text);
  letter-spacing: var(--tracking-eyebrow);
}

.colour-select {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.colour-option {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease);
}

.colour-option[aria-checked="true"] {
  border-color: var(--color-text);
}

.colour-option__swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: var(--color-placeholder);
  /* hairline so light colours (off-white) still show on white */
  box-shadow: inset 0 0 0 1px var(--color-line);
}

.colour-option:focus-visible {
  outline-offset: 2px;
}

.product-info__description {
  margin: var(--space-5) 0 0;
  max-width: 38em;
}

/* Size selector */
.product-info__sizes {
  margin-top: var(--space-7);
}

.product-info__sizes-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.product-info__sizes-head .eyebrow {
  margin: 0;
}

/* "Size guide": a plain underlined text button (.link). No hover. */
.product-info__guide {
  font-size: 13px;
  line-height: 1.4;
}

.product-info__guide:focus-visible {
  outline-offset: 3px;
}

.size-select {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-2);
}

.size-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 var(--space-1);
  margin: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    border-color var(--dur-1) var(--ease),
    background-color var(--dur-1) var(--ease),
    color var(--dur-1) var(--ease);
}

/* Selected size: black */
.size-option[aria-pressed="true"] {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-bg);
}

/* Sold out: struck through, not selectable */
.size-option:disabled {
  color: var(--color-muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  cursor: default;
  opacity: 0.6;
}

.size-option:focus-visible {
  outline-offset: 2px;
}

/* The one allowed hover on this page (besides .btn): a soft sage fill */
@media (hover: hover) {
  .size-option:not(:disabled):not([aria-pressed="true"]):hover {
    border-color: var(--color-accent);
    background-color: var(--color-accent);
    color: var(--color-text);
  }
}

/* Add to cart + inline message */
.product-info__add {
  margin-top: var(--space-5);
  transition:
    color var(--dur-2) var(--ease-in-out),
    background-color var(--dur-2) var(--ease-in-out),
    border-color var(--dur-2) var(--ease-in-out);
}

/* "Added" confirmation (js adds .is-added for ~1.6s): sage fill, black text.
   Written strongly enough to win over the .btn hover state in base.css. */
.product-info .btn.product-info__add.is-added,
.product-info .btn.product-info__add.is-added:hover {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
  color: var(--color-text);
}

.product-info .btn.product-info__add.is-added::before,
.product-info .btn.product-info__add.is-added:hover::before {
  opacity: 0;
}

.product-info__message {
  min-height: 1.6em;
  margin: var(--space-3) 0 0;
  font-size: 13px;
  color: var(--color-text);
}

/* Details list: hairline rows */
.product-details {
  margin-top: var(--space-6);
}

.product-details__title {
  margin: 0 0 var(--space-3);
}

.product-details__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-line);
}

.product-details__list li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-line);
  font-size: 14px;
  color: var(--color-muted);
}


/* --- Also in Drop 01 ----------------------------------------------------- */

.product-related {
  padding-top: var(--space-10);
  padding-bottom: var(--space-10);
}

/* Same grid and gaps as the homepage drop grid (3 columns from 760px):
   heading block in column 1, the two other products in columns 2–3. */
.product-related__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6) var(--space-4);
}

.product-related__head {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
}

.product-related__title {
  margin: 0;
}

.product-related__all {
  font-size: 13px;
  line-height: 1.4;
}

@media (min-width: 760px) {
  .product-related__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--space-6);
    row-gap: var(--space-9);
  }

  .product-related__head {
    grid-column: auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: var(--space-3);
  }
}

@media (min-width: 1200px) {
  .product-related__grid {
    column-gap: var(--space-7);
  }
}

/* Narrow screens: two small cards side by side, so stack name over price */
@media (max-width: 759px) {
  .product-related .product-card__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
  }
}


/* --- Not found ----------------------------------------------------------- */

.product-missing {
  padding-top: var(--space-9);
  padding-bottom: var(--space-10);
  min-height: 50vh;
}

.product-missing__title {
  margin: var(--space-3) 0 var(--space-5);
}


/* --- Size guide (inside the panel) --------------------------------------- */

.size-guide__product {
  margin: 0;
}

.size-guide__unit {
  margin: var(--space-2) 0 var(--space-5);
}

.size-guide__scroll {
  overflow-x: auto;
}

.size-guide__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.size-guide__table th,
.size-guide__table td {
  padding: var(--space-3) var(--space-2) var(--space-3) 0;
  border-bottom: 1px solid var(--color-line);
  text-align: left;
  font-weight: var(--weight-regular);
  white-space: nowrap;
}

.size-guide__table thead th {
  padding-top: 0;
  border-bottom-color: var(--color-text);
  font-size: 11px;
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-muted);
}

.size-guide__table tbody th {
  font-weight: var(--weight-medium);
}

.size-guide__note {
  margin: var(--space-5) 0 0;
  font-size: 14px;
  color: var(--color-muted);
}


/* --- Mobile (below 900px) ------------------------------------------------ */

@media (max-width: 899px) {
  .product-page {
    padding-top: 0;
  }

  .product {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-6);
  }

  /* Gallery runs edge to edge */
  .product__gallery {
    margin-inline: calc(-1 * var(--gutter));
  }

  .product-gallery,
  .product-gallery--single {
    display: block;
  }

  .product-gallery__thumbs {
    display: none;
  }

  /* Swipe strip with scroll-snap */
  .product-gallery__stage {
    display: flex;
    aspect-ratio: auto;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    background: none;
  }

  .product-gallery__stage::-webkit-scrollbar {
    display: none;
  }

  .product-gallery__stage:focus-visible {
    outline-offset: -2px;
  }

  .product-gallery__slide {
    position: relative;
    inset: auto;
    flex: 0 0 100%;
    height: auto;
    opacity: 1;
    scroll-snap-align: start;
    scroll-snap-stop: always;
  }

  .product-gallery__count {
    display: block;
    margin: var(--space-3) var(--gutter) 0;
    font-size: 12px;
    letter-spacing: var(--tracking-eyebrow);
    color: var(--color-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .product-info {
    max-width: none;
  }

  .product-related {
    padding-top: var(--space-8);
    padding-bottom: var(--space-8);
  }

}

@media (max-width: 360px) {
  .size-select {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}


/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .product-gallery__slide,
  .product-thumb,
  .product-thumb::after,
  .size-option,
  .product-info__add {
    transition: none;
  }
}


/* --- Small conversion details ------------------------------------------- */

/* One short line under the price (fabric weight etc.) */
.product-info__highlight {
  margin: var(--space-2) 0 0;
  font-size: 13px;
  color: var(--color-muted);
}

/* Reassurance under "Add to cart" */
.product-info__assure {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--color-muted);
}

.product-info__assure li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* small sage dot before each line */
.product-info__assure li::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* "Complete the set" — a quiet row, no hover by design */
.pair {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
  padding: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
}

.pair__media {
  display: block;
}

.pair__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pair__name {
  font-size: 13px;
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-head);
  text-transform: uppercase;
}

.pair__price {
  font-size: 13px;
  color: var(--color-muted);
}

.pair__view {
  font-size: 12px;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Mobile buy bar: slides up when the main button is out of view */
.buy-bar {
  display: none;
}

@media (max-width: 899px) {
  .buy-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--gutter);
    padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
    background: var(--color-bg);
    border-top: 1px solid var(--color-line);
    transform: translate3d(0, 100%, 0);
    transition: transform var(--dur-2) var(--ease);
  }

  .buy-bar.is-visible {
    transform: none;
  }

  .buy-bar__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 12px;
    line-height: 1.4;
  }

  .buy-bar__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: var(--tracking-head);
    text-transform: uppercase;
  }

  .buy-bar__price {
    color: var(--color-muted);
  }

  .buy-bar__btn {
    flex: none;
    min-height: 44px;
    padding: 12px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .buy-bar { transition: none; }
}

/* No concept label on the small set thumbnail (too small to read) */
.pair__media.media--concept::after {
  display: none;
}

/* Short fit line under the size buttons */
.product-info__fit {
  margin: var(--space-3) 0 0;
  font-size: 13px;
  color: var(--color-muted);
}
