/* ==========================================================================
   FrameX — Product Details page & Shop Detail page
   Namespaced with .pdp- / .shop-hero- to avoid colliding with the quick-view
   modal in overlays.css, which reuses similar concepts at a smaller size.
   ========================================================================== */

.pdp {
  display: grid;
  gap: clamp(28px, 5vw, 56px);
}

@media (min-width: 900px) {
  .pdp {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

/* Visualizer sticks alongside the info column on desktop only — the .pdp grid
   is a single column below 900px, so sticking here would overlap the info
   column underneath it as the page scrolls. */
@media (min-width: 900px) {
  .pdp-visualizer {
    position: sticky;
    top: calc(var(--header-h) + 16px);
  }
}

.pdp-gallery__thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pdp-gallery__thumbs::-webkit-scrollbar {
  display: none;
}

.pdp-gallery__thumb {
  flex: none;
  width: 72px;
  height: 72px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  overflow: hidden;
  opacity: 0.7;
  transition: opacity var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.pdp-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdp-gallery__thumb[aria-current="true"] {
  border-color: var(--amber-strong);
  opacity: 1;
}

.pdp-gallery__thumb:hover {
  opacity: 1;
}

/* Info column ------------------------------------------------------------------ */
.pdp-info {
  display: grid;
  align-content: start;
  gap: 16px;
}

.pdp-info__shop {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  min-height: 32px;
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

.pdp-info__shop:hover {
  color: var(--ink);
}

.pdp-info__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pdp-info__price {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.pdp-info__price .price__now {
  font-size: 1.7rem;
}

.pdp-info__desc {
  color: var(--muted);
  line-height: 1.7;
}

.pdp-option {
  display: grid;
  gap: 8px;
}

.pdp-option__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: var(--text-sm);
  font-weight: 700;
}

.pdp-option__label .form-field__error {
  display: none;
}

.pdp-option[data-invalid="true"] .form-field__error {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pdp-option__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pdp-option__choices .chip {
  min-height: 46px;
}

.pdp-option[data-invalid="true"] .chip {
  border-color: var(--danger);
}

.pdp-placeholder {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: var(--text-sm);
}

.pdp-placeholder strong {
  color: var(--ink);
}

/* Photo customization uploader --------------------------------------------------- */
.pdp-upload {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--stone-soft);
}

.pdp-upload__zone {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 20px 12px;
  border: 1px dashed var(--slate);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-out), background-color var(--dur-base) var(--ease-out);
}

.pdp-upload__zone:hover,
.pdp-upload__zone.is-dragover {
  border-color: var(--amber-strong);
  background: var(--cream);
}

.pdp-upload__zone .icon {
  width: 28px;
  height: 28px;
  color: var(--amber-strong);
}

.pdp-upload__preview {
  display: none;
  align-items: center;
  gap: 12px;
}

.pdp-upload__preview.is-visible {
  display: flex;
}

.pdp-upload__preview img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.pdp-upload__meta {
  display: grid;
  gap: 2px;
  font-size: var(--text-sm);
}

.pdp-upload__meta strong {
  word-break: break-all;
}

.pdp-upload__error {
  display: none;
  align-items: center;
  gap: 6px;
  color: var(--danger);
  font-size: var(--text-xs);
  font-weight: 600;
}

.pdp-upload__error.is-visible {
  display: flex;
}

.pdp-upload__note {
  color: var(--muted);
  font-size: var(--text-xs);
}

/* Quantity + CTA ------------------------------------------------------------------ */
.pdp-buybox {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding-top: 6px;
}

.pdp-buybox .btn {
  flex: 1 1 200px;
}

.pdp-availability {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 700;
}

.pdp-availability--in {
  color: var(--success);
}

.pdp-availability--low {
  color: var(--wine);
}

.pdp-availability--out {
  color: var(--muted);
}

.pdp-feedback {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: #e3f6ea;
  color: #12633a;
  font-size: var(--text-sm);
  font-weight: 600;
}

.pdp-feedback.is-visible {
  display: flex;
}

/* Shop info card inside PDP -------------------------------------------------------- */
.pdp-shop-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.pdp-shop-card img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--stone);
}

.pdp-shop-card__info {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.pdp-shop-card__info strong {
  font-size: 0.95rem;
}

.pdp-shop-card__info span {
  color: var(--muted);
  font-size: var(--text-xs);
}

/* Not-found handled by .not-found in pages.css */

/* ==========================================================================
   Shop Detail page
   ========================================================================== */
.shop-hero {
  display: grid;
  gap: 20px;
}

.shop-hero__cover {
  position: relative;
  aspect-ratio: 21 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--stone);
}

.shop-hero__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shop-hero__body {
  display: grid;
  gap: 14px;
}

.shop-hero__top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.shop-hero__logo {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  overflow: hidden;
}

.shop-hero__logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shop-hero__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-hero__meta {
  display: grid;
  gap: 10px;
  max-width: 60ch;
}

.shop-hero__meta li {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.shop-hero__meta .icon {
  flex: none;
  margin-top: 2px;
  color: var(--amber-strong);
}

.shop-hero__hours {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  font-size: var(--text-sm);
}

.shop-hero__hours dt {
  color: var(--muted);
}

.shop-hero__hours dd {
  margin: 0;
  font-weight: 600;
}

.shop-hero__hours dd.is-today {
  color: var(--amber-strong);
}

@media (min-width: 900px) {
  .shop-hero__body {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 32px;
  }
}

.pdp-shop-card .shop-hero__logo {
  width: 52px;
  height: 52px;
}

.pdp-option textarea {
  min-height: 84px;
}

.btn[aria-disabled="true"] {
  opacity: 0.55;
}

@media (max-width: 559px) {
  .pdp-buybox .btn {
    order: 3;
    flex-basis: 100%;
  }
}

.pdp-info__shop {
  min-height: 44px;
}

/* ==========================================================================
   Visualizer stage (colour + size + uploaded photo preview)
   ========================================================================== */
.pdp-visualizer {
  display: grid;
  gap: 12px;
}

.pdp-stage {
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 32px);
  border-radius: var(--radius-lg);
  background: var(--stone-soft);
}

/* View Product vs. Try With Your Own Image toggle ----------------------------------- */
.pdp-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pdp-mode__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 700;
  text-align: center;
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.pdp-mode__btn .icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.pdp-mode__btn[aria-selected="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--white);
}

.pdp-mode__btn:hover {
  border-color: var(--slate);
}

.pdp-stage__panel {
  position: relative;
  width: 100%;
}

.pdp-stage__panel[hidden] {
  display: none;
}

.pdp-stage__real {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.pdp-stage__real img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

/* The customization stage: Frame layer > Mat layer > Customer Photo layer.
   Each product's OWN frame config (frameOf in product-page.js) drives the
   style/border/shape classes below — never a single shared design. */
.pdp-stage__frame {
  --aspect: 4 / 5;
  --swatch: #1c1c1c;
  position: relative;
  isolation: isolate;
  width: min(100%, 420px);
  margin: 0 auto;
  aspect-ratio: var(--aspect);
  background: var(--swatch);
  box-shadow: var(--shadow-card);
  transition: aspect-ratio var(--dur-base) var(--ease-out), padding var(--dur-base) var(--ease-out);
}

/* Border width — how thick the product's frame reads ------------------------------ */
.pdp-stage__frame--border-thin { padding: clamp(8px, 2.4%, 16px); }
.pdp-stage__frame--border-medium { padding: clamp(12px, 4%, 24px); }
.pdp-stage__frame--border-thick { padding: clamp(18px, 6.5%, 36px); }

/* Material/style — plain colour, wood grain, or a richer ornate carve ------------- */
.pdp-stage__frame--style-grain {
  background-image: repeating-linear-gradient(
    118deg,
    color-mix(in srgb, var(--swatch) 88%, white) 0px,
    var(--swatch) 5px,
    color-mix(in srgb, var(--swatch) 70%, black) 9px,
    var(--swatch) 13px
  );
}

.pdp-stage__frame--style-ornate {
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--swatch) 78%, white) 0%, var(--swatch) 45%, color-mix(in srgb, var(--swatch) 65%, black) 100%);
  box-shadow: var(--shadow-card), inset 0 0 0 2px color-mix(in srgb, var(--swatch) 55%, black), inset 0 0 0 5px color-mix(in srgb, var(--swatch) 85%, white);
}

