/*
Theme Name: SiteClone Base
Description: Atmosphera French replica theme (source-faithful layout, native WooCommerce commerce).
Version: 0.1.1
*/

:root {
  --sc-bg: #f7f3ec;
  --sc-surface: #ffffff;
  --sc-ink: #1b1a18;
  --sc-muted: #6f675d;
  --sc-line: #e4dccf;
  --sc-beige: #efe9df;
  --sc-dark: #23211e;
  --sc-accent: #a45c33;
  --sc-radius: 2px;
  --sc-max: 1440px;
  --sc-gutter: clamp(16px, 3vw, 40px);
  --sc-serif: "Times New Roman", Georgia, "Iowan Old Style", serif;
  --sc-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--sc-bg);
  color: var(--sc-ink);
  font: 15px/1.6 var(--sc-sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
h1, h2, h3, h4 { font-family: var(--sc-serif); font-weight: 400; letter-spacing: .02em; margin: 0 0 .4em; }
.sc-eyebrow {
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--sc-muted); margin: 0 0 10px;
}

/* ---------- Promo + header ---------- */
.sc-promo {
  background: var(--sc-dark); color: #f6f1e8; text-align: center;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 9px 12px;
}
.sc-header { position: sticky; top: 0; z-index: 60; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--sc-line); }
.sc-header-inner {
  max-width: var(--sc-max); margin: 0 auto; padding: 16px var(--sc-gutter);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
}
.sc-burger { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.sc-burger span { display: block; width: 22px; height: 1.5px; background: var(--sc-ink); margin: 4px 0; }
.sc-logo { justify-self: start; line-height: 1; }
.sc-logo-word { font-family: var(--sc-serif); font-size: 27px; letter-spacing: .06em; text-transform: lowercase; }
.sc-logo-word sup { font-size: 9px; vertical-align: super; letter-spacing: 0; }
.sc-logo-tag { display: block; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--sc-muted); margin-top: 4px; }
.sc-search { display: flex; align-items: center; gap: 8px; background: #f3eee5; border-radius: 999px; padding: 9px 18px; width: min(520px, 34vw); }
.sc-search input[type="search"] { border: 0; background: transparent; outline: none; flex: 1; font-size: 13px; }
.sc-search button { border: 0; background: none; cursor: pointer; font-size: 16px; color: var(--sc-muted); }
.sc-utils { justify-self: end; display: flex; gap: 22px; }
.sc-util { display: flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--sc-ink); position: relative; }
.sc-ico { font-size: 17px; line-height: 1; }
.sc-cart-count {
  position: absolute; top: -7px; right: -10px; background: var(--sc-dark); color: #fff;
  border-radius: 50%; min-width: 16px; height: 16px; font-size: 10px; display: grid; place-items: center;
}
.sc-nav { border-top: 1px solid var(--sc-line); }
.sc-nav ul {
  max-width: var(--sc-max); margin: 0 auto; padding: 0 var(--sc-gutter);
  display: flex; gap: 26px; list-style: none; overflow-x: auto; scrollbar-width: none;
}
.sc-nav li a {
  display: inline-block; padding: 12px 0; font-size: 11px; letter-spacing: .16em;
  text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid transparent;
}
.sc-nav li a:hover { border-color: var(--sc-ink); }
.sc-nav-gift { color: var(--sc-accent); }

