/* ============================================================
   htw-Gallery.css — the gallery page (grid, slideshow, full-screen viewer).
   Loaded AFTER htw-MainStyles.css (header / wallet bar / modals).
   Night is the base; body.daytime (set by siteTheme.js) overrides.
   ============================================================ */

:root {
   --htw-accent: #00ffcc;
   --htw-card: #12122a;
   --htw-border: #2a2a4a;
   --htw-muted: #8a8ab0;
}

body.daytime {
   --htw-accent: #0088aa;
   --htw-card: #ffffff;
   --htw-border: #c8c8e0;
   --htw-muted: #5a6b85;
}



/* ---------- PAGE ---------- */
/* ⚠️ NO max-width OR SIDE PADDING HERE: the slideshow runs edge to edge. The grid carries its own. */
#galleryMain {
   position: relative;   /* anchors the floating #SlideshowGridToggleDIV */
   padding: 0;           /* the footer is the last thing a visitor sees: no empty band under it */
}

/* The grid has no image under the toggle to float over, so it leaves room for it instead. */
#gridView {
   max-width: 1400px;
   margin: 0 auto;
   padding: 56px 16px 0 16px;
}



/* ---------- SLIDESHOW | GRID TOGGLE ----------
   FLOATS over the top-right corner of the slideshow image instead of taking a row of its own, so the
   image starts right under the wallet bar. Compact, on a dark translucent pill so it reads over any
   part of the art in either theme. */
#SlideshowGridToggleDIV {
   position: absolute;
   top: 12px;
   right: 16px;
   z-index: 10;
   display: flex;
   padding: 3px;
   border-radius: 999px;
   background: rgba(10, 10, 26, 0.55);
   backdrop-filter: blur(6px);
   -webkit-backdrop-filter: blur(6px);
   box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.viewToggleButton {
   padding: 4px 12px;
   background: transparent;
   color: rgba(255, 255, 255, 0.8);
   border: none;
   border-radius: 999px;
   font-size: 0.72rem;
   font-weight: 600;
   letter-spacing: 1px;
   line-height: 1.4;
   transition: background 0.2s, color 0.2s;
}

.viewToggleButton:hover { color: #ffffff; }

.viewToggleButton[aria-pressed="true"] {
   background: var(--htw-accent);
   color: #0a0a1a;
}

body.daytime .viewToggleButton[aria-pressed="true"] { color: #ffffff; }

@media (max-width: 640px) {
   #SlideshowGridToggleDIV { top: 8px; right: 8px; }
   .viewToggleButton { padding: 3px 9px; font-size: 0.65rem; }
}



/* ---------- PURCHASE BUTTON (shared by grid, slideshow and viewer) ---------- */
.purchaseButton {
   display: block;
   width: 100%;
   max-width: 220px;
   margin: 0 auto;
   padding: 9px 16px;
   background: #2b6cff;
   color: #ffffff;
   border: none;
   border-radius: 8px;
   font-weight: 700;
   letter-spacing: 1.5px;
   transition: background 0.2s, transform 0.1s;
}

.purchaseButton:hover:not(:disabled)  { background: #1f56d6; }
.purchaseButton:active:not(:disabled) { transform: scale(0.98); }

/* Not buyable right now (SOLD, COMING SOON, NOT FOR SALE…): the label says why. */
.purchaseButton:disabled {
   background: transparent;
   color: var(--htw-muted);
   border: 1px solid var(--htw-border);
   cursor: default;
}

.purchaseButton[data-state="yours"]:disabled { color: var(--htw-accent); border-color: var(--htw-accent); }

/* The live price next to "1 / 6" (and in the full-screen viewer). */
.workPrice {
   margin-left: 10px;
   padding-left: 10px;
   border-left: 1px solid var(--htw-border);
   color: var(--htw-accent);
   font-weight: 600;
}

#lightboxCaption .workPrice { color: #00ffcc; border-left-color: rgba(255, 255, 255, 0.3); margin-left: 0; }
#lightboxCaption .purchaseButton:disabled { color: rgba(255, 255, 255, 0.6); border-color: rgba(255, 255, 255, 0.3); }



/* ---------- GRID VIEW ---------- */
#worksGrid {
   display: grid;
   grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
   gap: 28px;
}

.workCard {
   background: var(--htw-card);
   border: 1px solid var(--htw-border);
   border-radius: 12px;
   overflow: hidden;
   box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
   display: flex;
   flex-direction: column;
}

body.daytime .workCard { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10); }

/* The thumbnail is a button so it opens the viewer from the keyboard too. */
.workThumbButton {
   display: block;
   width: 100%;
   padding: 0;
   border: none;
   background: #000;
   aspect-ratio: 16 / 9;
   overflow: hidden;
   cursor: zoom-in;
}

.workThumbButton img {
   width: 100%;
   height: 100%;
   object-fit: cover;
   transition: transform 0.4s ease;
}

.workThumbButton:hover img { transform: scale(1.03); }

.workCardBody {
   padding: 14px 16px 18px 16px;
   text-align: center;
}

.workTitle {
   font-size: 1.15rem;
   font-weight: 600;
   letter-spacing: 0.5px;
   margin: 0;
}

.workMeta {
   color: var(--htw-muted);
   font-size: 0.9rem;
   margin: 2px 0 12px 0;
}



/* ---------- SLIDESHOW VIEW (the default view) ----------
   FULL-BLEED: each work spans the whole page width, edge to edge, at its own 16:9 shape (never
   cropped). Title, PURCHASE and the dots sit below it. A horizontal scroll-snap track: swipe or
   scroll it, use the arrows / dots, or the arrow keys. */
/* A one-column grid: the track in row 1, #slideInfo in row 2 (stacked mode) or in row 1 on top of the
   image (overlay mode — see SLIDE INFO below). */
#slidesFrame {
   position: relative;
   container-type: inline-size;   /* lets the arrows find the image's middle: 100cqw = frame width */
   display: grid;
   grid-template-columns: minmax(0, 1fr);
}

