/* ================================================================
   THE BIRDHOUSE · MALLORCA
   Shared Stylesheet
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=Jost:wght@300;400;500&display=swap');

/* --- Reset -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Jost', system-ui, -apple-system, sans-serif;
  font-weight: 300;
  background: #f8f7f4;
  color: #1a1916;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* --- Typography --------------------------------------------- */
h1, h2, h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(3rem, 7.5vw, 6.5rem); }
h2 { font-size: clamp(2rem, 4.5vw, 3.4rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); }

h1 em, h2 em, h3 em { font-style: italic; font-weight: 300; }

p {
  font-size: 0.95rem;
  font-weight: 300;
  color: #5a5854;
  line-height: 1.85;
  letter-spacing: 0.01em;
}

.section-label {
  display: block;
  font-family: 'Jost', sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #a8a49e;
  margin-bottom: 1.2rem;
  font-weight: 400;
}

/* --- Layout ------------------------------------------------- */
.container      { max-width: 1220px; margin: 0 auto; padding: 0 40px; }
.container--mid { max-width: 900px;  margin: 0 auto; padding: 0 40px; }
.container--narrow { max-width: 680px; margin: 0 auto; padding: 0 40px; }

/* --- Navigation --------------------------------------------- */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 44px;
  height: 68px;
  transition: background 0.4s ease, border-bottom-color 0.4s ease;
  border-bottom: 1px solid transparent;
}

.site-nav.scrolled {
  background: rgba(248, 247, 244, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: #e4e0da;
}

.nav-logo {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #fff;
  transition: color 0.4s;
}

.site-nav.scrolled .nav-logo { color: #1a1916; }

.nav-links {
  list-style: none;
  display: flex;
  gap: 38px;
  align-items: center;
}

.nav-links a {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
  transition: color 0.3s;
  font-weight: 400;
}

.nav-links a:hover { color: #fff; }
.site-nav.scrolled .nav-links a { color: #7a7670; }
.site-nav.scrolled .nav-links a:hover { color: #1a1916; }

/* mobile hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 6px;
}
.nav-toggle span {
  display: block;
  width: 26px;
  height: 1.5px;
  background: #fff;
  transition: background 0.3s, transform 0.3s;
}
.site-nav.scrolled .nav-toggle span { background: #1a1916; }

.nav-links.mobile-open {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 68px 0 0;
  background: #f8f7f4;
  padding: 40px;
  gap: 28px;
  align-items: flex-start;
}
.nav-links.mobile-open a {
  color: #1a1916;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
}

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

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  z-index: 0;
  animation: kb-slow 18s ease-in-out infinite alternate;
}

/* Slide captions (gallery) */
.slide-caption {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  font-weight: 400;
  z-index: 10;
  pointer-events: none;
}

/* Full-viewport gallery carousel */
.carousel--fullscreen {
  aspect-ratio: unset;
  height: calc(100vh - 0px);
  min-height: 600px;
}

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(0,0,0,0.1) 0%, transparent 30%),
    linear-gradient(to top,    rgba(0,0,0,0.55) 0%, transparent 50%);
  z-index: 1;
}

.hero-inner {
  position: relative;
  z-index: 2;
  color: #fff;
  padding: 0 24px;
}

.hero-location {
  position: absolute;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 2;
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  font-weight: 400;
}

.hero-page-label {
  font-size: 0.65rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.65);
  margin-bottom: 1.8rem;
  display: block;
  font-weight: 400;
}

.hero h1 {
  color: #fff;
  margin-bottom: 1.4rem;
  text-shadow: 0 2px 32px rgba(0,0,0,0.18);
}

.hero p {
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto 2.8rem;
  line-height: 1.75;
}

.hero-scroll {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-weight: 400;
}

.hero-scroll::after {
  content: '';
  width: 1px;
  height: 52px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.5), transparent);
  animation: drop 2s ease infinite;
}

@keyframes drop {
  0%   { opacity: 0; transform: scaleY(0); transform-origin: top; }
  40%  { opacity: 1; transform: scaleY(1); transform-origin: top; }
  60%  { opacity: 1; transform-origin: bottom; }
  100% { opacity: 0; transform: scaleY(0); transform-origin: bottom; }
}

/* --- Buttons ----------------------------------------------- */
.btn {
  display: inline-block;
  padding: 13px 40px;
  font-family: 'Jost', sans-serif;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.65);
  color: #fff;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.btn:hover { background: #fff; color: #1a1916; border-color: #fff; }

.btn--dark {
  border-color: #1a1916;
  color: #1a1916;
}
.btn--dark:hover { background: #1a1916; color: #fff; }

/* --- Stats Bar --------------------------------------------- */
.stats {
  display: flex;
  border-top: 1px solid #e4e0da;
  border-bottom: 1px solid #e4e0da;
  background: #f8f7f4;
}

.stat {
  flex: 1;
  padding: 34px 16px;
  text-align: center;
  border-right: 1px solid #e4e0da;
}
.stat:last-child { border-right: none; }

.stat-n {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 300;
  color: #1a1916;
  line-height: 1;
  margin-bottom: 7px;
}

.stat-l {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #a8a49e;
  font-weight: 400;
}

/* --- Section text ------------------------------------------ */
.section-text { text-align: center; }
.section-text h2 { margin-bottom: 1.2rem; }
.section-text p  { max-width: 600px; margin: 0 auto 1rem; }

/* --- Section wrapper --------------------------------------- */
.section { padding: 100px 0; }
.section--sm { padding: 64px 0; }
.section--lg { padding: 140px 0; }

/* --- Section cards (3-up) ---------------------------------- */
.section-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  margin: 72px 0;
}

