/* Cinematic Intro Slideshow - Refined Style */

:root {
    --intro-bg-color: #000000;
    --intro-text-color: #ffffff;
    --intro-subtext-color: #a0a0a0;
    --font-cinematic: 'Cinzel', serif;
    --font-sans: 'Lato', sans-serif;
}

#cinematic-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    font-family: var(--font-pixel);
    /* Layering context for video/overlay/slides */
    position: fixed;
}

/* Aurora layer (between video and overlay) */
#cinematic-intro::before {
    content: "";
    position: absolute;
    inset: -10%;
    z-index: 0; /* above video (0) but below overlay (1) via actual children stacking */
    background:
        radial-gradient(60vw 40vw at 20% 30%, rgba(204,204,255,0.28), transparent 60%),
        radial-gradient(50vw 35vw at 80% 20%, rgba(255,228,230,0.22), transparent 60%),
        radial-gradient(70vw 45vw at 50% 80%, rgba(230,230,250,0.22), transparent 60%);
    filter: blur(24px) saturate(1.1);
    opacity: 0.6;
    transform: translate3d(0,0,0);
    animation: none; /* disable animation for performance */
    pointer-events: none;
}

/* Fine grain on top of aurora for texture */
#cinematic-intro::after {
    content: none; /* disable grain layer for performance */
    position: absolute;
    inset: 0;
    z-index: 0; /* under .intro-overlay (z:1) */
    pointer-events: none;
}

@keyframes auroraFloat {
    0% {
        transform: translate(-2%, -2%) scale(1.02) rotate(0.2deg);
        filter: blur(24px) saturate(1.1);
    }
    50% {
        transform: translate(1%, 2%) scale(1.05) rotate(-0.2deg);
        filter: blur(28px) saturate(1.2);
    }
    100% {
        transform: translate(3%, -1%) scale(1.03) rotate(0.3deg);
        filter: blur(24px) saturate(1.1);
    }
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    #cinematic-intro::before,
    .intro-overlay::before {
        animation: none !important;
    }
}

.intro-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease-out;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    will-change: opacity;
}

.intro-slide.active {
    opacity: 1;
}

/* Removed the slide-image styling to keep background black */
.intro-slide .slide-image {
    display: none;
}

.intro-slide .slide-text span {
    display: inline-block; /* Ensures transform works correctly */
    color: #ffffff;
    font-family: var(--font-pixel);
    font-weight: 700;
    font-size: 4rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background-color: transparent;
    outline: none;
    text-shadow:
        0 2px 6px rgba(0,0,0,0.35),
        0 6px 24px rgba(0,0,0,0.35),
        0 0 22px rgba(230,230,250,0.35);
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.25);
    animation: slow-zoom-in 5s forwards cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.intro-slide .sub-text {
    margin-top: 1rem;
}

.intro-slide .sub-text span {
    display: inline-block; /* Ensures transform works correctly */
    color: #ffffff;
    font-family: var(--font-pixel);
    font-weight: 400;
    font-size: 1.25rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-shadow:
        0 1px 3px rgba(0,0,0,0.35),
        0 0 14px rgba(230,230,250,0.25);
    animation: fade-in-delay 6s forwards cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#skip-intro {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background-color: var(--header-bg);
    color: var(--header-text);
    border: none;
    padding: 10px 20px;
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    z-index: 10000;
    border-radius: 10px;
    opacity: 0.9;
    transition: all 0.3s ease;
    box-shadow: 4px 4px 0px #00000040;
}

#skip-intro:hover {
    opacity: 1;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 5px 5px 0px #00000060;
}

#skip-intro:active {
    transform: translate(2px, 2px) scale(0.97);
    box-shadow: 1px 1px 0px #00000040;
}

@keyframes slow-zoom-in {
    from { 
        opacity: 0; 
        transform: scale(0.9);
    }
    to { 
        opacity: 1; 
        transform: scale(1);
    }
}

@keyframes fade-in-delay {
    0%, 50% { 
        opacity: 0; 
        transform: translateY(10px);
    }
    100% { 
        opacity: 1; 
        transform: translateY(0);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .intro-slide .slide-text {
        font-size: 2.5rem;
    }
    .intro-slide .sub-text {
        font-size: 1rem;
    }
    #skip-intro {
        bottom: 20px;
        right: 20px;
        padding: 8px 16px;
        font-size: 0.7rem;
    }
}

