/* Amazon banners on adult pages (spec: private/plan/spec-amz.md; markup: private/views/amz-banner.php; PHP: private/amz.php).
   Loaded by layout.php ONLY on pages that render banners (rq_amz_head). Light + dark come from the site tokens in style.css,
   right-to-left from logical properties.
   VISIBILITY: every .amz is display:none until <html> has the class amz-on. The server sets it for the preview host and the tester
   browser; the inline head script sets it for a US time zone. Both happen before the first paint, so nothing moves (no layout
   shift) and a visitor outside the US never sees, downloads or clicks anything.
   LOOK: a flat, tinted "tear-off page" (surface-2, no shadow) so it never competes with the site's white cards and gold buttons.
   The one bold element is the art panel: an illustration when its file exists, else a CSS pattern per category (logic grid,
   interlocking rings, board squares, book spines, cube stickers) with the category icon. A dashed "perforation" separates art and text. */

.amz { display: none; --amz-c: #f2b705; --amz-deep: #22186a; font: 400 1rem/1.45 var(--font); color: var(--ink); text-align: start; }
html.amz-on .amz { display: block; }
body.running .amz { display: none !important; } /* never while a test or challenge runs (runner.js, club.js add body.running) */
@media print { .amz { display: none !important; } } /* never on paper (Amazon: no links in printed material) */

/* category colours: only the art panel uses them, never text */
.amz[data-cat="puzzle-books"] { --amz-c: #f2b705; --amz-deep: #22186a; }
.amz[data-cat="hands-on"] { --amz-c: #2dd4bf; --amz-deep: #0f3a3d; }
.amz[data-cat="strategy-games"] { --amz-c: #a78bfa; --amz-deep: #1e1550; }
.amz[data-cat="thinking-books"] { --amz-c: #fb7185; --amz-deep: #3a1029; }
.amz[data-cat="smart-toys"] { --amz-c: #a3e635; --amz-deep: #1c2b0b; } /* lime on deep moss: 9.9:1, cream 13.1:1 (15 Nov) */

/* the card = one link (.article a and other content link rules lose to .amz .amz-link: 0,2,0) */
.amz .amz-link { position: relative; display: grid; align-items: center; gap: 6px 18px; overflow: hidden; background: var(--surface-2); color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 14px; padding: 0; }
.amz .amz-link:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.amz .amz-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* art panel: picture (img, or a background on the leaderboard) or the CSS pattern */
.amz .amz-art { display: block; width: 100%; height: 100%; object-fit: cover; background-color: var(--amz-deep); background-size: cover; background-position: center; border-inline-end: 2px dashed color-mix(in srgb, var(--ink) 22%, transparent); }
.amz .amz-art-css { display: grid; place-items: center; }
.amz .amz-art-css .ic { width: 26px; height: 26px; padding: 9px; box-sizing: content-box; border-radius: 50%; background: var(--amz-deep); color: var(--amz-c); box-shadow: 0 0 0 2px var(--amz-c); }
.amz[data-cat="puzzle-books"] .amz-art-css {
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--amz-c) 55%, transparent) 2px, transparent 2px), linear-gradient(color-mix(in srgb, var(--amz-c) 55%, transparent) 2px, transparent 2px),
    linear-gradient(90deg, rgb(255 255 255 / .13) 1px, transparent 1px), linear-gradient(rgb(255 255 255 / .13) 1px, transparent 1px);
  background-size: 36px 36px, 36px 36px, 12px 12px, 12px 12px; background-position: center;
}
.amz[data-cat="hands-on"] .amz-art-css {
  background-image: repeating-radial-gradient(circle at 0 100%, transparent 0 13px, color-mix(in srgb, var(--amz-c) 50%, transparent) 13px 15px),
    repeating-radial-gradient(circle at 100% 0, transparent 0 13px, color-mix(in srgb, var(--amz-c) 30%, transparent) 13px 15px);
}
.amz[data-cat="strategy-games"] .amz-art-css {
  background-image: conic-gradient(color-mix(in srgb, var(--amz-c) 32%, transparent) 25%, transparent 0 50%, color-mix(in srgb, var(--amz-c) 32%, transparent) 0 75%, transparent 0);
  background-size: 22px 22px; background-position: center;
}
.amz[data-cat="thinking-books"] .amz-art-css {
  background-image: linear-gradient(transparent 80%, rgb(255 255 255 / .28) 80% 83%, transparent 83%),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--amz-c) 58%, transparent) 0 9px, transparent 9px 12px, rgb(255 255 255 / .16) 12px 19px, transparent 19px 23px, color-mix(in srgb, var(--amz-c) 30%, transparent) 23px 30px, transparent 30px 34px);
}
/* smart-toys: the stickers of a twisty cube face (18 px tiles in four tints, 4 px gaps); all layers start at 0 0 so the gaps and tints line up */
.amz[data-cat="smart-toys"] .amz-art-css {
  background-image: linear-gradient(90deg, var(--amz-deep) 0 4px, transparent 4px), linear-gradient(var(--amz-deep) 0 4px, transparent 4px),
    conic-gradient(color-mix(in srgb, var(--amz-c) 42%, transparent) 0 25%, color-mix(in srgb, var(--amz-c) 16%, transparent) 0 50%, rgb(244 239 226 / .14) 0 75%, color-mix(in srgb, var(--amz-c) 28%, transparent) 0);
  background-size: 22px 22px, 22px 22px, 44px 44px; background-position: 0 0;
}
/* PRODUCT PICTURE (owner 15 Nov): a banner whose "art" is a product key (RQ_AMZ_ITEM_ARTS) shows its own square picture,
   public/assets/img/amz/items/<key>.webp (400 x 400, one object on deep moss). The square stands WHOLE in the art panel (contain),
   centred on the moss ground, so a wide panel never cuts the object; its two open sides fade into the ground, so no picture edge
   shows. The square is sized by height + aspect-ratio (width on the tall side rail) before the file loads: no layout shift.
   Markup (amz-banner.php): span.amz-art.amz-art-sq > img.amz-obj (leaderboard: span.amz-obj with a background, as before). */
