/* ==========================================================================
   Catalogue: store toolbar, product grid/cards, product details, gallery.
   ========================================================================== */

/* ---- Card collections: 1 → centred, 2 → centred pair, 3+ → grid ------- */
.product-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));gap:var(--gap-m)}
.product-grid:has(>:only-child){grid-template-columns:minmax(0,380px);justify-content:center}
.product-grid:has(>:nth-child(2):last-child){grid-template-columns:repeat(2,minmax(0,380px));justify-content:center}

/* ---- Product card ------------------------------------------------------ */
.product-card{position:relative;display:flex;flex-direction:column;min-width:0;border:1px solid var(--line);border-radius:var(--r-m);background:color-mix(in srgb,var(--surface) 94%,transparent);overflow:hidden;transition:border-color var(--t) var(--ease),transform var(--t) var(--ease),box-shadow var(--t) var(--ease)}
.product-card:hover{border-color:var(--line-hi);transform:translateY(-3px);box-shadow:var(--shadow-2)}
.product-card:focus-within{border-color:var(--line-hi)}
.product-image{position:relative;display:block;aspect-ratio:16/10;overflow:hidden;background:var(--surface-2)}
.product-image>img{display:block;width:100%;height:100%;max-width:none;object-fit:cover;transition:width .6s var(--ease),height .6s var(--ease),margin .6s var(--ease)}
.product-card:hover .product-image>img{width:104%;height:104%;margin:-1.25% 0 0 -2%}
.image-vignette{position:absolute;inset:0;background:linear-gradient(180deg,transparent 55%,color-mix(in srgb,var(--surface) 70%,transparent));pointer-events:none}
.product-badge{position:absolute;top:12px;left:12px;padding:4px 8px;border-radius:var(--r-xs);background:color-mix(in srgb,var(--bg) 78%,transparent);border:1px solid var(--line-strong);color:var(--accent-3);font-size:10px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;backdrop-filter:blur(6px)}
.product-body{display:flex;flex-direction:column;flex:1;min-width:0;padding:18px 20px 0}
.product-meta{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px;font-size:var(--fs-label);font-weight:600;letter-spacing:.12em;text-transform:uppercase;color:var(--text-3)}
.product-version{font-family:var(--font-mono);letter-spacing:0;text-transform:none;font-size:12px;font-weight:500}
.product-body h3,.product-body h2{margin:0 0 6px;font-size:var(--fs-card);line-height:1.3;letter-spacing:-.01em}
.product-body h3 a::after{content:"";position:absolute;inset:0}
.product-body>.product-author{display:block;margin:0 0 8px;font-size:var(--fs-meta);color:var(--text-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.product-body>p{margin:0 0 18px;font-size:var(--fs-body-2);line-height:1.6;color:var(--text-2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.product-foot{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:auto;padding:14px 0 16px;border-top:1px solid var(--line)}
.visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.product-meta-end{display:inline-flex;align-items:center;gap:12px;flex-shrink:0}
.product-views{display:inline-flex;align-items:center;gap:4px;letter-spacing:.02em;white-space:nowrap}
.product-views svg{width:14px;height:14px}
.product-price{font-size:20px;font-weight:700;letter-spacing:-.01em;color:var(--price);font-variant-numeric:tabular-nums}
.product-action{position:relative;z-index:1;display:inline-flex;flex-shrink:0;align-items:center;gap:6px;font-size:var(--fs-meta);font-weight:600;white-space:nowrap;color:var(--text-2);transition:color var(--t-fast)}
.product-action>span{display:inline-block;transition:transform var(--t-fast)}
.product-card:hover .product-action{color:var(--text)}
.product-card:hover .product-action>span{transform:translateX(4px)}

/* ---- Store ------------------------------------------------------------- */
.store-content{padding-bottom:var(--section-tight)}
.store-demo-note{display:flex;align-items:center;gap:10px;font-size:var(--fs-meta)}
.store-categories{display:flex;flex-wrap:wrap;justify-content:center;gap:4px 22px;margin:22px 0 0;border-bottom:1px solid var(--line)}
.store-categories a{position:relative;padding:10px 0 12px;font-size:var(--fs-body-2);color:var(--text-2);transition:color var(--t-fast)}
.store-categories a:hover{color:var(--text)}
.store-categories a[aria-current]{color:var(--text);font-weight:600}
.store-categories a[aria-current]::after{content:"";position:absolute;left:0;right:0;bottom:-1px;height:2px;background:var(--accent)}
.store-pagination{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:16px;margin-top:var(--gap-l);padding-top:20px;border-top:1px solid var(--line)}
.store-pagination>p{margin:0;font-size:var(--fs-meta)}
.pagination{display:flex;align-items:center;flex-wrap:wrap;gap:6px}
.pagination [aria-current]{border-color:var(--line-hi);background:var(--accent-soft)}
.page-ellipsis{color:var(--text-3);padding:0 4px}

/* ---- Product details ------------------------------------------------- */
.product-page{max-width:var(--w-content);padding:24px 0 var(--section-tight)}
.product-layout{display:flex;flex-direction:column;margin-top:18px}
.product-layout>*{min-width:0}
.product-heading{display:flex;flex-direction:column;align-items:center;margin-bottom:var(--gap-l);text-align:center}
.product-heading h1{margin:0 0 10px;font-size:var(--fs-h1)}
.product-heading .product-author{margin:-4px 0 12px;font-size:var(--fs-meta);color:var(--text-3);overflow-wrap:anywhere}
.product-heading .product-author strong{color:var(--text-2);font-weight:600}
.product-intro{max-width:var(--measure);margin:0 auto;font-size:17px;color:var(--text-2)}

.gallery{position:relative;border:1px solid var(--line);border-radius:var(--r-l);background:var(--surface);overflow:hidden}
.gallery-main{position:relative;display:block;width:100%;padding:0;border:0;background:#000;color:var(--text)}
.gallery-main>img{display:block;width:100%;height:auto;aspect-ratio:16/9;object-fit:contain}
.gallery-arrow{position:absolute;top:calc(50% - 50px);width:40px;height:40px;border:1px solid var(--line-strong);border-radius:var(--r-s);background:color-mix(in srgb,var(--bg) 70%,transparent);color:var(--text);backdrop-filter:blur(6px)}
.gallery-arrow:hover{border-color:var(--line-hi)}
.gallery-arrow.previous{left:14px}
.gallery-arrow.next{right:14px}
.gallery:has(.gallery-thumbs>button:only-of-type) .gallery-arrow{display:none}
/* Optional product video (below the gallery). Centred heading like the other product sections. */
.product-video{margin-top:var(--gap-m)}
.product-video>h2{display:flex;align-items:center;justify-content:center;gap:10px;margin:0 0 12px;font-size:var(--fs-h3)}
.product-video>h2 .icon{color:var(--accent-3)}
.product-video-frame{overflow:hidden;border:1px solid var(--line);border-radius:var(--r-l);background:#000}
.product-video-frame>video{display:block;width:100%;height:auto;aspect-ratio:16/9;background:#000}
.admin-video-current{display:grid;gap:10px;padding:4px 0 16px}
.admin-video-current>video{display:block;width:100%;max-width:640px;height:auto;aspect-ratio:16/9;border:1px solid var(--line);border-radius:var(--r-m);background:#000}
.admin-video-current>p{margin:0;font-size:var(--fs-meta);color:var(--text-2);overflow-wrap:anywhere}
.admin-video-current form{margin:0}
.gallery-thumbs{display:flex;align-items:center;gap:10px;padding:12px 14px;overflow-x:auto;scrollbar-width:none;border-top:1px solid var(--line)}
.gallery-thumbs::-webkit-scrollbar{display:none}
.gallery-thumbs>button{flex-shrink:0;padding:0;border:2px solid transparent;border-radius:var(--r-s);background:none;overflow:hidden;opacity:.55;transition:opacity var(--t-fast),border-color var(--t-fast)}
.gallery-thumbs>button:hover{opacity:.85}
.gallery-thumbs>button[aria-pressed=true]{border-color:var(--accent);opacity:1}
.gallery-thumbs img{display:block;width:76px;height:48px;object-fit:cover}
.gallery-caption{margin-left:auto;font-size:12px;color:var(--text-3)}

/* Purchase bar — directly under the gallery, full content width */
.product-aside{margin-top:var(--gap-m)}
.purchase-panel{display:grid;grid-template-columns:auto minmax(0,1fr) auto;grid-template-areas:"price note action" "facts facts facts";align-items:center;gap:14px 28px;padding:22px 26px;border:1px solid var(--line-strong);border-radius:var(--r-l);background:color-mix(in srgb,var(--surface-2) 88%,transparent);box-shadow:var(--shadow-1)}
.purchase-price{grid-area:price;display:flex;flex-direction:column;gap:2px}
.purchase-price span{font-size:var(--fs-label);font-weight:600;letter-spacing:.14em;text-transform:uppercase;color:var(--text-3)}
.purchase-price strong{font-size:34px;font-weight:700;letter-spacing:-.02em;line-height:1.1;color:var(--price);font-variant-numeric:tabular-nums}
.purchase-panel>p{grid-area:note;margin:0;font-size:var(--fs-body-2);color:var(--text-2)}
.purchase-panel>form,.purchase-panel>.button{grid-area:action;margin:0}
.purchase-panel .button{min-width:220px;min-height:48px}
/* Free products: the digital-supply acknowledgement sits on its own row under the action. */
.purchase-panel.has-consent{grid-template-areas:"price note action" "consent consent consent" "facts facts facts"}
.purchase-panel>.free-consent{grid-area:consent;padding-top:14px;border-top:1px solid var(--line);text-align:left}
.purchase-panel>.purchase-notice{color:var(--text);font-weight:600}
.free-consent a{color:var(--accent-3)}
.product-facts{grid-area:facts;display:flex;flex-wrap:wrap;justify-content:center;gap:8px 32px;margin:4px 0 0;padding-top:14px;border-top:1px solid var(--line)}
.product-facts>div{display:flex;gap:8px;font-size:var(--fs-meta)}
.product-facts dt{color:var(--text-3)}
.product-facts dd{margin:0;color:var(--text);font-weight:500}

/* Documentation shortcuts */
.documentation-links{display:grid;margin-inline:auto;width:100%;grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));gap:var(--gap-s);margin-top:var(--gap-m)}
.documentation-links a{display:flex;align-items:center;gap:14px;padding:14px 16px;border:1px solid var(--line);border-radius:var(--r-m);background:color-mix(in srgb,var(--surface) 80%,transparent);transition:border-color var(--t-fast)}
.documentation-links a:hover{border-color:var(--line-hi)}
.documentation-links a>.icon{color:var(--accent-3)}
.documentation-links span{display:grid;gap:2px;flex:1;min-width:0}
.documentation-links strong{font-size:var(--fs-body-2)}
.documentation-links small{color:var(--text-3)}
.documentation-links b{color:var(--text-3);font-weight:400}

/* Product information — an open, divided document rather than stacked boxes */
.product-info{margin-top:clamp(36px,4vw,52px);padding-top:28px;border-top:1px solid var(--line)}
.product-info>h2{display:flex;align-items:center;gap:10px;margin:0 0 8px;font-size:var(--fs-h3)}
.product-info>h2 .icon{color:var(--accent-3)}
.product-info details{border-bottom:1px solid var(--line)}
.product-info summary{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:18px 0;font-size:var(--fs-body);font-weight:600;color:var(--text);cursor:pointer;list-style:none}
.product-info summary::-webkit-details-marker{display:none}
.product-info summary span{display:grid;place-items:center;width:26px;height:26px;color:var(--text-2);font-size:20px;font-weight:300;transition:transform var(--t-fast),color var(--t-fast)}
.product-info details[open] summary span{transform:rotate(45deg);color:var(--accent-3)}
.product-info .prose{max-width:none;padding:0 0 22px;color:var(--text-2);line-height:1.8;overflow-wrap:anywhere}
/* Product text formatting (product_rich_text): paragraphs, lists, sub-headings, code. */
.prose>p{margin:0 0 14px}
.prose>p:last-child,.prose>ul:last-child,.prose>pre:last-child{margin-bottom:0}
.prose>ul{margin:0 0 14px;padding-left:1.3em}
.prose>ul>li{margin:2px 0}
.prose>ul>li::marker{color:var(--accent-3)}
.prose>h4{margin:18px 0 6px;font-size:var(--fs-body);font-weight:600;color:var(--text)}
.prose>h4:first-child{margin-top:0}
.prose strong{font-weight:600;color:var(--text)}
.prose>.gpl-note{margin:0 0 16px;padding:12px 14px;border:1px solid var(--accent-3);border-radius:10px;color:var(--text)}
.prose em{font-style:italic}
.prose code{padding:1px 6px;border:1px solid var(--line);border-radius:6px;background:color-mix(in srgb,var(--surface-2) 75%,transparent);color:var(--text);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;font-size:.88em}
.prose>pre.prose-code{margin:0 0 14px;padding:14px 16px;overflow-x:auto;border:1px solid var(--line);border-radius:var(--r-m);background:color-mix(in srgb,var(--surface-2) 75%,transparent);line-height:1.55;white-space:pre}
.prose>pre.prose-code>code{padding:0;border:0;background:none;font-size:13px;white-space:pre;overflow-wrap:normal}
.important-details{margin-top:var(--gap-l);padding:18px 20px;border:1px solid var(--line);border-radius:var(--r-m);background:color-mix(in srgb,var(--surface) 80%,transparent)}
.important-details h2{display:flex;align-items:center;gap:10px;margin:0 0 6px;font-size:var(--fs-body);font-weight:600}
.important-details h2 .icon{width:18px;height:18px;color:var(--accent-3)}
.important-details .prose{font-size:var(--fs-body-2);line-height:1.7;color:var(--text-2);overflow-wrap:anywhere}
.important-details .prose>p{margin:0 0 10px}

@media(max-width:760px){
  .purchase-panel{grid-template-columns:minmax(0,1fr);grid-template-areas:"price" "note" "action" "facts";text-align:center;justify-items:center}
  .purchase-panel.has-consent{grid-template-areas:"price" "note" "consent" "action" "facts"}
  .purchase-price{align-items:center}
  .purchase-panel>form,.purchase-panel>.button,.purchase-panel .button{width:100%}
  .product-facts{justify-content:center}
}
@media(max-width:600px){
  .product-grid:has(>:nth-child(2):last-child){grid-template-columns:minmax(0,1fr)}
  .gallery-caption{display:none}
  .gallery-thumbs img{width:60px;height:40px}
  .purchase-price strong{font-size:30px}
}
/* Product badges: one fixed colour per badge, identical in every theme (all themes are dark). */
.product-badge.badge-new{--badge:#5cc8ff}
.product-badge.badge-popular{--badge:#ff8a5c}
.product-badge.badge-best-seller{--badge:#f5c451}
.product-badge.badge-updated{--badge:#b79cff}
.product-badge.badge-free{--badge:#46d39a}
.product-badge[class*="badge-"]{color:var(--badge);border-color:color-mix(in srgb,var(--badge) 55%,transparent);background:color-mix(in srgb,var(--badge) 16%,color-mix(in srgb,var(--bg) 82%,transparent))}