.sc-main { min-height: 60vh; }
.sc-section { max-width: var(--sc-max); margin: 0 auto; padding: 56px var(--sc-gutter); }
.sc-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.sc-section-head h2 { font-size: clamp(20px, 2.4vw, 28px); letter-spacing: .12em; text-transform: uppercase; margin: 0; }
.sc-link { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; border-bottom: 1px solid var(--sc-ink); padding-bottom: 2px; }
.sc-btn {
  display: inline-block; background: var(--sc-surface); color: var(--sc-ink); border: 1px solid var(--sc-ink);
  padding: 13px 28px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; cursor: pointer;
}
.sc-btn:hover { background: var(--sc-ink); color: #fff; }
.sc-btn-dark { background: var(--sc-dark); color: #fff; border-color: var(--sc-dark); }
.sc-btn-dark:hover { background: #000; }
.sc-btn-disabled { opacity: .55; cursor: not-allowed; }
.sc-empty { color: var(--sc-muted); }

/* ---------- Hero ---------- */
.sc-hero {
  min-height: min(72vh, 620px); background-size: cover; background-position: center;
  display: flex; align-items: flex-end; padding: clamp(40px, 7vw, 96px) var(--sc-gutter);
}
.sc-hero-copy { max-width: var(--sc-max); margin: 0 auto; width: 100%; color: #fff; }
.sc-hero-copy h2 { font-size: clamp(34px, 5vw, 64px); margin: 0 0 12px; letter-spacing: .04em; }
.sc-hero-copy p { max-width: 520px; font-size: 15px; color: #f0e9df; }
.sc-hero .sc-eyebrow { color: #e9ded0; }

/* ---------- Product cards ---------- */
.sc-carousel { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 22px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; contain: paint; }
.sc-card { background: var(--sc-surface); border: 1px solid var(--sc-line); display: flex; flex-direction: column; scroll-snap-align: start; }
.sc-card-media { position: relative; display: block; background: #f2ece2; aspect-ratio: 4 / 5; overflow: hidden; }
.sc-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.sc-card:hover .sc-card-media img { transform: scale(1.03); }
.sc-badge {
  position: absolute; left: 10px; top: 10px; background: rgba(27,26,24,.9); color: #fff;
  font-size: 10px; letter-spacing: .1em; padding: 4px 7px;
}
.sc-wish {
  position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--sc-line); background: rgba(255,255,255,.85); cursor: pointer; font-size: 14px; line-height: 1;
}
.sc-card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.sc-card-title { font-size: 12.5px; letter-spacing: .02em; line-height: 1.45; min-height: 2.6em; }
.sc-card-price { font-size: 12.5px; font-weight: 600; }
.sc-card-price del { color: var(--sc-muted); font-weight: 400; margin-right: 6px; }
.sc-card-price ins { text-decoration: none; }
.sc-swatches { display: flex; gap: 5px; }
.sc-swatch { width: 12px; height: 12px; border-radius: 50%; border: 1px solid #cfc6b8; background: #d9cbb8; }

/* ---------- Editorial tiles ---------- */
.sc-editorial-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 18px; }
.sc-tile {
  position: relative; min-height: 340px; background-size: cover; background-position: center;
  background-color: #ddd3c4; display: flex; align-items: flex-end; padding: 26px;
  background-image: linear-gradient(180deg, rgba(0,0,0,0) 35%, rgba(0,0,0,.45));
}
.sc-tile-wide { grid-row: span 2; min-height: 700px; }
.sc-tile-copy { color: #fff; }
.sc-tile-copy h3 { font-size: 26px; margin: 0 0 8px; }
.sc-tile-cta { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; border-bottom: 1px solid currentColor; padding-bottom: 2px; }

/* ---------- Rooms ---------- */
.sc-room-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.sc-room {
  position: relative; aspect-ratio: 3 / 4; background-size: cover; background-position: center;
  background-color: #ded4c5; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px; color: #fff; background-image: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.5));
}
.sc-room-label { font-family: var(--sc-serif); font-size: 19px; margin-bottom: 8px; }

/* ---------- Ambiance ---------- */
.sc-ambiance { display: grid; grid-template-columns: 1.2fr 1fr; gap: 0; padding-top: 0; padding-bottom: 0; align-items: stretch; }
.sc-ambiance-media { min-height: 420px; background-size: cover; background-position: center; background-color: #ded4c5; }
.sc-ambiance-copy { background: var(--sc-beige); padding: clamp(32px, 5vw, 72px); display: flex; flex-direction: column; justify-content: center; }
.sc-ambiance-copy h2 { font-size: clamp(24px, 3vw, 36px); }

/* ---------- Chips ---------- */
.sc-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.sc-chip {
  border: 1px solid var(--sc-line); background: var(--sc-surface); border-radius: 999px;
  padding: 9px 18px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
}
.sc-chip:hover { border-color: var(--sc-ink); }

/* ---------- Loyalty + trust ---------- */
.sc-loyalty { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.sc-loyalty-copy h2 { font-size: clamp(22px, 2.6vw, 30px); }
.sc-loyalty-card { background: #f3e7dd; padding: 36px; text-align: center; }
.sc-loyalty-logo { font-family: var(--sc-serif); font-size: 34px; }
.sc-loyalty-note { font-size: 11px; color: var(--sc-muted); }
.sc-trust {
  max-width: var(--sc-max); margin: 0 auto; padding: 30px var(--sc-gutter) 46px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; border-top: 1px solid var(--sc-line);
}
.sc-trust-row { display: flex; gap: 12px; align-items: flex-start; font-size: 12px; }
.sc-trust-row strong { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.sc-trust-row span { color: var(--sc-muted); }
.sc-trust-ico { font-size: 18px; line-height: 1; }

/* ---------- Footer ---------- */
.sc-footer { background: var(--sc-beige); margin-top: 20px; }
.sc-newsletter { text-align: center; padding: 46px var(--sc-gutter) 10px; }
.sc-newsletter-form { display: inline-flex; gap: 0; margin: 14px auto 6px; }
.sc-newsletter-form input { border: 1px solid var(--sc-ink); border-right: 0; background: #fff; padding: 12px 18px; min-width: 260px; }
.sc-newsletter-form button { background: var(--sc-dark); color: #fff; border: 1px solid var(--sc-dark); padding: 12px 22px; font-size: 11px; letter-spacing: .16em; cursor: pointer; }
.sc-newsletter-note { font-size: 11px; color: var(--sc-muted); }
.sc-footer-cols { max-width: var(--sc-max); margin: 0 auto; padding: 36px var(--sc-gutter); display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.sc-footer-cols h3 { font-family: var(--sc-sans); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 14px; }
.sc-footer-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; font-size: 12.5px; color: #3d3831; }
.sc-footer-cols a:hover { text-decoration: underline; }
.sc-static { color: var(--sc-muted); }
.sc-payments { display: flex; gap: 10px; justify-content: center; padding: 10px var(--sc-gutter) 0; }
.sc-payments span { border: 1px solid #cabfae; padding: 4px 9px; font-size: 10px; letter-spacing: .1em; }
.sc-legal { text-align: center; padding: 22px var(--sc-gutter) 34px; font-size: 11px; color: var(--sc-muted); }
.sc-legal-links a:hover { text-decoration: underline; }

/* ---------- Editorial / policy pages ---------- */
.sc-page { max-width: 900px; }
.sc-page-head { border-bottom: 1px solid var(--sc-line); padding-bottom: 18px; margin-bottom: 28px; }
.sc-page-head h1 { font-size: clamp(26px, 3vw, 38px); }
.sc-page-body { font-size: 14.5px; color: #2e2a25; }
.sc-page-body h2 { font-size: clamp(18px, 1.7vw, 22px); margin: 34px 0 12px; }
.sc-page-body h3 { font-size: 16px; margin: 26px 0 10px; }
.sc-page-body p { margin: 0 0 14px; }
.sc-page-body ul, .sc-page-body ol { margin: 0 0 16px; padding-left: 22px; }
.sc-page-body li { margin-bottom: 6px; }
.sc-page-body a { text-decoration: underline; }
.sc-page-body table { width: 100%; border-collapse: collapse; margin: 0 0 18px; }
.sc-page-body th, .sc-page-body td { border: 1px solid var(--sc-line); padding: 8px 10px; text-align: left; vertical-align: top; font-size: 13px; }
.sc-page-body strong { font-weight: 600; }

/* ---------- WooCommerce ---------- */
.woocommerce ul.products { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; margin: 0; padding: 0; }
.woocommerce ul.products li.product { background: var(--sc-surface); border: 1px solid var(--sc-line); margin: 0; padding: 0 0 14px; text-align: left; }
.woocommerce ul.products li.product a img { margin: 0 0 10px; aspect-ratio: 4 / 5; object-fit: cover; }
.woocommerce ul.products li.product .woocommerce-loop-product__title { font-size: 12.5px; padding: 0 14px; line-height: 1.45; }
.woocommerce ul.products li.product .price { padding: 0 14px; font-size: 12.5px; color: var(--sc-ink); }
.woocommerce ul.products li.product .button, .woocommerce a.button, .woocommerce button.button, .woocommerce input.button, .wc-block-components-button {
  background: var(--sc-dark); color: #fff; border-radius: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 11px 18px;
}
.woocommerce a.button:hover, .woocommerce button.button:hover { background: #000; color: #fff; }
.woocommerce span.onsale {
  background: var(--sc-dark); color: #fff; border-radius: 0; font-size: 10px; letter-spacing: .08em; min-height: 0; padding: 5px 8px; left: 10px; top: 10px;
}
.woocommerce .woocommerce-breadcrumb { font-size: 11px; letter-spacing: .08em; color: var(--sc-muted); margin-bottom: 18px; }
.woocommerce div.product .product_title { font-size: clamp(22px, 2.6vw, 32px); }
.woocommerce div.product p.price, .woocommerce div.product span.price { font-size: 20px; color: var(--sc-ink); }
.woocommerce div.product form.cart .button { width: 100%; }
.woocommerce div.product .woocommerce-tabs ul.tabs { padding: 0; margin-bottom: 0; }
.woocommerce div.product .woocommerce-tabs ul.tabs li { background: transparent; border: 0; border-bottom: 1px solid var(--sc-line); border-radius: 0; margin: 0 18px 0 0; }
.woocommerce div.product .woocommerce-tabs ul.tabs li.active { border-bottom-color: var(--sc-ink); background: transparent; }
.woocommerce div.product .woocommerce-tabs ul.tabs li a { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 10px 0; }
.woocommerce .woocommerce-message, .woocommerce .woocommerce-info { background: var(--sc-surface); border-top-color: var(--sc-ink); }
.woocommerce table.shop_table, .woocommerce-cart .cart-collaterals .cart_totals { background: var(--sc-surface); }
.wc-block-components-notice-banner { border-radius: 0; }
.wp-block-woocommerce-cart, .wp-block-woocommerce-checkout { max-width: var(--sc-max); margin: 0 auto; padding: 40px var(--sc-gutter); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .sc-header-inner { grid-template-columns: auto 1fr auto; gap: 14px; }
  .sc-search { width: 100%; }
  .sc-nav ul { gap: 18px; }
  .sc-editorial-grid { grid-template-columns: 1fr 1fr; }
  .sc-tile-wide { grid-row: auto; grid-column: span 2; min-height: 380px; }
  .sc-room-grid { grid-template-columns: repeat(3, 1fr); }
  .woocommerce ul.products { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px) {
  .sc-burger { display: block; justify-self: start; }
  .sc-header-inner { grid-template-columns: auto 1fr auto; padding: 12px 16px; }
  .sc-logo { justify-self: center; text-align: center; }
  .sc-logo-word { font-size: 21px; }
  .sc-logo-tag { display: none; }
  .sc-search { display: none; }
  .sc-utils { gap: 14px; }
  .sc-util-label { display: none; }
  .sc-nav { display: none; }
  .sc-nav.sc-open { display: block; }
  .sc-nav.sc-open ul { flex-direction: column; gap: 0; padding: 8px 16px 16px; }
  .sc-nav.sc-open li a { padding: 11px 0; border-bottom: 1px solid var(--sc-line); display: block; }
  .sc-hero { min-height: 60vh; }
  .sc-editorial-grid { grid-template-columns: 1fr; }
  .sc-tile-wide { grid-column: auto; min-height: 320px; }
  .sc-tile { min-height: 260px; }
  .sc-room-grid { grid-template-columns: 1fr 1fr; }
  .sc-ambiance { grid-template-columns: 1fr; }
  .sc-loyalty { grid-template-columns: 1fr; }
  .sc-trust { grid-template-columns: 1fr 1fr; }
  .sc-footer-cols { grid-template-columns: 1fr 1fr; }
  .woocommerce ul.products { grid-template-columns: 1fr 1fr; gap: 14px; }
  .sc-section { padding: 34px 16px; }
  .sc-section-head h2 { font-size: 18px; letter-spacing: .1em; }
}
@media (max-width: 420px) {
  .sc-room-grid { grid-template-columns: 1fr; }
  .sc-newsletter-form { flex-direction: column; }
  .sc-newsletter-form input { min-width: 0; width: 100%; border-right: 1px solid var(--sc-ink); }
  .woocommerce ul.products { grid-template-columns: 1fr 1fr; }
  .sc-card-title { font-size: 12px; }
}

/* Hover image swap on product cards */
.sc-card-media .sc-hover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .3s ease; }
.sc-card:hover .sc-card-media .sc-hover { opacity: 1; }

/* WooCommerce listing grid: neutralise Woo's float/width defaults */
.woocommerce ul.products { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; align-items: start; margin: 0; padding: 0; }
.woocommerce ul.products::before, .woocommerce ul.products::after { display: none; }
.woocommerce ul.products li.product { width: auto !important; float: none !important; margin: 0 !important; padding: 0 0 14px; background: var(--sc-surface); border: 1px solid var(--sc-line); text-align: left; }
.woocommerce ul.products li.product a img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; margin: 0 0 10px; }
.woocommerce ul.products li.product .woocommerce-loop-product__title { font-size: 12.5px; line-height: 1.45; padding: 0 14px; min-height: 2.6em; }
.woocommerce ul.products li.product .price { display: block; padding: 0 14px; font-size: 12.5px; }
.woocommerce ul.products li.product .button { display: block; width: auto; margin: 10px 14px 0; text-align: center; padding: 10px 8px; }
.woocommerce .woocommerce-result-count, .woocommerce .woocommerce-ordering { margin: 0 0 22px; font-size: 12px; }
.woocommerce .woocommerce-ordering select { padding: 8px 10px; border: 1px solid var(--sc-line); background: #fff; }
.woocommerce nav.woocommerce-pagination { margin: 36px 0 0; }
.woocommerce nav.woocommerce-pagination ul { border: 0; display: flex; gap: 6px; justify-content: center; }
.woocommerce nav.woocommerce-pagination ul li { border: 0; }
.woocommerce nav.woocommerce-pagination ul li a, .woocommerce nav.woocommerce-pagination ul li span { padding: 7px 11px; font-size: 12px; border: 1px solid var(--sc-line); background: #fff; }
.woocommerce nav.woocommerce-pagination ul li span.current { background: var(--sc-dark); color: #fff; border-color: var(--sc-dark); }
.sc-woo-inner > h1, .woocommerce-products-header .page-title { font-size: clamp(22px, 2.6vw, 30px); letter-spacing: .08em; text-transform: uppercase; }
@media (max-width: 1100px) { .woocommerce ul.products { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .woocommerce ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } }

/* Single product and checkout buttons */
.woocommerce div.product form.cart .button, .woocommerce #respond input#submit, .woocommerce button.button.alt, .woocommerce input.button.alt, .wp-block-woocommerce-proceed-to-checkout-block a { background: var(--sc-dark) !important; color: #fff !important; border-radius: 0 !important; }
.woocommerce div.product form.cart .button:hover { background: #000 !important; }
.woocommerce div.product form.cart div.quantity input.qty { border: 1px solid var(--sc-line); padding: 10px; height: auto; }
.woocommerce span.onsale { background: var(--sc-dark) !important; }

/* Contain horizontal carousels without widening the document */
html, body { max-width: 100%; overflow-x: hidden; }
.sc-carousel { max-width: 100%; }

/* Cart block on narrow viewports: the item table's min-content width used to
   overflow the content column and the price column was clipped by
   body{overflow-x:hidden}. A fixed table layout keeps every column inside the
   viewport at 320/390 without changing the desktop rendering. */
@media (max-width: 600px) {
  .wc-block-cart-items { table-layout: fixed; width: 100%; }
  .wc-block-cart-items th, .wc-block-cart-items td { padding-left: 4px; padding-right: 4px; min-width: 0; }
  .wc-block-cart-items__header-image, .wc-block-cart-item__image { width: 56px; }
  .wc-block-cart-item__product { min-width: 0; word-break: break-word; }
  .wc-block-cart-item__total { white-space: normal; }
  /* The struck-through regular price and the sale price already carry the
     discount information; the extra badge only overlaps them at 320/390. */
  .wc-block-cart .wc-block-components-sale-badge { display: none; }
}

/* Screen-reader heading */
.sc-visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 420px) { .sc-room-grid { grid-template-columns: 1fr 1fr; } }

/* --- W8: product gallery layout reservation (mobile CLS) -------------------
   The server HTML stacks every gallery image (the gallery stays opacity:0
   until flexslider runs). With no fixed ratio that stack is several viewport
   heights tall, then collapses to one slide, so .summary jumped: 0.478 CLS on
   the simple PDP and 0.378 on the variable PDP. Every imported source image is
   square (410x410), so the slide box is a fixed 1:1 area from the first paint.
   flexslider builds its thumbnail strip from the data-thumb attributes (four per
   row), so the body class sc-gallery-thumb-rows-N reserves exactly the row count
   the product will have and single-image products keep their current height. */
.woocommerce div.product div.images { position: relative; }
.woocommerce div.product div.images .woocommerce-product-gallery__wrapper {
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
/* flexslider wraps the same node into a .flex-viewport and sizes it inline;
   its slide row must not inherit the 1:1 auto height. */
.woocommerce div.product div.images:has(.flex-viewport) .woocommerce-product-gallery__wrapper {
  aspect-ratio: auto;
}
.woocommerce div.product div.images .flex-viewport {
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.woocommerce div.product div.images .woocommerce-product-gallery__image > a { display: block; }
.woocommerce div.product div.images .woocommerce-product-gallery__image img {
  width: 100%;
  height: auto;
  object-fit: contain;
}
/* Total gallery height = slide box (1) + thumbnail rows (N/4), expressed as an
   aspect-ratio on the gallery container so it is measured against the gallery's
   own width (a percentage padding would resolve against the wider product row). */
body.sc-gallery-thumb-rows-1 div.product div.images { aspect-ratio: 1 / 1.25; }
body.sc-gallery-thumb-rows-2 div.product div.images { aspect-ratio: 1 / 1.5; }
body.sc-gallery-thumb-rows-3 div.product div.images { aspect-ratio: 1 / 1.75; }
body.sc-gallery-thumb-rows-4 div.product div.images { aspect-ratio: 1 / 2; }
body.sc-gallery-thumb-rows-5 div.product div.images { aspect-ratio: 1 / 2.25; }
body.sc-gallery-thumb-rows-6 div.product div.images { aspect-ratio: 1 / 2.5; }
body.sc-gallery-thumb-rows-7 div.product div.images { aspect-ratio: 1 / 2.75; }
body.sc-gallery-thumb-rows-8 div.product div.images { aspect-ratio: 1 / 3; }
.woocommerce div.product div.images .flex-control-thumbs {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.woocommerce div.product div.images .flex-control-thumbs li { width: 25%; }
.woocommerce div.product div.images .flex-control-thumbs img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
