/* ─── Product page drawn from the store (inc/pdp-store.php) — the design PDF pp.9-12 ──────────────
   Measured on the PDF pages rendered at 1920x1080 (~/.vita/plans/cao-rebuild/design-pdf/design-09..12.png), +-2 px:

   | thing                      | PDF (1920)                      | here                                              |
   |----------------------------|---------------------------------|---------------------------------------------------|
   | photo column               | x8..988 (51.5%), frames 2:3, gap 7 | 51.5% wide, 2:3 frames, edge + gap = --cao-frame (10px; the PDF's 8 is the same 0.5% at 2000) |
   | info column                | x1135..1617 = 59.1% .. 84.2%    | starts at 59.1%, 25.1% wide (min 360px)           |
   | title top (cap)            | y262 = 24.3% of the screen      | padding-top 24.3svh (clamped)                     |
   | title                      | Anton, cap 28, "RAE TOTE" 94 wide | Anton 30px / 1                                  |
   | description                | mono ~10.5px, 13px lines, x1138, 480 wide | mono 12px / 16px (the 12px floor), para gap 8 |
   | description -> COLOR row   | 87                              | 88                                                |
   | COLOR label / swatches     | Anton ~22, x1139; swatches x1273 (label col 134), 36x36, pitch 45, radius 4 | label col 134, 36px, gap 9, radius 4 |
   | swatches -> FEATURES       | 53                              | 56                                                |
   | FEATURES label -> list     | 26                              | 24; list mono 12px / 16px caps (PDF ~10px / 14.7) |
   | list -> SIZE line          | 52                              | 56; SIZE label x+8, value at label + 92           |
   | SIZE line -> buttons       | 44                              | 48                                                |
   | ADD TO CART / express      | 226x48 each, gap 16, x+10       | two equal columns, 48 high, gap 16, inset 10      |
   | SHOP SIMILAR. heading      | Anton ~22, x11, y38             | Anton 22px, padding 10                            |
   | similar                    | 4 x 467x701 (2:3), gap 11, top 67 | jb 2026-11-12: the HOME rail (home-rail.css): one screen tall at 2:3, pinned, sideways |

   Tokens only (no hex), nothing under 12px. No JS: swatches and size chips are links (?color= / ?size=) the server reads. */

.pdps { display: grid; grid-template-columns: 51.5% 7.6% minmax(360px, 25.1%) 1fr; align-items: start; }
.pdps-gallery { grid-column: 1; display: grid; gap: var(--cao-frame); padding: var(--cao-frame) 0 0 var(--cao-frame); min-width: 0; }
.pdps-frame { margin: 0; aspect-ratio: 2 / 3; overflow: hidden; background: var(--cao-studio); }
.pdps-frame--soon { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: var(--cao-ink); }
.pdps-soon__name { font: 400 30px/1 var(--cao-font-display); text-transform: uppercase; }
.pdps-soon__line { font: 400 12px/16px var(--cao-font-mono); text-transform: uppercase; letter-spacing: 0.08em; }
.pdps-frame img {display: block; width: 100%; height: 100%; object-fit: cover; }
/* THE SEQUENCE (PLAN-6 P2): each box is the picture's OWN shape (inline aspect-ratio from its width/height, 2:3 studio, 3:4 lifestyle), at the
   full column width: the whole photo shows, nothing is cropped, no band. 2:3 below is only the fallback for a frame without a size. */
.pdps-frame--seq picture { display: block; width: 100%; height: 100%; }