.section-card {
  position: relative;
  display: block;
  aspect-ratio: 3/4;
  overflow: hidden;
  background: #111;
}

.section-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s ease;
}

.section-card:hover .section-card-img { transform: scale(1.05); }

.section-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 55%);
}

.section-card-body {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 32px 28px;
  z-index: 1;
  color: #fff;
}

.section-card-eyebrow {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  margin-bottom: 6px;
  font-weight: 400;
}

.section-card-title {
  display: block;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.45rem;
  font-weight: 300;
  margin-bottom: 6px;
}

.section-card-sub {
  display: block;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.06em;
  font-weight: 300;
}

/* --- Editorial split --------------------------------------- */
.editorial {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.editorial--reverse { direction: rtl; }
.editorial--reverse > * { direction: ltr; }

.editorial-img {
  position: relative;
  overflow: hidden;
  background: #111;
}

.editorial-img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  animation: kb-slow 16s ease-in-out infinite alternate;
}

.editorial-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px 72px;
  background: #f8f7f4;
}

.editorial-text h2 { margin-bottom: 1.2rem; }
.editorial-text p  { margin-bottom: 1rem; }

blockquote {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 300;
  color: #7a7670;
  border-left: 2px solid #e4e0da;
  padding-left: 20px;
  margin-top: 24px;
  line-height: 1.6;
}

/* === Ken Burns (zoom / pan) === */
@keyframes kb-zoom-right { 0% { transform: scale(1.0) translate(0,0); }       100% { transform: scale(1.12) translate(-2.5%,-1%); } }
@keyframes kb-zoom-left  { 0% { transform: scale(1.0) translate(0,0); }       100% { transform: scale(1.12) translate(2.5%,-1%); } }
@keyframes kb-zoom-down  { 0% { transform: scale(1.1) translate(-2%,0); }     100% { transform: scale(1.0) translate(2%,1%); } }
@keyframes kb-zoom-up    { 0% { transform: scale(1.1) translate(2%,1%); }     100% { transform: scale(1.0) translate(-2%,0); } }
@keyframes kb-slow       { 0% { transform: scale(1.0) translate(0,0); }       100% { transform: scale(1.07) translate(-1.5%,-0.5%); } }

/* --- Carousel ---------------------------------------------- */
.carousel {
  position: relative;
  overflow: hidden;
  background: #111;
  aspect-ratio: 16/9;
}

.carousel--tall  { aspect-ratio: 4/3; }
.carousel--sq    { aspect-ratio: 1/1; }
.carousel--ultra { aspect-ratio: 21/9; }

.carousel-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.6s ease-in-out;
  will-change: opacity;
  pointer-events: none;
}

/* Show first slide before JS initialises */
.carousel-slide:first-child {
  opacity: 1;
  pointer-events: all;
}

/* Once JS has run (.carousel--ready), it controls all visibility */
.carousel--ready .carousel-slide:first-child {
  opacity: 0;
  pointer-events: none;
}

.carousel-slide.active,
.carousel--ready .carousel-slide.active {
  opacity: 1;
  pointer-events: all;
}

/* Ken Burns on active slide images — direction rotates per slide */
.carousel-slide.active img {
  animation-duration: 7s;
  animation-timing-function: ease-in-out;
  animation-fill-mode: both;
}
.carousel-slide:nth-child(4n+1).active img { animation-name: kb-zoom-right; }
.carousel-slide:nth-child(4n+2).active img { animation-name: kb-zoom-left; }
.carousel-slide:nth-child(4n+3).active img { animation-name: kb-zoom-down; }
.carousel-slide:nth-child(4n+0).active img { animation-name: kb-zoom-up; }

/* Autoplay progress bar */
.carousel-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 2px;
  background: rgba(255,255,255,0.7);
  z-index: 20;
  width: 0%;
  transition: none;
}
.carousel-progress.running {
  width: 100%;
  transition: width linear;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  width: 52px;
  height: 52px;
  font-size: 1.4rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s, color 0.25s;
  line-height: 1;
}

.carousel-btn:hover { background: rgba(0,0,0,0.55); color: #fff; }
.carousel-prev { left: 20px; }
.carousel-next { right: 20px; }

.carousel-counter {
  position: absolute;
  bottom: 18px;
  right: 22px;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.6);
  z-index: 10;
  font-weight: 400;
}

/* --- Single image full width ------------------------------- */
.image-full {
  position: relative;
  width: 100%;
  aspect-ratio: 21/9;
  overflow: hidden;
  background: #111;
}