.amz .amz-art-sq { display: flex; align-items: center; justify-content: center; overflow: hidden; background-color: #1c2b0b; }
.amz .amz-obj { display: block; flex: none; width: auto; height: 100%; max-width: none; aspect-ratio: 1; object-fit: cover; background-position: center; background-size: cover; background-repeat: no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.amz-side .amz-obj { width: 100%; height: auto;
  -webkit-mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent); }

/* text */
.amz .amz-body { display: grid; gap: 3px; min-width: 0; align-content: center; }
.amz .amz-tag { justify-self: start; font: 600 .72rem/1 var(--font); color: var(--muted); border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 8px; }
.amz .amz-h { font: 700 1.08rem/1.25 var(--font-h); color: var(--ink); overflow-wrap: anywhere; }
.amz .amz-line { font-size: .92rem; line-height: 1.4; color: var(--muted); }
.amz .amz-cta { display: inline-flex; align-items: center; justify-content: center; gap: 6px; justify-self: start; white-space: nowrap; border: 2px solid var(--ink); color: var(--ink); border-radius: 999px; padding: 7px 14px; font: 700 .9rem/1.2 var(--font); }
.amz .amz-link:hover .amz-cta { background: var(--ink); color: var(--surface); }
.amz .amz-ext { flex: none; }
[dir="rtl"] .amz .amz-ext { transform: scaleX(-1); }
.amz .amz-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.amz .amz-disc { margin: 6px 4px 0; font-size: .74rem; line-height: 1.4; color: var(--muted); }

/* LEADERBOARD (.amz-lb): first banner of the page, full content width up to 970px */
.amz-lb { width: 100%; max-width: 970px; margin: 2px auto 4px; }
.amz-lb .amz-link { grid-template-columns: 150px minmax(0, 1fr) auto; min-height: 100px; padding-inline-end: 18px; }
.amz-lb .amz-art { align-self: stretch; min-height: 100px; }
.amz-lb .amz-body { padding-block: 10px; }
.amz-lb .amz-line { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  .amz-lb .amz-link { grid-template-columns: 96px minmax(0, 1fr); gap: 6px 14px; padding-inline-end: 14px; }
  .amz-lb .amz-art { grid-row: 1 / span 2; min-height: 112px; }
  .amz-lb .amz-body { padding-block: 10px 0; align-self: end; }
  .amz-lb .amz-line { display: none; }
  .amz-lb .amz-cta { align-self: start; margin-bottom: 10px; padding: 5px 12px; font-size: .85rem; }
}

/* INLINE (.amz-in): between sections, up to 760px */
.amz-in { width: 100%; max-width: 760px; margin: 6px auto; }
.amz-in .amz-link { grid-template-columns: 200px minmax(0, 1fr); grid-template-areas: "art body" "art cta"; gap: 10px 20px; padding-inline-end: 18px; }
.amz-in .amz-art { grid-area: art; width: 200px; height: 150px; }
.amz-in .amz-body { grid-area: body; align-self: end; padding-top: 12px; }
.amz-in .amz-cta { grid-area: cta; align-self: start; margin-bottom: 12px; }
.article .amz-in { margin: 1.8em auto; }
@media (max-width: 560px) {
  .amz-in .amz-link { grid-template-columns: 112px minmax(0, 1fr); grid-template-areas: "art body" "cta cta"; gap: 10px 14px; padding-inline-end: 14px; }
  .amz-in .amz-art { width: 112px; height: 84px; align-self: start; }
  .amz-in .amz-body { align-self: center; padding-top: 10px; }
  .amz-in .amz-cta { justify-self: stretch; margin-inline: 12px 0; }
}

/* FOOTER (.amz-ft): last block before the site footer, quieter (no line on phones) */
.amz-ft { width: 100%; max-width: 970px; margin: 10px auto 0; }
.amz-ft .amz-link { grid-template-columns: 120px minmax(0, 1fr) auto; padding-inline-end: 18px; }
.amz-ft .amz-art { width: 120px; height: 80px; }
.amz-ft .amz-body { padding-block: 8px; }
.amz-ft .amz-line { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 640px) {
  .amz-ft .amz-link { grid-template-columns: 84px minmax(0, 1fr); gap: 6px 14px; padding-inline-end: 14px; }
  .amz-ft .amz-art { width: 84px; height: 56px; align-self: start; }
  .amz-ft .amz-line { display: none; }
  .amz-ft .amz-cta { grid-column: 1 / -1; justify-self: stretch; margin: 0 0 12px; margin-inline-start: 12px; }
}

/* SIDE (.amz-side): fixed rail in the free margin, only on wide and tall screens (>= 1500 x 760). Takes no space in the page. */
html.amz-on .amz.amz-side { display: none; }
@media (min-width: 1500px) and (min-height: 760px) {
  html.amz-on .amz.amz-side { display: block; position: fixed; z-index: 30; top: 120px; width: 160px; inset-inline-end: max(12px, calc((100vw - 1140px) / 2 - 176px)); }
}
.amz-side .amz-link { grid-template-columns: 1fr; gap: 8px; padding-bottom: 12px; }
.amz-side .amz-art { height: auto; aspect-ratio: 2 / 3; border-inline-end: 0; border-bottom: 2px dashed color-mix(in srgb, var(--ink) 22%, transparent); }
.amz-side .amz-body, .amz-side .amz-cta { margin-inline: 10px; }
.amz-side .amz-h { font-size: 1rem; }
.amz-side .amz-line { font-size: .85rem; }
.amz-side .amz-cta { justify-self: stretch; white-space: normal; text-align: center; padding: 7px 6px; font-size: .8rem; }
.amz-side .amz-ext { display: none; }
.amz-side .amz-disc { font-size: .7rem; margin-inline: 2px; }

/* spacing next to the site's own blocks (the banners' own margins are small so grids with a gap, like .res-body and .verify, stay even) */
section.wrap:not(.res-body) > .amz-lb:first-child { margin-top: 26px; } /* blog post: first block under the hero */
.test-main > .amz { margin-top: 36px; } /* test start page: after the start card, between the text sections */
.prose-sec + .amz { margin-top: 40px; } /* after any text section (blog footer strip, test page) */

/* Blog list (/blog, spec-amz 4.5): leaderboard right under the hero, then the category tabs; grid banners span a whole row of cards and
   hide while a category tab filters the cards (their place is only right in the full list) */
section.wrap.test-main > .amz-lb:first-child { margin-top: 0; }
.test-main > .amz + .blog-filter { margin-top: 24px; }
.cgrid > .amz { grid-column: 1 / -1; }
.cgrid > .amz-in { margin: 8px auto; }
.cgrid:has(> .vcard[hidden]) > .amz { display: none !important; }

/* Blog post (owner 15 Nov): the leaderboard sits in the hero, between the breadcrumb and the title */
.test-hero .amz-lb { margin: 14px 0 18px; }

/* FLOATING CARD "Smart puzzles from Amazon" (.amz-pop, spec-amz 4.6; markup views/amz-pop.php; script inline there).
   Adult pages only, once per page, never in print or while a test or challenge runs. Shown after 35% scroll or 8 s; Close hides it
   7 days. One markup, three layouts:
   - phones and tablets (< 1240 px): a small pill at the bottom end corner above the safe area that shrinks to a round 44 px glyph
     button 4 s after it appears (.is-mini) and fades out while a button or link sits under it (.is-dodge, script); tap = a bottom
     sheet with 3 products;
   - laptops (1240 px+): a slim tab docked to the end edge in the lower half (inside the page margin, never over content);
     click = a 300 px panel docked to that edge;
   - wide laptops and screens (1520 x 640+, e.g. 1536 x 674): a slim card docked to the end edge inside the empty margin, open from
     the start, 14 px clear of the 1140 px content;
   - pages with the 160 px side rail banner (1500 x 760+): the tab or card docks to the START edge, so the two never meet.
   Colours: the smart-toys pair (moss #1c2b0b, lime #a3e635, cream #f4efe2: cream 13.1:1, lime 9.9:1 on moss) for the pill, the tab
   and the card head; everything else uses the site tokens (light + dark). RTL: logical properties (tab corners set per direction).
   Open, the fixed box spans the VISIBLE width (both insets set, pointer-events off) and the card sizes in % of it, so a scrollbar
   never pushes it off-screen. */
.amz-pop { --pop-moss: #1c2b0b; --pop-lime: #a3e635; --pop-cream: #f4efe2; display: none; position: fixed; z-index: 35; inset-inline-end: 12px; bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 8px)); font: 400 1rem/1.45 var(--font); color: var(--ink); text-align: start; }
html.amz-on .amz-pop:not([hidden]) { display: block; }
body.running .amz-pop { display: none !important; }
@media print { .amz-pop { display: none !important; } }
.amz-pop[data-state="closed"] .amz-pop-card, .amz-pop[data-state="open"] .amz-pop-pill { display: none; }
.amz-pop[data-state="open"] { inset-inline-start: 12px; pointer-events: none; }
.amz-pop[data-state="open"] .amz-pop-card { pointer-events: auto; margin-inline-start: auto; }
@media (prefers-reduced-motion: no-preference) {
  .amz-pop { transition: opacity .35s ease, translate .35s ease, visibility .35s; }
  .amz-pop:not(.is-in) { opacity: 0; translate: 0 10px; }
}
@media (max-width: 1239px) {
  .amz-pop.is-mini .amz-pop-pill { justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
  .amz-pop.is-mini .amz-pop-pill span { display: none; }
  .amz-pop.is-mini .amz-pop-pill .ic { width: 20px; height: 20px; }
  .amz-pop.is-dodge { opacity: 0; visibility: hidden; pointer-events: none; }
}
.amz-pop-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding-block: 8px; padding-inline: 12px 16px; border: 0; border-radius: 999px; background: var(--pop-moss); color: var(--pop-cream); font: 700 .88rem/1.2 var(--font); cursor: pointer; box-shadow: 0 6px 20px rgb(10 8 30 / .25), inset 0 0 0 1px rgb(163 230 53 / .35); }
.amz-pop-pill .ic { flex: none; color: var(--pop-lime); }
.amz-pop-pill:hover { background: #26390f; }
.amz-pop-pill:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.amz-pop-card { container: amzpop / inline-size; width: min(420px, 100%); max-height: min(560px, calc(100vh - 96px)); overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 48px rgb(10 8 30 / .28); }
[data-theme="dark"] .amz-pop-card { box-shadow: 0 18px 48px rgb(0 0 0 / .55); }
.amz-pop-card:focus { outline: none; }
.amz-pop-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.amz-pop-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "tag min x" "h h h"; align-items: center; gap: 0 2px; padding: 8px; padding-inline: 16px 6px; background: var(--pop-moss); color: var(--pop-cream); }
.amz-pop-tag { grid-area: tag; justify-self: start; font: 600 .7rem/1 var(--font); color: var(--pop-cream); border: 1px solid rgb(244 239 226 / .4); border-radius: 999px; padding: 4px 8px; }
.amz-pop-h { grid-area: h; margin: 2px 0 8px; margin-inline-end: 10px; font: 700 1.02rem/1.3 var(--font-h); color: var(--pop-cream); }
.amz-pop-head button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: var(--pop-cream); cursor: pointer; }
.amz-pop-min { grid-area: min; }
.amz-pop-x { grid-area: x; }
.amz-pop-head button:hover { background: rgb(244 239 226 / .12); }
.amz-pop-head button:focus-visible { outline: 3px solid var(--pop-lime); outline-offset: -3px; }
.amz-pop-list { list-style: none; margin: 0; padding: 4px 0; }
.amz-pop-list > .amz + .amz { border-top: 1px solid var(--line); }
/* product row (owner 15 Nov): a SQUARE thumbnail on the start side (64 px; 56 px in the slim card) + name, short line and "See it on
   Amazon" beside it. The thumbnail is the product picture (items/<key>.webp, square) or, until it exists, a centred square crop of the
   smart-toys picture; object-fit cover + aspect-ratio 1, so the row never changes height while it loads. Never a wide strip. */
.amz-pop-link { display: grid; grid-template-columns: 64px minmax(0, 1fr); grid-template-areas: "art txt" "art cta"; gap: 3px 12px; align-items: center; padding: 10px 14px; color: var(--ink); text-decoration: none; }
.amz-pop-link:hover { background: var(--surface-2); }
.amz-pop-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: 10px; }
.amz-pop .amz-art { grid-area: art; align-self: center; width: 64px; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border-inline-end: 0; background-color: #1c2b0b; }
.amz-pop .amz-art-css .ic { width: 14px; height: 14px; padding: 5px; box-shadow: 0 0 0 1.5px var(--amz-c); }
.amz-pop-txt { grid-area: txt; align-self: end; display: grid; gap: 1px; min-width: 0; }
.amz-pop-txt b { font: 700 .9rem/1.3 var(--font); color: var(--ink); overflow-wrap: anywhere; }
.amz-pop-txt span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .8rem; line-height: 1.35; color: var(--muted); }
.amz-pop-cta { grid-area: cta; align-self: start; display: inline-flex; align-items: center; gap: 5px; justify-self: start; font: 700 .8rem/1.2 var(--font); color: var(--ink); }
.amz-pop-cta .ic { color: var(--accent); }
.amz-pop-link:hover .amz-pop-cta { text-decoration: underline; text-underline-offset: 3px; }
.amz-pop .amz-disc { margin: 0; padding: 10px 16px 14px; border-top: 1px solid var(--line); font-size: .72rem; }
/* short display fields (popup pop_brand / pop_name): only the stacked tiles of the slim margin card show them */
.amz-pop-txt .amz-pop-brand, .amz-pop-txt .amz-pop-name { display: none; }
/* the slim margin card (160-260 px): name + link only, beside the square */
@container amzpop (max-width: 279px) {
  .amz-pop-txt span { display: none; }
}
/* the slim margin card (screens 1520-1699 px wide, card 150-190 px): STACKED TILES (owner 15 Nov) = the square centred on top, the
   brand eyebrow, the short name (2 lines max, breaks only at spaces: no hyphen, no mid-word break) and "See it on Amazon". The square
   follows the screen height so the head, the three tiles (names on 1-2 lines) and the disclosure fit without scrolling: 96 px from
   about 760 px tall (795 on fr/es/ar pages), 68 px at 674 (the owner's laptop), 52 px minimum. */