#slidesTrack { grid-area: 1 / 1; }

#slidesTrack {
   display: flex;
   overflow-x: auto;
   scroll-snap-type: x mandatory;
   scroll-behavior: smooth;
   scrollbar-width: none;
   outline: none;
}

#slidesTrack::-webkit-scrollbar { display: none; }

.slide {
   flex: 0 0 100%;
   scroll-snap-align: center;
   display: flex;
   flex-direction: column;
   align-items: center;
}

.slide .workThumbButton {
   width: 100%;
   border-radius: 0;
}

.slide .workThumbButton img { object-fit: contain; }
.slide .workThumbButton:hover img { transform: none; }

/* Each slide's own caption is not used: #slideInfo shows the current slide's instead. */
.slide .workCardBody { display: none; }

/* Arrows float over the image's left and right edges, centred on its height (width × 9/16 ÷ 2). */
.slidesNav {
   position: absolute;
   top: calc(100cqw * 9 / 32);
   transform: translateY(-50%);
   z-index: 2;
   width: 48px;
   height: 48px;
   border: 1px solid rgba(255, 255, 255, 0.6);
   border-radius: 50%;
   background: rgba(0, 0, 0, 0.5);
   color: #ffffff;
   font-size: 1.25rem;
   box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
   display: flex;
   align-items: center;
   justify-content: center;
   transition: background 0.2s, opacity 0.2s;
}

#slidesPrevButton { left: 16px; }
#slidesNextButton { right: 16px; }

.slidesNav:hover:not(:disabled) { background: rgba(0, 0, 0, 0.75); }
.slidesNav:disabled { opacity: 0; pointer-events: none; }

#slidesDots {
   display: flex;
   justify-content: center;
   flex-wrap: wrap;
   gap: 10px;
   margin-top: 14px;
   padding: 0 16px;
}

.slidesDot {
   width: 11px;
   height: 11px;
   padding: 0;
   border-radius: 50%;
   border: 1px solid var(--htw-muted);
   background: transparent;
}

.slidesDot[aria-selected="true"] { background: var(--htw-accent); border-color: var(--htw-accent); }

@media (max-width: 640px) {
   .slidesNav { width: 36px; height: 36px; font-size: 1rem; }
   #slidesPrevButton { left: 8px; }
   #slidesNextButton { right: 8px; }
}



/* ---------- SLIDE INFO (title · count · price · PURCHASE for the current slide) ----------
   STACKED mode (default; the whole work + info fit on screen): centred below the image.
   OVERLAY mode (#slidesView.infoOverlay, set by updateInfoMode() when the screen is too short): a
   horizontal pill over the bottom of the image. `position: sticky` in the same grid cell as the image
   keeps it at the bottom of the VISIBLE page while the image runs below the fold, and never above the
   image. After a few seconds it collapses to the "i" button; hover / tap / focus brings it back. */
#slideInfo {
   grid-area: 2 / 1;
   position: relative;
   text-align: center;
   padding: 16px 16px 0 16px;
}

#slideInfoFull {
   display: flex;
   flex-direction: column;
   align-items: center;
   transition: opacity 0.45s ease;
}

#slideInfoIcon { display: none; }

#slidesView.infoOverlay #slideInfo {
   grid-area: 1 / 1;
   align-self: end;
   justify-self: center;
   position: sticky;
   bottom: 16px;
   z-index: 3;
   margin: 0 16px 16px 16px;
   padding: 0;
}

