/* product.css — the graph-driven catalog detail page (server/templates/product.html).
   Loaded ONLY on those routes via PageData.PageCSS, so the 377 other pages do
   not pay for it. Tokens come from site.css; nothing here redefines a variable.

   Two layout invariants, both gate conditions in .claude/pm/80-qa:
     · no horizontal overflow at any width — every rail scrolls inside itself
       and every grid column is minmax(0, …) so a wide image cannot push the
       page wider than the viewport.
     · nothing depends on JS. The zoom is an <a href> that works when
       assets/js/product.js never loads. */

/* ── hero ─────────────────────────────────────────────────────────────────── */
/* The slab spans the FULL viewport width and the facts sit underneath it. It
   was a 1.25fr column beside a text column, which capped the slab at ~660px on
   a 1600px screen — the one image a countertop shopper actually wants to
   inspect, shown smaller than the text next to it. Full-bleed via 100vw with a
   negative margin, not by escaping .wrap, so the surrounding layout is
   untouched. calc(100vw - …) accounts for a scrollbar; without it the page
   gains ~15px of horizontal overflow, which is a gate failure. */
.p-hero { padding: 0 0 8px; }
/* NOT the 100vw full-bleed trick. `100vw` is the viewport INCLUDING the
   scrollbar, so on a page tall enough to scroll it is ~8-15px wider than the
   content box and the page gains that much horizontal overflow — measured at
   exactly 8px here, and "no horizontal spill, ever" is a gate condition.
   Since .p-hero-grid is no longer inside .wrap, this element is already the
   full body width; plain 100% needs no viewport math and cannot overflow. */
.p-hero-full { width: 100%; }
.p-hero-grid { display: block; }
.p-facts { max-width: 1100px; margin: 26px auto 0; padding: 0 var(--gutter, 22px); }
.p-facts h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); margin: 0 0 .35em; }

/* slab figure — the reason the page exists */
.slabfig { margin: 0; }
.slabzoom {
  display: block; position: relative; overflow: hidden;
  background: var(--surface-2); border-block: 1px solid var(--border);
  cursor: zoom-in; touch-action: pan-y;
}
.slabzoom img, .slabzoom picture { display: block; width: 100%; height: auto; }
.slabimg {
  width: 100%; height: clamp(300px, 52vh, 620px); object-fit: cover;
  /* the loupe reads this element's own box, so it must not be transformed */
}

/* ── loupe ────────────────────────────────────────────────────────────────
   A magnifier over the slab, driven by pointer events so one code path serves
   mouse, pen and touch. It is a second copy of the SAME image scaled up and
   offset by background-position — no canvas, no library. Hidden until the JS
   attaches (.has-loupe), so with JS off the anchor still opens the full file. */
.loupe {
  position: absolute; pointer-events: none; opacity: 0; visibility: hidden;
  width: var(--loupe-size, 240px); height: var(--loupe-size, 240px);
  border-radius: 50%; border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 6px 26px rgba(0,0,0,.55), inset 0 0 0 1px rgba(0,0,0,.35);
  background-repeat: no-repeat; background-color: var(--surface-2);
  transition: opacity .12s ease;
  will-change: transform, background-position;
}
.slabzoom.is-loupe-on .loupe { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .loupe { transition: none; } }
/* Coarse pointers get a bigger lens offset above the finger, or the fingertip
   covers exactly the detail the loupe exists to show. */
