/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  background: #fff;
  color: #111;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
}

/* ============================================================
   HEADER  (gallery pages only — hidden on landing)
   ============================================================ */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 40px;
  opacity: 0;
  pointer-events: none;
  transition: background 0.4s ease, border-color 0.4s ease,
              backdrop-filter 0.4s ease, opacity 0.35s ease;
}

#header.on-gallery {
  opacity: 1;
  pointer-events: all;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

#site-name {
  font-family: 'Faculty Glyphic', serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.3s ease;
  user-select: none;
  color: #111;
}

#site-name:hover {
  opacity: 0.55;
}

/* ── Index Button ── */
.glass-btn {
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #111;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.3s ease;
}

.glass-btn:hover {
  opacity: 0.5;
}

/* ============================================================
   MENU OVERLAY
   ============================================================ */
#menu {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(250, 249, 246, 0.93);
  backdrop-filter: blur(48px) saturate(150%);
  -webkit-backdrop-filter: blur(48px) saturate(150%);
  transform: translateY(-100%);
  transition: transform 0.72s cubic-bezier(0.77, 0, 0.175, 1);
  overflow-y: auto;
  overscroll-behavior: contain;
}

#menu.open {
  transform: translateY(0);
}

.menu-content {
  min-height: 100vh;
  padding: 120px 40px 80px;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 80px;
  align-content: center;
}

/* About */
.menu-about {
  padding-top: 6px;
}

.menu-about-label {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: 16px;
}

.menu-about-text {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.85;
  color: #666;
  max-width: 340px;
}

/* Nav */
.menu-nav {
  display: flex;
  flex-direction: column;
  gap: 38px;
}

.menu-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-category {
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #bbb;
  display: block;
}

.menu-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-link {
  font-family: 'Faculty Glyphic', serif;
  font-size: 40px;
  font-weight: 300;
  line-height: 1.12;
  color: #111;
  cursor: pointer;
  display: inline-block;
  position: relative;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.menu-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 2px;
  width: 0;
  height: 1px;
  background: #111;
  transition: width 0.28s ease;
}

.menu-link:hover {
  opacity: 0.45;
}

.menu-link:hover::after {
  width: 100%;
}

/* Staggered entrance animation */
#menu.open .menu-section {
  animation: menuItemIn 0.55s ease forwards;
  opacity: 0;
}
#menu.open .menu-section:nth-child(1) { animation-delay: 0.18s; }
#menu.open .menu-section:nth-child(2) { animation-delay: 0.26s; }
#menu.open .menu-section:nth-child(3) { animation-delay: 0.34s; }
#menu.open .menu-about { animation: menuItemIn 0.55s ease 0.1s forwards; opacity: 0; }

@keyframes menuItemIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   MAIN / VIEWS
   ============================================================ */
#main {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* ============================================================
   LANDING
   ============================================================ */
#view-landing {
  height: 100vh;
  background: #fff;
}

.landing-layout {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 52px 80px;
}

.landing-name {
  font-family: 'Faculty Glyphic', serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.3s ease;
  color: #111;
}

.landing-name:hover {
  opacity: 0.5;
}

.landing-photo-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  padding: 28px 0;
}

.hero-img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  width: auto;
  height: 100%;
}

.landing-index-btn {
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #111;
  cursor: pointer;
  transition: opacity 0.3s ease;
  padding: 4px 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.landing-index-btn:hover {
  opacity: 0.5;
}

/* ============================================================
   GALLERY PAGES
   ============================================================ */
.gallery-view {
  padding-top: 96px;
  min-height: 100vh;
  background: #fff;
}

.gallery-header {
  padding: 40px 24px 28px;
  text-align: center;
}

.gallery-category-label {
  display: block;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: 10px;
}

.gallery-title {
  font-family: 'Faculty Glyphic', serif;
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: #111;
}

/* Masonry grid */
.gallery {
  columns: 3;
  column-gap: 5px;
  padding: 0 5px 5px;
}

.gallery img {
  width: 100%;
  break-inside: avoid;
  margin-bottom: 5px;
  cursor: zoom-in;
  transition: opacity 0.3s ease;
  background: #f0efec;
}

.gallery img:hover {
  opacity: 0.88;
}

/* Costa Rica — single stacked column */
#gallery-costarica {
  columns: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 24px;
}

