/* ==========================================================================
   Times Furnishing — catalogue pages (listing, product, search, wishlist)
   Uses the tokens defined in main.css.
   ========================================================================== */

/* ---------- Product cards (grid + extras) ---------- */

.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px 20px; }
.product-grid .product-card[hidden] { display: none; }
.product-media > a { position: absolute; inset: 0; }
.product-media > a img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.product-alt { opacity: 0; transition: opacity .6s var(--ease), transform 1s var(--ease) !important; }
.product-card:hover .product-alt { opacity: 1; }
.product-info h3 a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .4s var(--ease); }
.product-info h3 a:hover { background-size: 100% 1px; }
.dot-row { display: flex; align-items: center; gap: 5px; margin-top: 10px; }
.dot-row i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.dot-row small { font-size: var(--fs-xs); color: var(--muted); margin-left: 2px; }

/* ---------- Breadcrumbs ---------- */

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); margin-bottom: 28px; }
.crumbs a:hover { color: var(--terra-deep); }
.crumbs [aria-current] { color: var(--ink); }
.crumbs .sep { opacity: .5; }

/* ---------- Listing hero ---------- */

.listing-hero { padding-block: clamp(28px, 4vw, 48px) clamp(28px, 4vw, 56px); position: relative; }
.listing-hero::before {
  content: ""; position: absolute; inset: 0 0 auto auto; width: 50vw; height: 100%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, #F6E3D8, transparent); opacity: .7;
}
.listing-hero .title { margin: 14px 0 16px; max-width: 16ch; }
.listing-hero__grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: center; }
.listing-hero--cat .listing-hero__grid { grid-template-columns: 1fr 1.1fr; }
.listing-hero__media { border-radius: var(--r-xl); overflow: hidden; aspect-ratio: 16 / 10; box-shadow: var(--shadow-lg); }
.listing-hero__media img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Sticky filter bar ---------- */

.listing-bar {
  position: sticky; top: 0; z-index: 40; background: rgba(251, 248, 243, .9);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-block: 1px solid var(--line); transition: top .5s var(--ease), box-shadow .3s;
}
body:has(.site-header.is-scrolled:not(.is-hidden)) .listing-bar { top: var(--header-h); }
.listing-bar.is-stuck { box-shadow: 0 10px 24px -18px rgba(31, 27, 22, .4); }
.listing-bar__inner { display: flex; align-items: center; gap: 16px; padding-block: 12px; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; padding: 2px; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row--center { justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; white-space: nowrap;
  font-size: var(--fs-sm); border: 1px solid var(--line-2); background: var(--surface); transition: .25s;
}
.pill small { font-size: .72rem; color: var(--muted); }
.pill:hover { border-color: var(--ink); }
.pill.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill.is-active small { color: rgba(255, 255, 255, .6); }

.sort-form select {
  appearance: none; border: 1px solid var(--line-2); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%234E463D' stroke-width='1.6'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
  border-radius: 999px; padding: 9px 38px 9px 16px; font-size: var(--fs-sm); cursor: pointer;
}

.listing { padding-top: 32px; }
.listing-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 28px; color: var(--ink-2); font-size: var(--fs-sm); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 500; background: var(--bg-2); transition: .25s; }
.tag:hover { background: var(--sand); }
.tag.is-active { background: var(--terra); color: #fff; }
.tag .icon { width: 12px; height: 12px; }

.empty-state { text-align: center; padding: 64px 16px; max-width: 560px; margin-inline: auto; }
.empty-state__icon { width: 64px; height: 64px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--terra-soft); color: var(--terra-deep); margin-bottom: 18px; }
.empty-state h2 { font-size: var(--fs-xl); margin-bottom: 10px; }
.empty-state p { color: var(--ink-2); }
.empty-state .hero-actions { justify-content: center; margin-top: 24px; }

.custom-band {
  display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: 32px;
  padding: clamp(28px, 5vw, 64px); border-radius: var(--r-xl);
  background: linear-gradient(135deg, var(--sage-soft), #F2EEE3); border: 1px solid rgba(255, 255, 255, .8);
}
.custom-band .title { margin: 12px 0; }
.custom-band__actions { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }

/* ---------- Product detail ---------- */

.pdp { padding-top: clamp(20px, 3vw, 36px); }
.pdp-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: start; }

