/* ==========================================================================
   AGRIM SOLAR — CINEMATIC CAPSULE INTRO EXPERIENCE OVERLAY
   An opening portal transition that reveals the existing homepage.
   Features:
   - Full-viewport layered overlay (does not modify underlying DOM)
   - Oversized AGRIM [CAPSULE] SOLAR brand typography
   - Expanding capsule portal on click / scroll / swipe / Enter
   - Zero-flash session suppression
   - Accessible skip controls & prefers-reduced-motion support
   ========================================================================== */

/* Immediate suppression if intro was already seen in session */
html.intro-dismissed .cinematic-intro-overlay {
  display: none !important;
}

/* --------------------------------------------------------------------------
   1. Full-Viewport Intro Overlay
   -------------------------------------------------------------------------- */
.cinematic-intro-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 999999;
  background: #F8FAFC;
  background: linear-gradient(180deg, #FBFBFD 0%, #F5F7FA 50%, #EEF2F6 100%);
  color: #071724;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: clamp(20px, 3vh, 40px) clamp(20px, 4vw, 60px);
  box-sizing: border-box;
  overflow: hidden;
  user-select: none;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.5s ease;
}

/* Ambient Radial Glow */
.cinematic-intro-overlay::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  max-width: 1400px;
  height: 60vh;
  background: radial-gradient(ellipse 65% 50% at 50% 20%, rgba(16, 185, 129, 0.09) 0%, rgba(10, 88, 152, 0.06) 50%, transparent 80%);
  pointer-events: none;
  z-index: 1;
}

/* Faint Solar CAD / Energy Flux Grid */
.intro-vector-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.045;
  background-image: 
    radial-gradient(circle at 50% 50%, #0A5898 1.5px, transparent 1.5px),
    linear-gradient(to right, rgba(10, 88, 152, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10, 88, 152, 0.08) 1px, transparent 1px);
  background-size: 40px 40px, 80px 80px, 80px 80px;
  background-position: center center;
}

/* --------------------------------------------------------------------------
   2. Content Wrapper
   -------------------------------------------------------------------------- */
.intro-content-wrap {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 1400px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
}

/* Top Subtle Eyebrow Badge */
.intro-top-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 999px;
  font-size: clamp(0.72rem, 0.85vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #065F46;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.08);
  margin-top: 8px;
  animation: introFadeDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.intro-pulse-dot {
  width: 7px;
  height: 7px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: introDotPulse 2s infinite ease-in-out;
}

@keyframes introDotPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.08); }
}

