/* Shared curved gallery. All document restyling is gated by the optional feature. */
.curved-gallery{--gallery-thumb-width:68px;--gallery-thumb-height:92px;--gallery-selected:var(--persona-lilac,var(--acc-soft));display:flex;flex-direction:column;gap:12px;min-width:0;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;padding:16px;background:var(--panel);color:var(--ink);scrollbar-width:thin}
.gallery-hero{position:relative;display:block;flex:none;width:100%;height:clamp(180px,30dvh,360px);padding:0;border:1px solid var(--line);border-radius:18px;overflow:hidden;background:var(--panel2);cursor:pointer}
.gallery-layer{position:absolute;inset:0;display:grid;place-items:center;opacity:0;transition:opacity 220ms ease;pointer-events:none}
.gallery-layer.is-front{opacity:1}.gallery-layer>img{display:block;width:100%;height:100%;object-fit:contain}
.gallery-hero.is-loading .gallery-layer.is-front{opacity:.35}
.gallery-file{display:flex;width:100%;height:100%;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:12px;background:linear-gradient(150deg,var(--gallery-selected),var(--panel));color:var(--ink)}
.gallery-file-symbol{font-size:44px;line-height:1.1;color:var(--acc-text)}.gallery-file>b{font-size:14px;letter-spacing:.08em}
.gallery-file-name{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;max-width:100%;overflow:hidden;overflow-wrap:anywhere;text-align:center;font-size:13px}
.gallery-info{flex:none;opacity:1;transition:opacity 90ms}.gallery-info.is-changing{opacity:.25}
.gallery-title{margin:0;font-size:18px;font-weight:750;line-height:1.25;overflow-wrap:anywhere}
.gallery-detail{margin:5px 0 0;color:var(--ink2);font-size:12px;line-height:1.45;overflow-wrap:anywhere}
.gallery-actions{display:flex;flex:none;gap:8px}.gallery-actions .btn{flex:1;min-height:44px;background:var(--panel);border-color:var(--line2)}.gallery-actions .is-danger{color:var(--err)}
.gallery-rail{position:relative;display:flex;flex:none;gap:10px;width:100%;min-width:0;overflow-x:auto;overflow-y:hidden;padding:18px calc(50% - var(--gallery-thumb-width)/2);scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain;overflow-anchor:none;-webkit-overflow-scrolling:touch}
.gallery-rail::-webkit-scrollbar{display:none}
.gallery-slot{display:block;flex:none;width:var(--gallery-thumb-width);height:var(--gallery-thumb-height);scroll-snap-align:center}
.gallery-option{position:relative;display:block;width:100%;height:100%;padding:0;border:2px solid transparent;border-radius:12px;overflow:hidden;background:var(--panel2);transform-origin:center;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;cursor:pointer}
.gallery-option[aria-selected=true]{border-color:var(--acc-text);box-shadow:0 0 0 3px var(--gallery-selected)}
.gallery-option>img{display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}
.gallery-option .gallery-file{padding:5px;gap:5px}.gallery-option .gallery-file-symbol{font-size:22px}.gallery-option .gallery-file>b{font-size:10px}.gallery-option .gallery-file-name{font-size:9px}
.gallery-spacer{display:block;flex:none;height:1px;pointer-events:none}
.gallery-count{flex:none;text-align:center;color:var(--ink2);font-size:12px;padding-bottom:4px;font-variant-numeric:tabular-nums}
.gallery-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);display:grid;place-items:center;width:40px;height:40px;border-radius:50%;background:#202638b3;color:white;font-size:20px;pointer-events:none}
.gallery-option .gallery-play{width:24px;height:24px;font-size:12px}
@media(prefers-reduced-motion:reduce){.gallery-layer,.gallery-info{transition:none}.gallery-option{transform:none!important}.gallery-rail{scroll-behavior:auto}}
/* Same header, folder strip, search, controls and card treatment for all three views. */
.documents-library.is-gallery-ready{background:var(--panel)}
.is-gallery-ready .library-toolbar{padding:16px 20px;gap:12px;background:var(--panel);border-bottom:0}
.is-gallery-ready .library-toolbar h2{font-size:24px;letter-spacing:-.025em}
.is-gallery-ready .library-toolbar .eyebrow{color:var(--acc-text);font-size:10px;letter-spacing:.13em}
.is-gallery-ready .document-toolbar-actions .btn{min-height:44px;border-radius:12px}
.is-gallery-ready .document-library-layout{display:flex;flex:1;min-height:0;min-width:0;flex-direction:column}
.is-gallery-ready .document-folders{display:flex;flex:none;flex-direction:row;gap:8px;align-items:stretch;max-height:76px;min-height:64px;margin:0;padding:6px 16px;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:1px solid var(--line);background:var(--panel)}
.is-gallery-ready .document-folder-distribution{display:flex;flex:none;flex-direction:row;gap:8px;overflow:visible}
.is-gallery-ready .document-folder-row{flex:none;min-height:48px;border-radius:12px;background:var(--panel);border:1px solid var(--line);box-shadow:none;--folder-color:var(--ink2)}
.is-gallery-ready .document-folder-row.is-active,.is-gallery-ready .document-folder-all.is-active{background:var(--persona-lilac,var(--acc-soft));border-color:var(--acc-text);box-shadow:none;color:var(--ink)}
.is-gallery-ready .document-folder-all{border:1px solid var(--line);border-radius:12px}
.is-gallery-ready .document-folder{width:max-content;max-width:200px;padding:7px 10px;min-height:44px}
.is-gallery-ready .document-folder-label>b{-webkit-line-clamp:1;font-size:12px;white-space:nowrap;text-overflow:ellipsis}
.is-gallery-ready .document-folder-label>small{font-size:10px}
.is-gallery-ready .document-folder-row>.iconbtn{display:grid;width:28px;min-width:28px;height:44px}
.is-gallery-ready .document-list-panel{display:flex;flex:1;flex-direction:column;min-height:0;min-width:0}
.is-gallery-ready .document-list-toolbar{display:flex;flex:none;flex-wrap:wrap;gap:10px;padding:12px 16px;background:var(--panel)}
.is-gallery-ready .document-list-toolbar>b{display:none}
.is-gallery-ready .document-list-toolbar .search{flex:1 1 240px;width:auto;max-width:none;order:0;margin:0}
.is-gallery-ready .document-list-toolbar .input{height:44px;border-radius:12px;background:var(--panel)}
.is-gallery-ready .document-view-modes{display:flex;flex:1 1 260px;gap:6px;padding:0;border:0;background:transparent}
.is-gallery-ready .document-view-modes button{display:flex;flex:1;gap:7px;justify-content:center;width:auto;height:44px;padding:0 8px;border:1px solid var(--line);border-radius:11px;background:var(--panel);font-size:12px;color:var(--ink2)}
.is-gallery-ready .document-view-modes button.on{background:var(--persona-lilac,var(--acc-soft));border-color:var(--acc-text);color:var(--ink);box-shadow:none}
.is-gallery-ready .document-rows{background:var(--panel);padding:12px 16px}
.is-gallery-ready .document-row{border:1px solid var(--line);border-radius:14px;background:var(--panel);margin-bottom:10px}
.is-gallery-ready .document-rows.is-grid{gap:12px;grid-template-columns:repeat(auto-fill,minmax(210px,1fr))}
.is-gallery-ready .is-grid .document-row{margin:0;border-radius:16px;box-shadow:none;overflow:hidden}
.is-gallery-ready .document-thumb{background:var(--panel2)}
.is-gallery-ready .document-row-main>b{font-weight:750}
.is-gallery-ready .document-row>.iconbtn{min-height:40px}
@media(max-width:760px){
 .is-gallery-ready .library-toolbar{padding:12px 16px;align-items:flex-start}
 .is-gallery-ready .library-toolbar h2{font-size:21px}
 .is-gallery-ready .document-toolbar-actions{gap:6px;flex-wrap:wrap}
 .is-gallery-ready .document-toolbar-actions .btn{padding:0 10px;font-size:12px}
 .is-gallery-ready .document-list-toolbar{gap:8px}
 .is-gallery-ready .document-list-toolbar .search,.is-gallery-ready .document-view-modes{flex-basis:100%}
 .is-gallery-ready .document-rows.is-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
 .curved-gallery{padding-top:8px}
}
@media(max-width:360px){.is-gallery-ready .document-rows.is-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-height:500px){
 .is-gallery-ready .library-toolbar{padding:8px 12px}.is-gallery-ready .library-toolbar h2{font-size:18px}
 .is-gallery-ready .document-list-toolbar .search{flex-basis:220px}.is-gallery-ready .document-view-modes{flex-basis:240px}
 .is-gallery-ready .document-library-layout{min-height:350px}
 .curved-gallery{overflow-y:visible;flex:none}.gallery-hero{height:210px}
}
/* Share the available height with the preview so the thumbnail strip stays reachable. */
.curved-gallery{display:grid;flex:1;grid-template-rows:minmax(120px,1fr) auto auto 116px auto;gap:8px;padding:12px 16px;align-content:stretch}
.gallery-hero{height:100%;min-height:120px;max-height:360px}
.gallery-layer{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
.gallery-layer>img{min-width:0;min-height:0}
.gallery-rail{height:116px;padding-top:12px;padding-bottom:12px}
.gallery-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;font-size:17px}
.gallery-detail{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.is-gallery-ready .document-folders{max-height:64px;min-height:64px}
@media(max-width:760px){.is-gallery-ready .library-toolbar{padding-top:10px;padding-bottom:10px;gap:8px}.is-gallery-ready .library-toolbar p{display:none}}
@media(max-height:500px){.curved-gallery{display:flex;flex:none;overflow:visible}.gallery-hero{height:210px;min-height:210px}.gallery-rail{height:116px}}
/* Cardex total: same component inside the page flow, square product thumbnails on the light tile used by the product cards. */
.curved-gallery.product-gallery{display:flex;flex:none;flex-direction:column;gap:8px;overflow:visible;margin-top:4px;padding:12px 16px;border:1px solid var(--line);border-radius:18px}
.product-gallery .gallery-hero{flex:none;height:clamp(220px,36dvh,380px);min-height:200px;max-height:none;background:var(--panel2)}
.product-gallery .gallery-option{background:var(--panel2)}
.product-gallery .gallery-layer>img{box-sizing:border-box;padding:16px;mix-blend-mode:multiply}
.product-gallery .gallery-option>img{box-sizing:border-box;object-fit:contain;padding:6px;mix-blend-mode:multiply}
html[data-theme="dark"] .product-gallery .gallery-hero,html[data-theme="dark"] .product-gallery .gallery-option{background:oklch(0.93 0.004 265)}
.product-gallery .gallery-action.is-pressed{background:var(--persona-lilac,var(--acc-soft));border-color:var(--acc-text);color:var(--ink)}
.product-gallery .gallery-action:disabled{opacity:.55;cursor:not-allowed}
@media(max-height:500px){.product-gallery .gallery-hero{height:200px}}