.gallery { position: sticky; top: calc(var(--header-h) + 20px); }
.gallery-main {
  position: relative; aspect-ratio: 4 / 4.4; border-radius: var(--r-xl); overflow: hidden; background: var(--bg-2);
  --zx: 50%; --zy: 50%;
}
.gallery-slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.04); transition: opacity .7s var(--ease), transform 1.2s var(--ease); }
.gallery-slide.is-active { opacity: 1; transform: none; }
.gallery-main.is-zoom .gallery-slide.is-active { transform: scale(1.8); transform-origin: var(--zx) var(--zy); transition: opacity .7s var(--ease), transform .3s ease-out; cursor: zoom-in; }
.gallery-main .chip { position: absolute; top: 18px; left: 18px; z-index: 2; }
.gallery-main .wish { top: 16px; right: 16px; z-index: 2; width: 46px; height: 46px; }
.gallery-arrows { position: absolute; left: 16px; bottom: 16px; z-index: 2; display: flex; gap: 8px; }
.gallery-arrows button { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .85); backdrop-filter: blur(8px); transition: .3s; }
.gallery-arrows button:hover { background: var(--ink); color: #fff; }
.gallery-count { position: absolute; right: 18px; bottom: 22px; z-index: 2; font-size: var(--fs-xs); padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .85); }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.gallery-thumbs button { width: 84px; aspect-ratio: 1; border-radius: 14px; overflow: hidden; opacity: .55; outline-offset: 2px; transition: opacity .3s, box-shadow .3s; }
.gallery-thumbs button[aria-selected="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--ink); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.pdp-cat { font-size: var(--fs-xs); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--terra-deep); }
.pdp-title { font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); margin: 10px 0 14px; }
.pdp-short { font-size: var(--fs-lg); color: var(--ink-2); }
.pdp-price { display: flex; flex-direction: column; gap: 2px; padding: 18px 0; margin: 22px 0 6px; border-block: 1px solid var(--line); }
.pdp-price span { font-family: var(--font-display); font-size: 1.5rem; }
.pdp-price small { color: var(--muted); font-size: var(--fs-sm); }

.option { border: 0; padding: 0; margin: 22px 0 0; }
.option legend { font-weight: 600; font-size: var(--fs-sm); margin-bottom: 12px; }
.option legend span { font-weight: 400; color: var(--ink-2); margin-left: 6px; }
.option-note { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--muted); margin-top: 12px; }
.fabric-options { display: flex; flex-wrap: wrap; gap: 10px; }
.fabric-opt { position: relative; cursor: pointer; }
.fabric-opt input { position: absolute; opacity: 0; }
.fabric-opt span:first-of-type {
  display: block; width: 40px; height: 40px; border-radius: 50%; background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7), 0 2px 6px rgba(0, 0, 0, .12); transition: transform .3s var(--ease);
  position: relative;
}
.fabric-opt span:first-of-type::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1.5px solid var(--ink); opacity: 0; transform: scale(.8); transition: .3s var(--ease); }
.fabric-opt:hover span:first-of-type { transform: translateY(-2px); }
.fabric-opt input:checked + span::after { opacity: 1; transform: none; }
.fabric-opt input:focus-visible + span { outline: 2px solid var(--terra); outline-offset: 6px; }

.size-options { display: flex; flex-wrap: wrap; gap: 8px; }
.size-opt { cursor: pointer; }
.size-opt input { position: absolute; opacity: 0; }
.size-opt span { display: inline-block; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-2); font-size: var(--fs-sm); transition: .25s; }
.size-opt:hover span { border-color: var(--ink); }
.size-opt input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.size-opt input:focus-visible + span { outline: 2px solid var(--terra); outline-offset: 2px; }