@media (pointer: coarse) { .loupe { --loupe-size: 200px; } }
.zoomhint {
  position: absolute; right: 12px; bottom: 12px; padding: 6px 12px; font-size: 13px;
  font-weight: 600; letter-spacing: .02em; border-radius: 20px; color: #201a0c;
  background: linear-gradient(135deg, var(--gold-hi), var(--gold));
  box-shadow: 0 2px 10px rgba(0,0,0,.45);
}
.slabzoom:hover .zoomhint { background: linear-gradient(135deg, #fff0bf, var(--gold-hi)); }
.slabfig figcaption { margin-top: 10px; font-size: .88rem; color: var(--fg-subtle); }

/* ── color + veining facet ────────────────────────────────────────────────── */
.p-color { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 18px; }
.p-color .chip {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 8px;
  border: 1px solid var(--border-strong); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25);
}
.p-colortext { margin: 0 0 4px; font-size: 1.08rem; color: var(--fg); }
.p-measured { margin: 0; font-size: .85rem; color: var(--fg-subtle); }
.p-measured code { font-family: var(--mono); font-size: .95em; color: var(--fg-muted); }

.p-vein { margin: 0 0 20px; }
.p-vein-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.p-vein-label { font-weight: 700; text-transform: capitalize; }
.p-vein-num { font-size: .82rem; color: var(--fg-subtle); font-family: var(--mono); }
.p-meter {
  margin: 7px 0 8px; height: 8px; border-radius: 6px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
}
.p-meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold-hi)); }
.p-vein-help { margin: 0; font-size: .85rem; color: var(--fg-subtle); }

/* ── labelled values ──────────────────────────────────────────────────────── */
.p-spec { list-style: none; margin: 0 0 18px; padding: 0; }
.p-spec li { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 2px 14px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.p-spec li:last-child { border-bottom: 0; }
.p-spec span, .p-line span {
  display: inline-block; min-width: 11rem; color: var(--fg-subtle);
  font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; line-height: 1.9;
}
.p-spec li > span { min-width: 0; }
.p-spec--wide { max-width: 640px; }
.p-line { font-size: .95rem; margin: 0 0 8px; }
.p-aka { font-size: .9rem; color: var(--fg-muted); }
.p-price { margin: 16px 0; font-size: .95rem; color: var(--fg-muted); }
.p-price strong { color: var(--fg); font-size: 1.15rem; }
.p-hero .cta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ── sections ─────────────────────────────────────────────────────────────── */
.p-sec { padding: 34px 0; border-top: 1px solid var(--border); }
.p-sec h2 { font-size: clamp(1.25rem, 2.6vw, 1.7rem); }
.p-note { font-size: .85rem; color: var(--fg-subtle); margin: 12px 0 0; }
.p-tips p { max-width: 68ch; color: var(--fg-muted); }

/* ── image rails ──────────────────────────────────────────────────────────── */
/* Horizontal scrollers: the rail scrolls, the page never does. */
.p-rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(88vw, 340px);
  gap: 14px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; padding-bottom: 10px;
}
.p-rail--sw { grid-auto-columns: 160px; }
.p-shot { margin: 0; scroll-snap-align: start; min-width: 0; }
.p-shot a { display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.p-shot-img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.p-shot--sw .p-shot-img { aspect-ratio: 1 / 1; }
.p-shot figcaption { margin-top: 7px; font-size: .82rem; color: var(--fg-subtle); }

/* ── cabinet colors ───────────────────────────────────────────────────────── */
/* A cabinet swatch is a photograph of a DOOR — rails, stiles, a panel and an
   edge profile. It was rendered as a 72px circle, which crops a rectangular
   door to its middle and throws away the two things that identify it: the
   profile and the grain direction. Now a 4:3 door tile, large enough to read,
   in the same responsive column rhythm as the catalog cards. */
.p-cabs {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr));
}
.p-cabs li { text-align: left; }
.p-cabs img, .p-cab-blank {
  width: 100%; aspect-ratio: 4 / 3; height: auto; border-radius: 10px;
  margin: 0 0 8px; object-fit: cover; object-position: center;
  border: 1px solid var(--border-strong); display: block; background: var(--surface-2);
}
.p-cab-name { font-size: .9rem; color: var(--fg); text-transform: capitalize; }
.p-cab-fam { display: block; font-size: .78rem; color: var(--fg-subtle); }

