
/* =========================================
   ROOT VARIABLES
========================================= */

:root {
    color-scheme: dark;

    --cyan: #21c9ff;
    --blue: #087bff;
}

/* =========================================
   GLOBAL STYLES
========================================= */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    background: #020817;
}

body {
    min-height: 100svh;
    display: grid;
    place-items: center;
    overflow: hidden;

    font-family: "Montserrat", "Avenir Next", Avenir, Arial, sans-serif;

    background:
        radial-gradient(
            ellipse at 50% 42%,
            rgba(0, 83, 173, .22),
            transparent 43%
        ),
        radial-gradient(
            ellipse at 50% 100%,
            rgba(0, 108, 255, .13),
            transparent 40%
        ),
        linear-gradient(
            115deg,
            #01040b 0%,
            #03132d 48%,
            #01050d 100%
        );
}

/* =========================================
   MAIN SCENE
========================================= */

.scene {
    position: relative;

    width: min(100vw, 1640px);
    aspect-ratio: 1640 / 900;

    min-height: 360px;
    max-height: 100svh;

    overflow: hidden;
    isolation: isolate;
}

/* Ambient background lighting */

.scene::before {
    content: "";

    position: absolute;
    inset: 0;
    z-index: -1;

    opacity: .5;

    background: radial-gradient(
        ellipse at 50% 48%,
        rgba(0, 104, 255, .15),
        transparent 52%
    );

    animation: ambient 7s ease-in-out infinite alternate;
}

/* Background haze */

.haze {
    position: absolute;

    width: 70%;
    height: 35%;

    left: 15%;
    top: 28%;

    border-radius: 50%;

    background: rgba(0, 118, 255, .09);

    filter: blur(75px);

    animation: haze 8s ease-in-out infinite alternate;
}

/* =========================================
   SVG LOGO
========================================= */

svg.logo {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    overflow: visible;
}

/* =========================================
   LETTER A ANIMATION
========================================= */

.a-wrap {
    transform-origin: 50% 42%;

    animation:
        a-arrive
        1.7s
        cubic-bezier(.16, .78, .2, 1)
        both;
}

/* Main A shape */

