/* ============================================================================
   The Flooring Mart — Premium hover glow for product listing cards
   v2 · 2026-08-13 (v1 was too faint against the existing neutral card shadow)

   SCOPE: `#productGrid .product-card` only — the product grid on the five
   category/listing pages (Engineered Hardwood, Vinyl/SPC, Laminate, Solid
   Hardwood, Tile). Every product rendered into that grid inherits the effect,
   including future imports, because the styling hangs off the shared card
   classes rather than any individual product.

   NOT applied to: homepage, PDP galleries, More Colours swatches, guide pages,
   local SEO pages, reviews, nav, footer, calculators or forms.

   ── INTENSITY ─────────────────────────────────────────────────────────────
   One number controls the whole effect: `--tfm-glow` on #productGrid.
       .38  subtle      .58  balanced (current)      .82  strong
   Nothing else needs editing to dial it up or down.

   SHEEN: turned OFF by the owner on 2026-08-13. Glow only.

   ON HOVER / KEYBOARD FOCUS:
     - a warm champagne-gold bloom around the card, sitting outside a small
       neutral contact shadow so the gold reads as light, not as dirt
     - the border warms from neutral grey to gold
     - a gold hairline and soft edge-light around the thumbnail
     - no light sweep across the photograph (sheen disabled)
   WHAT IT NEVER DOES:
     - no tint, wash or overlay across the flooring photo — the image colour
       stays exactly as photographed (only the extreme edges catch light)
     - no extra scale or lift beyond the card behaviour approved 2026-07-24,
       so card height, grid spacing and alignment are unchanged
     - no keyframes, no filters, no JavaScript, no colour cycling

   Colours are the approved tokens: gold #B79030, gold-lt #C4A96A, ink #1A1A18.
   Selectors use the #productGrid id so these rules layer on top of each page's
   inline card CSS without editing it.
   ========================================================================== */

#productGrid {
  --tfm-glow: .58;             /* master glow intensity — see note above     */
  --tfm-sheen: 0;              /* sheen OFF — owner decision 2026-08-13.
                                  The travelling-light band is disabled site
                                  wide. To bring it back set .08–.18 here;
                                  the rules below stay dormant at 0.         */
  --tfm-gold: 183, 144, 48;    /* #B79030 */
  --tfm-gold-lt: 196, 169, 106;/* #C4A96A */
}

/* ── transition setup (shared) ─────────────────────────────────────────── */
#productGrid .product-card {
  transition: box-shadow .32s cubic-bezier(.22, .61, .36, 1),
              transform  .32s cubic-bezier(.22, .61, .36, 1),
              border-color .32s ease;
}

/* Edge-light layer on the thumbnail. Both wrappers are already
   position:relative; overflow:hidden on every listing page.
   `.product-card-img` = vinyl / engineered / solid / tile
   `.card-media`       = laminate                                            */
#productGrid .product-card-img::after,
#productGrid .card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .32s ease;
  /* inset shadows with heavy negative spread stay on the very edge of the
     frame — the centre of the photograph is never covered or recoloured */
  box-shadow:
    inset 0 0    0   1px rgba(var(--tfm-gold-lt), calc(var(--tfm-glow) * 1.05)),
    inset 0 -26px 34px -26px rgba(var(--tfm-gold), calc(var(--tfm-glow) * 1.05)),
    inset 0  24px 32px -28px rgba(var(--tfm-gold), calc(var(--tfm-glow) * .78));
}

/* ── sheen: one soft band of light crossing the photo on hover ──────────── */
/* A neutral white highlight, not a colour — it lifts the surface the way
   showroom lighting does, then leaves. It runs ONCE per hover, on the hovered
   card only, and it is transform-only so it stays cheap on a full grid.
   Peak brightness is `--tfm-sheen` (default .12). The band is clipped by the
   wrapper's existing overflow:hidden, and sits under the Sale / In Stock
   badges so nothing is obscured.                                            */
#productGrid .product-card-img::before,
#productGrid .card-media::before {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: -55%;
  width: 40%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transform: translateX(0) rotate(14deg);
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, calc(var(--tfm-sheen) * .40)) 28%,
    rgba(255, 255, 255, var(--tfm-sheen)) 50%,
    rgba(255, 255, 255, calc(var(--tfm-sheen) * .40)) 72%,
    rgba(255, 255, 255, 0) 100%);
}
@keyframes tfm-card-sheen {
  0%   { opacity: 0; transform: translateX(0)    rotate(14deg); }
  14%  { opacity: 1; }
  86%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(390%) rotate(14deg); }
}
/* OFF by default. The sweep only runs if the grid carries `tfm-sheen-on`,
   which no page does — so on the live listings nothing animates and nothing
   composites. To switch it back on later: add class="tfm-sheen-on" to
   #productGrid (or set it in JS) and give --tfm-sheen a value of .08–.18. */