/* THE LEFT WINDOW (theme 0.1.15, jb 2026-11-12: "the left side scrolls if the mouse is on there, and only the left side, and its a viewport height
   scrolling window of images … anchored into the bottom section"; "right scrolls away with the page, the left is its own little world").
   Desktop: the photo column is its own viewport-high scroller, sticky at the top of the product row, so it sits put while the page moves and
   rides out FLUSH with the row's foot, right where SHOP SIMILAR starts. The info column is plain flow: it scrolls away with the page.
   At either end of the photo stack a wheel over it carries the PAGE on in the same gesture (inc/pdp-scroll.js, the edge hand-off): browsers
   latch a wheel gesture to the inner scroller, so CSS scroll chaining alone stops dead until the next gesture (measured, docs/cao-photos/scroll-0.1.15).
   The title still lands at the PDF's 24.3% of the screen. */
.pdps-info { grid-column: 3; min-width: 0; }
.pdps-info__in { padding: clamp(96px, 24.3svh, 262px) 0 var(--cao-space-8); }
@media (min-width: 1024px) {
  .pdps-gallery {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100svh;
    align-content: start;
    grid-auto-rows: max-content; /* a fixed-height grid shares its height out between auto rows: without this the frames overlapped (measured) */
    padding-bottom: var(--cao-frame);
    overflow-y: auto;
    overscroll-behavior-y: auto; /* chaining on: with no script, the next gesture at an end still moves the page */
    scrollbar-width: none; /* the window is the frame: a scrollbar would narrow the 2:3 frames off the column width */
  }
  .pdps-gallery::-webkit-scrollbar { display: none; }
  .pdps-gallery:focus-visible { outline: 2px solid var(--cao-ink); outline-offset: -2px; }
}

.pdps-title { margin: 0; font: 400 30px/1 var(--cao-font-display); text-transform: uppercase; letter-spacing: 0; }
.pdps-desc { margin-top: 16px; font: 400 12px/16px var(--cao-font-mono); }
.pdps-desc p { margin: 0 0 8px; }

.pdps-label { margin: 0; font: 400 22px/1 var(--cao-font-display); text-transform: uppercase; }
.pdps-row { display: grid; grid-template-columns: 134px 1fr; align-items: center; }
.pdps-row__v { margin: 0; min-width: 0; }

.pdps-colour { --pdps-sw-size: 36px; --pdps-sw-gap: 9px; margin-top: 88px; align-items: start; }
.pdps-colour .pdps-label { line-height: 36px; }
.pdps-sws, .pdps-chips, .pdps-features ul { list-style: none; margin: 0; padding: 0; }
.pdps-sws { display: flex; flex-wrap: wrap; gap: var(--pdps-sw-gap, 9px); }
.pdps-sw { position: relative; display: block; width: var(--pdps-sw-size, 36px); height: var(--pdps-sw-size, 36px); border-radius: 4px; background: var(--swatch, var(--cao-paper)); box-shadow: inset 0 0 0 1px var(--cao-line); }
.pdps-sw[aria-current="true"] { outline: 2px solid var(--cao-ink); outline-offset: 3px; }
@media (hover: hover) { .pdps-sw:hover:not([aria-current="true"]) { outline: 1px solid var(--cao-ink); outline-offset: 3px; } } /* a touch has no hover: a stuck outline would read as a second selection */
.pdps-sw.is-sold::after { content: ""; position: absolute; left: -3px; right: -3px; top: 50%; border-top: 2px solid var(--cao-ink); transform: rotate(-45deg); }
.pdps-colour__name { margin: 8px 0 0 min(calc(var(--pdps-sel, 0) * (var(--pdps-sw-size) + var(--pdps-sw-gap))), max(0px, calc(100% - 18ch))); font: 400 12px/16px var(--cao-font-mono); text-transform: uppercase; }

.pdps-features { margin-top: 56px; }
.pdps-colour + .pdps-features { margin-top: 32px; } /* the colour name line (24) sits in the PDF's 56 gap */
.pdps-features ul { margin-top: 24px; padding-left: 3px; font: 400 12px/16px var(--cao-font-mono); text-transform: uppercase; }