/* Colour-finish texture (from frame-colors.seed.js), independent of the shape above */
.pdp-stage__frame--wood {
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--swatch) 80%, white) 0%, var(--swatch) 45%, color-mix(in srgb, var(--swatch) 70%, black) 100%);
}

.pdp-stage__frame--metal {
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--swatch) 60%, white) 0%, var(--swatch) 50%, color-mix(in srgb, var(--swatch) 80%, black) 100%);
}

/* Shape — square keeps a tight, minimal corner; arch gets a rounded top window --- */
.pdp-stage__frame--square {
  border-radius: 2px;
}

.pdp-stage__frame--arch {
  border-radius: 46% 46% 6px 6px / 20% 20% 6px 6px;
}

.pdp-stage__frame--arch .pdp-stage__mat,
.pdp-stage__frame--arch .pdp-stage__photo {
  border-radius: 44% 44% 4px 4px / 19% 19% 4px 4px;
}

/* Double border — a thin inset accent line near the inner edge ------------------- */
.pdp-stage__frame--double::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1.5px solid color-mix(in srgb, var(--swatch) 40%, white);
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}

/* Ornament — a small decorative crest at the top, for carved/vintage styles ------ */
.pdp-stage__frame--ornament::after {
  content: "";
  position: absolute;
  top: -5px;
  left: 50%;
  width: 14px;
  height: 14px;
  background: color-mix(in srgb, var(--swatch) 70%, white);
  border: 1.5px solid color-mix(in srgb, var(--swatch) 40%, black);
  border-radius: 2px;
  transform: translateX(-50%) rotate(45deg);
  box-shadow: var(--shadow-card);
  z-index: 1;
}

