/* View Toggle Bar */
.view-toggle-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 0 4px;
}

.view-toggle-btn {
  flex: 1;
  max-width: 140px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: 'Raleway', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-toggle-btn svg {
  opacity: 0.6;
}

.view-toggle-btn.active {
  background: rgba(78, 205, 196, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.view-toggle-btn.active svg {
  opacity: 1;
  stroke: var(--accent);
}

/* ── Gallery Container ───────────────────────────────────────────────────── */
.gallery-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  overflow-x: auto;
  overflow-y: hidden;
  display: block;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  z-index: 2500; /* Over everything */
  background: var(--bg);
}

/* Ensure the wine background is still visible behind the gallery container */
.gallery-container::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../wine.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

.gallery-container::-webkit-scrollbar {
  display: none;
}

.gallery-scroll-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 100%;
  width: max-content;
  /* --card-w is overridden in media queries so spacer & card always match */
  --card-w: clamp(260px, 80vw, 320px);
}

.gallery-spacer {
  flex: 0 0 calc((100% - var(--card-w)) / 2);
  min-width: 0;
  flex-shrink: 0;
}

/* ── Gallery Card — Base ─────────────────────────────────────────────────── */
.gallery-card {
  position: relative;
  flex: 0 0 var(--card-w);
  width: var(--card-w);
  height: 75vh; /* Match vertical height */
  max-height: 650px;
  border-radius: 20px;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), 
              opacity 0.35s ease, 
              filter 0.35s ease, 
              box-shadow 0.3s ease;
  transform: scale(0.9) translateZ(0);
  will-change: transform, opacity, filter;
  opacity: 0.4;
  filter: blur(4px);
}

.gallery-card.active {
  transform: scale(1) translateZ(0);
  opacity: 1;
  filter: blur(0);
  z-index: 10;
}

