/* Hide navigation bar on landing page */
body[data-js-page="home"] .nav-bar {
  display: none !important;
}

/* Hero Preview Main Wrapper */
.hero-preview {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 600px;
  background-color: var(--color-bg-dark, #1A1A2E);
  /* Keep dark scheme */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Home Tiles & Grid container */
.home-tiles {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 2;
}

/* Pieces container holding the 42 tiles */
.pieces {
  --pieces-height: 72vh;
  --pieces-width: calc(72vh * 1.111);
  /* 10:9 Aspect ratio */

  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--pieces-width);
  height: var(--pieces-height);
  margin-left: calc(-1 * var(--pieces-width) / 2);
  margin-top: calc(-1 * var(--pieces-height) / 2);
  transform-style: preserve-3d;
  perspective: 1000px;
  pointer-events: none;
  /* Smooth mousemove interpolation */
  transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: transform;
}

/* Seamless single image background layer for assembled resting state */
.pieces-bg {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.pieces-bg.visible {
  opacity: 1;
}

.home-tiles.is-explored .pieces-bg {
  opacity: 0 !important;
  transition: opacity 0.3s ease !important;
}

/* Individual grid pieces */
.piece {
  position: absolute;
  /* Expand 1px beyond grid cell on right+bottom edge to cover subpixel gaps */
  width: calc(var(--pieces-width) / 6 + 1px);
  height: calc(var(--pieces-height) / 7 + 1px);
  left: calc(var(--col) * var(--pieces-width) / 6);
  top: calc(var(--row) * var(--pieces-height) / 7);

  background-repeat: no-repeat;
  background-size: var(--pieces-width) var(--pieces-height);
  background-position: calc(-1 * var(--col) * var(--pieces-width) / 6) calc(-1 * var(--row) * var(--pieces-height) / 7);
  box-shadow: none;

  /* Staggered flyaway animations set dynamically via JS */
  transition: transform 1.5s cubic-bezier(0.76, 0, 0.24, 1),
    opacity 1.5s cubic-bezier(0.76, 0, 0.24, 1);
  transition-delay: var(--delay, 0s);
  will-change: transform, opacity;
  opacity: 1;
  transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
}

/* Explore Transition: Pieces Fly Away */
/* Force inline styles from entrance animation to be overridden */
.home-tiles.is-explored .piece {
  transform: translate3d(var(--fly-x, 0), var(--fly-y, 0), 0) rotate(var(--fly-r, 15deg)) scale(0.3) !important;
  opacity: 0.15 !important;
  /* Re-apply CSS transition so fly-away timing is correct even if entrance inline is still present */
  transition: transform 1.5s cubic-bezier(0.76, 0, 0.24, 1) var(--delay, 0s),
    opacity 1.5s cubic-bezier(0.76, 0, 0.24, 1) var(--delay, 0s) !important;
}

/* Ambient Overlay to darken background grid and add depth */
.tiles-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(26, 26, 46, 0.25) 0%, rgba(26, 26, 46, 0.85) 90%);
  pointer-events: none;
  z-index: 5;
}

/* Centered Branding Content Overlay */
.intro-content {
  position: relative;
  z-index: 10;
  text-align: center;
  pointer-events: none;
  transition: opacity 1s cubic-bezier(0.25, 1, 0.5, 1);
}

