/* IntroSequence - Dramatic Full Screen Experience (matching AwardReveal CountingVotes style) */
.intro-sequence-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for better iOS support */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: var(--z-intro-sequence);
    overflow: hidden;
    font-family: var(--font-system);
    /* iOS Safari specific fixes */
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
}

/* Phase: Simple Text - Dark gradient background like CountingVotes */
.intro-sequence-container.phase-text {
    background: var(--gradient-dark-stage);
    animation: phaseBackground 0.8s ease-in-out;
}

/* Phase: Superlative Display - Purple gradient for variety */
.intro-sequence-container.phase-superlative {
    background: var(--gradient-purple);
    animation: phaseBackground 0.8s ease-in-out;
}

/* Phase: Complete (fade out) */
.intro-sequence-container.phase-complete {
    background: transparent;
    animation: fadeOut 1s ease-out forwards;
}

/* Main Animation Container - Centered like CountingVotes */
.intro-animation {
    text-align: center;
    color: white;
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    /* Default animation - will be overridden by transition classes */
    animation: slideIn 0.8s ease-out;
}

/* ============================================
   DRAMATIC PHASE TRANSITIONS
   ============================================ */

/* Transition: Fly from TOP to BOTTOM */
.intro-animation.transition-fly-top {
    animation: flyInFromTop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               flyOutToBottom 0.6s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
    animation-delay: 0s, calc(var(--phase-duration, 3s) - 0.6s);
}

/* Transition: Fly from BOTTOM to TOP */
.intro-animation.transition-fly-bottom {
    animation: flyInFromBottom 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               flyOutToTop 0.6s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
    animation-delay: 0s, calc(var(--phase-duration, 3s) - 0.6s);
}

/* Transition: Fly from LEFT to RIGHT */
.intro-animation.transition-fly-left {
    animation: flyInFromLeft 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               flyOutToRight 0.6s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
    animation-delay: 0s, calc(var(--phase-duration, 3s) - 0.6s);
}

/* Transition: Fly from RIGHT to LEFT */
.intro-animation.transition-fly-right {
    animation: flyInFromRight 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               flyOutToLeft 0.6s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
    animation-delay: 0s, calc(var(--phase-duration, 3s) - 0.6s);
}

/* Transition: ZOOM IN (small to normal, then out large) */
.intro-animation.transition-zoom-in {
    animation: zoomInFromSmall 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               zoomOutToLarge 0.6s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
    animation-delay: 0s, calc(var(--phase-duration, 3s) - 0.6s);
}

/* Transition: ZOOM OUT (large to normal, then out small) */
.intro-animation.transition-zoom-out {
    animation: zoomInFromLarge 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               zoomOutToSmall 0.6s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
    animation-delay: 0s, calc(var(--phase-duration, 3s) - 0.6s);
}

.intro-content-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* BIG CENTERED TITLE - Like CountingVotes h1 */
.intro-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    margin: 0;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    line-height: 1.2;
    animation: titlePulse 2s ease-in-out infinite alternate;
}

/* Subtitle */
.intro-subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: subtextFadeIn 1s ease-out 0.3s both;
}

/* Superlative Icon - BIG and ANIMATED */
.superlative-icon {
    font-size: clamp(4rem, 12vw, 8rem);
    margin-bottom: 1rem;
    animation: iconBounce 1.5s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
}

/* Superlative Title - BIG like CountingVotes */
.superlative-title {
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 900;
    color: white;
    margin: 0 0 1rem 0;
    text-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 255, 255, 0.3);
    line-height: 1.1;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleReveal 0.8s ease-out 0.2s both;
}

/* Superlative Description */
.superlative-description {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    margin: 0;
    padding: 0 2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
    max-width: 700px;
    animation: descriptionFadeIn 0.8s ease-out 0.5s both;
}

/* Skip Button - Bottom Right, Semi-Transparent, Rounded (matching DONE button) */
.intro-skip-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.3rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 2001;
    /* Enhanced touch responsiveness */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    text-transform: none;
}

.intro-skip-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.intro-skip-button:active {
    transform: translateY(0);
}

.skip-text {
    line-height: 1;
}

.intro-skip-button i {
    font-size: 1rem;
    animation: chevronPulse 1.5s ease-in-out infinite;
}

