/* STACK Theme CSS - Simplified Structure */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000;
    perspective: 1000;
}

/* CSS Custom Properties */
:root {
    --color-bg1: rgb(22, 22, 24);
    --color-bg2: rgb(22, 22, 24);
    --color1: 82, 154, 252;
    --color2: 112, 119, 248;
    --color3: 125, 225, 255;
    --color4: 82, 154, 252;
    --color5: 112, 119, 248;
    --color-interactive: 125, 225, 255;
    --circle-size: 120%;
    --blending: hard-light;
    --glass-width: 100px;
    --glass-spacing: 0px;
    
    /* Wave Effect Variables - Discord Blue Theme */
    --shimmer-hue-1: 235deg;
    --shimmer-sat-1: 85%;
    --shimmer-lit-1: 65%;
    --shimmer-hue-2: 235deg;
    --shimmer-sat-2: 100%;
    --shimmer-lit-2: 70%;
    --shimmer-hue-3: 235deg;
    --shimmer-sat-3: 90%;
    --shimmer-lit-3: 75%;
    
    --glow-hue: 222deg;
    --shadow-hue: 180deg;
    --spring-easing: linear(
        0, 0.002, 0.01 0.9%, 0.038 1.8%, 0.156, 0.312 5.8%, 0.789 11.1%, 1.015 14.2%,
        1.096, 1.157, 1.199, 1.224 20.3%, 1.231, 1.231, 1.226, 1.214 24.6%,
        1.176 26.9%, 1.057 32.6%, 1.007 35.5%, 0.984, 0.968, 0.956, 0.949 42%,
        0.946 44.1%, 0.95 46.5%, 0.998 57.2%, 1.007, 1.011 63.3%, 1.012 68.3%,
        0.998 84%, 1
    );
    --spring-duration: 1.33s;
    --bg: #161618;
    --fg: #ffffff;
}

/* Body and HTML */
body {
    font-family: 'Unbounded', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #161618;
    color: white;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

html {
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
}

/* Animation Keyframes */
@keyframes moveInCircle {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); }
    50% { transform: translate3d(0, 0, 0) rotate(180deg); }
    100% { transform: translate3d(0, 0, 0) rotate(360deg); }
}

@keyframes moveVertical {
    0% { transform: translate3d(0, -50%, 0); }
    50% { transform: translate3d(0, 50%, 0); }
    100% { transform: translate3d(0, -50%, 0); }
}

@keyframes moveHorizontal {
    0% { transform: translate3d(-50%, -10%, 0); }
    50% { transform: translate3d(50%, 10%, 0); }
    100% { transform: translate3d(-50%, -10%, 0); }
}

@keyframes shimmer {
    0% { transform: translate3d(-100%, 0, 0); }
    100% { transform: translate3d(100%, 0, 0); }
}