@keyframes introFadeDown {
  0% { opacity: 0; transform: translateY(-16px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   4. Core Typographic Stage: AGRIM [CAPSULE] SOLAR
   -------------------------------------------------------------------------- */
.intro-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.4vw, 38px);
  width: 100%;
  margin: auto 0;
  position: relative;
}

/* Oversized 5-Letter Brand Typography */
.intro-word {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: clamp(4rem, 9.2vw, 10.8rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.045em;
  text-transform: uppercase;
  color: #071724;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  display: inline-block;
  will-change: transform, opacity;
  transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.5s ease;
}

.intro-word-agrim {
  text-align: right;
  animation: introWordLeft 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.intro-word-solar {
  text-align: left;
  animation: introWordRight 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes introWordLeft {
  0% { opacity: 0; transform: translateX(-40px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes introWordRight {
  0% { opacity: 0; transform: translateX(40px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* --------------------------------------------------------------------------
   5. The Central Animated Morphing & Expanding Capsule
   -------------------------------------------------------------------------- */
.intro-capsule {
  position: relative;
  flex-shrink: 0;
  width: clamp(210px, 21vw, 340px);
  height: clamp(88px, 8.6vw, 136px);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  background: #071724;
  box-shadow: 
    0 18px 45px -10px rgba(10, 88, 152, 0.28),
    0 8px 20px -6px rgba(7, 23, 36, 0.2),
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 0 0 5px rgba(16, 185, 129, 0.25);
  animation: introCapsuleScaleIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, width, height, border-radius;
  transition: 
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s ease;
}

@keyframes introCapsuleScaleIn {
  0% { opacity: 0; transform: scale(0.85); }
  100% { opacity: 1; transform: scale(1); }
}

.intro-capsule:hover {
  transform: scale(1.035);
  box-shadow: 
    0 24px 55px -6px rgba(10, 88, 152, 0.38),
    0 12px 28px -6px rgba(16, 185, 129, 0.35),
    0 0 0 3px rgba(255, 255, 255, 1),
    0 0 0 6px rgba(16, 185, 129, 0.45);
}

/* Inner Media Container */
.intro-capsule-inner {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
}

.intro-capsule-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.intro-capsule-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  border-radius: inherit;
  z-index: 0;
  transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1);
}

.intro-capsule:hover .intro-capsule-video,
.intro-capsule:hover .intro-capsule-img {
  transform: scale(1.06);
}

/* Glass Sheen */
.intro-capsule-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg, 
    rgba(255, 255, 255, 0.25) 0%, 
    rgba(255, 255, 255, 0.06) 40%, 
    transparent 60%, 
    rgba(10, 88, 152, 0.15) 100%
  );
  pointer-events: none;
  z-index: 5;
  mix-blend-mode: overlay;
}

/* Tag Pill inside Capsule */
.intro-capsule-tag {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(7, 23, 36, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.intro-tag-dot {
  width: 6px;
  height: 6px;
  background: #34D399;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.3);
}

/* --------------------------------------------------------------------------
   6. Bottom Interactive Invitation & Explore Button
   -------------------------------------------------------------------------- */
.intro-bottom-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  margin-bottom: 8px;
  animation: introFadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
  opacity: 0;
}

@keyframes introFadeUp {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

.intro-explore-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #071724;
  color: #FFFFFF;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(0.92rem, 1.05vw, 1.02rem);
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(7, 23, 36, 0.22);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.intro-explore-btn:hover {
  background: #0A5898;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(10, 88, 152, 0.35);
}

.intro-explore-btn i {
  transition: transform 0.25s ease;
}

.intro-explore-btn:hover i {
  transform: translateX(4px);
}

.intro-cue-text {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748B;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.intro-cue-icon {
  font-size: 0.85rem;
  color: #0A5898;
  animation: cueBounce 2s infinite ease-in-out;
}

@keyframes cueBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}

/* --------------------------------------------------------------------------
   7. THE EXPANSION ANIMATION STATE (.is-revealing)
   Dramatic portal growth from central pill into full-screen reveal
   -------------------------------------------------------------------------- */
.cinematic-intro-overlay.is-revealing {
  pointer-events: none;
}

/* Staggered Outward Fade for Top Badge & Bottom Bar */
.cinematic-intro-overlay.is-revealing .intro-top-badge,
.cinematic-intro-overlay.is-revealing .intro-bottom-bar,
.cinematic-intro-overlay.is-revealing .intro-capsule-tag {
  opacity: 0 !important;
  transform: translateY(20px) !important;
  transition: opacity 0.35s ease, transform 0.35s ease !important;
}

/* Words Fly Outward */
.cinematic-intro-overlay.is-revealing .intro-word-agrim {
  opacity: 0 !important;
  transform: translateX(-160px) scale(0.9) !important;
  transition: transform 0.85s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.5s ease !important;
}

.cinematic-intro-overlay.is-revealing .intro-word-solar {
  opacity: 0 !important;
  transform: translateX(160px) scale(0.9) !important;
  transition: transform 0.85s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.5s ease !important;
}

/* Capsule Grows to Entire Screen, Losing Rounded Corners */
.cinematic-intro-overlay.is-revealing .intro-capsule {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  width: 105vw !important;
  height: 105vh !important;
  height: 105dvh !important;
  border-radius: 0px !important;
  box-shadow: none !important;
  z-index: 50 !important;
  transition: 
    width 1.1s cubic-bezier(0.77, 0, 0.175, 1),
    height 1.1s cubic-bezier(0.77, 0, 0.175, 1),
    border-radius 1.1s cubic-bezier(0.77, 0, 0.175, 1),
    transform 1.1s cubic-bezier(0.77, 0, 0.175, 1) !important;
}

.cinematic-intro-overlay.is-revealing .intro-capsule-video,
.cinematic-intro-overlay.is-revealing .intro-capsule-img {
  transform: scale(1.15) !important;
  transition: transform 1.2s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* The Final Reveal Fade-Out */
.cinematic-intro-overlay.is-revealing {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease 0.85s, visibility 0.5s ease 0.85s;
}

/* --------------------------------------------------------------------------
   8. Mobile & Tablet Responsiveness
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  .intro-word {
    font-size: clamp(3.2rem, 8vw, 6.5rem);
  }

  .intro-capsule {
    width: clamp(170px, 18vw, 240px);
    height: clamp(74px, 7.5vw, 100px);
  }
}

@media (max-width: 767px) {
  .cinematic-intro-overlay {
    padding: 18px 16px;
  }

  .intro-stage {
    flex-direction: column;
    gap: 12px;
  }

  .intro-word {
    font-size: clamp(2.8rem, 13vw, 4.4rem);
    text-align: center;
  }

  .intro-capsule {
    width: clamp(170px, 52vw, 220px);
    height: clamp(74px, 22vw, 94px);
  }

  .intro-explore-btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
    padding: 12px 20px;
    font-size: 0.92rem;
  }

  .intro-cue-text {
    font-size: 0.74rem;
  }
}

/* --------------------------------------------------------------------------
   9. Prefers-Reduced-Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .intro-capsule-video {
    display: none !important;
  }

  .intro-capsule-img {
    display: block !important;
    position: relative !important;
  }

  .cinematic-intro-overlay,
  .intro-word,
  .intro-capsule,
  .intro-top-badge,
  .intro-bottom-bar,
  .intro-explore-btn,
  .intro-pulse-dot,
  .intro-cue-icon {
    animation: none !important;
    transition: opacity 0.3s ease !important;
  }

  .cinematic-intro-overlay.is-revealing {
    opacity: 0 !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease !important;
  }
}
