/* ==========================================================================
   Flossie's Cards: card page, gallery, lightbox and Quick View (WP11), ported from the front-page mock.
   NO COLOUR IN THIS FILE: every colour is a token from the :root block of shop.css. FrameTest::colours_only_in_root_tokens
   scans every stylesheet and script under public/, this file included; QuickViewTest::product_css_and_scripts_use_tokens_only
   repeats those checks for WP11's three files and also pins no :root block here and the token count.
   Sections continue the mock's numbering: 10a Quick view on a card, 12a gallery, 12b lightbox,
   12c (moved to basket.css: the ADD TO BASKET form is the basket package's),
   14a the Quick View dialog, 17a responsive.
   ========================================================================== */

/* ---------- 10a. "Quick view" on a product card (mock section 10): slides up over the photo on hover,
   and on keyboard focus anywhere in the card; always shown where nothing can hover (touch phones and tablets),
   so Flossie can open it on her phone. Without JavaScript it is a plain link to the card page. ---------- */
.product-card [data-quick-view] {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 var(--space-3);
  background: var(--color-button-bg); color: var(--color-button-text);
  font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps);
  transform: translateY(101%); transition: transform .25s ease;
}
.product-card:hover [data-quick-view], .product-card:focus-within [data-quick-view] { transform: translateY(0); }
.product-card [data-quick-view]:hover { background: var(--color-button-bg-hover); color: var(--color-button-text); }
.product-card [data-quick-view]:focus-visible { outline-color: var(--color-focus-on-dark); outline-offset: -5px; }
@media (hover: none) {
  .product-card [data-quick-view] { transform: none; }
}

/* ---------- 12a. Gallery on the card page: the main 800 px picture, then up to 4 thumbnails ---------- */
.gallery-main { display: block; position: relative; background: var(--color-surface-alt); cursor: zoom-in; }
.gallery-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin: var(--space-2) 0 0; padding: 0; list-style: none; }
.gallery-thumb, .qv-thumb {
  display: block; width: 100%; padding: 0; border: 3px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-surface-alt); color: var(--color-text); cursor: pointer;
}
.gallery-thumb:hover, .qv-thumb:hover { border-color: var(--color-border-strong); }
/* the photo shown: a darker, double border, so the mark survives forced-colours mode (not colour alone) */
.gallery-thumb[aria-pressed="true"], .qv-thumb[aria-pressed="true"] { border-color: var(--color-heading); border-style: double; }
.gallery-thumb img, .qv-thumb img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }

/* ---------- 12b. Lightbox: the 1200 px photos in a dialog; previous/next over the photo, the count below ----------
   A closed <dialog> is hidden by the browser's own dialog:not([open]) rule; the two dialogs here set their own display
   only while open, and the next rule keeps them hidden even in a browser without <dialog> support. */
.quick-view:not([open]), .lightbox:not([open]) { display: none; }
.lightbox {
  width: min(calc(100vw - 2 * var(--space-4)), 1200px); max-width: none;
  max-height: 90vh; overflow: hidden;
}
.lightbox > .dialog-close { position: absolute; top: 2px; right: 2px; z-index: 1; }
/* the buttons on the dialogs' edges: the focus ring is drawn inside them, so overflow: hidden never clips it */
.lightbox > .dialog-close, .lightbox-prev, .lightbox-next, .quick-view > .dialog-close { outline-offset: -4px; }
.lightbox-stage { position: relative; padding: var(--tap) var(--tap) 0; }
.lightbox-slides { margin: 0; padding: 0; list-style: none; }
.lightbox-slide img {                                   /* width/height attributes keep the photo's own ratio: no jump while it loads */
  display: block; width: 100%; height: auto; max-height: calc(90vh - 2 * var(--tap) - var(--space-7));
  margin: 0 auto; object-fit: contain;
}
.lightbox-prev, .lightbox-next {
  position: absolute; top: 50%; z-index: 1; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0;
  border: var(--hairline) solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); color: var(--color-text);
}
.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }
.lightbox-prev:hover, .lightbox-next:hover { background: var(--color-latte); }
.lightbox-prev svg, .lightbox-next svg { width: 20px; height: 20px; }
.lightbox-count { margin: 0; padding: var(--space-2) var(--space-4) var(--space-3); text-align: center; color: var(--color-text-muted); font-size: var(--fs-sm); }

/* (The ADD TO BASKET form's rules, the quantity stepper and its messages, live in basket.css section 3: the
   basket package owns the component; one copy.) */

/* ---------- 14a. Quick View dialog (mock section 14): centred, at most 1000px wide and 90vh tall, scrolls inside ---------- */
.quick-view { width: calc(100vw - 2 * var(--space-4)); max-width: 1000px; max-height: 90vh; overflow: hidden; }
.quick-view[open] { display: flex; flex-direction: column; }   /* only while open: a display of its own would un-hide a closed dialog */
.quick-view > .dialog-close { flex: none; align-self: flex-end; }
.qv-body { flex: 1 1 auto; min-height: 0; overflow: auto; }
.qv-loading { margin: 0; padding: var(--space-8) var(--space-4); text-align: center; color: var(--color-text-muted); }
.qv-content .staff-banner { margin: 0 var(--grid-gap) var(--space-4); }
.qv-inner { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: var(--grid-gap); padding: 0 var(--grid-gap) var(--grid-gap); }
.qv-gallery .gallery-thumbs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.qv-more { margin: 14px 0 0; font-size: var(--fs-sm); }
/* "SKU … · Category: <link>": a link inside muted text is told apart by its underline, not by colour alone */
.product-meta a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 17a. Responsive (the mock's breakpoints, section 17) ---------- */
@media (max-width: 849.98px) {
  .qv-inner { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 599.98px) {
  .lightbox { width: 100vw; }
  .quick-view { width: 100vw; }
  .qv-inner { padding: 0 var(--space-4) var(--space-5); }
  .qv-content .staff-banner { margin: 0 var(--space-4) var(--space-4); }
}