.pdps-size { margin-top: 40px; }
.pdps-chips { display: flex; gap: 9px; }
.pdps-chip { display: inline-flex; align-items: center; min-width: 64px; min-height: 36px; padding: 0 12px; justify-content: center; border: 1px solid var(--cao-line); font: 400 13px/1 var(--cao-font-mono); color: var(--cao-ink); text-decoration: none; }
.pdps-chip[aria-current="true"] { border-color: var(--cao-ink); box-shadow: inset 0 0 0 1px var(--cao-ink); }
.pdps-chip.is-sold { color: var(--cao-mute); text-decoration: line-through; }

.pdps-line { margin-top: 56px; grid-template-columns: 92px 1fr; padding-left: 8px; }
.pdps-line__v { font: 400 12px/16px var(--cao-font-mono); }
.pdps-size + .pdps-line { margin-top: 32px; }

.pdps-buy { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 48px 0 0 10px; }
.pdps-btn { min-height: 48px; border: 1px solid var(--cao-ink); background: var(--cao-paper); color: var(--cao-ink); font: 400 22px/1 var(--cao-font-display); text-transform: uppercase; cursor: pointer; }
.pdps-btn[aria-disabled="true"] { color: var(--cao-mute); border-color: var(--cao-line); cursor: not-allowed; }
.pdps-express:not(:empty) { min-height: 48px; border: 1px solid var(--cao-ink); }

.pdps-disc { margin: 32px 0 0 10px; border-top: 1px solid var(--cao-line); font: 400 12px/16px var(--cao-font-mono); }
.pdps-disc summary { padding: 12px 0; font-size: 13px; cursor: pointer; }
.pdps-disc dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0 0 12px; }
.pdps-disc dd { margin: 0; }

/* SHOP SIMILAR. is the HOME rail (jb 2026-11-12: "put those on a side scroll just like the home page, with the relief and sizing to the
   viewport"): the section is a .home-rail, so home-rail.css sizes the cards (one screen tall at 2:3; a phone: the screen less a gutter each
   side) and holds the panel; assets/js/home-rail.js moves the track 1:1 with the page's scroll. The heading is the rail's trigger: its 12px
   below is PADDING, not margin, so its bottom edge IS the panel's top (the hold starts the pixel the scrub does: no dead zone).
   The section carries no side padding: the rail's own gutters are the frame. */
.pdps-similar { padding: 64px 0 0; }
.pdps-similar__head { margin: 0; padding: 0 var(--cao-frame) 12px; font: 400 22px/1 var(--cao-font-display); text-transform: uppercase; }

/* ─── Under 1024: one column (photos, then the buy block), tiles two across ─── */
@media (max-width: 1023px) {
  .pdps { display: block; }
  .pdps-gallery { padding: var(--cao-frame) var(--cao-frame) 0; }
  .pdps-info { position: static; padding: 0 16px; }
  .pdps-info__in { padding: 32px 0 0; }
  .pdps-colour { margin-top: 40px; }
  .pdps-row { grid-template-columns: 96px 1fr; }
  .pdps-colour { --pdps-sw-size: 44px; }
  .pdps-sw { width: 44px; height: 44px; }
  .pdps-features, .pdps-line { margin-top: 40px; }
  .pdps-buy { margin: 32px 0 0; grid-template-columns: 1fr; }
  .pdps-line { padding-left: 0; }
  .pdps-express:empty { display: none; }
  .pdps-similar { padding-top: 48px; }
}

/* Desktop: the photo window above is the ONLY inner scroller. Nothing around it may clip (an overflow on an ancestor would break its sticky). */
@media (min-width: 1024px) {
  .pdps, .pdps-info, .pdps-info__in { overflow: visible; max-height: none; scroll-snap-type: none; }
  .cao-pdp .cao-main, .cao-product--store { overflow: visible; }
}