.cinematic-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #E6E6FA, #CCCCFF, #FFE4E6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    opacity: 1;
    transition: opacity 1s ease-out;
    font-family: 'Space Grotesk', 'Courier New', monospace;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.cinematic-intro.fade-out {
    opacity: 0;
    pointer-events: none;
}

.cinematic-intro.hidden {
    display: none;
}

.intro-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.6s ease-out;
    text-align: center;
    padding: 2rem;
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
    z-index: 2; /* above video and overlay */
    will-change: opacity;
}

.intro-slide.active {
    opacity: 1;
    z-index: 2;
    animation: none; /* disable float for performance */
}

.intro-slide.exit {
    opacity: 0;
}

/* Slide Content */
.slide-content {
    max-width: 800px;
    width: 100%;
    text-wrap: balance;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.intro-text {
    font-family: var(--font-pixel);
    font-size: clamp(2rem, 10vw, 6rem);
    font-weight: 800;
    margin: 0 0 1rem;
    color: #ffffff;
    text-shadow:
        0 2px 6px rgba(0,0,0,0.35),
        0 6px 24px rgba(0,0,0,0.35),
        0 0 22px rgba(230,230,250,0.35);
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.25);
    line-height: 1.1;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: inline-block;
}

.highlight {
    color: #ffffff;
    text-shadow:
        0 2px 6px rgba(0,0,0,0.35),
        0 6px 24px rgba(0,0,0,0.35),
        0 0 22px rgba(230,230,250,0.35);
    animation: glow 2s ease-in-out infinite alternate;
}

.intro-subtext {
    font-family: var(--font-pixel);
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    color: #ffffff;
    margin: 1rem 0 0;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s;
    font-weight: 600;
    letter-spacing: 3px;
    position: relative;
    display: inline-block;
}

.intro-image {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    box-shadow: 
        0 0 30px rgba(230, 230, 250, 0.3),
        0 0 60px rgba(204, 204, 255, 0.2);
    animation: imageFloat 4s ease-in-out infinite;
    margin-bottom: 2rem;
}

.intro-image.family {
    border-radius: 20px;
    width: 400px;
    height: 250px;
}

.intro-image.bodybuilding {
    border-radius: 20px;
    width: 350px;
    height: 400px;
}

/* Animations */
@keyframes textGlow {
    0% {
        text-shadow: 0 0 20px rgba(230, 230, 250, 0.5);
    }
    100% {
        text-shadow: 
            0 0 30px rgba(230, 230, 250, 0.8),
            0 0 40px rgba(204, 204, 255, 0.6),
            0 0 50px rgba(255, 228, 230, 0.4);
    }
}

@keyframes imageFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Progress Bar */
.intro-progress {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #E6E6FA, #CCCCFF, #FFE4E6);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

/* Skip Button */
.skip-intro {
    position: absolute;
    top: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 25px;
    font-family: var(--font-pixel);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.skip-intro:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: transparent;
    transform: translateY(-2px);
}

/* Particle Effects */
.intro-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

/* Background Video & Overlay */
.intro-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
    /* Stronger dim for silhouette effect, still lightweight */
    filter: brightness(0.9) contrast(1.1) saturate(1.0);
}

.intro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Layered gradients: pastel tint + global dim + soft vignette */
    background:
        linear-gradient(0deg, rgba(0,0,0,0.25), rgba(0,0,0,0.25)),
        linear-gradient(120deg, rgba(230,230,250,0.22), rgba(204,204,255,0.14), rgba(255,228,230,0.22)),
        linear-gradient(180deg, rgba(0,0,0,0.65), rgba(0,0,0,0.55) 40%, rgba(0,0,0,0.80)),
        radial-gradient(ellipse at center, rgba(0,0,0,0.10) 0%, rgba(0,0,0,0.65) 70%);
    z-index: 1;
    pointer-events: none;
}

/* Retro scanlines for a subtle Y2K vibe */
.intro-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,0.03) 0 2px,
        rgba(0,0,0,0.03) 2px 4px
    );
    opacity: 0.12;
    mix-blend-mode: normal;
    pointer-events: none;
    animation: none;
}

/* Remove center bloom for stronger silhouette */
.intro-overlay::after { content: none; }