/* ANIMATIONS - Matching AwardReveal style */
@keyframes phaseBackground {
    from { filter: brightness(0.8); }
    to { filter: brightness(1); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes titlePulse {
    from { transform: scale(1); }
    to { transform: scale(1.03); }
}

@keyframes subtextFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes titleReveal {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes descriptionFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* ============================================
   DRAMATIC TRANSITION KEYFRAMES
   ============================================ */

/* FLY IN/OUT - TOP/BOTTOM */
@keyframes flyInFromTop {
    from {
        opacity: 0;
        transform: translateY(-120vh) scale(0.8);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes flyOutToBottom {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateY(120vh) scale(0.8);
        filter: blur(10px);
    }
}

@keyframes flyInFromBottom {
    from {
        opacity: 0;
        transform: translateY(120vh) scale(0.8);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes flyOutToTop {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateY(-120vh) scale(0.8);
        filter: blur(10px);
    }
}

/* FLY IN/OUT - LEFT/RIGHT */
@keyframes flyInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-120vw) scale(0.8) rotate(-15deg);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1) rotate(0deg);
        filter: blur(0);
    }
}

@keyframes flyOutToRight {
    from {
        opacity: 1;
        transform: translateX(0) scale(1) rotate(0deg);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateX(120vw) scale(0.8) rotate(15deg);
        filter: blur(10px);
    }
}

@keyframes flyInFromRight {
    from {
        opacity: 0;
        transform: translateX(120vw) scale(0.8) rotate(15deg);
        filter: blur(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1) rotate(0deg);
        filter: blur(0);
    }
}

@keyframes flyOutToLeft {
    from {
        opacity: 1;
        transform: translateX(0) scale(1) rotate(0deg);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: translateX(-120vw) scale(0.8) rotate(-15deg);
        filter: blur(10px);
    }
}

/* ZOOM IN/OUT TRANSITIONS */
@keyframes zoomInFromSmall {
    from {
        opacity: 0;
        transform: scale(0.1) rotate(180deg);
        filter: blur(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0);
    }
}

@keyframes zoomOutToLarge {
    from {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: scale(3) rotate(-180deg);
        filter: blur(20px);
    }
}

@keyframes zoomInFromLarge {
    from {
        opacity: 0;
        transform: scale(3) rotate(-180deg);
        filter: blur(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0);
    }
}

@keyframes zoomOutToSmall {
    from {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: blur(0);
    }
    to {
        opacity: 0;
        transform: scale(0.1) rotate(180deg);
        filter: blur(20px);
    }
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .intro-animation {
        padding: 1.5rem;
    }
    
    .intro-content-centered {
        gap: 1.5rem;
    }
    
    .intro-title {
        font-size: clamp(2.5rem, 10vw, 4.5rem);
    }
    
    .intro-subtitle {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }
    
    .superlative-icon {
        font-size: clamp(3rem, 15vw, 6rem);
        margin-bottom: 1rem;
    }
    
    .superlative-title {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }
    
    .superlative-description {
        font-size: clamp(1rem, 4vw, 1.4rem);
        padding: 0 1rem;
    }
    
    .intro-skip-button {
        bottom: 1.5rem;
        right: 1.5rem;
        padding: 0.65rem 1.2rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .intro-animation {
        padding: 1rem;
    }
    
    .intro-content-centered {
        gap: 1.5rem;
    }
    
    .intro-title {
        font-size: clamp(2rem, 12vw, 3.5rem);
    }
    
    .intro-subtitle {
        font-size: clamp(0.95rem, 4.5vw, 1.3rem);
    }
    
    .superlative-icon {
        font-size: clamp(2.5rem, 18vw, 5rem);
        margin-bottom: 0.75rem;
    }
    
    .superlative-title {
        font-size: clamp(1.8rem, 9vw, 3rem);
    }
    
    .superlative-description {
        font-size: clamp(0.95rem, 4.5vw, 1.2rem);
        padding: 0 0.5rem;
    }
    
    .intro-skip-button {
        bottom: 1rem;
        right: 1rem;
        padding: 0.6rem 1rem;
        font-size: 0.75rem;
    }
    
    .intro-skip-button i {
        font-size: 0.9rem;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .intro-sequence-container {
        min-height: -webkit-fill-available;
        height: -webkit-fill-available;
    }
    
    .intro-skip-button {
        -webkit-appearance: none;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        background-clip: padding-box;
    }
}

/* Very short screens - landscape phones */
@media (max-height: 600px) and (orientation: landscape) {
    .intro-animation {
        padding: 1rem;
    }
    
    .intro-content-centered {
        gap: 1rem;
    }
    
    .intro-title {
        font-size: clamp(1.8rem, 7vw, 3.5rem);
    }
    
    .intro-subtitle {
        font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    }
    
    .superlative-icon {
        font-size: clamp(2rem, 10vw, 4rem);
        margin-bottom: 0.5rem;
    }
    
    .superlative-title {
        font-size: clamp(1.5rem, 6vw, 2.8rem);
    }
    
    .superlative-description {
        font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    }
    
    .intro-skip-button {
        bottom: 0.75rem;
        right: 0.75rem;
        padding: 0.5rem 0.9rem;
        font-size: 0.7rem;
    }
}