.a-shape {
    fill: url(#aGrad);

    stroke: #a9edff;
    stroke-width: 3;
    stroke-linejoin: round;

    filter: url(#aGlow);
}

/* Outer A edge */

.a-edge {
    fill: none;

    stroke: rgba(255, 255, 255, .72);
    stroke-width: 1.6;

    opacity: .75;
}

/* =========================================
   WATER ANIMATION
========================================= */

/* Background water layer */

.water-back {
    fill: none;

    stroke: url(#waveBack);
    stroke-width: 38;
    stroke-linecap: round;

    opacity: .28;

    filter: url(#softGlow);

    stroke-dasharray: 1100;
    stroke-dashoffset: 1100;

    animation:
        wave-reveal 2.4s 1.35s ease-out forwards,
        drift 8s 3.75s ease-in-out infinite;
}

/* Main water layer */

.water-body {
    fill: none;

    stroke: url(#waveMain);
    stroke-width: 21;
    stroke-linecap: round;

    filter: url(#waterGlow);

    stroke-dasharray: 1300;
    stroke-dashoffset: 1300;

    animation:
        wave-reveal 2.5s 1.45s cubic-bezier(.2, .7, .2, 1) forwards,
        drift 7s 3.95s ease-in-out infinite;
}

/* Water highlights */

.water-highlight {
    fill: none;

    stroke: rgba(218, 250, 255, .92);
    stroke-width: 3.2;
    stroke-linecap: round;

    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;

    filter: drop-shadow(0 0 7px #39caff);

    animation:
        wave-reveal 2.1s 1.72s ease-out forwards,
        shimmer 3.5s 4s ease-in-out infinite;
}

/* Water foam */

.foam {
    fill: none;

    stroke: #d9faff;
    stroke-width: 4;
    stroke-linecap: round;

    stroke-dasharray: 2 13;

    opacity: 0;

    filter: drop-shadow(0 0 5px #55dfff);

    animation:
        foam-in .8s 3s forwards,
        foam-drift 4s 3.8s linear infinite;
}

/* =========================================
   WORDMARK
========================================= */

.wordmark {
    opacity: 0;

    animation: word-in 1.2s 2.15s ease-out forwards;
}

.wordmark text {
    fill: url(#typeGrad);

    font-size: 70px;
    font-weight: 400;
    letter-spacing: 25px;
}

/* =========================================
   WATER FLOOR / REFLECTION
========================================= */

/* Horizontal floor glow */

.floor-glow {
    position: absolute;

    left: 22%;
    right: 22%;
    bottom: 15.5%;

    height: 2px;

    background: linear-gradient(
        90deg,
        transparent,
        #087dff 24%,
        #c9f8ff 50%,
        #087dff 76%,
        transparent
    );

    box-shadow:
        0 0 12px 3px rgba(0, 139, 255, .7),
        0 0 38px 8px rgba(0, 111, 255, .35);

    opacity: 0;

    animation: floor-in 1.2s 2.5s forwards;
}

/* Reflective floor */

.floor {
    position: absolute;

    left: -10%;
    right: -10%;
    bottom: -3%;

    height: 17%;

    background:
        radial-gradient(
            ellipse at 50% 0%,
            rgba(0, 151, 255, .22),
            transparent 45%
        ),
        repeating-linear-gradient(
            178deg,
            transparent 0 13px,
            rgba(33, 160, 255, .09) 14px,
            transparent 17px 30px
        );

    transform: perspective(240px) rotateX(56deg);
    transform-origin: top;

    opacity: 0;

    mask-image: linear-gradient(
        to bottom,
        black,
        transparent 90%
    );

    animation:
        floor-in 1.5s 2.7s forwards,
        water-floor 6s 4s ease-in-out infinite;
}

/* Water reflection */

.reflection {
    position: absolute;

    left: 30%;
    right: 30%;
    bottom: 5%;

    height: 12%;

    background: linear-gradient(
        180deg,
        rgba(0, 151, 255, .23),
        transparent
    );

    filter: blur(18px);

    opacity: 0;

    animation: floor-in 1.5s 2.8s forwards;
}

/* =========================================
   BUBBLES
========================================= */

.bubble {
    position: absolute;

    bottom: 20%;

    width: 7px;
    height: 7px;

    border: 1px solid rgba(135, 220, 255, .85);
    border-radius: 50%;

    box-shadow: 0 0 8px rgba(0, 164, 255, .6);

    opacity: 0;

    animation:
        bubble-rise
        var(--dur, 5s)
        var(--delay, 0s)
        infinite ease-in;
}

/* Individual bubble positions and timing */

.b1 {
    left: 20%;
    --dur: 5.7s;
    --delay: 1s;
}

.b2 {
    left: 28%;

    width: 4px;
    height: 4px;

    --dur: 4.6s;
    --delay: 2.8s;
}

.b3 {
    left: 73%;

    --dur: 6.3s;
    --delay: 1.8s;
}

.b4 {
    left: 81%;

    width: 5px;
    height: 5px;

    --dur: 5s;
    --delay: 3.5s;
}

.b5 {
    left: 62%;

    width: 3px;
    height: 3px;

    --dur: 4.8s;
    --delay: 2.2s;
}

/* =========================================
   KEYFRAME ANIMATIONS
========================================= */

/* A arrives */

@keyframes a-arrive {

    0% {
        opacity: 0;
        transform: translateY(45px) scale(.82);
        filter: blur(10px);
    }

    65% {
        opacity: 1;
        filter: blur(0);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Water draws itself across the logo */

@keyframes wave-reveal {

    to {
        stroke-dashoffset: 0;
    }
}

/* Water movement */

@keyframes drift {

    0%,
    100% {
        transform: translateX(-5px) translateY(0);
    }

    50% {
        transform: translateX(7px) translateY(-5px);
    }
}

/* Water highlight shimmer */

@keyframes shimmer {

    0%,
    100% {
        opacity: .7;
    }

    50% {
        opacity: 1;
    }
}

/* Foam appears */

@keyframes foam-in {

    to {
        opacity: .9;
    }
}

/* Foam movement */

@keyframes foam-drift {

    to {
        stroke-dashoffset: -120;
    }
}

/* Wordmark appears */

@keyframes word-in {

    from {
        opacity: 0;
        transform: translateY(18px);
        filter: blur(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Floor and reflection appear */

@keyframes floor-in {

    to {
        opacity: 1;
    }
}

/* Floor water movement */

@keyframes water-floor {

    0%,
    100% {
        transform: perspective(240px) rotateX(56deg) translateY(0);
    }

    50% {
        transform: perspective(240px) rotateX(56deg) translateY(5px);
    }
}

/* Bubbles rise */

@keyframes bubble-rise {

    0% {
        transform: translateY(0) scale(.6);
        opacity: 0;
    }

    15% {
        opacity: .7;
    }

    90% {
        opacity: .4;
    }

    100% {
        transform: translateY(-360px) scale(1.15);
        opacity: 0;
    }
}

/* Ambient background animation */

@keyframes ambient {

    to {
        opacity: .9;
        transform: scale(1.12);
    }
}

/* Background haze movement */

@keyframes haze {

    to {
        transform: translateY(-18px) scale(1.12);
        opacity: .65;
    }
}

/* =========================================
   RESPONSIVE STYLING
========================================= */

/* Mobile devices */

@media (max-width: 700px) {

    .scene {
        min-height: 300px;
    }

    .wordmark text {
        font-size: 66px;
        letter-spacing: 16px;
    }
}

/* =========================================
   ACCESSIBILITY
========================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition: none !important;
    }
}
