:root {
  --bg-dark: #0a0a0a;
  --text-light: #f5f5f5;
  --accent: #c9a962;
  --stone-400: #a8a29e;
  --stone-600: #57534e;
  --stone-800: #292524;
  --stone-900: #1c1917;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  overflow-x: hidden;
}

.serif {
  font-family: 'Playfair Display', serif;
}

/* Film grain overlay */
.grain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Smooth reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.2s cubic-bezier(0.16, 1, 0.3, 1), transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Image hover effects */
.image-container {
  overflow: hidden;
  position: relative;
}

.image-hover {
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.8s ease;
  will-change: transform;
}

#hero-bg {
  will-change: transform;
}

.group:hover .image-hover {
  transform: scale(1.08);
}

/* Custom cursor for gallery */
.cursor-view {
  cursor: zoom-in;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 10, 0.98);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--stone-800);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--stone-600);
}

/* Filter buttons */
.filter-btn {
  position: relative;
  transition: all 0.4s ease;
}

.filter-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.4s ease;
}

.filter-btn:hover::after,
.filter-btn.active::after {
  width: 100%;
}

.filter-btn.active {
  color: var(--accent);
}

/* Text selection */
::selection {
  background: rgba(201, 169, 98, 0.3);
  color: #fff;
}

/* Loader */
.image-loading {
  background: linear-gradient(90deg, var(--stone-900) 25%, var(--stone-800) 50%, var(--stone-900) 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

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

/* FIXED: Collage gallery - No overlaps, perfect fit */
.gallery-collage {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: 120px; /* Base row height */
  gap: clamp(0.8rem, 2vw, 1.5rem);
  align-items: stretch;
  grid-auto-flow: dense;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  border: 1px solid rgba(168, 162, 158, 0.12);
  background: #111;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  grid-column: span var(--col-span, 4);
  grid-row: span var(--row-span, 2);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s ease,
              border-color 0.4s ease;
  will-change: transform;
}

/* Responsive grid spans */
@media (min-width: 1200px) {
  .gallery-item { --base-col: 4; }
  .gallery-item[data-shape="hero"] { --col-span: 8; --row-span: 4; }
  .gallery-item[data-shape="portrait"] { --col-span: 3; --row-span: 4; }
  .gallery-item[data-shape="wide"] { --col-span: 6; --row-span: 3; }
  .gallery-item[data-shape="square"] { --col-span: 4; --row-span: 3; }
  .gallery-item[data-shape="panorama"] { --col-span: 12; --row-span: 3; }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .gallery-collage { grid-template-columns: repeat(6, 1fr); }
  .gallery-item { --col-span: 3; --row-span: 3; }
  .gallery-item[data-shape="hero"] { --col-span: 6; --row-span: 4; }
  .gallery-item[data-shape="panorama"] { --col-span: 6; --row-span: 3; }
}

@media (max-width: 767px) {
  .gallery-collage {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .gallery-item {
    --col-span: 1 !important;
    --row-span: 1 !important;
    aspect-ratio: 4/3;
    min-height: 300px;
  }
}

.gallery-item:hover {
  border-color: rgba(201, 169, 98, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* This crops beautifully */
  object-position: center;
  transition: transform 1.2s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.8s ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item.reveal {
  opacity: 0;
  transform: translateY(30px) scale(0.96);
}

.gallery-item.reveal.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}