.pdp-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 30px; }
.pdp-actions .btn { min-height: 58px; }
.btn--wa { --btn-bg: #25D366; --btn-fg: #fff; }
.btn--wa::before { background: #1DA851; }
.icon--fill { fill: currentColor; stroke: none; width: 20px; height: 20px; }

.pdp-perks { list-style: none; margin: 24px 0 0; padding: 18px 20px; display: grid; gap: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-sm); color: var(--ink-2); }
.pdp-perks li { display: flex; align-items: flex-start; gap: 12px; }
.pdp-perks .icon { color: var(--terra-deep); margin-top: 2px; }
.pdp-perks strong { color: var(--ink); font-weight: 600; }

.accordion { margin-top: 28px; border-top: 1px solid var(--line); }
.accordion details { border-bottom: 1px solid var(--line); }
.accordion summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 18px 0; cursor: pointer; font-weight: 500; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary .icon { transition: transform .35s var(--ease); }
.accordion details[open] summary .icon { transform: rotate(180deg); }
.accordion-body { padding-bottom: 20px; color: var(--ink-2); font-size: .96rem; }
.accordion-body p + p { margin-top: 12px; }
.ticks { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.ticks li { position: relative; padding-left: 26px; }
.ticks li::before { content: ""; position: absolute; left: 0; top: .45em; width: 14px; height: 8px; border-left: 2px solid var(--sage-deep); border-bottom: 2px solid var(--sage-deep); transform: rotate(-45deg); }
.specs { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; color: var(--ink); }
.mini-steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }

.pdp-share { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 22px; font-size: var(--fs-sm); color: var(--muted); }
.pdp-share a, .pdp-share button { color: var(--ink); border-bottom: 1px solid var(--line-2); padding-bottom: 2px; }
.pdp-share a:hover, .pdp-share button:hover { border-color: var(--terra); color: var(--terra-deep); }

/* Recently viewed */
.recent-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 280px); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.recent-card { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); transition: box-shadow .3s, transform .4s var(--ease); }
.recent-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.recent-card img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; }
.recent-card span { font-weight: 500; font-size: var(--fs-sm); line-height: 1.3; }
.recent-card small { display: block; color: var(--muted); font-weight: 400; font-size: var(--fs-xs); margin-bottom: 2px; }

/* Mobile sticky action bar */
.pdp-bar {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 70; display: none; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 18px; border-radius: 20px; background: rgba(255, 255, 255, .92); border: 1px solid var(--line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow-lg);
  transform: translateY(140%); transition: transform .5s var(--ease);
}
.pdp-bar strong { display: block; font-size: var(--fs-sm); font-weight: 600; }
.pdp-bar span { font-size: var(--fs-xs); color: var(--muted); }
.pdp-bar-on .pdp-bar { transform: none; }

/* Quote dialog */
.quote-dialog {
  width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.quote-dialog::backdrop { background: rgba(31, 27, 22, .45); backdrop-filter: blur(4px); }
.quote-dialog[open] { animation: dialog-in .45s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(20px) scale(.98); } }
.quote-form { position: relative; padding: clamp(22px, 4vw, 36px); }
.quote-close { position: absolute; top: 14px; right: 14px; }
.quote-head { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; padding-right: 40px; }
.quote-head img { border-radius: 14px; object-fit: cover; flex: none; }
.quote-head h2 { font-size: 1.6rem; margin: 4px 0 2px; }
.quote-head p { color: var(--muted); font-size: var(--fs-sm); }

/* ---------- Search ---------- */

.search-results { display: grid; gap: 6px; margin-top: 18px; }
.search-hit { display: flex; align-items: center; gap: 14px; padding: 8px; border-radius: 14px; transition: background .2s; }
.search-hit:hover, .search-hit:focus-visible { background: rgba(31, 27, 22, .05); }
.search-hit img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.search-hit strong { display: block; font-weight: 500; }
.search-hit small { color: var(--muted); font-size: var(--fs-xs); }
.search-all { font-weight: 600; font-size: var(--fs-sm); color: var(--terra-deep); padding: 8px; }
.search-none { color: var(--muted); padding: 8px; }

.search-inline { display: flex; align-items: center; gap: 12px; max-width: 640px; margin-top: 24px; padding: 6px 6px 6px 18px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-2); }
.search-inline:focus-within { border-color: var(--terra); box-shadow: 0 0 0 4px rgba(200, 113, 74, .12); }
.search-inline input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 1rem; padding: 8px 0; }

/* ---------- Responsive ---------- */

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