/* ── comparison table ─────────────────────────────────────────────────────── */
.p-tablewrap { overflow-x: auto; }
.p-cmp { border-collapse: collapse; width: 100%; min-width: 560px; font-size: .92rem; }
.p-cmp th, .p-cmp td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--border); }
.p-cmp thead th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-subtle); font-weight: 600; }
.p-cmp tbody th { font-weight: 600; }
.p-cmp td { color: var(--fg-muted); }
.p-cmp tr.is-self { background: rgba(210,174,90,.07); }
.p-here { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gold); margin-left: 6px; }
.p-dash { color: var(--fg-subtle); opacity: .6; }

/* ── chips + footer rail ──────────────────────────────────────────────────── */
.p-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 9px; margin: 0; padding: 0; }
.p-chips li {
  padding: 7px 14px; border-radius: 20px; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--fg-muted);
}
.p-chips li:has(a) { border-color: var(--border-strong); }
.p-morelinks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.p-morelinks a { font-size: .97rem; }

/* ── zoom dialog (product.js) ─────────────────────────────────────────────── */
.p-lb { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; width: 100vw; height: 100dvh; }
.p-lb::backdrop { background: rgba(8,8,8,.94); }
.p-lb-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: zoom-in; }
.p-lb-stage.is-zoomed { cursor: grab; }
.p-lb-stage.is-panning { cursor: grabbing; }
.p-lb-img { position: absolute; top: 50%; left: 50%; transform-origin: 0 0; max-width: none; will-change: transform; }
.p-lb-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 12px;
  align-items: center; justify-content: space-between; padding: 12px 16px;
  background: linear-gradient(to top, rgba(0,0,0,.72), transparent);
  color: var(--fg-muted); font-size: .86rem; pointer-events: none;
}
.p-lb-close {
  position: absolute; top: 12px; right: 14px; z-index: 2; border: 1px solid var(--border-strong);
  background: rgba(20,20,20,.8); color: var(--fg); border-radius: 50%;
  width: 42px; height: 42px; font-size: 22px; line-height: 1; cursor: pointer;
}
.p-lb-close:hover { border-color: var(--gold); color: var(--gold-hi); }

@media (max-width: 900px) {
  .p-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .p-spec li { grid-template-columns: minmax(0, 1fr); }
  .p-spec span, .p-line span { display: block; min-width: 0; line-height: 1.5; }
}
@media (prefers-reduced-motion: reduce) {
  .p-lb-img { will-change: auto; }
}

/* dense similar-styles list (replaces the five-column table — see product.html) */
.p-cmplist { list-style: none; margin: 0; padding: 0; }
.p-cmplist li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.p-cmplist li:last-child { border-bottom: 0; }
.p-cmplist li.is-self { color: var(--fg); }
.p-cmpd { color: var(--fg-muted); }

/* ── "slabs that look like this", as slabs ───────────────────────────────── */
.p-cmpgrid {
  list-style: none; margin: 0; padding: 0; display: grid; gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1100px) { .p-cmpgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .p-cmpgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } }
@media (max-width: 460px)  { .p-cmpgrid { grid-template-columns: 1fr; } }
.p-cmpgrid a { display: block; color: inherit; text-decoration: none; }
.p-cmpgrid a:hover .p-cmpname { color: var(--gold-hi); }
.p-cmpimg {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  margin-bottom: 8px;
}
.p-cmpgrid a:hover .p-cmpimg { border-color: var(--border-strong); }
.p-cmpname { display: block; font-weight: 600; font-size: .96rem; line-height: 1.3; }
.p-cmpgrid .p-cmpd, .p-cmpgrid .p-dash { display: block; font-size: .84rem; color: var(--fg-muted); margin-top: 2px; }
.p-cmpgrid li.is-self .p-cmpimg { border-color: var(--gold); }
.slabcap { margin: 0 0 14px; font-size: .88rem; color: var(--fg-subtle); }

/* The zoom affordance is a decoration, not content: its label lives in CSS so
   it is not a text node repeated on every product page (the <a> already carries
   the accessible name). */
.zoomhint::after { content: "Zoom"; }
.p-sub { margin: -6px 0 14px; font-size: .88rem; color: var(--fg-subtle); }