@keyframes scanShift {
    0% { background-position: 0 0; }
    100% { background-position: 0 200px; }
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #E6E6FA;
    border-radius: 50%;
    animation: particleFloat 8s linear infinite;
    opacity: 0.7;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-100px) translateX(100px);
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .intro-text {
        font-size: clamp(1.5rem, 6vw, 3rem);
    }
    
    .intro-subtext {
        font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    }
    
    .intro-image {
        width: 200px;
        height: 200px;
    }
    /* Ensure legacy slide span text scales too */
    .intro-slide .slide-text span {
        font-size: clamp(1.6rem, 8vw, 2.4rem);
        letter-spacing: 0.08em;
        line-height: 1.15;
    }
    .intro-slide .sub-text span {
        font-size: clamp(0.8rem, 3.2vw, 1rem);
        letter-spacing: 0.12em;
        line-height: 1.2;
    }
    .slide-content {
        max-width: 92vw;
        padding: 1rem;
    }
    /* Tuck skip button a bit further from edges */
    #skip-intro { bottom: 16px; right: 16px; }
    .intro-image.family {
        width: 280px;
        height: 180px;
    }
    .intro-image.bodybuilding {
        width: 250px;
        height: 300px;
    }
    
    .intro-progress {
        width: 250px;
        bottom: 30px;
    }
    
    .skip-intro {
        top: 20px;
        right: 20px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .slide-content {
        padding: 1rem;
    }
    
    .intro-image {
        width: 150px;
        height: 150px;
    }
    
    .intro-image.family {
        width: 220px;
        height: 140px;
    }
    
    .intro-image.bodybuilding {
        width: 200px;
        height: 240px;
    }
    /* Extra-small phones: tighten text more */
    .intro-slide .slide-text span {
        font-size: clamp(1.3rem, 7vw, 2rem);
        letter-spacing: 0.06em;
        line-height: 1.12;
    }
    .intro-slide .sub-text span {
        font-size: clamp(0.75rem, 3vw, 0.95rem);
        letter-spacing: 0.1em;
    }
    #skip-intro { bottom: 12px; right: 12px; padding: 7px 14px; font-size: 0.68rem; }
}

/* Constrain for short viewports to prevent overlap (e.g., landscape phones) */
@media (max-height: 600px) {
    .intro-image { display: none; }
    .intro-text { margin-bottom: 0.5rem; }
    .intro-subtext { margin-top: 0.5rem; }
    .intro-slide { padding: 1rem; }
}

/* Intro Preloader */
.intro-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px) saturate(1.1);
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  z-index: 5; /* above video and overlay, below slides if slides use higher */
}

.intro-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  animation: intro-spin 0.9s linear infinite;
}

@keyframes intro-spin {
  to { transform: rotate(360deg); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .intro-spinner { animation: none; border-top-color: rgba(255,255,255,0.7); }
}

/* Google-style indeterminate spinner */
.g-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  /* Arc using conic gradient */
  background:
    conic-gradient(
      from 0deg,
      #4285F4 0 90deg,
      transparent 90deg 360deg
    );
  /* Hollow center */
  -webkit-mask: radial-gradient(farthest-side, transparent 62%, #000 63%);
  mask: radial-gradient(farthest-side, transparent 62%, #000 63%);
  animation: g-rotate 1s linear infinite;
  box-shadow: 0 0 16px rgba(66, 133, 244, 0.35);
}

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

@media (prefers-reduced-motion: reduce) {
  .g-spinner { animation: none; }
}

/* Modern Loader (Glassmorphism) */
.loader-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 28px 28px 24px;
  min-width: 260px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
}

.loader-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-family: var(--font-pixel);
  font-weight: 800;
  letter-spacing: 1px;
  color: #0f0f14;
  background: linear-gradient(135deg, #E6E6FA, #CCCCFF, #FFE4E6);
  box-shadow: 0 6px 20px rgba(230,230,250,0.35);
}

.loader-title {
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.loader-progress {
  width: 240px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.25);
}

.loader-bar {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #E6E6FA 0%, #CCCCFF 50%, #FFE4E6 100%);
  box-shadow: 0 0 12px rgba(230,230,250,0.6);
  transition: width 350ms ease;
}

.loader-sub {
  font-family: var(--font-pixel);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.85);
}
