/* 
  3D Orbit Layout - Desktop (Spheres) / Mobile (Boxes)
*/
:root {
  --bg-color: #050505;
  --text-primary: #ffffff;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  margin: 0;
  overflow-x: hidden;
}

/* ==========================================
   LAYOUT SEPARATION
========================================== */
.desktop-layout { display: block; }
.mobile-layout { display: none; }

@media (max-width: 768px) {
  .desktop-layout { display: none; }
  .mobile-layout { display: block; }
}

/* ==========================================
   VIEWPORT & SCROLL TRACK
========================================== */
.orbit-main {
  position: relative;
  width: 100%;
}

/* 4 sections = 400vh scroll height */
.orbit-scroll-track {
  height: 400vh; 
}

/* Fixed viewport that holds the scenes */
.orbit-viewport {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  background: var(--bg-color);
  perspective: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* The actual spinning carousel */
.orbit-carousel {
  position: relative;
  width: 1px;
  height: 1px;
  transform-style: preserve-3d;
  will-change: transform;
}

/* ==========================================
   ORBIT ITEMS (Desktop: Stable Spheres)
========================================== */
.orbit-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 80vw;
  max-width: 1000px;
  height: 60vh;
  /* Centering */
  margin-top: -30vh;
  margin-left: -40vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transform-style: preserve-3d;
}
.orbit-item, .orbit-item * {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Position items in a massive 3D ring */
.item-1 { transform: rotateY(0deg) translateZ(900px); }
.item-2 { transform: rotateY(90deg) translateZ(900px); }
.item-3 { transform: rotateY(180deg) translateZ(900px); }
.item-4 { transform: rotateY(270deg) translateZ(900px); }

/* ==========================================
   THE 3D MEDIA
========================================== */
.orbit-media {
  position: relative;
  /* Desktop Sphere dimensions */
  width: 35vw;
  height: 35vw;
  max-width: 450px;
  max-height: 450px;
  border-radius: 50%;
  transform-style: preserve-3d;
  will-change: transform;
}

/* The actual image */
.media-bg {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  z-index: 1;
}

/* 3D Lighting/Shadow */
.media-shadow {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border-radius: 50%;
  box-shadow: inset -30px -30px 60px rgba(0,0,0,0.8),
              inset 10px 10px 30px rgba(255,255,255,0.2),
              0 20px 50px rgba(0,0,0,0.5);
  z-index: 2;
}

/* ==========================================
   TYPOGRAPHY (Desktop: Stable Layout)
========================================== */
.orbit-text {
  position: relative;
  z-index: 3;
  width: 45%;
  transform: translateZ(80px); /* Increased Z push for more dramatic 3D pop */
  transform-style: preserve-3d;
}

/* Adjust text placement depending on side */
.right-align { text-align: left; }
.left-align { text-align: right; order: -1; }

.orbit-subtitle {
  color: #b0b0b0;
  letter-spacing: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 15px;
  display: block;
  text-shadow: 0 5px 15px rgba(0,0,0,0.8);
}

.orbit-text h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 4vw, 4rem);
  line-height: 1.1;
  margin-bottom: 25px;
  text-shadow: 0 10px 30px rgba(0,0,0,0.8), 0 2px 10px rgba(0,0,0,0.5);
  transform: translateZ(20px); /* Individual depth */
}

.orbit-text p {
  color: #eaeaea;
  line-height: 1.6;
  font-size: clamp(1rem, 1.2vw, 1.2rem);
  text-shadow: 0 5px 15px rgba(0,0,0,0.8);
  transform: translateZ(10px); /* Individual depth */
}

/* Button */
.orbit-btn {
  display: inline-block;
  margin-top: 30px;
  padding: 16px 45px;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  border-radius: 30px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  transform: translateZ(15px); /* Depth for button */
}
.orbit-btn:hover {
  background: #fff;
  color: #000;
  transform: scale(1.05) translateZ(15px);
}

