/* ============================================================
   Shop styling — makes the catalogue read like the homepage
   ============================================================ */

.woocommerce .wp-block-woocommerce-product-collection,
.woocommerce-page .wp-block-woocommerce-product-collection {
  margin-top: 8px;
}

/* grid rhythm */
ul.wc-block-product-template,
ul.wc-block-grid__products {
  gap: 32px 28px !important;
  row-gap: 44px !important;
}

li.wc-block-product,
ul.wc-block-grid__products > li {
  background: transparent;
}

/* image */
li.wc-block-product .wc-block-components-product-image,
ul.wc-block-grid__products > li .wc-block-grid__product-image {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: #f3efe8;
}
li.wc-block-product .wc-block-components-product-image > a,
ul.wc-block-grid__products > li .wc-block-grid__product-image > a {
  display: block;
  position: relative;
  line-height: 0;
}
li.wc-block-product .wc-block-components-product-image img,
ul.wc-block-grid__products > li img {
  display: block;
  width: 100%;
  height: auto;
  /* the photographs are portrait; 4:5 keeps the whole earring in frame */
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center;
  transition: transform .5s ease, opacity .3s ease;
}
li.wc-block-product:hover .wc-block-components-product-image img {
  transform: scale(1.03);
}

/* title */
li.wc-block-product .wc-block-components-product-title,
li.wc-block-product .wp-block-post-title {
  font-family: "Playfair Display", Georgia, serif !important;
  font-size: 16px !important;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: .01em;
  margin: 14px 0 4px !important;
  /* catalogue names run long; two lines keeps every card the same height */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}
li.wc-block-product .wc-block-components-product-title a,
li.wc-block-product .wp-block-post-title a {
  color: #1a1a1a;
  text-decoration: none;
}
li.wc-block-product .wc-block-components-product-title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* price */
li.wc-block-product .wc-block-components-product-price,
li.wc-block-product .wc-block-components-product-price ins {
  font-size: 14px !important;
  color: #6b6259 !important;
  font-weight: 400;
  margin: 0 0 12px !important;
}
li.wc-block-product .wc-block-components-product-price ins {
  color: #1a1a1a !important;
  font-weight: 500;
  text-decoration: none;
}
li.wc-block-product .wc-block-components-product-price del {
  color: #a8a099;
  opacity: .8;
  margin-right: 7px;
  text-decoration: line-through;
}

/* add to cart */
li.wc-block-product .wp-block-button__link,
li.wc-block-product .wc-block-components-product-button__button {
  background: #1a1a1a !important;
  color: #fff !important;
  border-radius: 3px !important;
  font-size: 14px !important;
  font-weight: 500;
  letter-spacing: .04em;
  min-height: 44px;
  width: 100%;
  padding: 0 16px !important;
  text-transform: none;
}
li.wc-block-product .wp-block-button__link:hover,
li.wc-block-product .wc-block-components-product-button__button:hover {
  background: #333 !important;
}

/* sale badge — sits on the picture now that the badge lives inside it */
li.wc-block-product .wc-block-components-product-sale-badge,
li.wc-block-product .onsale {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  margin: 0;
  background: #1a1a1a !important;
  color: #fff !important;
  border-radius: 2px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
  min-height: 0;
  min-width: 0;
  line-height: 1.4;
}

/* sorting + count row */
.woocommerce .woocommerce-result-count,
.woocommerce-page .woocommerce-result-count {
  font-size: 13px;
  color: #6b6259;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.woocommerce .woocommerce-ordering select,
.woocommerce-page .woocommerce-ordering select {
  font-size: 14px;
  padding: 10px 14px;
  border: 1px solid #ddd6cb;
  border-radius: 3px;
  background: #fff;
}

/* pagination */
.wp-block-query-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  min-height: 40px;
  border: 1px solid #ddd6cb;
  border-radius: 3px;
  text-decoration: none;
  color: #1a1a1a;
  font-size: 14px;
  margin: 0 3px;
}
.wp-block-query-pagination .page-numbers.current {
  background: #1a1a1a;
  color: #fff;
  border-color: #1a1a1a;
}

/* single product page: keep the same voice */
.single-product .product_title {
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: .01em;
}

/* The banner repeats the product name at 50px. With names this long it
 * turned into four lines and pushed the page down, so it steps back to a
 * size that still reads as a title. */
.single-product .banner h2.wp-block-post-title {
  font-size: clamp(24px, 3vw, 34px) !important;
  line-height: 1.25 !important;
  max-width: 82%;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* The media column was 512px wide, which at 4:5 came out ~620px tall and
 * pushed the whole page down. Capped so the picture reads as an object,
 * not a billboard. */
/* ============================================================
   Frame and picture size — desktop and phone, decided separately
   ============================================================ */

/* The theme lets every container grow to 80% of the viewport, so on a
   wide monitor the page keeps expanding until one product fills the
   screen. Cap the frame; backgrounds that are alignfull are untouched. */
.wp-block-group.is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) {
  max-width: min(80%, 1200px);
}

