* { box-sizing: border-box; }
body.product-gallery-page { margin: 0; color: #392c22; font: 15px/1.65 Arial, sans-serif; background: #e7c5a0; }
.product-gallery-page::before { content: ''; position: fixed; inset: 0; z-index: -1; background: url('/assets/studio-browse/STUDIO.webp') center top / cover no-repeat; }
.gallery-shell { width: 100%; margin: 0 auto; padding: clamp(145px, 13vw, 230px) clamp(16px, 4vw, 72px) 48px; }
.gallery-navigation { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.gallery-navigation a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 999px; background: rgba(255, 253, 249, 0.92); backdrop-filter: blur(8px); border: 1.5px solid #A8C5B5; color: #2E2522; font-weight: 700; font-size: 14px; text-decoration: none; box-shadow: 0 2px 8px rgba(57, 44, 34, 0.08); transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease; }
.gallery-navigation a:hover { background: #FFFDF9; color: #16866F; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(57, 44, 34, 0.12); }
.gallery-shell > p a { display: inline-flex; align-items: center; margin-top: 28px; padding: 8px 18px; border-radius: 999px; background: rgba(255, 253, 249, 0.92); backdrop-filter: blur(8px); border: 1.5px solid #A8C5B5; color: #2E2522; font-weight: 700; text-decoration: none; box-shadow: 0 2px 8px rgba(57, 44, 34, 0.08); transition: background 0.18s ease, transform 0.18s ease; }
.gallery-shell > p a:hover { background: #FFFDF9; color: #16866F; transform: translateY(-1px); }
.gallery-shell h1 { display: inline-block; margin: 0 0 12px; padding: 8px 20px; font-size: clamp(22px, 2.2vw, 32px); line-height: 1.35; color: #2E2522; background: rgba(255, 253, 249, 0.94); backdrop-filter: blur(8px); border-radius: 14px; box-shadow: 0 3px 12px rgba(57, 44, 34, 0.08); }
.gallery-shell h2 { display: inline-block; margin: 32px 0 14px; padding: 6px 18px; font-size: 20px; color: #2E2522; background: rgba(255, 253, 249, 0.94); backdrop-filter: blur(8px); border-radius: 12px; box-shadow: 0 2px 8px rgba(57, 44, 34, 0.08); }
.gallery-description { margin: 0 0 28px; padding: 12px 22px; max-width: 85ch; background: rgba(255, 253, 249, 0.94); backdrop-filter: blur(8px); border-radius: 14px; box-shadow: 0 3px 12px rgba(57, 44, 34, 0.08); line-height: 1.65; color: #4A3E39; }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gallery-photo, .gallery-entry { display: block; min-width: 0; width: 100%; padding: 8px; border: 1px solid rgba(234, 219, 206, 0.7); background: rgba(255, 253, 249, 0.9); backdrop-filter: blur(8px); border-radius: 16px; box-shadow: 0 4px 16px rgba(57, 44, 34, 0.1), 0 1px 3px rgba(57, 44, 34, 0.06); color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s ease, background 0.2s ease; }
.gallery-photo:hover, .gallery-entry:hover { transform: translateY(-4px); background: #FFFDF9; box-shadow: 0 8px 24px rgba(57, 44, 34, 0.16), 0 2px 6px rgba(57, 44, 34, 0.08); }
.gallery-photo img, .gallery-entry img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; object-position: center; background: #FFFDF9; border-radius: 12px; }
.gallery-entry span { display: block; padding: 10px 4px 4px; font-weight: 700; color: #392c22; font-size: 15px; }
button:focus-visible, a:focus-visible { outline: 3px solid #795338; outline-offset: 4px; }
#galleryViewer { position: fixed; inset: 0; margin: auto; width: min(90vw, 900px); max-width: 900px; height: min(85vh, 85dvh); max-height: 85vh; padding: 12px; border: 0; border-radius: 16px; background: #fffaf0; color: #392c22; overflow: hidden; box-sizing: border-box; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); }
#galleryViewer[open] { display: flex; flex-direction: column; }
#galleryViewer:not([open]) { display: none; }
#galleryViewer::backdrop { background: rgb(30 22 16 / .85); }
.gallery-viewer-toolbar { display: flex; justify-content: flex-start; align-items: center; min-height: 36px; padding: 0 48px 0 4px; flex-shrink: 0; }
#galleryCounter { font-size: 14px; font-weight: 700; color: #795338; }
[data-viewer-close] { position: absolute; top: 10px; right: 10px; z-index: 10; width: 40px; height: 40px; min-width: 40px; min-height: 40px; padding: 0; border: 0; border-radius: 50%; background: rgba(231, 197, 160, 0.4); color: #392c22; font-size: 26px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.15s ease, transform 0.15s ease; }
[data-viewer-close]:hover { background: rgba(231, 197, 160, 0.85); transform: scale(1.05); }
[data-viewer-close]:active { transform: scale(0.95); }
[data-viewer-close]:focus-visible { outline: 3px solid #795338; outline-offset: 2px; }
[data-viewer-close] span { pointer-events: none; }
.gallery-viewer-image { flex: 1 1 0; min-height: 0; min-width: 0; display: flex; align-items: center; justify-content: center; margin: 4px 0 0; overflow: hidden; position: relative; }
.gallery-viewer-image img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.gallery-viewer-controls { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); display: flex; justify-content: space-between; align-items: center; padding: 0 12px; pointer-events: none; z-index: 5; }
.gallery-viewer-controls button { pointer-events: auto; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 50%; background: #D8F4E8; color: #16866F; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 8px rgba(22, 134, 111, 0.22); transition: background 0.15s ease, transform 0.15s ease; }
.gallery-viewer-controls button:hover:not(:disabled) { background: #c2ebd9; transform: scale(1.06); }
.gallery-viewer-controls button:active:not(:disabled) { transform: scale(0.94); }
.gallery-viewer-controls button:focus-visible { outline: 3px solid #16866F; outline-offset: 2px; }
.gallery-viewer-controls button svg { pointer-events: none; display: block; }
[data-viewer-previous][hidden], [data-viewer-next][hidden], .gallery-viewer-controls[hidden] { display: none !important; }
@media (min-width: 700px) { .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1200px) { .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; } }
/* Match the existing editor's proportional background on wide screens; never stretch the artwork. */
@media (min-width: 1024px) { .product-gallery-page::before { background-size: 100% auto; } }
@media (max-width: 699px) { .gallery-shell { padding-top: 150px; } .gallery-navigation { font-size: 13px; } }