.intro-title {
  font-family: var(--font-heading, 'Playfair Display');
  font-size: 5rem;
  color: var(--color-text-light, #F9F6F0);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  animation: introFadeIn 1.4s cubic-bezier(0.25, 1, 0.5, 1) both;
}

.intro-subtitle {
  font-family: var(--font-body, 'DM Sans');
  font-size: 0.95rem;
  color: var(--color-gold, #C9A96E);
  /* Gold */
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  margin-top: 1rem;
  opacity: 0.85;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  animation: introFadeIn 1.4s cubic-bezier(0.25, 1, 0.5, 1) 0.2s both;
}

/* Explore Fadeout */
.home-tiles.is-explored .intro-content {
  opacity: 0;
}

/* Explore Button (Circular Overlay) */
.explore-btn {
  position: absolute;
  bottom: 8vh;
  left: 50%;
  transform: translateX(-50%) scale(1);
  width: 140px;
  height: 140px;
  z-index: 15;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1),
    transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: opacity, transform;
}

.explore-btn__circle {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(249, 246, 240, 0.3);
  /* Pale cream */
  background-color: rgba(26, 26, 46, 0.8);
  /* Dark */
  border-radius: 50%;
  transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
}

.explore-btn__text {
  position: relative;
  z-index: 2;
  font-family: var(--font-body, 'DM Sans');
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: var(--color-text-light, #F9F6F0);
  transition: color 0.4s ease;
}

/* Explore Button Hover Animations */
.explore-btn:hover .explore-btn__circle {
  border-color: var(--color-gold, #C9A96E);
  background-color: var(--color-burgundy, #4A1A2C);
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(201, 169, 110, 0.2);
}

.explore-btn:hover .explore-btn__text {
  color: var(--color-gold, #C9A96E);
}

/* Explore Fadeout */
.home-tiles.is-explored .explore-btn {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(0.3);
}

/* Full-Screen Navigation Overlay */
.preview-nav-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(26, 26, 46, 0.98);
  /* Deep Navy */
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.04);
  transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1),
    transform 0.8s cubic-bezier(0.25, 1, 0.5, 1),
    visibility 0.8s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: opacity, transform;
}

.preview-nav-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
}

/* Close Button inside Overlay */
.preview-nav-close {
  position: absolute;
  top: 40px;
  right: 40px;
  background: none;
  border: none;
  color: var(--color-text-light, #F9F6F0);
  font-size: 3rem;
  font-weight: 200;
  cursor: pointer;
  transition: color 0.3s ease, transform 0.3s ease;
  line-height: 1;
  z-index: 110;
}

.preview-nav-close:hover {
  color: var(--color-gold, #C9A96E);
  transform: rotate(90deg);
}

/* Overlay Navigation List */
.preview-nav-links {
  list-style: none;
  text-align: center;
  padding: 0;
  margin: 0;
}

.preview-nav-links li {
  margin: 1.5rem 0;
  overflow: hidden;
}

.preview-nav-links a {
  display: inline-block;
  font-family: var(--font-heading, 'Playfair Display');
  font-size: 3.5rem;
  color: var(--color-text-light, #F9F6F0);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.4s ease, transform 0.4s ease;
  transform: translateY(0);
}

.preview-nav-links a:hover {
  color: var(--color-gold, #C9A96E);
  transform: translateY(-5px);
}

.preview-nav-links a.active {
  color: var(--color-gold, #C9A96E);
  font-style: italic;
}

/* Hero Socials & Copyright - Positioning */
.hero__socials {
  position: absolute;
  bottom: 40px;
  left: 40px;
  z-index: 25;
}

.hero__copyright {
  position: absolute;
  bottom: 40px;
  right: 40px;
  z-index: 25;
  font-family: var(--font-body, 'DM Sans');
  font-size: 0.8rem;
  color: rgba(249, 246, 240, 0.5);
  margin: 0;
}

/* Animations */
@keyframes introFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .pieces {
    --pieces-height: 60vh;
    --pieces-width: calc(60vh * 1.111);
  }

  .intro-title {
    font-size: 4rem;
  }

  .preview-nav-links a {
    font-size: 2.8rem;
  }
}

@media (max-width: 768px) {
  .pieces {
    --pieces-height: 50vh;
    --pieces-width: calc(50vh * 1.111);
  }

  .intro-title {
    font-size: 3rem;
  }

  .intro-subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.25em;
  }

  .preview-nav-links a {
    font-size: 2.2rem;
  }

  .explore-btn {
    width: 110px;
    height: 110px;
    bottom: 12vh;
  }

  .explore-btn__text {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
  }

  .hero__socials,
  .hero__copyright {
    bottom: 20px;
    left: 20px;
    right: 20px;
  }

  .hero__copyright {
    text-align: right;
  }
}

@media (max-width: 480px) {
  .pieces {
    --pieces-height: 40vh;
    --pieces-width: calc(40vh * 1.111);
  }

  .intro-title {
    font-size: 2.2rem;
  }

  .preview-nav-links a {
    font-size: 1.8rem;
  }

  .preview-nav-close {
    top: 20px;
    right: 20px;
    font-size: 2.5rem;
  }
}