/* ============================================================
   gallery.css — Gallery Page Styles
   aharsh.com | Sprint 4
   ============================================================ */


/* ============================================================
   PAGE HERO
   Reuses .page-hero, .page-hero-bg, .page-hero-overlay,
   .page-hero-content, .page-hero-eyebrow from about.css.
   Those classes are defined there and imported via sections.css.
   The styles below are gallery-specific overrides only.
   ============================================================ */

/* The page hero eyebrow and title are in about.css via the
   shared .page-hero-* classes — no overrides needed here. */


/* ============================================================
   GALLERY INTRO
   ============================================================ */

.gallery-intro {
  padding: clamp(48px, 6vw, 80px) 0 clamp(32px, 4vw, 56px);
  border-bottom: 1px solid var(--border);
}

.gallery-intro-text {
  font-family: var(--font-serif);
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 300;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: clamp(28px, 3vw, 44px);
  max-width: 640px;
}

/* ------------------------------------------------------------
   Filter Bar
   ------------------------------------------------------------ */
.gallery-filters {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-btn {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 9px 20px;
  border: 1px solid transparent;
  transition:
    color       0.3s var(--ease-smooth),
    border-color 0.3s var(--ease-smooth);
  cursor: pointer;
}

.filter-btn:hover {
  color: var(--text-primary);
}

.filter-btn.active {
  color: var(--accent);
  border-color: rgba(201, 168, 76, 0.3);
}

/* Hidden items (filtered out) */
.gallery-item.hidden {
  display: none;
}


/* ============================================================
   MASONRY GRID
   CSS columns approach — natural masonry without JS.
   ============================================================ */

.gallery-grid-section {
  padding: clamp(48px, 5vw, 72px) 0 clamp(64px, 8vw, 120px);
}

.gallery-masonry {
  columns: 3;
  column-gap: clamp(12px, 1.5vw, 20px);
}

/* Each item sits in one column, never breaks across two */
.gallery-item {
  break-inside: avoid;
  margin-bottom: clamp(12px, 1.5vw, 20px);
  cursor: pointer;
  outline: none;
}

/* Focus style for keyboard users */
.gallery-item:focus-visible .gallery-item-inner {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

/* Inner wrapper handles overflow for the hover effects */
.gallery-item-inner {
  position: relative;
  overflow: hidden;
  background: var(--bg-card); /* shown while image loads */
}

/* The painting image */
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.7s var(--ease-expo);
  will-change: transform;
}

/* Scale image slightly on hover */
.gallery-item:hover .gallery-item-inner img,
.gallery-item:focus-visible .gallery-item-inner img {
  transform: scale(1.04);
}

/* ------------------------------------------------------------
   Hover Overlay
   ------------------------------------------------------------ */
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(15, 15, 13, 0.88) 0%,
    rgba(15, 15, 13, 0.20) 55%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  padding: clamp(14px, 2vw, 24px);
  gap: 8px;

  /* Hidden by default, revealed on hover */
  opacity: 0;
  transition: opacity 0.4s var(--ease-smooth);
}

.gallery-item:hover .gallery-item-overlay,
.gallery-item:focus-visible .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  justify-content: flex-end;
}

.gallery-item-title {
  font-family: var(--font-serif);
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.2;
}

.gallery-item-meta {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.gallery-item-view {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  align-self: flex-end;
  margin-top: auto;
  transition: letter-spacing 0.3s var(--ease-smooth);
}

.gallery-item:hover .gallery-item-view {
  letter-spacing: 0.28em;
}

/* Status badge: "Available" or "Sold" */
.gallery-status-badge {
  position: absolute;
  top: clamp(10px, 1.5vw, 16px);
  right: clamp(10px, 1.5vw, 16px);
  font-family: var(--font-sans);
  font-size: 8.5px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bg);
  background: var(--accent);
  padding: 4px 10px;
  opacity: 0;
  transition: opacity 0.4s var(--ease-smooth);
}

/* Only show badge when overlay is visible */
.gallery-item:hover .gallery-status-badge,
.gallery-item:focus-visible .gallery-status-badge {
  opacity: 1;
}

/* Sold items get a muted badge */
.gallery-item[data-status="sold"] .gallery-status-badge {
  background: var(--text-muted);
  color: var(--text-primary);
  content: 'Sold';
}