@keyframes slideInFromTop {
    0% { opacity: 0; transform: translate3d(0, -50px, 0); }
    100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes slideInFromBottom {
    0% { opacity: 0; transform: translate3d(0, 50px, 0); }
    100% { opacity: var(--final-opacity, 1); transform: translate3d(0, 0, 0); }
}

/* Wave Effect Animations */
@property --mask {
    syntax: "<angle>";
    inherits: false;
    initial-value: 33deg;
}

@keyframes spin {
    0% { --mask: 0deg; }
    100% { --mask: 360deg; }
}

@keyframes wipe {
    0% { mask-position: 200% center; }
    100% { mask-position: 0% center; }
}

@keyframes pulse {
    0%, 90%, 100% { opacity: 0; }
    20% { opacity: 1; }
}

@keyframes pulse2 {
    0% { opacity: 0; }
    8% { opacity: 1; }
    14% { opacity: 0; }
    20% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes flicker {
    0% { opacity:0.1; mask-image:none;}
    1% { opacity:1; }
    2% { opacity:0.5; }
    3% { opacity:0.1; }
    4% { opacity:0.7; }
    5% { opacity:1; }
    7% { opacity:0.7; 
        mask-image: linear-gradient(
            90deg, transparent 15%, black 45%, black 55%, transparent 85%
        ); }
    8% { opacity:0.1; }
    10% { opacity:0.4; }
    13% { opacity:1; }
    15% { opacity:0.1;  
        mask-image: linear-gradient(
            45deg, rgba(0,0,0,0.4) 25%, transparent 45%, black 65%, black 90%, transparent 100%
        );}
    17% { opacity:0.8;}
    19% { opacity:0.3; }
    21.5% { opacity:0; }
    23% { opacity:1; }
    39% { opacity:0.7; }
    45% { opacity:0.2; }
    49% { opacity:0.9; }
    52% { opacity:0.7;}
    53.5% { opacity:0.2;  
        mask-image: linear-gradient(
            90deg, black 15%, black 45%, rgba(0,0,0,0.4) 75%, transparent 85%
        );}
    57% { opacity:0.8; }
    63% { opacity:1; }
    75% { opacity:.85; }
    77% { opacity:1; }
    80% { opacity:.9; }
    82% { opacity:.95; }
    83% { opacity:.85; }
    86% { opacity:1; }
    89% { opacity:.85; }
    91% { opacity:1; }
    92% { opacity:.9; }
    100% { opacity:1; }
}

@keyframes shine {
    0% { opacity: 0; }
    15% { opacity: 1; }
    55% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes text {
    0% { background-position: 100% center; }    
    100% { background-position: -100% center; }    
}

/* Background Elements */
.gradient-bg,
.starry-background,
.shimmer-overlay,
.reeded-glass-container,
.effects-image-container,
.fluted-glass-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100%;
    min-height: 100vh;
    z-index: -3;
}

.gradient-bg {
    z-index: -2;
    background: linear-gradient(40deg, var(--color-bg1), var(--color-bg2));
    overflow: hidden;
}

.gradient-bg svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
}

.gradients-container {
    filter: url(#goo) blur(25px);
    -webkit-filter: url(#goo) blur(25px);
    -moz-filter: url(#goo) blur(25px);
    -o-filter: url(#goo) blur(25px);
    -ms-filter: url(#goo) blur(25px);
    width: 100%;
    height: 100%;
    will-change: filter;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Gradient Elements */
.g1, .g2, .g3, .g4, .g5 {
    position: absolute;
    background: radial-gradient(circle at center, rgba(var(--color1), 0.8) 0, rgba(var(--color1), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending);
    width: var(--circle-size);
    height: var(--circle-size);
    top: calc(50% - var(--circle-size) / 2);
    left: calc(50% - var(--circle-size) / 2);
    opacity: 1;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.g1 {
    background: radial-gradient(circle at center, rgba(var(--color1), 0.6) 0, rgba(var(--color1), 0) 50%) no-repeat;
    transform-origin: center center;
    animation: moveVertical 45s ease infinite;
}

.g2 {
    background: radial-gradient(circle at center, rgba(var(--color2), 0.6) 0, rgba(var(--color2), 0) 50%) no-repeat;
    transform-origin: calc(50% - 400px);
    animation: moveInCircle 35s reverse infinite;
}

.g3 {
    background: radial-gradient(circle at center, rgba(var(--color3), 0.6) 0, rgba(var(--color3), 0) 50%) no-repeat;
    top: calc(50% - var(--circle-size) / 2 + 200px);
    left: calc(50% - var(--circle-size) / 2 - 500px);
    transform-origin: calc(50% + 400px);
    animation: moveInCircle 60s linear infinite;
}

.g4 {
    background: radial-gradient(circle at center, rgba(var(--color4), 0.6) 0, rgba(var(--color4), 0) 50%) no-repeat;
    transform-origin: calc(50% - 200px);
    animation: moveHorizontal 50s ease infinite;
    opacity: 0.5;
}

.g5 {
    background: radial-gradient(circle at center, rgba(var(--color5), 0.6) 0, rgba(var(--color5), 0) 50%) no-repeat;
    width: calc(var(--circle-size) * 2);
    height: calc(var(--circle-size) * 2);
    top: calc(50% - var(--circle-size));
    left: calc(50% - var(--circle-size));
    transform-origin: calc(50% - 800px) calc(50% + 200px);
    animation: moveInCircle 35s ease infinite;
}

.interactive {
    position: absolute;
    background: radial-gradient(circle at center, rgba(var(--color-interactive), 0.8) 0, rgba(var(--color-interactive), 0) 50%) no-repeat;
    mix-blend-mode: var(--blending);
    width: 100%;
    height: 100%;
    top: -50%;
    left: -50%;
    opacity: 0.7;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Reeded Glass Effect */
.reeded-glass-container {
    z-index: 1;
    pointer-events: none;
    opacity: 0.4;
    display: flex;
    flex-wrap: nowrap;
}

.reeded-glass-box {
    flex: 0 0 var(--glass-width);
    height: 100%;
    background: linear-gradient(to right, 
        rgba(22, 22, 24, 0.5) 0%, 
        rgba(22, 22, 24, 0.5) 17%, 
        rgba(22, 22, 24, 0.003) 100%);
    backdrop-filter: blur(185px);
    -webkit-backdrop-filter: blur(185px);
    box-shadow: 
        inset 0 3.6px 7px 0 rgba(255, 255, 255, 0.16),
        0 4px 20px rgba(0, 0, 0, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    will-change: backdrop-filter;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Shimmer Effect */
.shimmer-overlay {
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(125, 225, 255, 0.1) 25%,
        rgba(82, 154, 252, 0.2) 50%,
        rgba(112, 119, 248, 0.1) 75%,
        transparent 100%
    );
    animation: shimmer 8s ease-in-out infinite;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Fluted Glass Container */
.fluted-glass-container {
    z-index: 2;
}

.fluted-glass-container img {
    display: none;
}

/* Effects Image Container */
.effects-image-container {
    z-index: 1;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    mix-blend-mode: lighten;
}

.effects-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: normal;
    opacity: 0.8;
}

/* Main Content */
.container {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    max-width: 100%;
}

.hero-section {
    text-align: center;
    max-width: 600px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: white;
    text-transform: uppercase;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    animation: slideInFromTop 1.2s ease-out 0.3s both;
}

.hero-subtitle {
    font-size: 1rem;
    color: rgb(255, 255, 255);
    margin-bottom: 3rem;
    line-height: 1.6;
    font-weight: 300;
    letter-spacing: 0.15em;
    opacity: 0;
    animation: slideInFromBottom 1.2s ease-out 0.6s both;
}

.viral-loops-embed {
    opacity: 0;
    animation: slideInFromBottom 1.2s ease-out 0.8s both;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    transition: all 0.9s ease;
}

/* Users Ahead Section */
.users-ahead-section {
    margin-top: 3rem;
    text-align: center;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 2;
}

.users-ahead-title {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.704);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    font-weight: 300;
    letter-spacing: 0.15em;
    opacity: 0;
    animation: slideInFromBottom 1.2s ease-out 0.6s both;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    list-style: none;
}

.user-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transition: none;
}

.user-item:hover {
    background: none;
    border-color: transparent;
    transform: none;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: none;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    text-align: left;
    margin-right: auto;
}

.user-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: white;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.user-handle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 300;
    line-height: 1.2;
}

.user-place {
    font-size: 0.9rem;
    font-weight: 400;
    color: rgb(255, 255, 255);
    margin-left: auto;
    flex-shrink: 0;
    position: relative;
}

.user-place-number {
    filter: blur(3px);
    -webkit-filter: blur(3px);
    -moz-filter: blur(3px);
    -o-filter: blur(3px);
    -ms-filter: blur(3px);
    margin-left: 1px;
}

/* Discord Button Styles */
.discord-button {
    color: white;
    font-weight: 600;
    font-size: 1.2em;
    background-image: linear-gradient(
        315deg, 
        hsl(var(--shimmer-hue-1),var(--shimmer-sat-1),var(--shimmer-lit-1)) 0.00%, 
        hsl(var(--shimmer-hue-2),var(--shimmer-sat-2),var(--shimmer-lit-2)) 47%,
        hsl(var(--shimmer-hue-3),var(--shimmer-sat-3),var(--shimmer-lit-3)) 100.00% 
    );
    padding: .8em 1.4em;
    position: relative;
    isolation: isolate;
    box-shadow: 0 2px 3px 1px hsl(var(--glow-hue) 50% 20% / 50%);
    border: none;
    outline: none;
    border-radius: 0.66em;
    scale: 1;
    transition: all var(--spring-duration) var(--spring-easing);
    text-transform: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    text-decoration: none;
    margin: 1rem 0 2rem 0;
    animation: slideInFromBottom 1s ease-out 0.6s both;
}

.discord-button .shimmer {
    position: absolute;
    inset: -40px;
    border-radius: inherit;
    mix-blend-mode: color-dodge;
    mix-blend-mode: plus-lighter;
    pointer-events: none;
}

.discord-button .shimmer::before,
.discord-button .shimmer::after {
    transition: all 0.5s ease;
    opacity: 0;
    content: "";
    border-radius: inherit;
    position: absolute;
    inset: 40px;
}

.discord-button .shimmer::before {
    box-shadow: 0 0 3px 2px hsl(var(--shimmer-hue-1) 20% 95%),
        0 0 7px 4px hsl(var(--shimmer-hue-1) 20% 80%),
        0 0 13px 8px hsl(var(--shimmer-hue-2) 40% 60%),
        0 0 22px 6px hsl(var(--shimmer-hue-2) 20% 40%);
    z-index: -1;
}

.discord-button .shimmer::after {
    box-shadow: inset 0 0 0 1px hsl(var(--shimmer-hue-2) 70% 95%),
        inset 0 0 3px 1px hsl(var(--shimmer-hue-2) 100% 80%),
        inset 0 0 9px 1px hsl(var(--shimmer-hue-2) 100% 70%);
    z-index: 2;
}

.discord-button[disabled] {
    background: rgb(76 76 92);
    background-image: none;
}

.discord-button:hover:not(:active):not([disabled]) {
    scale: 1.1;
    transition-duration: calc(var(--spring-duration)*0.5);
}

.discord-button:active:not([disabled]) {
    scale: 1.05;
    transition-duration: calc(var(--spring-duration)*0.5);
}

.discord-button:focus .shimmer,
.discord-button:active .shimmer {
    animation-play-state: paused!important;
    mask-image: none!important;
}

.discord-button:hover:not([disabled]),
.discord-button:hover:not([disabled]) .shimmer::before,
.discord-button:hover:not([disabled]) .shimmer::after {
    opacity: 1;
}

.discord-button .text {
    color: transparent;
    background-clip: text;
    background-color: white;
    background-image: linear-gradient(120deg, transparent, hsla(var(--shimmer-hue-1),100%,80%,0.66) 40%, hsla(var(--shimmer-hue-2),100%,90%,.9) 50%, transparent 52%);
    background-repeat: no-repeat;
    background-size: 300% 300%;
    background-position: center 200%;
}

.discord-button:not([disabled]):hover .text {
    animation: text .66s ease-in-out 1;
}

.discord-button:not([disabled]) .shimmer::before,
.discord-button:not([disabled]) .shimmer::after {
    opacity: 1;
}

.discord-button:not([disabled]) .shimmer {
    mask-image: conic-gradient(
        from var(--mask, 0deg),
        transparent 0%,
        transparent 10%,
        black 36%,
        black 45%,
        transparent 50%,
        transparent 60%,
        black 85%,
        black 95%,
        transparent 100%
    );
    mask-size: cover;
    animation: spin 3s linear infinite both -0.5s;
}

.discord-button:not([disabled])[data-effect=wipe] .shimmer {
    mask-image: linear-gradient(
        90deg, transparent 20%, black 88%, transparent 90%
    );
    mask-size: 200% 200%;
    mask-position: center;
    animation: wipe 1.5s linear infinite both -0.5s;
}

.discord-button:not([disabled])[data-effect=wave] .shimmer {
    mask-image: linear-gradient(
        90deg, transparent 15%, black 45%, black 55%, transparent 85%
    );
    mask-size: 200% 200%;
    mask-position: center;
    animation: wipe 3s linear infinite both -0.5s;
}

.discord-button:not([disabled])[data-effect=throb] .shimmer {
    mask-image: none;
    animation: pulse 3s ease infinite both  -0.5s;
}

.discord-button:not([disabled])[data-effect=pulse] .shimmer {
    mask-image: none;
    animation: pulse2 3s ease infinite both  -0.5s;
}

.discord-button:not([disabled])[data-effect=flicker] .shimmer {
    mask-image: none;
    animation: flicker 3.33s ease infinite both  -0.5s;
}

.discord-button svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.discord-button svg path {
    fill: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title { font-size: 2.5rem; }
    .hero-subtitle { font-size: 1rem; margin-bottom: 1.5rem; }
    .container { padding: 2.5rem 2.5rem 2.5rem 2.5rem; }
    :root { --glass-width: 65px; }
    
    .users-ahead-section {
        margin-top: 1rem;
        max-width: 100%;
    }
    
    .users-list { gap: 1.4rem; }
    .user-item { gap: 0.875rem; }
    .user-avatar { width: 36px; height: 36px; }
    .user-name { font-size: 0.9rem; }
    .user-handle { font-size: 0.8rem; }
    .user-place { font-size: 0.85rem; }
}

/* Fix for 450-520px range where container breaks */
@media (min-width: 450px) and (max-width: 520px) {
    .container {
        padding: 1.5rem 1rem;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .hero-section {
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    .hero-title {
        font-size: 2.2rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.1;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.4;
        margin-bottom: 2rem;
    }
    
    .discord-button {
        font-size: 1.1em;
        padding: 0.7em 1.2em;
        margin: 1rem 0 1.5rem 0;
    }
    
    .users-ahead-section {
        max-width: 100%;
        padding: 0 0.5rem;
    }
    
    .users-list {
        gap: 1.2rem;
    }
    
    .user-item {
        gap: 0.75rem;
    }
    
    .user-avatar {
        width: 34px;
        height: 34px;
    }
    
    .user-name {
        font-size: 0.88rem;
    }
    
    .user-handle {
        font-size: 0.78rem;
    }
    
    .user-place {
        font-size: 0.82rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
        max-width: 100%;
        overflow-x: hidden;
    }
    
    .hero-section {
        max-width: 100%;
        padding: 0 0.25rem;
    }
    
    .hero-title { 
        font-size: 2rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.1;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle { 
        font-size: 0.9rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.4;
        margin-bottom: 1.5rem;
    }
    
    .discord-button {
        font-size: 1em;
        padding: 0.6em 1em;
        margin: 1rem 0 1.5rem 0;
    }
    
    .users-ahead-section {
        max-width: 100%;
        padding: 0 0.25rem;
    }
    
    .users-ahead-title {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .users-list {
        gap: 1rem;
    }
    
    .user-item {
        gap: 0.6rem;
    }
    
    .user-avatar { width: 32px; height: 32px; }
    .user-name { font-size: 0.85rem; }
    .user-handle { font-size: 0.75rem; }
    .user-place { font-size: 0.8rem; }
}

/* Handle ultra-wide screens */
@media (min-width: 2000px) {
    :root { --glass-width: 120px; }
}

/* Safari-specific viewport fixes */
@supports (-webkit-touch-callout: none) {
    .reeded-glass-box {
        position: relative;
        height: 100%;
    }
}

/* Additional Safari scroll prevention */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    html, body {
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Performance optimization for lower-end devices */
@media (prefers-reduced-motion: reduce) {
    .g1, .g2, .g3, .g4, .g5, .interactive {
        animation: none;
    }
    
    .shimmer-overlay {
        animation: none;
    }
}

/* Reduce animations on mobile for better performance */
@media (max-width: 768px) {
    .g1 { animation-duration: 60s; }
    .g2 { animation-duration: 50s; }
    .g3 { animation-duration: 80s; }
    .g4 { animation-duration: 70s; }
    .g5 { animation-duration: 50s; }
    .shimmer-overlay { animation-duration: 12s; }
}