/* ── Coffee Project special layout ── */
.coffee-layout {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 32px 80px;
}

.coffee-hero-img {
  width: 100%;
  height: auto;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.3s ease;
}

.coffee-hero-img:hover {
  opacity: 0.9;
}

.coffee-description {
  font-size: 14px;
  font-weight: 300;
  line-height: 1.85;
  color: #666;
  text-align: center;
  max-width: 580px;
  margin: 28px auto 52px;
}

.coffee-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.coffee-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.3s ease;
  background: #f0efec;
}

.coffee-grid img:hover {
  opacity: 0.85;
}

@media (max-width: 700px) {
  .coffee-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 400px) {
  .coffee-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
  .coffee-layout {
    padding: 0 16px 60px;
  }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(8, 8, 8, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

#lb-img {
  max-width: 92vw;
  max-height: 90vh;
  object-fit: contain;
  user-select: none;
  transition: opacity 0.18s ease;
}

#lb-close {
  position: absolute;
  top: 22px;
  right: 28px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.55);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s ease, transform 0.2s ease;
  outline: none;
}

#lb-close:hover {
  color: #fff;
  transform: rotate(90deg);
}

#lb-prev,
#lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 52px;
  font-weight: 200;
  line-height: 1;
  cursor: pointer;
  padding: 20px 16px;
  transition: color 0.2s ease, transform 0.2s ease;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#lb-prev:hover {
  color: rgba(255, 255, 255, 0.9);
  transform: translateY(-50%) translateX(-3px);
}

#lb-next:hover {
  color: rgba(255, 255, 255, 0.9);
  transform: translateY(-50%) translateX(3px);
}

#lb-prev { left: 8px; }
#lb-next { right: 8px; }

/* ============================================================
   RESPONSIVE — TABLET (≤ 900px)
   ============================================================ */
@media (max-width: 900px) {
  #header {
    padding: 24px 28px;
  }

  .menu-content {
    grid-template-columns: 1fr;
    gap: 52px;
    padding: 110px 32px 72px;
  }

  .menu-about-text {
    max-width: 100%;
  }

  .menu-link {
    font-size: 34px;
  }

  .gallery {
    columns: 2;
  }

  .gallery-title {
    font-size: 26px;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤ 580px)
   ============================================================ */
@media (max-width: 580px) {
  #header {
    padding: 20px 20px;
  }

  #site-name {
    font-size: 13px;
    letter-spacing: 0.15em;
  }

  .glass-btn {
    font-size: 9px;
    padding: 8px 16px;
    letter-spacing: 0.16em;
  }

  .menu-content {
    padding: 96px 24px 60px;
    gap: 44px;
  }

  .menu-link {
    font-size: 28px;
  }

  .menu-nav {
    gap: 28px;
  }

  .gallery {
    columns: 1;
    padding: 0 4px 4px;
    column-gap: 4px;
  }

  .gallery img {
    margin-bottom: 4px;
  }

  .gallery-view {
    padding-top: 76px;
  }

  .gallery-header {
    padding: 28px 20px 20px;
  }

  .gallery-title {
    font-size: 22px;
  }

  #lb-prev,
  #lb-next {
    font-size: 38px;
    padding: 14px 10px;
  }

  #lb-prev { left: 0; }
  #lb-next { right: 0; }

  #lb-img {
    max-width: 100vw;
    max-height: 86vh;
  }
}

/* ============================================================
   CUSTOM CURSOR  (desktop only)
   ============================================================ */
@media (pointer: fine) {
  * { cursor: none !important; }

  #cursor {
    position: fixed;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    background: #111;
    border: 1.5px solid transparent;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: width 0.22s ease, height 0.22s ease,
                background 0.22s ease, border-color 0.22s ease,
                opacity 0.22s ease;
    will-change: transform;
  }

  #cursor.is-hovering {
    width: 26px;
    height: 26px;
    background: transparent;
    border-color: #111;
    animation: cursorPulse 2.8s ease-in-out infinite;
  }

  #cursor.is-hidden {
    opacity: 0;
  }
}

@keyframes cursorPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    opacity: 1; }
  50%       { transform: translate(-50%, -50%) scale(1.35); opacity: 0.55; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