#slidesView.infoOverlay #slideInfoFull {
   flex-direction: row;
   flex-wrap: wrap;
   justify-content: center;
   gap: 6px 18px;
   padding: 8px 8px 8px 22px;
   border-radius: 999px;
   background: rgba(10, 10, 26, 0.62);
   backdrop-filter: blur(8px);
   -webkit-backdrop-filter: blur(8px);
   box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
   color: #ffffff;
}

#slidesView.infoOverlay #slideInfoTitle { color: #ffffff; font-size: 1.05rem; }
#slidesView.infoOverlay #slideInfoMeta { margin: 0; color: rgba(255, 255, 255, 0.75); }
#slidesView.infoOverlay #slideInfoPrice { color: #00ffcc; border-left-color: rgba(255, 255, 255, 0.3); }
#slidesView.infoOverlay #slideInfoPurchase { width: auto; margin: 0; padding: 8px 22px; }
#slidesView.infoOverlay #slideInfoPurchase:disabled { color: rgba(255, 255, 255, 0.7); border-color: rgba(255, 255, 255, 0.35); }

#slidesView.infoOverlay #slideInfoIcon {
   display: flex;
   align-items: center;
   justify-content: center;
   position: absolute;
   left: 50%;
   bottom: 0;
   transform: translateX(-50%);
   width: 38px;
   height: 38px;
   padding: 0;
   border: 1px solid rgba(255, 255, 255, 0.6);
   border-radius: 50%;
   background: rgba(10, 10, 26, 0.62);
   backdrop-filter: blur(8px);
   -webkit-backdrop-filter: blur(8px);
   color: #ffffff;
   font-family: Georgia, 'Times New Roman', serif;
   font-style: italic;
   font-weight: 700;
   font-size: 1.2rem;
   opacity: 0;
   pointer-events: none;
   transition: opacity 0.45s ease;
}

#slidesView.infoOverlay #slideInfo.collapsed #slideInfoFull { opacity: 0; pointer-events: none; }
#slidesView.infoOverlay #slideInfo.collapsed #slideInfoIcon { opacity: 1; pointer-events: auto; }

@media (max-width: 640px) {
   #slidesView.infoOverlay #slideInfoFull { border-radius: 18px; padding: 8px 12px; }
}



/* ---------- FOOTER ----------
   Base look comes from #FooterDIV / .footerLinkClass in htw-MainStyles.css (RECT-PACKED-PUNKS' footer). */
#FooterDIV { margin-top: 48px; }

.footerXLink { display: inline-flex; align-items: center; gap: 7px; vertical-align: middle; }

/* The logo is a black disc with a white X: invisible on the dark night footer, so invert it there. */
.footerXLink img { width: 59px; height: auto; filter: invert(1); }
body.daytime .footerXLink img { filter: none; }



/* ---------- FULL-SCREEN VIEWER ---------- */
body.lightboxOpen { overflow: hidden; }

#lightbox {
   position: fixed;
   inset: 0;
   z-index: 5000;
   background: rgba(0, 0, 0, 0.94);
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 16px;
}

#lightboxFigure {
   margin: 0;
   max-width: 100%;
   max-height: 100%;
   display: flex;
   flex-direction: column;
   align-items: center;
}

#lightboxImage {
   max-width: calc(100vw - 140px);
   max-height: calc(100vh - 110px);
   object-fit: contain;
   cursor: zoom-out;
}

#lightboxCaption {
   display: flex;
   align-items: center;
   gap: 18px;
   margin-top: 14px;
   color: #e3e3e3;
}

#lightboxTitle { font-size: 1.1rem; font-weight: 600; letter-spacing: 0.5px; }

#lightboxCaption .purchaseButton { width: auto; margin: 0; }

.lightboxControl {
   position: absolute;
   width: 46px;
   height: 46px;
   border: none;
   border-radius: 50%;
   background: rgba(255, 255, 255, 0.10);
   color: #ffffff;
   font-size: 1.3rem;
   display: flex;
   align-items: center;
   justify-content: center;
   transition: background 0.2s;
}

.lightboxControl:hover { background: rgba(255, 255, 255, 0.22); }

#lightboxCloseButton { top: 14px; right: 14px; }
#lightboxPrevButton  { left: 14px; top: 50%; transform: translateY(-50%); }
#lightboxNextButton  { right: 14px; top: 50%; transform: translateY(-50%); }

@media (max-width: 640px) {
   #lightboxImage { max-width: 100%; max-height: calc(100vh - 140px); }
   #lightboxPrevButton, #lightboxNextButton { top: auto; bottom: 14px; transform: none; }
   #lightboxCaption { flex-direction: column; gap: 10px; margin-bottom: 56px; }
}