@media (hover: hover) {
  #productGrid.tfm-sheen-on .product-card:hover .product-card-img::before,
  #productGrid.tfm-sheen-on .product-card:hover .card-media::before {
    animation: tfm-card-sheen 950ms cubic-bezier(.25, .6, .35, 1) 80ms 1 both;
  }
}
/* keep the thumbnail badges above the sheen */
#productGrid .product-badge { z-index: 3; }

/* ── the glow itself ───────────────────────────────────────────────────── */
/* Layer order matters: a small tight neutral shadow keeps the card grounded,
   then the gold blooms outward from it. Overriding the page's own neutral
   hover shadow is deliberate — a heavy black shadow underneath kills the gold. */
@media (hover: hover) {
  #productGrid .product-card:hover {
    border-color: rgba(var(--tfm-gold), calc(.30 + var(--tfm-glow) * .62));
    box-shadow:
      0 2px  6px       rgba(26, 26, 24, .07),
      0 12px 26px      rgba(26, 26, 24, .09),
      0 0    0    1px  rgba(var(--tfm-gold), calc(var(--tfm-glow) * .60)),
      0 10px 26px -6px rgba(var(--tfm-gold), calc(var(--tfm-glow) * .90)),
      0 22px 58px -14px rgba(var(--tfm-gold), calc(var(--tfm-glow) * .72));
  }
  #productGrid .product-card:hover .product-card-img::after,
  #productGrid .product-card:hover .card-media::after {
    opacity: 1;
  }
}

/* ── keyboard focus — same glow, plus a clearly visible ring ────────────── */
#productGrid .product-card:focus-within {
  border-color: rgba(var(--tfm-gold), calc(.34 + var(--tfm-glow) * .62));
  box-shadow:
    0 2px  6px       rgba(26, 26, 24, .07),
    0 12px 26px      rgba(26, 26, 24, .09),
    0 0    0    2px  rgba(var(--tfm-gold), calc(var(--tfm-glow) * .85)),
    0 10px 26px -6px rgba(var(--tfm-gold), calc(var(--tfm-glow) * .90)),
    0 22px 58px -14px rgba(var(--tfm-gold), calc(var(--tfm-glow) * .72));
}
#productGrid .product-card:focus-within .product-card-img::after,
#productGrid .product-card:focus-within .card-media::after {
  opacity: 1;
}
/* never suppress the browser's own focus ring on the inner links */
#productGrid .product-card a:focus-visible {
  outline: 2px solid rgba(var(--tfm-gold), .85);
  outline-offset: 2px;
}

/* ── reduced motion — keep the glow, drop the movement ──────────────────── */
@media (prefers-reduced-motion: reduce) {
  #productGrid .product-card,
  #productGrid .product-card-img::after,
  #productGrid .card-media::after,
  #productGrid .product-card img {
    transition: none;
  }
  /* no travelling light */
  #productGrid .product-card:hover .product-card-img::before,
  #productGrid .product-card:hover .card-media::before,
  #productGrid .product-card-img::before,
  #productGrid .card-media::before {
    animation: none;
    opacity: 0;
  }
  #productGrid .product-card:hover,
  #productGrid .product-card:focus-within {
    transform: none;
  }
  #productGrid .product-card:hover .product-card-img img,
  #productGrid .product-card:hover .card-media img,
  #productGrid .product-card:focus-within .product-card-img img,
  #productGrid .product-card:focus-within .card-media img {
    transform: translateZ(0) !important;
  }
}

/* ============================================================================
   LISTING LAYOUT + FILTERS & SORT DRAWER — Phase 9.1 (owner brief 2026-10-17)
   One stylesheet for all six category listings (loaded in <head>, so nothing
   here waits for a script). The behaviour is listing-view.js; the reasons are
   at the top of that file. The selectors use #productGrid / #filterSidebar /
   #filterFab so they outrank each page's own inline rules without editing them.
   ========================================================================== */

/* ── 1. COLUMNS: the layout control decides, the CSS obeys ────────────────────
   #productGrid[data-vt] is the layout listing-view.js applied — the column count
   follows it at EVERY width (the control never applies one a width cannot draw:
   phones List·2, tablets List·2·3, desktop List·2·3·4). Before the script runs
   the page's own view class shows, except that up to 900px the default is TWO
   columns (the script's default there), so loading never shifts the grid. The
   old per-page clamps (3 and 4 drawn as 2 up to 900px; 4 drawn as 3 up to
   1180-1200px; one column on phones) no longer decide anything. */