/* Mat layer — the mount between the frame and the photo --------------------------- */
.pdp-stage__mat {
  --mat-color: #f7f4ee;
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--mat-color);
}

.pdp-stage__mat--none { padding: 0; background: transparent; }
.pdp-stage__mat--thin { padding: clamp(4px, 2%, 10px); }
.pdp-stage__mat--medium { padding: clamp(8px, 4%, 18px); }
.pdp-stage__mat--wide { padding: clamp(12px, 6%, 28px); }

.pdp-stage__photo {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--white);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.pdp-stage__photo img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate(-50%, -50%) translate(var(--ox, 0%), var(--oy, 0%)) scale(var(--z, 1));
  transition: transform 120ms var(--ease-out);
}

.pdp-stage__empty {
  position: absolute;
  inset: auto 10% 10%;
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 0;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: var(--text-xs);
  text-align: center;
  pointer-events: none;
}

.pdp-stage__empty .icon {
  color: var(--slate);
}

.pdp-stage__caption {
  color: var(--muted);
  font-size: var(--text-xs);
  text-align: center;
}

/* Real-world size comparison --------------------------------------------------------- */
.pdp-compare {
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
}

.pdp-compare__title {
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.pdp-compare__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(20px, 4vw, 48px);
  min-height: 150px;
  padding: 0 8px 14px;
  border-bottom: 2px solid var(--line);
}