/* ============================================================
   GALLERY CTA SECTION
   ============================================================ */

.gallery-cta-section {
  padding: clamp(56px, 7vw, 100px) 0;
  border-top: 1px solid var(--border);
}

.gallery-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.gallery-cta-text {
  font-family: var(--font-serif);
  font-size: clamp(22px, 3vw, 38px);
  font-weight: 300;
  font-style: italic;
  color: var(--text-primary);
  line-height: 1.2;
}


/* ============================================================
   LIGHTBOX
   ============================================================ */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(10, 10, 8, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;

  /* Hidden by default */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease-smooth);
}

.lightbox.active {
  opacity: 1;
  pointer-events: all;
}

/* ------------------------------------------------------------
   Lightbox Dialog (content area)
   ------------------------------------------------------------ */
.lightbox-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(90vw, 1100px);
  max-height: 90vh;
  width: 100%;
}

/* Close button */
.lightbox-close {
  position: fixed;
  top: clamp(20px, 3vw, 36px);
  right: clamp(20px, 3vw, 36px);
  z-index: 9010;
  color: var(--text-secondary);
  padding: 8px;
  transition: color 0.25s, transform 0.3s var(--ease-smooth);
}

.lightbox-close:hover {
  color: var(--text-primary);
  transform: rotate(90deg);
}

/* Image wrapper — constrains image size */
.lightbox-img-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: calc(85vh - 80px);
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: calc(85vh - 80px);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: opacity 0.25s;
}

/* Info bar below image */
.lightbox-info {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  gap: 20px;
}

.lightbox-info-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lightbox-title {
  font-family: var(--font-serif);
  font-size: clamp(16px, 2vw, 22px);
  font-weight: 400;
  color: var(--text-primary);
}

.lightbox-meta {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.lightbox-shop-link {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  transition: letter-spacing 0.3s var(--ease-smooth);
}

.lightbox-shop-link:hover {
  letter-spacing: 0.28em;
}

/* Prev / Next arrow buttons */
.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  padding: 16px 12px;
  z-index: 9010;
  transition: color 0.25s, transform 0.3s var(--ease-smooth);
}

.lightbox-prev { left: clamp(8px, 2vw, 24px); }
.lightbox-next { right: clamp(8px, 2vw, 24px); }

.lightbox-prev:hover { color: var(--text-primary); transform: translateY(-50%) translateX(-3px); }
.lightbox-next:hover { color: var(--text-primary); transform: translateY(-50%) translateX(3px); }

/* Dim arrows at first/last item */
.lightbox-prev[aria-disabled="true"],
.lightbox-next[aria-disabled="true"] {
  opacity: 0.25;
  pointer-events: none;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 900px) {
  .gallery-masonry {
    columns: 2;
  }
}

@media (max-width: 540px) {
  .gallery-masonry {
    columns: 1;
  }

  .gallery-cta-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  /* On mobile, overlay is always slightly visible so users know paintings are tappable */
  .gallery-item-overlay {
    opacity: 0.6;
  }

  .gallery-status-badge {
    opacity: 1;
  }

  .lightbox-dialog {
    max-width: 100vw;
    padding: 0 16px;
  }

  .lightbox-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
}

/* ============================================================
   PAGE HERO — shared class overrides for gallery page
   The .page-hero class is defined in about.css.
   Since about.css is not loaded on gallery.html,
   we redeclare the essential hero styles here.
   ============================================================ */

.page-hero {
  position: relative;
  width: 100%;
  height: 80vh;
  min-height: 500px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(48px, 6vw, 80px);
}

.page-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(135deg, #1f1d16, #2a2218);
}

.page-hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  will-change: transform;
}

.page-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(to top, rgba(15, 15, 13, 0.92) 0%, rgba(15, 15, 13, 0.30) 60%, rgba(15, 15, 13, 0.50) 100%);
}

.page-hero-content {
  position: relative;
  z-index: 2;
  padding: 0 var(--page-h);
  width: 100%;
}

.page-hero-eyebrow {
  display: block;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0; /* animated in by JS */
}

.page-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(64px, 10vw, 130px);
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 0.9;
  color: var(--text-primary);
  overflow: hidden;
}

/* Character spans for letter-by-letter animation */
.page-hero-title .char {
  display: inline-block;
  will-change: transform;
}
