/* ============================================
   Design Tokens
   ============================================ */
:root {
  --bg: #0a0a0b;
  --bg-elevated: #131316;
  --bg-surface: #1a1a1f;
  --gold: #d4a24e;
  --gold-bright: #e8b863;
  --gold-dim: rgba(212, 162, 78, 0.15);
  --text: #f5f5f7;
  --text-secondary: #9ca3af;
  --text-dim: #6b7280;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-w: 1400px;
}

/* ============================================
   Reset
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ============================================
   Hero
   ============================================ */
.hero {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/web/bg-hero.webp') center / cover no-repeat;
  filter: brightness(0.35) saturate(1.2);
  transform: scale(1.05);
  z-index: 0;
}

.hero-bg-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 0%, var(--bg) 85%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.hero-logo-wrap {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 900ms var(--ease-out), transform 900ms var(--ease-out);
  will-change: opacity, transform;
}

.hero-logo-wrap.reveal {
  opacity: 1;
  transform: scale(1);
}

.hero-logo {
  width: min(640px, 85vw);
  height: auto;
  filter: drop-shadow(0 8px 40px rgba(212, 162, 78, 0.15));
}

.hero-meta {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.7;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms var(--ease-out) 300ms, transform 700ms var(--ease-out) 300ms;
}

.hero-meta.reveal {
  opacity: 1;
  transform: translateY(0);
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 2rem;
  background: var(--gold);
  color: #1a1208;
  font-weight: 600;
  font-size: 1.05rem;
  border-radius: var(--radius-pill);
  transition: transform 160ms var(--ease-out), background 200ms ease, box-shadow 200ms ease;
  opacity: 0;
  transform: translateY(16px);
  box-shadow: 0 4px 24px rgba(212, 162, 78, 0.25);
}

.hero-cta.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 700ms var(--ease-out) 500ms, transform 700ms var(--ease-out) 500ms,
              background 200ms ease, box-shadow 200ms ease;
}

.hero-cta:hover {
  background: var(--gold-bright);
  box-shadow: 0 6px 32px rgba(212, 162, 78, 0.35);
}

.hero-cta:active {
  transform: scale(0.97);
}

.hero-cta svg {
  transition: transform 200ms var(--ease-out);
}

.hero-cta:hover svg {
  transform: translateY(2px);
}

/* ============================================
   Gallery Section
   ============================================ */
.gallery-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.gallery-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.gallery-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.gallery-count {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.gallery-actions {
  display: flex;
  gap: 0.75rem;
}

.btn-select {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: transform 160ms var(--ease-out), background 200ms ease, color 200ms ease, border-color 200ms ease;
}

.btn-select:hover {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--gold-dim);
}

.btn-select:active {
  transform: scale(0.97);
}

.btn-select.active {
  background: var(--gold);
  color: #1a1208;
  border-color: var(--gold);
  font-weight: 600;
}

/* ============================================
   Gallery Grid (Masonry via CSS Columns)
   ============================================ */
.gallery-grid {
  column-count: 4;
  column-gap: 1rem;
}

@media (max-width: 1200px) {
  .gallery-grid { column-count: 3; }
}

@media (max-width: 768px) {
  .gallery-grid { column-count: 2; column-gap: 0.75rem; }
}

@media (max-width: 480px) {
  .gallery-grid { column-count: 1; }
}

.photo-card {
  break-inside: avoid;
  margin-bottom: 1rem;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: box-shadow 200ms ease;
  opacity: 0;
  transform: translateY(24px);
}

.photo-card.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out),
              box-shadow 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .photo-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }
  .photo-card:hover .photo-thumb {
    transform: scale(1.03);
  }
  .photo-card:hover .photo-overlay {
    opacity: 1;
  }
}

.photo-thumb {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms var(--ease-out), opacity 400ms ease;
  will-change: transform;
  opacity: 0;
}

.photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  padding: 0.75rem;
}

.photo-overlay svg {
  width: 20px;
  height: 20px;
  color: var(--text);
  opacity: 0.8;
}

/* Selection mode */
.photo-card.selectable .photo-checkbox {
  display: flex;
}

.photo-checkbox {
  display: none;
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  align-items: center;
  justify-content: center;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms var(--ease-out);
  z-index: 2;
}