.image-full--wide { aspect-ratio: 3/1; }
.image-full--standard { aspect-ratio: 16/9; }

.image-full img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  animation: kb-slow 14s ease-in-out infinite alternate;
}

.image-full-caption {
  position: absolute;
  bottom: 28px;
  left: 40px;
  color: rgba(255,255,255,0.7);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  z-index: 2;
  font-weight: 400;
}

/* --- Feature Dark Band ------------------------------------- */
.band-dark {
  background: #1a1916;
  color: #f0ede8;
  padding: 100px 0;
  text-align: center;
}

.band-dark .section-label { color: #5a5854; }
.band-dark h2 { color: #f0ede8; }
.band-dark p  { color: #7a7670; max-width: 600px; margin: 0 auto; }

/* --- Cave dark theme --------------------------------------- */
.cave-bg {
  background: #111008;
  color: #f0ede8;
}

.cave-bg .section-label { color: #5a5650; }
.cave-bg h2  { color: #f0ede8; }
.cave-bg h3  { color: #d8d4cc; }
.cave-bg p   { color: #8a8880; }

.cave-bg .editorial-text { background: #111008; }
.cave-bg .stats { background: #111008; border-color: #2a2820; }
.cave-bg .stat  { border-right-color: #2a2820; }
.cave-bg .stat-n { color: #f0ede8; }

/* --- Feature grid (icons) ---------------------------------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 52px 72px;
}

.feature-item { text-align: center; }

.feature-icon {
  display: block;
  font-size: 1.6rem;
  margin-bottom: 16px;
  color: #a8a49e;
}

.feature-item h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  color: #1a1916;
}

.feature-item p { font-size: 0.85rem; color: #7a7670; }

.cave-bg .feature-item h3 { color: #d8d4cc; }

/* --- Gallery grid ------------------------------------------ */
.gallery-section { margin-bottom: 64px; }

.gallery-section h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-weight: 400;
  color: #a8a49e;
  margin-bottom: 3px;
}

.gallery-section h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 28px;
}

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

.gallery-item {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #111;
  cursor: zoom-in;
}

.gallery-item--wide { grid-column: span 2; aspect-ratio: 8/3; }
.gallery-item--tall { grid-row: span 2; }

.gallery-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}

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

/* --- Lightbox ---------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 7, 0.96);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

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

#lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  box-shadow: 0 8px 80px rgba(0,0,0,0.6);
}

.lb-close, .lb-prev, .lb-next {
  position: fixed;
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
  padding: 8px;
  font-family: Georgia, serif;
}

.lb-close:hover, .lb-prev:hover, .lb-next:hover { color: #fff; }

.lb-close { top: 24px; right: 32px; font-size: 1.6rem; }
.lb-prev  { left: 28px;  top: 50%; transform: translateY(-50%); font-size: 2.4rem; }
.lb-next  { right: 28px; top: 50%; transform: translateY(-50%); font-size: 2.4rem; }

/* --- Footer ------------------------------------------------ */
.site-footer {
  border-top: 1px solid #e4e0da;
  padding: 52px 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
  background: #f8f7f4;
}

.footer-logo {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 400;
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #1a1916;
}

.footer-nav {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #a8a49e;
  transition: color 0.25s;
  font-weight: 400;
}

.footer-nav a:hover { color: #1a1916; }

.footer-copy {
  font-size: 0.65rem;
  color: #c0bcb6;
  letter-spacing: 0.06em;
  font-weight: 300;
}

/* --- Reveal animation -------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* --- Responsive -------------------------------------------- */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  .section-cards {
    grid-template-columns: 1fr;
  }
  .section-card { aspect-ratio: 3/2; }

  .editorial {
    grid-template-columns: 1fr;
    direction: ltr !important;
  }
  .editorial-img { aspect-ratio: 4/3; position: relative; min-height: 340px; }
  .editorial-text { padding: 56px 40px; }

  .feature-grid { grid-template-columns: 1fr 1fr; gap: 40px 48px; }

  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery-item--wide { grid-column: span 1; aspect-ratio: 4/3; }

  .image-full { aspect-ratio: 4/3; }
  .carousel { aspect-ratio: 4/3; }
}

@media (max-width: 640px) {
  .container, .container--mid, .container--narrow { padding: 0 24px; }
  .site-nav { padding: 0 24px; }

  h1 { font-size: 2.8rem; }
  h2 { font-size: 2rem; }

  .section { padding: 72px 0; }
  .section--lg { padding: 72px 0; }

  .stats { flex-wrap: wrap; }
  .stat { flex: 1 1 50%; border-bottom: 1px solid #e4e0da; }

  .feature-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  .gallery-item--wide { aspect-ratio: 4/3; }

  .editorial-text { padding: 40px 24px; }

  .carousel { aspect-ratio: 1/1; }
  .image-full { aspect-ratio: 1/1; }
}

/* --- Hero Carousel ----------------------------------------- */
.hero .carousel {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero .carousel-btn,
.hero .carousel-counter,
.hero .carousel-progress {
  display: none !important;
}
.hero .carousel-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