@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
  .listing-hero--cat .listing-hero__grid { grid-template-columns: 1fr; }
  .custom-band { grid-template-columns: 1fr; }
  .pdp-grid { grid-template-columns: 1fr; }
  .gallery { position: static; }
  .gallery-main { aspect-ratio: 1; }
  .pdp-bar { display: flex; }
  .is-product .wa-float { bottom: 92px; }
}

@media (max-width: 600px) {
  .listing-bar__inner { flex-wrap: wrap; gap: 10px; }
  .chip-row { flex: 1 1 100%; }
  .sort-form { width: 100%; }
  .sort-form select { width: 100%; }
  .product-info h3 { font-size: .95rem; }
  .product-cta { display: none; }
  .gallery-thumbs button { width: 64px; }
  .pdp-actions { grid-template-columns: 1fr; }
  .specs { grid-template-columns: 1fr; gap: 2px; }
  .specs dd { margin-bottom: 10px; }
}

/* ---------- CMS pages ---------- */
.page-head .title { max-width: 20ch; }
.prose { max-width: 760px; font-size: 1.05rem; color: var(--ink-2); }
.prose > * + * { margin-top: 1em; }
.prose h2 { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem); color: var(--ink); margin-top: 1.6em; }
.prose h3 { font-family: var(--font-body); font-size: 1.15rem; font-weight: 600; letter-spacing: 0; color: var(--ink); margin-top: 1.6em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: .4em; }
.prose a { color: var(--terra-deep); text-decoration: underline; text-underline-offset: 3px; }
.prose img { border-radius: var(--r-lg); }
.prose blockquote { margin: 1.4em 0; padding-left: 1.2em; border-left: 3px solid var(--terra); font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); }
.prose table { width: 100%; border-collapse: collapse; }
.prose th, .prose td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); }

/* ---------- Fabric photo / 3D colour preview ---------- */
.gallery-slide--fabric[hidden] { display: none; }
.fabric-badge {
  position: absolute; z-index: 3; left: 16px; right: 16px; bottom: 76px; margin-inline: auto; width: fit-content; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; border-radius: 16px;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: var(--shadow-md); font-size: var(--fs-sm);
}
.fabric-badge[hidden] { display: none; }
.fabric-badge i { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .8), 0 2px 8px rgba(0, 0, 0, .15); }
.fabric-badge b { font-weight: 600; }
.fabric-badge small { display: block; color: var(--muted); font-size: var(--fs-xs); }
.fabric-badge.is-pop { animation: badge-pop .5s var(--ease); }
@keyframes badge-pop { from { transform: translateY(10px) scale(.96); opacity: 0; } }

.gallery-3d {
  position: absolute; inset: 0; z-index: 1;
  background: radial-gradient(120% 90% at 50% 105%, #EADFCF 0%, rgba(234, 223, 207, 0) 60%), linear-gradient(160deg, #FFFFFF, #F6EFE5);
}
.gallery-3d[hidden] { display: none; }
.gallery-3d canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
.gallery-3d canvas:active { cursor: grabbing; }
.gallery-3d__hint {
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 7px 14px; border-radius: 999px; background: rgba(255, 255, 255, .88); font-size: var(--fs-xs); color: var(--ink-2); box-shadow: var(--shadow-sm);
}
.gallery-3d__hint .icon { width: 16px; height: 16px; }
.gallery-3d__note { position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; font-size: var(--fs-xs); color: var(--muted); }
.gallery-main.is-3d-view .gallery-arrows, .gallery-main.is-3d-view .gallery-count, .gallery-main.is-3d-view .chip { display: none; }
.gallery-main.is-fabric-view .gallery-count { display: none; }

.thumb-3d { display: grid; place-content: center; justify-items: center; gap: 2px; background: var(--ink); color: #fff; font-size: var(--fs-xs); font-weight: 600; opacity: 1 !important; }
.thumb-3d .icon { width: 20px; height: 20px; }
.thumb-3d[aria-selected="true"] { background: var(--terra); box-shadow: 0 0 0 2px var(--ink); }
.no-3d .thumb-3d { display: none; }
@media (max-width: 600px) { .fabric-badge { bottom: 70px; padding: 8px 12px 8px 8px; } .fabric-badge i { width: 32px; height: 32px; } }
