/* ==========================================================================
   Cinematic 3D Intro
   A tall scroll track (.cine) with a sticky 3D stage. js/cinematic.js maps
   scroll progress onto a camera path: through the clouds, down onto the site,
   up the towers, and into the home hero.
   ========================================================================== */

.cine {
  --cine-length: 520vh;
  /* Brand colours sampled from the Sahjanand logo */
  --brand-orange: #eb770e;
  --brand-blue: #3d6eb1;
  position: relative;
  height: var(--cine-length);
  background: #0d0f0e;
  color: #fff;
}

.cine-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  perspective: 1100px;
  perspective-origin: 50% 42%;
  isolation: isolate;
  background: linear-gradient(180deg, #d9e8f5 0%, #fbf6ec 45%, #e8ecef 100%);
}

/* Each layer is projected with its own perspective but painted in DOM order
   (no shared preserve-3d), so tilted shots never slice through one another */
.cine-world {
  position: absolute;
  inset: 0;
  perspective: 1100px;
  perspective-origin: 50% 42%;
  will-change: transform;
}

.cine-shot {
  position: absolute;
  inset: -4%;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

/* Oversized so the plane still fills the frame while the camera pitches */
/* Kept close to frame size: every extra % of zoom is upscaling the render */
.cine-shot.shot-aerial {
  inset: -12%;
  transform-origin: 50% 70%;
}

/* Atmospheric haze over the aerial that burns off as the camera descends */
.cine-haze {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 253, 248, .72), rgba(238, 243, 248, .94));
  pointer-events: none;
  will-change: opacity;
}

.cine-shot.shot-rise,
.cine-shot.shot-home {
  opacity: 0;
}

.cine-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.cine-clouds {
  position: absolute;
  inset: 0;
  perspective: 1100px;
  perspective-origin: 50% 42%;
  pointer-events: none;
}

.cine-cloud {
  position: absolute;
  left: 50%;
  top: 50%;
  aspect-ratio: 1024 / 640;
  background: center / contain no-repeat;
  backface-visibility: hidden;
  will-change: transform, opacity;
}

/* Legibility layer: haze at the top, weight on the left for copy beats */
.cine-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(13, 15, 13, .78) 0%, rgba(13, 15, 13, .2) 55%, transparent 80%),
    linear-gradient(0deg, rgba(13, 15, 13, .7) 0%, transparent 45%);
  opacity: 0;
  will-change: opacity;
}

/* Dark vignette only once the camera is below the clouds (--vig set by cinematic.js) */
.cine-stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(8, 9, 8, .55) 100%);
  opacity: var(--vig, 0);
}

/* Morning sun above the cloud bank: a warm core, a soft bloom and slowly turning rays */
.cine-sun {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  will-change: opacity, transform;
  background:
    radial-gradient(circle at 80% 24%, #fffef9 0, #fff6df 3%, rgba(255, 228, 170, .75) 7%, rgba(255, 210, 140, .32) 16%, rgba(255, 205, 130, .12) 30%, transparent 52%),
    linear-gradient(200deg, rgba(255, 214, 150, .28) 0%, transparent 45%);
}

.cine-sun i {
  position: absolute;
  left: 80%;
  top: 24%;
  width: 240vmax;
  height: 240vmax;
  margin: -120vmax 0 0 -120vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 238, 200, .34) 0deg 2.5deg, transparent 2.5deg 9deg);
  -webkit-mask-image: radial-gradient(circle, #000 0, rgba(0, 0, 0, .55) 9%, transparent 34%);
  mask-image: radial-gradient(circle, #000 0, rgba(0, 0, 0, .55) 9%, transparent 34%);
  animation: cineSunRays 140s linear infinite;
}

@keyframes cineSunRays {
  to { transform: rotate(360deg); }
}

.cine-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Copy beats ---------- */

.cine-beat {
  position: absolute;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.cine-beat.is-live {
  pointer-events: auto;
}

.beat-title {
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 1;
}

.beat-title > * {
  transition: opacity 1.1s cubic-bezier(.2, .8, .2, 1), transform 1.3s cubic-bezier(.2, .8, .2, 1), filter 1.1s ease;
}

.cine:not(.is-ready) .beat-title > * {
  opacity: 0;
  transform: translateY(28px);
  filter: blur(10px);
}

.beat-title .cine-title {
  transition-delay: .12s;
}

.beat-title .cine-sub {
  transition-delay: .3s;
}

/* The opening beat sits on white cloud, so it uses the logo's orange and blue, not white */
.cine-kicker,
.cine-sub {
  margin: 0;
  font: 700 11px var(--sans);
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--brand-blue);
  text-shadow: 0 0 12px rgba(255, 255, 255, .9), 0 0 2px rgba(255, 255, 255, .8);
}

.cine-sub i {
  display: inline-block;
  width: 34px;
  height: 2px;
  margin: 0 12px 3px;
  background: var(--brand-orange);
}

/* Title: the सहजानंद lettering traced from the logo, filled in brand orange with a sunlit sheen */
.cine-title {
  margin: 14px 0 18px;
  line-height: 0;
}

.cine-title-glow {
  display: block;
  filter: drop-shadow(0 2px 0 rgba(160, 72, 0, .28)) drop-shadow(0 10px 28px rgba(120, 58, 0, .22));
}

.cine-title-mark {
  display: block;
  width: min(66vw, 860px);
  aspect-ratio: 633 / 200;
  -webkit-mask: url("assets/cinematic/sahjanand-wordmark.svg") center / contain no-repeat;
  mask: url("assets/cinematic/sahjanand-wordmark.svg") center / contain no-repeat;
  background: linear-gradient(105deg, #e06a05 0%, #eb770e 38%, #ffc27a 48%, #ffe2b8 50%, #ffc27a 52%, #eb770e 62%, #e06a05 100%) 100% 0 / 300% 100%;
  animation: cineSheen 7s cubic-bezier(.45, 0, .2, 1) 1.4s infinite;
}

@keyframes cineSheen {
  0% { background-position: 100% 0; }
  32%, 100% { background-position: 0 0; }
}

.beat-rise {
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}

.cine-statement {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(48px, 8.4vw, 128px);
  line-height: .92;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-shadow: 0 6px 34px rgba(0, 0, 0, .5);
}

.beat-why {
  left: 8vw;
  top: 24%;
  max-width: 520px;
}

.cine-heading {
  margin: 0 0 22px;
  font-family: var(--serif);
  font-size: clamp(44px, 6.2vw, 96px);
  line-height: .95;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .45);
}

.cine-body {
  margin: 0;
  max-width: 400px;
  font-size: 15px;
  line-height: 1.65;
  color: #ede9e1;
  border-left: 1px solid var(--gold);
  padding-left: 18px;
}

.beat-home {
  left: 8vw;
  bottom: 14%;
  max-width: 640px;
}

.cine-home-title {
  font-size: clamp(42px, 5.8vw, 84px);
  margin-bottom: 20px;
}

.cine-badge {
  position: absolute;
  z-index: 3;
  right: 6vw;
  bottom: 14%;
  display: grid;
  gap: 4px;
  padding: 22px 26px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  will-change: transform, opacity;
}

.cine-badge span {
  font: 500 44px/1 var(--serif);
  color: #f0c58c;
}

.cine-badge strong {
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.cine-badge small {
  font-size: 9px;
  letter-spacing: .26em;
  color: rgba(255, 255, 255, .62);
}

/* ---------- Chrome ---------- */

.cine-cue {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 10px;
  font: 700 10px var(--sans);
  letter-spacing: .38em;
  text-transform: uppercase;
  color: var(--brand-blue);
  text-shadow: 0 0 10px rgba(255, 255, 255, .9);
}

.cine-cue i {
  width: 2px;
  height: 46px;
  background: linear-gradient(180deg, var(--brand-blue), transparent);
  transform-origin: top;
  animation: cineCue 2s cubic-bezier(.6, 0, .3, 1) infinite;
}

@keyframes cineCue {
  0% { transform: scaleY(0); opacity: 1; }
  60% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); opacity: 0; }
}