@container amzpop (max-width: 229px) {
  .amz-pop-head { padding: 6px; padding-inline: 12px 4px; }
  .amz-pop-head button { width: 32px; height: 32px; }
  .amz-pop-tag { white-space: nowrap; font-size: .64rem; padding: 3px 6px; }
  .amz-pop-h { font-size: .82rem; line-height: 1.2; margin: 0 0 5px; margin-inline-end: 6px; }
  .amz-pop-list { padding: 0; }
  .amz-pop-link { grid-template-columns: minmax(0, 1fr); grid-template-areas: "art" "txt" "cta"; justify-items: center; gap: 0; padding: 8px 10px; text-align: center; }
  .amz-pop .amz-art { width: clamp(52px, calc((100vh - 468px) / 3), 96px); border-radius: 12px; margin-bottom: 6px; }
  html:not([lang="en"]) .amz-pop .amz-art { width: clamp(52px, calc((100vh - 505px) / 3), 96px); } /* longer head + translated disclosure */
  .amz-pop-txt { align-self: auto; justify-items: center; gap: 1px; width: 100%; }
  .amz-pop-txt .amz-pop-full, .amz-pop-txt .amz-pop-line { display: none; }
  .amz-pop-txt .amz-pop-brand { display: block; font: 700 .64rem/1.25 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .amz-pop-txt .amz-pop-name { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: 700 .82rem/1.25 var(--font); color: var(--ink); overflow-wrap: normal; word-break: normal; -webkit-hyphens: manual; hyphens: manual; }
  .amz-pop-cta { justify-self: center; margin-top: 4px; gap: 4px; font-size: .74rem; }
  .amz-pop .amz-disc { padding: 6px 10px 8px; font-size: .62rem; line-height: 1.3; text-align: center; }
}
/* laptops: slim tab on the end edge, lower half; open = panel docked to that edge */
@media (min-width: 1240px) {
  .amz-pop { inset-inline-end: 0; bottom: 22vh; }
  .amz-pop[data-state="open"] { inset-inline: 16px; bottom: 24px; }
  .amz-pop-pill { writing-mode: vertical-rl; min-height: 0; gap: 10px; padding: 14px 9px; border-radius: 12px 0 0 12px; font-size: .84rem; box-shadow: 0 6px 20px rgb(10 8 30 / .22), inset 0 0 0 1px rgb(163 230 53 / .3); }
  [dir="rtl"] .amz-pop-pill { border-radius: 0 12px 12px 0; }
  .amz-pop-card { width: 300px; max-height: calc(100vh - 140px); }
}
/* wide laptops and screens: the card sits in the empty margin beside the content (1140 px), 6 px from the screen edge and 14 px clear
   of the content. Open, the box is the visible width minus 12 px, so (100% - 1128px) / 2 - 20px = the margin minus 6 px minus 14 px.
   1520-1699 px: at most 190 px (stacked tiles); 1700 px+: up to 260 px (rows). Below the 64 px header (max-height). Script query: 1520 x 640. */
@media (min-width: 1520px) and (min-height: 640px) {
  .amz-pop[data-state="open"] { inset-inline: 6px; bottom: 12px; }
  .amz-pop-card { width: clamp(150px, calc((100% - 1128px) / 2 - 20px), 190px); max-height: calc(100vh - 80px); }
}
@media (min-width: 1700px) and (min-height: 640px) {
  .amz-pop-card { width: clamp(150px, calc((100% - 1128px) / 2 - 20px), 260px); }
}
/* the side rail banner owns the end margin: dock to the start edge */
@media (min-width: 1500px) and (min-height: 760px) {
  body:has(.amz-side) .amz-pop { inset-inline-end: auto; inset-inline-start: 0; }
  body:has(.amz-side) .amz-pop[data-state="open"] { inset-inline: 16px; }
  body:has(.amz-side) .amz-pop[data-state="open"] .amz-pop-card { margin-inline-start: 0; margin-inline-end: auto; }
  body:has(.amz-side) .amz-pop-pill { border-radius: 0 12px 12px 0; }
  [dir="rtl"] body:has(.amz-side) .amz-pop-pill { border-radius: 12px 0 0 12px; }
}
@media (min-width: 1520px) and (min-height: 640px) {
  body:has(.amz-side) .amz-pop[data-state="open"] { inset-inline: 6px; }
}

[dir="rtl"] .amz .amz-h { line-height: 1.45; }