#productGrid[data-vt="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#productGrid[data-vt="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#productGrid[data-vt="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
#productGrid[data-vt="list"] { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) {
  #productGrid:not([data-vt]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* two readable cards side by side on a phone */
@media (max-width: 599px) {
  #productGrid[data-vt="2"], #productGrid:not([data-vt]) { gap: 14px 10px; }
  #productGrid[data-vt="2"] .product-card-body,
  #productGrid:not([data-vt]) .product-card-body { padding: 12px 11px 13px; }
  #productGrid[data-vt="2"] .card-info,
  #productGrid:not([data-vt]) .card-info { padding: 11px 11px 12px; }
  #productGrid[data-vt="2"] .product-name-link, #productGrid[data-vt="2"] .card-name,
  #productGrid:not([data-vt]) .product-name-link, #productGrid:not([data-vt]) .card-name {
    font-size: 15px; line-height: 1.25; overflow-wrap: anywhere;
  }
  #productGrid[data-vt="2"] .spec-chip, #productGrid:not([data-vt]) .spec-chip { font-size: 10.5px; white-space: normal; }
  #productGrid[data-vt="2"] .product-price, #productGrid[data-vt="2"] .price-main, #productGrid[data-vt="2"] .price-sale,
  #productGrid:not([data-vt]) .product-price, #productGrid:not([data-vt]) .price-main, #productGrid:not([data-vt]) .price-sale {
    font-size: 19px;
  }
  #productGrid[data-vt="2"] .product-actions, #productGrid[data-vt="2"] .card-actions,
  #productGrid:not([data-vt]) .product-actions, #productGrid:not([data-vt]) .card-actions { grid-template-columns: 1fr; }
  #productGrid[data-vt="2"] .btn-quote, #productGrid:not([data-vt]) .btn-quote {
    width: 100%; min-height: 40px; padding-left: 8px; padding-right: 8px; font-size: 10.5px; letter-spacing: .06em;
  }
  /* the list layout on a phone: a thumbnail beside the details, one per row */
  #productGrid[data-vt="list"] .product-card { display: grid; grid-template-columns: 112px minmax(0, 1fr); min-height: 0; max-height: none; }
  #productGrid[data-vt="list"] .product-card-img { aspect-ratio: 1 / 1; height: auto; align-self: start; }
  #productGrid[data-vt="list"] .product-card-body { padding: 10px 12px; }
}