.cine-progress {
  position: absolute;
  z-index: 3;
  right: 28px;
  top: 50%;
  width: 2px;
  height: 120px;
  margin-top: -60px;
  background: rgba(255, 255, 255, .2);
  border-radius: 2px;
  overflow: hidden;
}

.cine-progress i {
  display: block;
  height: 100%;
  background: var(--gold);
  transform: scaleY(0);
  transform-origin: top;
}

/* ---------- Mobile ---------- */

@media (max-width: 768px) {
  .cine {
    --cine-length: 440vh;
  }

  .cine-kicker,
  .cine-sub {
    font-size: 9px;
    letter-spacing: .3em;
  }

  .cine-title-mark {
    width: 84vw;
  }

  .cine-sun {
    background:
      radial-gradient(circle at 78% 17%, #fffef9 0, #fff6df 5%, rgba(255, 228, 170, .75) 11%, rgba(255, 210, 140, .32) 22%, rgba(255, 205, 130, .12) 36%, transparent 58%),
      linear-gradient(200deg, rgba(255, 214, 150, .28) 0%, transparent 45%);
  }

  .cine-sun i {
    left: 78%;
    top: 17%;
  }

  .beat-why {
    left: 20px;
    right: 20px;
    top: auto;
    bottom: 16%;
  }

  .cine-heading {
    font-size: clamp(32px, 10vw, 44px);
  }

  .beat-home {
    left: 20px;
    right: 20px;
    bottom: 12%;
  }

  .beat-home .hero-actions .button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .cine-shade {
    background: linear-gradient(0deg, rgba(13, 15, 13, .88) 0%, rgba(13, 15, 13, .35) 55%, transparent 80%);
  }

  .cine-badge,
  .cine-progress {
    display: none;
  }
}

/* Phones held sideways: very little height, so tighten every beat */
@media (max-height: 500px) and (orientation: landscape) {
  .cine-title {
    margin: 10px 0 12px;
  }

  .cine-title-mark {
    width: min(52vw, 120vh);
  }

  .beat-why {
    top: auto;
    bottom: 10%;
  }

  .cine-heading {
    font-size: 36px;
    margin-bottom: 12px;
  }

  .beat-home {
    bottom: 8%;
  }

  .beat-home .eyebrow {
    margin-bottom: 8px;
  }

  .cine-home-title {
    font-size: 36px;
    margin-bottom: 10px;
  }

  .beat-home .hero-copy {
    margin-bottom: 14px;
  }

  .cine-badge,
  .cine-progress,
  .cine-cue {
    display: none;
  }
}

/* ---------- Static fallback (reduced motion) ---------- */

.cine.is-static {
  height: auto;
}

.cine.is-static .cine-stage {
  position: relative;
}

.cine.is-static .shot-home,
.cine.is-static .beat-home,
.cine.is-static .cine-badge,
.cine.is-static .cine-shade {
  opacity: 1;
  pointer-events: auto;
}

.cine.is-static .shot-aerial,
.cine.is-static .cine-haze,
.cine.is-static .cine-clouds,
.cine.is-static .cine-sun,
.cine.is-static .beat-title,
.cine.is-static .beat-rise,
.cine.is-static .beat-why,
.cine.is-static .cine-cue,
.cine.is-static .cine-progress {
  display: none;
}

/* "Why Sahjanand?" - brand word in the logo's orange */
.cine-heading .cine-brand-word { color: #ef7a0f; text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35); }