.pdp-compare__item {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.pdp-compare__shape {
  display: block;
  transition: width var(--dur-base) var(--ease-out), height var(--dur-base) var(--ease-out);
}

.pdp-compare__shape--frame {
  border: 3px solid var(--ink);
  background: var(--cream);
  border-radius: 2px;
}

.pdp-compare__shape--hand {
  color: var(--amber-strong);
  stroke-width: 1.6;
}

.pdp-compare__shape--paper {
  background: var(--white);
  border: 1px solid var(--slate);
  box-shadow: var(--shadow-card);
}

.pdp-compare__label {
  max-width: 16ch;
  color: var(--muted);
  font-size: var(--text-xs);
  text-align: center;
}

.pdp-compare__note {
  margin-top: 14px;
  color: var(--muted);
  font-size: var(--text-xs);
}

/* Colour swatches ------------------------------------------------------------------ */
.pdp-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pdp-swatch {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
}

.pdp-swatch__dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--swatch);
}

.pdp-swatch__dot--wood {
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--swatch) 75%, white), var(--swatch));
}

.pdp-swatch__dot--metal {
  background-image: linear-gradient(135deg, color-mix(in srgb, var(--swatch) 55%, white), var(--swatch) 60%);
}

.pdp-swatch__check {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  color: var(--white);
  opacity: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
  transition: opacity var(--dur-fast) var(--ease-out);
}

.pdp-swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--ink);
}

.pdp-swatch[aria-checked="true"] .pdp-swatch__check {
  opacity: 1;
}

.pdp-option__value {
  color: var(--muted);
  font-size: var(--text-sm);
}

/* Size cards -------------------------------------------------------------------------- */
.pdp-size-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 420px) {
  .pdp-size-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.pdp-size-card {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 12px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  text-align: left;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}

.pdp-size-card__label {
  font-weight: 700;
  font-size: 0.92rem;
}

.pdp-size-card__dims {
  color: var(--muted);
  font-size: var(--text-xs);
}

.pdp-size-card__delta {
  margin-top: 4px;
  color: var(--amber-strong);
  font-size: var(--text-xs);
  font-weight: 700;
}

.pdp-size-card__check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 16px;
  height: 16px;
  color: var(--amber-strong);
  opacity: 0;
}

.pdp-size-card[aria-checked="true"] {
  border-color: var(--ink);
  background: var(--cream);
}

.pdp-size-card[aria-checked="true"] .pdp-size-card__check {
  opacity: 1;
}

.pdp-option[data-invalid="true"] .pdp-size-card {
  border-color: var(--danger);
}

/* Summary card ------------------------------------------------------------------------- */
.pdp-summary {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--cream);
}

.pdp-summary__title {
  margin-bottom: 10px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.pdp-summary__list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: var(--text-sm);
}

.pdp-summary__list dt {
  color: var(--muted);
}

.pdp-summary__list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.pdp-summary__list dd#sum-price {
  color: var(--amber-strong);
  font-weight: 800;
}

/* Upload + position controls ----------------------------------------------------------- */
.pdp-upload__meta-actions {
  display: flex;
  gap: 14px;
  margin-top: 2px;
}

.pdp-position {
  display: grid;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.pdp-position__label {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
}

.pdp-position__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

@media (max-width: 559px) {
  .pdp-buybox .btn {
    order: 3;
    flex-basis: 100%;
  }
}

/* `[hidden]` must win over this file's own `display:` rules — the JS toggles
   this attribute and relies on it collapsing the element. */
.pdp-position[hidden],
.pdp-stage__empty[hidden],
.pdp-upload[hidden],
.pdp-stage__panel[hidden],
.pdp-gallery__thumbs[hidden] {
  display: none;
}

/* Photo controls sit directly under the preview (moved there by product-page.js) */
.pdp-visualizer .pdp-upload {
  margin-top: 14px;
}

.pdp-position__controls .icon-btn {
  width: 48px;
  height: 48px;
}

/* Zoomed-in photo can be dragged inside the frame */
.pdp-stage__photo.is-pannable {
  cursor: grab;
  touch-action: none;
}

.pdp-stage__photo.is-pannable:active {
  cursor: grabbing;
}

.pdp-stage__photo img {
  -webkit-user-drag: none;
  user-select: none;
}

.pdp-mode[hidden] {
  display: none;
}

/* Link to FrameX Studio under the buy box */
.pdp-studio-link {
  margin-top: 10px;
}