/* ==========================================
   MOBILE RESPONSIVENESS (Mobile: Boxes)
========================================== */
@media (max-width: 768px) {
  .mobile-layout .orbit-main {
    position: relative;
    width: 100vw;
    height: 100vh;
  }
  
  .mobile-layout .orbit-scroll-track {
    display: none;
  }
  
  .mobile-layout .orbit-viewport {
    position: relative;
    width: 100vw;
    height: 100vh;
  }

  .swipe-indicator-wrapper {
    display: none;
  }
  
  /* Mobile Adjustments for Orbit Items */
  .mobile-layout .orbit-item {
    padding: 0 15px;
  }
  
  .mobile-layout .orbit-text h2 {
    font-size: clamp(2rem, 8vw, 3rem);
    margin-bottom: 15px;
  }
  
  .mobile-layout .orbit-text p {
    font-size: 0.95rem;
  }
  
  .mobile-layout .orbit-btn {
    padding: 12px 30px;
    font-size: 0.8rem;
  }
  .orbit-carousel {
    transform: translateZ(0px); /* No additional shift on mobile */
  }

  .orbit-item {
    flex-direction: column;
    width: 70vw; /* Reverted to 70vw so edges don't cut off in 3D space */
    height: 95vh; 
    margin-top: -47.5vh; 
    margin-left: -35vw; /* Re-centered for 70vw */
    justify-content: center;
    padding-top: 0;
    gap: 8px;
    transform-style: preserve-3d; /* Fixes broken Z-depth on children */
  }
  
  /* Morph Spheres into Portrait Boxes on Mobile */
  .orbit-media {
    width: 45vw; /* Shrunk slightly to give text more vertical room */
    height: 45vw; 
    max-width: 220px;
    max-height: 220px;
    border-radius: 15px; /* Become boxes */
  }
  
  .media-bg, .media-shadow {
    border-radius: 15px; /* Box corners */
  }

  .orbit-text {
    width: 100%;
    max-width: 100%; 
    margin: 0 auto;
    padding: 0 5vw; /* Restored safe padding to keep words off the edge */
    box-sizing: border-box;
    text-align: center;
    order: 0 !important;
    transform: translateZ(80px); /* Massive base depth on mobile */
    transform-style: preserve-3d; /* Keep children in 3D */
  }

  .left-align, .right-align {
    text-align: center;
  }
  
  .orbit-subtitle {
    transform: translateZ(40px); /* Doubled depth */
    display: inline-block;
    margin-bottom: 5px;
    font-size: clamp(0.4rem, 1.5vw, 0.5rem); /* Micro sized */
    letter-spacing: 2px;
    color: #c7a26b; /* Ensure it stays gold */
    text-transform: uppercase;
  }

  .orbit-text > * {
    transform: translateZ(40px); /* Default pop out for EVERYTHING (button, trusted section, etc) */
  }

  .orbit-text h2 {
    font-size: clamp(0.7rem, 3.5vw, 0.95rem); /* Micro heading */
    margin-bottom: 8px; /* Slightly tighter margin */
    white-space: normal;
    transform: translateZ(100px); /* EXTREME pop out for heading */
  }

  .orbit-text p {
    font-size: clamp(0.4rem, 1.8vw, 0.55rem); /* Micro paragraph */
    line-height: 1.25; /* Tighter line height saves vertical space */
    transform: translateZ(60px); /* Strong pop for para */
  }

  .orbit-btn {
    margin-top: 20px;
    padding: 14px 35px;
    font-size: 0.85rem;
    pointer-events: auto;
  }
  
  /* Tighter carousel radius on mobile */
  .item-1 { transform: rotateY(0deg) translateZ(300px); }
  .item-2 { transform: rotateY(90deg) translateZ(300px); }
  .item-3 { transform: rotateY(180deg) translateZ(300px); }
  .item-4 { transform: rotateY(270deg) translateZ(300px); }
}

/* ==========================================
   DESKTOP COVERFLOW LAYOUT
========================================== */
.coverflow-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #111, var(--bg-color));
}

.coverflow-viewport {
  width: 100%;
  height: 100vh;
  perspective: 1500px; /* 3D depth */
  overflow: hidden;
  display: flex;
  align-items: center;
  padding-top: 80px; /* Clear the fixed header */
  box-sizing: border-box;
}

.coverflow-track {
  display: flex;
  width: max-content;
  height: 100vh;
  align-items: center;
}

.coverflow-card {
  width: 85vw;
  max-width: 1300px;
  margin: 0 30px; /* Gap between cards */
  flex-shrink: 0;
  transform-origin: center center;
  will-change: transform, opacity;
  display: flex;
  justify-content: center;
}

.coverflow-card-content {
  width: 100%;
  height: auto;
  max-height: 85vh;
  overflow-y: auto;
  background: rgba(40, 40, 40, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 40px;
  display: flex;
  align-items: stretch;
  gap: 40px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.8);
}

/* Hide scrollbar for card content if it scrolls */
.coverflow-card-content::-webkit-scrollbar {
  display: none;
}
.coverflow-card-content {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Layout Variations */
.coverflow-card-content.layout-left { flex-direction: row; }
.coverflow-card-content.layout-right { flex-direction: row-reverse; }

.node-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  pointer-events: auto;
}

.depth-year {
  color: #c7a26b;
  letter-spacing: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
  text-transform: uppercase;
}

.node-text h2 {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  line-height: 1.1;
  margin-bottom: 15px;
}

.node-text p {
  color: #cccccc;
  line-height: 1.6;
  font-size: 1rem;
  margin-bottom: 15px;
}

.node-media {
  flex: 1;
  min-height: 300px;
  overflow: hidden;
  border-radius: 10px;
  opacity: 1;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.node-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================
   FINAL CTA SECTION
========================================== */
.final-cta {
    position: relative;
    width: 100%;
    padding: 120px 20px;
    background-color: #0b0b0b; /* Solid fallback to prevent fixed viewport bleed-through */
    background-image: url('https://images.unsplash.com/photo-1604928141064-207cea6f5822?q=80&w=1600&auto=format&fit=crop');
    background-size: cover;
    background-position: center;
    /* Removed background-attachment: fixed because it is notoriously broken on mobile and causes transparency bugs */
    text-align: center;
    color: #fff;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .cta-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); /* Much darker overlay for perfect text clarity */
    z-index: 1;
  }

.cta-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.cta-content h2 {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 20px;
}

.cta-content p {
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.6;
  margin-bottom: 30px;
  color: #eaeaea;
}

/* Footer Fix */
footer {
  position: relative;
  z-index: 10;
  background: var(--bg-color);
}