.photo-checkbox svg {
  width: 16px;
  height: 16px;
  color: #1a1208;
  opacity: 0;
  transition: opacity 120ms ease;
}

.photo-card.selected .photo-checkbox {
  background: var(--gold);
  border-color: var(--gold);
}

.photo-card.selected .photo-checkbox svg {
  opacity: 1;
}

.photo-card.selected {
  box-shadow: 0 0 0 3px var(--gold), 0 8px 32px rgba(212, 162, 78, 0.2);
}

.photo-card.selectable:active {
  transform: scale(0.98);
}

.photo-card.selectable {
  transition: box-shadow 200ms ease, transform 160ms var(--ease-out);
}

/* Skeleton placeholder */
.photo-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg-elevated) 0%, var(--bg-surface) 50%, var(--bg-elevated) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  z-index: 0;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Selection Bar
   ============================================ */
.selection-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem 0.75rem 1.5rem;
  background: rgba(19, 19, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  z-index: 100;
  animation: slideUp 300ms var(--ease-out);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(100%); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.selection-bar-info {
  font-size: 0.9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.selection-bar-info span {
  color: var(--gold);
  font-weight: 700;
}

.selection-bar-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-cancel {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn-cancel:active {
  transform: scale(0.97);
}

.btn-select-all {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}

.btn-select-all:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn-select-all:active {
  transform: scale(0.97);
}

.btn-download-zip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  background: var(--gold);
  color: #1a1208;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 160ms var(--ease-out), background 200ms ease;
}

.btn-download-zip:hover {
  background: var(--gold-bright);
}

.btn-download-zip:active {
  transform: scale(0.97);
}

.btn-download-zip:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.selection-bar-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-left: 0.5rem;
}

.progress-bar-track {
  width: 120px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--gold);
  border-radius: var(--radius-pill);
  transition: width 200ms ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ============================================
   Lightbox
   ============================================ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 8, 10, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 250ms var(--ease-out);
}

.lightbox.visible {
  opacity: 1;
}

.lightbox-image-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 4rem 1rem;
  width: 100%;
  overflow: hidden;
}

.lightbox-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
  transform: scale(0.96);
  opacity: 0;
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
}

.lightbox-image-wrap img.loaded {
  transform: scale(1);
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  transition: background 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
  z-index: 3;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.lightbox-close:active {
  transform: scale(0.92);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  transition: background 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
  z-index: 3;
}

.lightbox-prev { left: 1.25rem; }
.lightbox-next { right: 1.25rem; }

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.lightbox-nav:active {
  transform: translateY(-50%) scale(0.92);
}

.lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 2rem 1.5rem;
  width: 100%;
  max-width: 800px;
}

.lightbox-counter {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--gold);
  color: #1a1208;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 160ms var(--ease-out), background 200ms ease;
}

.btn-download:hover {
  background: var(--gold-bright);
}

.btn-download:active {
  transform: scale(0.97);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem;
  text-align: center;
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-logo {
  width: 200px;
  height: auto;
  opacity: 0.7;
  transition: opacity 200ms ease;
}

.footer-logo:hover {
  opacity: 1;
}

.footer-credit {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.footer-copy {
  font-size: 0.8rem;
  color: var(--text-dim);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .gallery-section { padding: 3rem 1rem 5rem; }
  .gallery-toolbar { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .lightbox-image-wrap { padding: 3.5rem 1rem 1rem; }
  .lightbox-nav { width: 40px; height: 40px; }
  .lightbox-prev { left: 0.75rem; }
  .lightbox-next { right: 0.75rem; }
  .lightbox-bar { padding: 0.75rem 1rem 1.25rem; }
  .selection-bar {
    flex-wrap: wrap;
    justify-content: center;
    left: 1rem;
    right: 1rem;
    transform: none;
    border-radius: var(--radius);
  }
  .selection-bar { animation: slideUpMobile 300ms var(--ease-out); }
  @keyframes slideUpMobile {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .hero-logo-wrap, .hero-meta, .hero-cta {
    opacity: 1 !important;
    transform: none !important;
  }
  .photo-card {
    opacity: 1 !important;
    transform: none !important;
  }
  .photo-skeleton { animation: none; }
}
