/* White product-page surfaces with the store's existing warm accents. */
html:root:not([data-design-option]):has(main.rw-product) {
  --pdp-paper: #fff;
  --pdp-inset: #fff;
  --story-paper: #fff;
  --pdp-rule: #ded7d2;
}

/* The purchase panel already supplies an 18px gap between every pair of rows. */
html:root[data-shop-story="rosewood"] main.rw-product .rw-info > h1:has(+ .rw-pr) {
  margin-block-end: -6px !important;
}
@media (max-width: 767px) {
  html:root[data-shop-story="rosewood"] main.rw-product .rw-info > h1:has(+ .rw-pr) {
    margin-block-end: -8px !important;
  }
}

/* Shared fit controls and gallery affordances for the three Rosewood previews. */
html:root[data-design-option]:has(main.rw-handoff) {
  --rw-ink: #332827;
  --rw-wine: #642d39;
  --rw-line: #c7b8af;
  --rw-paper: #f2ebe5;
  --rw-field: #e9dfd8;

  & main.rw-handoff { --paper: var(--rw-paper); --mut: #5c514c; --line: var(--rw-line); }
  & main.rw-product .rw-info { min-width: 0; text-align: start; }
  & main.rw-product .rw-info .rw-lab { align-items: center; gap: 8px; line-height: 1.35; font-size: 14px; }
  & main.rw-product .rw-info .rw-lab a { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 2px; }
  & main.rw-product .rw-sz { flex-wrap: wrap; gap: 6px; }
  & main.rw-product .rw-sz button,
  & main.rw-product .rw-sw button { min-width: 44px; min-height: 44px; }
  & main.rw-product .rw-sz button { color: var(--rw-ink); padding: 0 11px; font-size: 14px; }
  & main.rw-product .rw-sz button[aria-pressed="true"] { background: var(--rw-wine); color: #fff; box-shadow: none; }
  & main.rw-product .rw-size { margin: 0; }
  & main.rw-product .rw-info > .stock-note { margin: 0; }
  & main.rw-product .rw-info > .stock-note + .rw-btn { margin: -4px 0 0; min-height: 48px; }
  & main.rw-product .rw-info details:not(.design-rating) { padding-block: 0; }
  & main.rw-product .rw-info details:not(.design-rating)[open] { padding-bottom: 14px; }
  & main.rw-product .rw-info .design-rating { padding: 0; border: 0; margin: -6px 0 0; }
  & main.rw-product .rw-info .design-rating > summary { justify-content: flex-start; }
  & main.rw-product .rw-info .design-rating > summary::after { content: none; }
  & main.rw-product .rw-info details:not(.design-rating) > summary { min-height: 48px; display: flex; align-items: center; justify-content: space-between; }
  & main.rw-product .product-gallery-stage { display: grid; grid-template-areas: "image" "thumbnails"; grid-template-columns: minmax(0,1fr); gap: 8px; align-items: start; }
  & main.rw-product .product-gallery-stage[hidden] { display: none !important; }
  & main.rw-product .photo-track { grid-area: image; }
  & main.rw-product .product-gallery-stage .photo-track img,
  & main.rw-product .rw-view-pair img { object-fit: contain; object-position: center; }
  & main.rw-product .product-gallery-stage > .product-photo-nav {
    grid-area: image; position: relative; inset: auto; align-self: end; margin: 0 4px 4px; z-index: 2;
  }
  & main.rw-product .design-thumbnails { grid-area: thumbnails; display: flex; align-items: flex-start; gap: 6px; padding: 3px; overflow: auto; min-width: 0; }
  & main.rw-product .design-thumbnails button {
    flex: 0 0 auto; width: 48px; height: 60px; margin: 0; padding: 2px; background: transparent;
    border: 1px solid transparent; border-radius: 0;
  }
  & main.rw-product .design-thumbnails button:is([aria-current="true"],[aria-pressed="true"]) { border-color: var(--rw-wine); }
  & main.rw-product .design-thumbnails img { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--rw-field); }
  & main.rw-product .rw-view-pair { display: none; }
  & .rw-foot nav a, & main.rw-handoff .rw-tabs a, & main.rw-handoff .rw-chips a {
    display: inline-flex; align-items: center; min-height: 44px;
  }
  & main.rw-handoff .rw-cbar { gap: 8px 18px; }
  & main.rw-handoff .rw-cbar .rw-tabs { gap: 2px 14px; }
  & main.rw-handoff .rw-card .rw-c { padding: 10px 2px 0; }
  & main.rw-handoff .rw-card .rw-nm { line-height: 1.25; overflow-wrap: break-word; }
}

@media (width > 767px) {
  html:root[data-design-option]:has(main.rw-product) main.rw-product .rw-wrap:has(.rw-pdp) { max-width: 1480px; padding-inline: clamp(18px,3vw,52px); }
  html:root[data-design-option]:has(main.rw-product) main .rw-pdp:has(> .rw-gw) {
    max-width: 1240px;
    grid-template-columns: minmax(0,1.35fr) minmax(0,1fr) !important;
    gap: clamp(22px,4vw,64px) !important;
    padding: clamp(22px,3.5vw,52px) 0 !important;
  }
  html:root[data-design-option="a"]:has(main.rw-product) main .product-gallery-stage {
    grid-template-areas: "thumbnails image"; grid-template-columns: clamp(48px,4.5vw,68px) minmax(0,1fr);
    gap: clamp(8px,1vw,18px);
  }
  html:root[data-design-option="a"]:has(main.rw-product) main .product-gallery-stage:not(:has(.design-thumbnails button:nth-child(2))) {
    grid-template-areas: "image"; grid-template-columns: minmax(0,1fr);
  }
  html:root[data-design-option="a"]:has(main.rw-product) main .design-thumbnails {
    flex-direction: column; max-height: min(74vh,760px); width: 100%; padding: 2px;
  }
  html:root[data-design-option="a"]:has(main.rw-product) main .design-thumbnails button { width: 100%; height: auto; aspect-ratio: 4/5; }
  html:root[data-design-option="b"]:has(main.rw-product) main .rw-pdp:has(> .rw-gw) {
    max-width: 1140px; grid-template-columns: minmax(0,1.17fr) minmax(0,1fr) !important;
  }
  html:root[data-design-option="b"]:has(main.rw-product) main .rw-pdp > .rw-info {
    align-self: center; padding: clamp(16px,2.2vw,34px) !important;
    border-block: 1px solid var(--rw-line); background: #f6f0eb !important;
  }
  html:root[data-design-option="b"]:has(main.rw-product) main .design-thumbnails { justify-content: safe center; }
  html:root[data-design-option="c"]:has(main.rw-product) main .rw-pdp > .rw-info {
    border-top: 2px solid var(--rw-wine); padding-top: 14px !important;
  }
}

@media (min-width: 960px) {
  html:root[data-design-option="c"]:has(main.rw-product) main .rw-pdp:has(> .rw-gw) {
    max-width: 1440px; grid-template-columns: minmax(0,1.95fr) minmax(0,1fr) !important;
  }
  html:root[data-design-option="c"]:has(main.rw-product) main .product-gallery-stage:has(.rw-view-pair:not([hidden])) {
    grid-template-areas: "image companion" "thumbnails thumbnails";
    grid-template-columns: minmax(0,1fr) minmax(0,1fr); column-gap: 10px;
  }
  html:root[data-design-option="c"]:has(main.rw-product) main .rw-view-pair:not([hidden]) {
    display: block; grid-area: companion; border: 0; padding: 0; width: 100%; aspect-ratio: 4/5;
    min-width: 0; background: var(--rw-field); cursor: pointer;
  }
  html:root[data-design-option="c"]:has(main.rw-product) main .rw-view-pair img {
    display: block; width: 100%; height: 100%;
  }
}

@media (width <= 767px) {
  html:root[data-design-option]:has(main.rw-product) main.rw-product .rw-pdp { min-width: 0; }
  html:root[data-design-option]:has(main.rw-product) main.rw-product .rw-info {
    padding-block: 20px 28px !important; gap: 14px !important;
  }
  html:root[data-design-option]:has(main.rw-product) main.rw-product .product-gallery-stage { row-gap: 0; }
  html:root[data-design-option="a"]:has(main.rw-product) main .design-thumbnails { display: none; }
  html:root[data-design-option="b"]:has(main.rw-product) main .product-gallery-stage {
    padding: 10px clamp(12px,3vw,20px) 0; box-sizing: border-box;
  }
  html:root[data-design-option="b"]:has(main.rw-product) main .design-thumbnails { padding: 7px 2px 2px; gap: 5px; }
  html:root[data-design-option="c"]:has(main.rw-product) main .product-gallery-stage .photo-track {
    height: min(115vw,67svh); aspect-ratio: auto; background: var(--rw-field);
  }
  html:root[data-design-option="c"]:has(main.rw-product) main .design-thumbnails {
    padding: 8px 16px; gap: 5px; border-bottom: 1px solid var(--rw-line);
  }
  html:root[data-design-option="c"]:has(main.rw-product) main .design-thumbnails button { width: 44px; height: 50px; }
}

/* Department entrances and product lists use the same editorial treatments as the PDPs. */
html:root[data-design-option]:has(main.rw-handoff) main.rw-handoff:not(.rw-product) {
  color: var(--rw-ink); background: var(--rw-paper);
  & .rw-grid { gap: clamp(22px,3vw,42px) clamp(9px,1.4vw,22px); }
  & .rw-hp::after { inset: 52% 0 0; background: linear-gradient(transparent,rgba(32,20,17,.72)); }
}
html:root[data-design-option="a"]:has(main.rw-handoff) main.rw-handoff:not(.rw-product) {
  & .rw-hero { gap: 4px; }
  & .rw-chd { border-bottom: 1px solid var(--rw-line); }
}
html:root[data-design-option="b"]:has(main.rw-handoff) main.rw-handoff:not(.rw-product) {
  & .rw-hero { padding: clamp(12px,3vw,46px); gap: clamp(12px,2.5vw,35px); max-width: 1440px; }
  & .rw-hp { height: clamp(260px,49vw,680px); }
  & .rw-chd { border-block: 1px solid var(--rw-line); margin-top: 22px; }
  & .rw-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  & .rw-card .rw-c { padding-bottom: 12px; border-bottom: 1px solid var(--rw-line); }
}
html:root[data-design-option="c"]:has(main.rw-handoff) main.rw-handoff:not(.rw-product) {
  & .rw-hero { grid-template-columns: 1.3fr 1fr; max-width: 1440px; gap: 8px; padding-block: 8px; }
  & .rw-hp { height: clamp(360px,51vw,740px); }
  & .rw-cbar { border-block: 1px solid var(--rw-line); margin-bottom: 22px; }
  & .rw-grid { grid-template-columns: repeat(auto-fit,minmax(min(100%,215px),1fr)); }
}
@media (width <= 767px) {
  html:root[data-design-option]:has(main.rw-handoff) main.rw-handoff:not(.rw-product) .rw-grid {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
  html:root[data-design-option="b"]:has(main.rw-handoff) main.rw-handoff:not(.rw-product) {
    & .rw-hero { grid-template-columns: 1fr; padding: 12px; }
    & .rw-hp { height: clamp(188px,48vw,305px); }
  }
  html:root[data-design-option="c"]:has(main.rw-handoff) main.rw-handoff:not(.rw-product) {
    & .rw-hero { grid-template-columns: 1fr 1fr; gap: 3px; }
    & .rw-hp { height: clamp(205px,73vw,430px); }
    & .rw-cbar .rw-tabs { flex-wrap: nowrap; overflow: auto; width: 100%; }
    & .rw-cbar .rw-tabs a { flex: none; }
    & .rw-grid { gap: 20px 8px; }
  }
}
