:root {
  --bg: #f5f4f0;
  --text: #1a1a1a;
  --text-muted: #706e6a;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.5rem 4rem;
  z-index: 100;
}

.logo a {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
}

.filters {
  display: flex;
  gap: 1.5rem;
}

.filter-btn, .nav-link {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.filter-btn:hover, .nav-link:hover {
  color: var(--text);
}

.filter-btn.active {
  color: var(--text);
  border-bottom: 1px solid var(--text);
}

.background-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--serif);
  font-size: 20vw;
  font-weight: 300;
  color: rgba(26, 26, 26, 0.02);
  z-index: -1;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 6rem 3rem;
  max-width: 1400px;
  margin: 12rem auto 8rem auto;
  padding: 0 4rem;
}

.grid-item {
  position: relative;
  display: block;
}

.grid-item .image-wrapper {
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 4;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}

.grid-item:hover img {
  transform: scale(1.03);
}

.grid-item .caption {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.grid-item .caption .category {
  color: var(--text-muted);
}

.grid-item .caption .title {
  font-family: var(--serif);
  font-size: 0.95rem;
  text-transform: none;
  font-weight: 400;
  font-style: italic;
}

.grid-item {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.grid-item.fade-out {
  opacity: 0;
  transform: translateY(15px);
}

@media (min-width: 769px) {
  .grid-item:nth-child(1) { grid-column: 1 / span 5; }
  .grid-item:nth-child(2) { grid-column: 7 / span 5; margin-top: 4rem; }
  .grid-item:nth-child(3) { grid-column: 2 / span 4; margin-top: -2rem; }
  .grid-item:nth-child(4) { grid-column: 7 / span 5; }
  .grid-item:nth-child(5) { grid-column: 3 / span 6; margin-top: 2rem; }
  .grid-item:nth-child(6) { grid-column: 1 / span 4; margin-top: -4rem; }
}

.info-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 450px;
  height: 100%;
  background-color: var(--bg);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.6s var(--ease);
  border-left: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.info-drawer.active {
  transform: translateX(0);
}

.drawer-header {
  padding: 2.5rem 4rem;
  display: flex;
  justify-content: flex-end;
}

.close-drawer {
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.drawer-content {
  padding: 0 4rem 4rem 4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-grow: 1;
}

.drawer-content h2 {
  font-family: var(--serif);
  font-size: 3rem;
  font-weight: 300;
  margin-bottom: 2rem;
}

.drawer-content p {
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.drawer-footer a {
  display: block;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 0.5rem;
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(245, 244, 240, 0.9);
  z-index: 150;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s var(--ease);
}

.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(245, 244, 240, 0.98);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

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

.lightbox-content {
  max-width: 80%;
  max-height: 75vh;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  opacity: 0;
  transform: translateY(20px);
  transition: transform 0.6s var(--ease), opacity 0.6s var(--ease);
}

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

.lightbox-caption {
  margin-top: 1.5rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lightbox-close {
  position: absolute;
  top: 2.5rem;
  right: 4rem;
  background: none;
  border: none;
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

#custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  background-color: #fff;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: #000;
  transition: width 0.3s var(--ease), height 0.3s var(--ease), background-color 0.3s var(--ease);
}

#custom-cursor.view-mode {
  width: 60px;
  height: 60px;
  background-color: #fff;
  color: #000;
  mix-blend-mode: normal;
}

#custom-cursor.link-mode {
  width: 24px;
  height: 24px;
  border: 1px solid #fff;
  background-color: transparent;
}

@media (hover: none) {
  #custom-cursor {
    display: none !important;
  }
}

@media (max-width: 768px) {
  header {
    padding: 1.5rem 2rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    position: relative;
    background-color: var(--bg);
  }
  .filters {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.5rem;
  }
  .grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    margin-top: 2rem;
    padding: 0 2rem;
  }
  .grid-item {
    grid-column: span 1 !important;
    margin-top: 0 !important;
  }
  .info-drawer {
    width: 100%;
  }
  .drawer-content {
    padding: 2rem;
  }
  .drawer-header {
    padding: 1.5rem 2rem;
  }
  .lightbox-content {
    max-width: 90%;
  }
  .lightbox-close {
    top: 1.5rem;
    right: 2rem;
  }
}