/* ── 2. THE DRAWER (phones and tablets, up to 1023px — the header's breakpoint) */
#filterFab .filter-fab-count:empty { display: none; }
@media (max-width: 1023px) {
  body .catalog-wrap { grid-template-columns: minmax(0, 1fr); }
  body .product-area { padding-left: 0; }

  /* the one action: Filters & Sort, with the active-filter count */
  #filterFab {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; margin: 0 0 14px;
    padding: 10px 16px; background: var(--white, #fff); color: var(--ink, #1c1b18);
    border: 1px solid var(--border, #e2ddd3); border-radius: 4px; cursor: pointer;
    font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; letter-spacing: .02em;
    position: sticky; top: calc(var(--tfm-hdr-h, 113px) + 8px); z-index: 40;
    box-shadow: 0 2px 10px rgba(28, 27, 24, .06);
  }
  #filterFab:focus-visible { outline: 2px solid var(--gold, #9B7940); outline-offset: 2px; }
  #filterFab .filter-fab-count {
    margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px;
    background: var(--gold, #9B7940); color: #fff; font-size: 11px; font-weight: 700; line-height: 22px; text-align: center;
  }

  /* the panel: off-canvas, out of the tab order and the accessibility tree while
     closed (visibility, plus `inert` from the script) */
  #filterSidebar {
    display: block; position: fixed; top: 0; bottom: 0; left: 0; right: auto; inset: 0 auto 0 0;
    width: min(400px, 92vw); height: 100%; max-height: none; margin: 0; padding: 0;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    background: var(--white, #fff); border: 0; box-shadow: 4px 0 40px rgba(0, 0, 0, .18);
    z-index: 1200; transform: translateX(-104%); visibility: hidden;
    transition: transform .28s ease, visibility 0s linear .28s;
  }
  #filterSidebar.fd-open { transform: none; visibility: visible; transition: transform .28s ease; }
  #drawerBackdrop {
    display: block; position: fixed; inset: 0; background: rgba(17, 17, 16, .5); z-index: 1190;
    opacity: 0; pointer-events: none; transition: opacity .28s;
  }
  #drawerBackdrop.open { opacity: 1; pointer-events: auto; }

  #filterSidebar .drawer-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border, #e2ddd3);
    position: sticky; top: 0; z-index: 2; background: var(--white, #fff);
  }
  #filterSidebar .drawer-head-title { font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700; color: var(--ink, #1c1b18); margin: 0; }
  #filterSidebar .drawer-close {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -6px -8px -6px 0;
    background: none; border: 0; border-radius: 50%; font-size: 22px; line-height: 1; color: var(--ink, #1c1b18); cursor: pointer;
  }
  #filterSidebar .drawer-close:focus-visible { outline: 2px solid var(--gold, #9B7940); outline-offset: 0; }
  #filterSidebar .fd-sort { display: block; padding: 14px 20px 6px; }
  #filterSidebar .fd-sort-lab {
    display: block; margin: 0 0 6px; font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase; color: var(--muted, #6b6558);
  }
  #filterSidebar .fd-sort-sel {
    width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; font-size: 16px; color: var(--ink, #1c1b18);
    background: var(--white, #fff); border: 1px solid var(--border, #e2ddd3); border-radius: 4px;
  }
  #filterSidebar .fd-sort-sel:focus-visible { outline: 2px solid var(--gold, #9B7940); outline-offset: 1px; }
  #filterSidebar .drawer-foot {
    display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border, #e2ddd3); position: sticky; bottom: 0; z-index: 2; background: var(--white, #fff);
  }
  #filterSidebar .m-btn-clear, #filterSidebar .m-btn-apply {
    min-height: 46px; padding: 10px 12px; border-radius: 4px; cursor: pointer;
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  }
  #filterSidebar .m-btn-clear { flex: 1; background: transparent; border: 1px solid var(--border, #cfc7b8); color: var(--ink, #1c1b18); }
  #filterSidebar .m-btn-apply { flex: 2; background: var(--ink, #1c1b18); border: 0; color: #fff; }
  #filterSidebar .m-btn-clear:focus-visible, #filterSidebar .m-btn-apply:focus-visible { outline: 2px solid var(--gold, #9B7940); outline-offset: 2px; }
  /* every page's filter groups get the drawer's side margins (vinyl's sit directly in the panel) */
  #filterSidebar > :not(.drawer-head):not(.drawer-foot):not(.fd-sort) { padding-left: 20px; padding-right: 20px; }
  /* the toolbar (count · layout · sort) wraps instead of clipping the sort control */
  body .sort-bar { flex-wrap: wrap; row-gap: 10px; }
  body .sort-bar-right, body .sort-controls { flex-wrap: wrap; row-gap: 8px; max-width: 100%; }
  body .sort-bar .sort-select { max-width: 100%; }
}
.tvt-btn .tvt-s { display: none; }
@media (max-width: 599px) {
  .tvt-btn .tvt-l { display: none; }
  .tvt-btn .tvt-s { display: inline; }
}
@media (min-width: 1024px) {
  #filterFab, #drawerBackdrop, #filterSidebar .drawer-head, #filterSidebar .drawer-foot, #filterSidebar .fd-sort { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #filterSidebar, #filterSidebar.fd-open, #drawerBackdrop { transition: none; }
}

/* ── 3. THE ROOM PHOTO WITHOUT HOVER (Phase 9.1 item 4; tfm-chrome.js §10 tfmRoomToggle) ────────────────────────────
   A card's room photo was a hover effect only: on a touch screen the tile and solid cards never showed it at all.
   On a screen without hover (or with a touch pointer) those cards carry a labelled toggle — "View in Room" /
   "View Swatch", aria-pressed — exactly like the engineered cards; a sideways swipe on the photo does the same. A mouse
   keeps the hover; a keyboard reveals the room photo while focus is inside the card. */
#productGrid .product-card-img .pc-room-toggle {
  position: absolute; right: 8px; bottom: 8px; z-index: 3; display: none; align-items: center; min-height: 32px;
  padding: 6px 10px; background: rgba(255, 255, 255, .94); color: #111; border: 1px solid #cfc8bd; border-radius: 2px;
  font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
#productGrid .product-card-img .pc-room-toggle:focus-visible { outline: 2px solid #111; outline-offset: 2px; }
@media (hover: none), (any-pointer: coarse) {
  #productGrid .product-card-img .pc-room-toggle { display: inline-flex; }
  #productGrid .product-card-img { touch-action: pan-y pinch-zoom; }
}
#productGrid .room-on .tl-img-room, #productGrid .room-on .sh-img-room { display: block; opacity: 1; }
@media (hover: hover) and (pointer: fine) {
  #productGrid .product-card:focus-within .tl-img-room, #productGrid .product-card:focus-within .sh-img-room { opacity: 1; }
}