/* --- desktop: the picture is about a third of the frame --- */
.single-product {
  --sharine-media-w: 400px;
}
.single-product .wp-block-column[style*="flex-basis:512px"] {
  flex-basis: var(--sharine-media-w) !important;
  max-width: var(--sharine-media-w);
  align-self: flex-start;
}
.single-product .woocommerce-product-gallery {
  max-width: var(--sharine-media-w);
  margin: 0 auto;
}
.single-product .woocommerce-product-gallery img {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
}

/* --- tablet: narrower frame, smaller picture --- */
@media (min-width: 782px) and (max-width: 1199px) {
  .single-product { --sharine-media-w: 320px; }
}

/* --- phone: picture goes full width of its column, height held in check --- */
@media (max-width: 781px) {
  .single-product { --sharine-media-w: 100%; }
  .single-product .wp-block-column[style*="flex-basis:512px"] {
    flex-basis: 100% !important;
    max-width: 100%;
  }
  .single-product .woocommerce-product-gallery,
  .single-product .woocommerce-product-gallery img {
    max-width: 100%;
  }
  .single-product .woocommerce-product-gallery img {
    max-height: 72vh;
    object-fit: contain;
  }
}

/* thumbnails: four across at any size, so they stay tappable */
.single-product .flex-control-thumbs {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.single-product .flex-control-thumbs li {
  width: auto !important;
  margin: 0 !important;
  float: none !important;
}
.single-product .flex-control-thumbs img {
  width: 100% !important;
  height: auto !important;
  border-radius: 2px;
}

/* The summary heading carries the same long name next to the gallery. */
.single-product .wp-block-post-title {
  line-height: 1.3;
  overflow-wrap: break-word;
}

.single-product .single_add_to_cart_button {
  background: #1a1a1a !important;
  color: #fff !important;
  border-radius: 3px !important;
  min-height: 50px;
  padding: 0 34px !important;
  letter-spacing: .04em;
}

@media (max-width: 781px) {
  ul.wc-block-product-template,
  ul.wc-block-grid__products { row-gap: 30px !important; gap: 22px 14px !important; }
  li.wc-block-product .wp-block-button__link,
  li.wc-block-product .wc-block-components-product-button__button { min-height: 42px; font-size: 13px !important; }
  li.wc-block-product .wc-block-components-product-title,
  li.wc-block-product .wp-block-post-title { font-size: 14.5px !important; }
}

/* ============================================================
   Order tracking — same voice as the rest of the shop
   ============================================================ */

.woocommerce-form-track-order {
  max-width: 640px;
  margin: 26px 0 4px;
}

.woocommerce-form-track-order > p:first-of-type {
  font-size: 15px;
  line-height: 1.7;
  color: #6b6259;
  margin: 0 0 26px;
}

.woocommerce-form-track-order .form-row {
  margin: 0 0 18px;
  padding: 0;
}

.woocommerce-form-track-order .form-row-first,
.woocommerce-form-track-order .form-row-last {
  display: inline-block;
  float: none;
  vertical-align: top;
  width: calc(50% - 11px);
  margin-bottom: 18px;
}
.woocommerce-form-track-order .form-row-first { margin-right: 18px; }

.woocommerce-form-track-order label {
  display: block;
  font-size: 12px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #8a8178;
  margin: 0 0 7px;
}

.woocommerce-form-track-order .input-text {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #ddd6cb;
  border-radius: 3px;
  background: #fff;
  font: inherit;
  font-size: 15px;
  color: #1a1a1a;
}
.woocommerce-form-track-order .input-text:focus {
  outline: none;
  border-color: #1a1a1a;
}
.woocommerce-form-track-order .input-text::placeholder { color: #b4aca3; }

.woocommerce-form-track-order button.button,
.woocommerce-form-track-order .button {
  background: #1a1a1a;
  color: #fff;
  border: 0;
  border-radius: 3px;
  min-height: 48px;
  padding: 0 32px;
  font-size: 14px;
  letter-spacing: .04em;
  cursor: pointer;
}
.woocommerce-form-track-order button.button:hover { background: #333; }

/* the answer */
.order-info {
  border-top: 1px solid #e6e0d6;
  padding-top: 22px;
  margin: 34px 0 10px;
  font-size: 15px;
  line-height: 1.75;
  color: #4a443d;
}
.order-info mark {
  background: none;
  color: #1a1a1a;
  font-weight: 600;
}

.order-info ~ h2 {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 19px;
  font-weight: 500;
  margin: 30px 0 12px;
}
.order-info ~ ol.notes {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: #6b6259;
}
.order-info ~ ol.notes li {
  padding: 0 0 14px;
  margin: 0 0 14px;
  border-bottom: 1px solid #f0ece5;
}
.order-info ~ ol.notes li:last-child { border-bottom: 0; }

@media (max-width: 620px) {
  .woocommerce-form-track-order .form-row-first,
  .woocommerce-form-track-order .form-row-last {
    width: 100%;
    margin-right: 0;
  }
  .woocommerce-form-track-order button.button { width: 100%; }
}