/* ─── Feedback + motion (docs/cao/motion-s1; assets/src/pdp/buy.js) ─────────────────────────────────────────────
   States change at once, under every motion preference: a picked swatch / chip wears aria-current the moment it is clicked; ADD TO CART
   inverts while the form goes and reads ADDED (inverted) when the page comes back with the cart count up. Only the easing between states,
   and the press scale, are motion, and they sit in the no-preference block. Transform / opacity / colour only: nothing moves the layout. */
.pdps-btn:active,
.pdps-btn.is-pressed,
.pdps-btn.is-added { background: var(--cao-ink); color: var(--cao-paper); }
.pdps-btn[aria-disabled="true"]:active { background: var(--cao-paper); color: var(--cao-mute); }
.pdps-buy__mark { order: 5; height: 0; } /* buy.js's zero-height marker after the bar: in the bar's flex slot, takes no room */

@media (max-width: 1023px) {
  .pdps-info__in > .pdps-buy.is-tucked { transform: translateY(calc(100% + 1px)); }
  .pdps-gallery { -webkit-overflow-scrolling: touch; }
}

@media (prefers-reduced-motion: no-preference) {
  .pdps-sw, .pdps-chip { transition: transform 0.12s cubic-bezier(0.25, 1, 0.5, 1); }
  .pdps-sw:active, .pdps-chip:active { transform: scale(0.94); }
  .pdps-btn { transition: background-color 0.12s ease-out, color 0.12s ease-out, transform 0.12s cubic-bezier(0.25, 1, 0.5, 1); }
  .pdps-btn:not([aria-disabled="true"]):active { transform: scale(0.98); }
  .pdps-info__in > .pdps-buy { transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); }
}

/* ─── Phone + tablet (docs/cao/mobile-s1) ────────────────────────────────────────────────────────────────────────
   1. The photographs are a swipe row (CSS scroll-snap: works with JavaScript off): 86vw frames on a phone, 58vw on a tablet, the next one
      peeking; no counter on the photographs (removed 0.1.44, Kina via jb 2026-11-25). Stacked, they were five to eight screens of photographs before the title.
   2. The buy block reads title, price, colour, size, ADD TO CART, then the words (description, features, details). Only reading blocks
      move (CSS order): the controls keep their DOM order, so tab order still follows what is seen.
   3. ADD TO CART is a bar held to the bottom of the screen (position: sticky inside the buy column) until it reaches its own place:
      it leaves with the column, so it never sits over SHOP SIMILAR or the footer, and it clears the home indicator (safe-area inset).
   4. Every control 44px; body text 14px. */