/* ── Status-specific card theming ────────────────────────────────────────── */
.gallery-card.ready {
  background: radial-gradient(ellipse at 50% 0%, rgba(46, 204, 113, 0.10) 0%, #1e1e1e 65%);
  border-color: rgba(46, 204, 113, 0.7);
  box-shadow: 0 0 24px rgba(46, 204, 113, 0.12), 0 24px 48px rgba(0, 0, 0, 0.7);
}
.gallery-card.soon {
  background: radial-gradient(ellipse at 50% 0%, rgba(243, 156, 18, 0.10) 0%, #1e1e1e 65%);
  border-color: rgba(243, 156, 18, 0.7);
  box-shadow: 0 0 24px rgba(243, 156, 18, 0.12), 0 24px 48px rgba(0, 0, 0, 0.7);
}
.gallery-card.spirits {
  background: radial-gradient(ellipse at 50% 0%, rgba(204, 153, 68, 0.10) 0%, #1e1e1e 65%);
  border-color: rgba(204, 153, 68, 0.7);
  box-shadow: 0 0 24px rgba(204, 153, 68, 0.12), 0 24px 48px rgba(0, 0, 0, 0.7);
}
.gallery-card.consumed {
  background: radial-gradient(ellipse at 50% 0%, rgba(154, 163, 171, 0.07) 0%, #1e1e1e 65%);
  border-color: rgba(154, 163, 171, 0.5);
  box-shadow: 0 0 24px rgba(154, 163, 171, 0.08), 0 24px 48px rgba(0, 0, 0, 0.7);
}

/* ── Hero Section (45%) — Name / Year / Region / Grape ──────────────────── */
.gc-hero {
  flex: 0 0 45%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 22px 10px;
  text-align: center;
  gap: 4px;
}

.gc-name {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 400;
  color: #ffffff;
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.gc-year {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
}
.gallery-card.ready   .gc-year { color: #2ecc71; }
.gallery-card.soon    .gc-year { color: #f39c12; }
.gallery-card.spirits .gc-year { color: #cc9944; }
.gallery-card.consumed .gc-year { color: #9aa3ab; }

.gc-region {
  font-size: 0.85rem;
  color: #A0A0A0;
  letter-spacing: 0.04em;
}

.gc-grape {
  font-size: 0.75rem;
  color: #707070;
  letter-spacing: 0.03em;
}

/* ── Divider ─────────────────────────────────────────────────────────────── */
.gc-divider {
  width: 40px;
  height: 1px;
  border-radius: 1px;
  flex-shrink: 0;
  margin: 2px auto;
}
.gallery-card.ready   .gc-divider { background: rgba(46, 204, 113, 0.65); }
.gallery-card.soon    .gc-divider { background: rgba(243, 156, 18, 0.65); }
.gallery-card.spirits .gc-divider { background: rgba(204, 153, 68, 0.65); }
.gallery-card.consumed .gc-divider { background: rgba(154, 163, 171, 0.5); }

/* ── Bottom Section — Badge / ABV / Notes / Meta / Dots ─────────────────── */
.gc-bottom {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 6px 20px 14px;
  gap: 5px;
  text-align: center;
}

.gc-badges-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gc-status-badge {
  font-family: 'Cinzel', serif;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 4px 12px;
  border-radius: 4px;
}
.gallery-card.ready   .gc-status-badge { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.gallery-card.soon    .gc-status-badge { background: rgba(243, 156, 18, 0.15); color: #f39c12; }
.gallery-card.spirits .gc-status-badge { background: rgba(204, 153, 68, 0.15); color: #cc9944; }
.gallery-card.consumed .gc-status-badge { background: rgba(154, 163, 171, 0.12); color: #9aa3ab; }

.gc-abv-pill {
  font-family: 'Raleway', sans-serif;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.gc-notes {
  font-size: 0.78rem;
  font-style: italic;
  color: #808080;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin: 0;
}

.gc-bottom-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gc-star { font-size: 1rem; line-height: 1; }

.gc-qty {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  color: var(--accent);
}

/* Dot pagination */
.gc-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 12px;
  margin-top: 2px;
}

.gc-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.gc-dot.gc-dot-active {
  width: 14px;
  border-radius: 3px;
}
.gallery-card.ready   .gc-dot-active { background: #2ecc71; }
.gallery-card.soon    .gc-dot-active { background: #f39c12; }
.gallery-card.spirits .gc-dot-active { background: #cc9944; }
.gallery-card.consumed .gc-dot-active { background: #9aa3ab; }

/* Progress bar for large collections */
.gc-progress {
  width: 60px;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}
.gc-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.gallery-card.ready   .gc-progress-fill { background: #2ecc71; }
.gallery-card.soon    .gc-progress-fill { background: #f39c12; }
.gallery-card.spirits .gc-progress-fill { background: #cc9944; }
.gallery-card.consumed .gc-progress-fill { background: #9aa3ab; }

/* ── Chevron Navigation Hints ────────────────────────────────────────────── */
.gc-chevron {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.5s ease;
  font-weight: 100;
  letter-spacing: -0.1em;
}
.gc-chevron-left  { left: 10px; }
.gc-chevron-right { right: 10px; }
.gc-chevron.hidden { opacity: 0; }

/* ── Gallery Controls (arrows + pagination) ──────────────────────────────── */
.gallery-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 16px;
  margin-bottom: 20px;
}

.gallery-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(78, 205, 196, 0.15);
  border: 1.5px solid rgba(78, 205, 196, 0.5);
  color: var(--accent);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-nav-btn:hover  { background: rgba(78, 205, 196, 0.30); border-color: var(--accent); transform: scale(1.08); }
.gallery-nav-btn:active { transform: scale(0.94); }

.gallery-pagination {
  text-align: center;
  font-family: 'Raleway', sans-serif;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  min-width: 72px;
}

/* ── Swipe Hint ──────────────────────────────────────────────────────────── */
.gallery-hint {
  text-align: center;
  font-family: 'Raleway', sans-serif;
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  margin-top: 8px;
  animation: hintFadeOut 3.5s forwards;
  pointer-events: none;
}
.gallery-hint.faded { opacity: 0; transition: opacity 0.4s ease; }

@keyframes hintFadeOut {
  0%, 40% { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Desktop Responsive ──────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .gallery-container {
    height: 66vh;
    margin-top: 36px;
  }

  .gallery-scroll-wrapper { --card-w: clamp(300px, 44vw, 380px); }

  .gallery-card {
    height: 85%;
    max-height: 560px;
  }

  .gc-name { font-size: 2.2rem; }
  .gallery-controls { margin-top: 24px; }
}

@media (min-width: 1200px) {
  .gallery-container { height: 68vh; }

  .gallery-scroll-wrapper { --card-w: clamp(320px, 34vw, 420px); }

  .gallery-card {
    height: 82%;
    max-height: 580px;
  }

  .gc-name { font-size: 2.4rem; }
}

/* ── Reduced Motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .gallery-card,
  .gallery-hint,
  .gc-chevron { transition: none !important; animation: none !important; }
}