@media (max-width: 1023px) {
  .pdps-gallery {
    display: flex;
    gap: var(--cao-frame);
    padding: var(--cao-frame);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--cao-frame);
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .pdps-gallery::-webkit-scrollbar { display: none; }
  .pdps-gallery::after { content: ""; flex: 0 0 1px; }
  .pdps-frame { position: relative; flex: 0 0 58vw; scroll-snap-align: start; scroll-snap-stop: always; }
  .pdps-frame:only-child { flex-basis: 100%; }

  .pdps-info { padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .pdps-info__in { display: flex; flex-direction: column; padding-top: 24px; }
  .pdps-info__in > .pdps-title { order: 1; }
  .pdps-info__in > .pdps-line { order: 2; margin-top: 12px; }
  .pdps-info__in > .pdps-colour { order: 3; margin-top: 32px; }
  .pdps-info__in > .pdps-size { order: 4; margin-top: 24px; }
  .pdps-info__in > .pdps-buy { order: 5; }
  .pdps-info__in > .pdps-desc { order: 6; margin-top: 40px; }
  .pdps-info__in > .pdps-features { order: 7; margin-top: 40px; }
  .pdps-info__in > .pdps-disc { order: 8; margin: 32px 0 0; }

  .pdps-line__v { font-size: 16px; line-height: 1.4; }
  .pdps-chip { min-height: var(--cao-hit); min-width: 64px; }
  .pdps-disc summary { min-height: var(--cao-hit); padding: 14px 0; }

  .pdps-info__in > .pdps-buy {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 32px calc(-1 * max(16px, env(safe-area-inset-right))) 0 calc(-1 * max(16px, env(safe-area-inset-left)));
    padding: var(--cao-space-2) max(16px, env(safe-area-inset-right)) calc(var(--cao-space-2) + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    background: var(--cao-paper);
    border-top: 1px solid var(--cao-hair);
  }
}

@media (max-width: 767px) {
  .pdps-frame { flex-basis: 86vw; }
  .pdps-frame:only-child { flex-basis: 100%; }
  /* COLOR and SIZE sit above their controls: beside a label column, five 44px swatches wrapped one onto a second row at 360 */
  .pdps-colour, .pdps-size { grid-template-columns: minmax(0, 1fr); row-gap: var(--cao-space-3); }
  .pdps-colour .pdps-label { line-height: 1; }
  .pdps-desc { font-size: 14px; line-height: 1.55; }
  .pdps-desc p { margin-bottom: 12px; }
  .pdps-features ul { font-size: 14px; line-height: 1.55; }
  .pdps-colour__name { font-size: 14px; line-height: 1.4; }
  .pdps-chip { font-size: 14px; }
  .pdps-disc { font-size: 14px; line-height: 1.5; }
}


/* ─── THE SEQUENCE (PLAN-6 P2, jb 2026-11-11): ONE stacked column per colour, P L I in jb's order ───
   Every frame is a box of its OWN portrait shape (inline aspect-ratio = width / height), so the whole photo shows at the full column width,
   uncropped, with no band. Desktop: the column above (51.5%, gaps --cao-frame, scrolls with the page under the
   fixed header; since 0.1.15 it is the left window, its own viewport-high scroller). Under 1024: the same column, full width, stacked in the same order: no swipe row, no counter.
   A colour swap redraws only the boxes whose picture changes, in place (inc/pdp-photos.js drawSeq): nothing moves, nothing animates. */
@media (max-width: 1023px) {
  .pdps-gallery--seq { display: grid; overflow: visible; scroll-snap-type: none; padding: var(--cao-frame) var(--cao-frame) 0; }
  .pdps-gallery--seq::after { content: none; }
  .pdps-gallery--seq .pdps-frame { flex: none; width: 100%; scroll-snap-align: none; }
}

/* ─── THE SWIPE ROW, framed by the screen (jb 2026-11-12: "the photos at the top at slimmer widths when they go to sideways, lets have the
   margin on the bottom to the viewport so its even all the way around") ───
   Under 1024 the photographs are a sideways row. Each 2:3 frame is sized from the SCREEN: the page's frame margin (--cao-frame: 10px, 8px under
   768) on the left, at the top (the header is fixed and transparent: the row starts at the screen's top) and at the BOTTOM, so a frame is never
   taller than the screen less two margins: height = 100svh - 2 x margin, width = that x 2/3. A portrait phone cannot hold a screen-tall 2:3
   photograph, so there the frame is the row's width (the screen less a margin each side), as the home rail's card is. svh: the small
   viewport, so a phone's URL bar showing or hiding never resizes the row. align-items: start, so a frame keeps its own 2:3 (never stretched).
   THE SEQUENCE (.pdps-gallery--seq) stacks under 1024 and is not this row. Measured: docs/cao-photos/pdp-slim. */
@media (max-width: 1023px) {
  .pdps-gallery:not(.pdps-gallery--seq) { --pdps-row-h: calc(100vh - 2 * var(--cao-frame)); align-items: start; }
  @supports (height: 100svh) { .pdps-gallery:not(.pdps-gallery--seq) { --pdps-row-h: calc(100svh - 2 * var(--cao-frame)); } }
  .pdps-gallery:not(.pdps-gallery--seq) > .pdps-frame { flex: 0 0 min(100%, calc(var(--pdps-row-h) * 2 / 3)); aspect-ratio: 2 / 3; }
}
