/* ============================================================
   GrowWaves — Motion System (animations.css)
   ============================================================ */

/* ---------- Scroll reveal engine ---------- */
.reveal {
    opacity: 0;
    will-change: opacity, transform, filter;
    transition:
        opacity 0.9s var(--ease-out),
        transform 0.9s var(--ease-out),
        filter 0.9s var(--ease-out);
}

.reveal-up {
    transform: translateY(60px);
}

.reveal-left {
    transform: translateX(-60px);
}

.reveal-right {
    transform: translateX(60px);
}

.reveal-scale {
    transform: scale(0.9);
}

.reveal-blur {
    filter: blur(14px);
}

.reveal.in-view {
    opacity: 1;
    transform: none;
    filter: none;
}

/* Staggered children (up to 10 items) */
.stagger > * {
    transition-delay: 0ms;
}
.stagger > *:nth-child(2) { transition-delay: 80ms; }
.stagger > *:nth-child(3) { transition-delay: 160ms; }
.stagger > *:nth-child(4) { transition-delay: 240ms; }
.stagger > *:nth-child(5) { transition-delay: 320ms; }
.stagger > *:nth-child(6) { transition-delay: 400ms; }
.stagger > *:nth-child(7) { transition-delay: 480ms; }
.stagger > *:nth-child(8) { transition-delay: 560ms; }
.stagger > *:nth-child(9) { transition-delay: 640ms; }
.stagger > *:nth-child(10) { transition-delay: 720ms; }

/* ---------- Hero word reveal ---------- */
.hero .line {
    display: block;
    overflow: hidden;
    padding-bottom: 0.09em;
    margin-bottom: -0.09em;
}

.hero .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
    padding-bottom: 0.1em;
    margin-bottom: -0.1em;
}

.hero .word-inner {
    display: inline-block;
    opacity: 0;
    transform: translateY(112%) rotate(2deg);
    filter: blur(6px);
    will-change: transform, opacity, filter;
}

html.is-loaded .hero .word-inner {
    animation: wordUp 0.9s var(--ease-out) both;
    animation-delay: var(--d, 0ms);
}

@keyframes wordUp {
    to {
        opacity: 1;
        transform: none;
        filter: none;
    }
}

/* Sub-hero elements fade in after the title */
.hero__eyebrow,
.hero__sub,
.hero__actions,
.hero__cards,
.hero__scroll {
    opacity: 0;
}

html.is-loaded .hero__eyebrow {
    animation: fadeUp 0.8s var(--ease-out) 0.75s both;
}

html.is-loaded .hero__sub {
    animation: fadeUp 0.8s var(--ease-out) 0.95s both;
}

html.is-loaded .hero__actions {
    animation: fadeUp 0.8s var(--ease-out) 1.1s both;
}

html.is-loaded .hero__cards {
    animation: fadeIn 1s var(--ease-out) 1.2s both;
}

html.is-loaded .hero__scroll {
    animation: fadeIn 1s var(--ease-out) 1.5s both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(26px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

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

/* ---------- Page loader ---------- */
.loader {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: grid;
    place-items: center;
    background: var(--color-navy);
    transition: opacity 0.6s var(--ease-out), visibility 0.6s;
}

.loader--done {
    opacity: 0;
    visibility: hidden;
}

.loader__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
}

.loader__logo {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader__line {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 7vw, 3.8rem);
    letter-spacing: 0.12em;
    line-height: 1;
    color: #fff;
    opacity: 0;
    transform: translateY(110%);
}

.loader__line--accent {
    color: transparent;
    background: var(--grad-aqua);
    -webkit-background-clip: text;
    background-clip: text;
}

.loader.is-running .loader__line {
    animation: loaderWord 0.7s var(--ease-out) forwards;
}

.loader.is-running .loader__line--accent {
    animation-delay: 0.14s;
}

@keyframes loaderWord {
    to {
        opacity: 1;
        transform: none;
    }
}

.loader__wave {
    width: 240px;
    height: auto;
}

.loader__wave path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
}

.loader.is-running .loader__wave path {
    animation: loaderDraw 1s 0.35s var(--ease-out) forwards;
}

@keyframes loaderDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* ---------- Scroll ring + back to top ---------- */
.scroll-ring {
    --p: 0;
    position: fixed;
    right: clamp(16px, 3vw, 30px);
    bottom: clamp(16px, 3vw, 30px);
    z-index: 160;
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--color-aqua);
    background: rgba(11, 37, 56, 0.9);
    border: 1px solid rgba(45, 212, 191, 0.3);
    box-shadow: 0 14px 40px -18px rgba(7, 26, 43, 0.9);
    opacity: 0;
    transform: translateY(14px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out),
        box-shadow 0.35s var(--ease-out), border-color 0.35s;
}

.scroll-ring.is-active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.scroll-ring:hover {
    border-color: rgba(45, 212, 191, 0.7);
    box-shadow: 0 18px 52px -18px rgba(45, 212, 191, 0.55);
}

.scroll-ring svg {
    display: block;
}

.scroll-ring__svg {
    position: absolute;
    inset: -1px;
    width: calc(100% + 2px);
    height: calc(100% + 2px);
    transform: rotate(-90deg);
}

.scroll-ring__track,
.scroll-ring__fill {
    fill: none;
    stroke-width: 2.5;
}

.scroll-ring__track {
    stroke: rgba(45, 212, 191, 0.16);
}

.scroll-ring__fill {
    stroke: var(--color-aqua);
    stroke-linecap: round;
    stroke-dasharray: 131.95;
    stroke-dashoffset: calc(131.95 * (1 - var(--p)));
    transition: stroke-dashoffset 0.12s linear;
    filter: drop-shadow(0 0 6px rgba(45, 212, 191, 0.65));
}

@media (prefers-reduced-motion: reduce) {
    .scroll-ring,
    .scroll-ring__fill {
        transition: none;
    }
}

/* Keep the ring clear of footer text on small screens */
@media (max-width: 767px) {
    .scroll-ring {
        width: 46px;
        height: 46px;
        right: 12px;
        bottom: 12px;
    }
}

/* ---------- Custom cursor ---------- */
.cursor-dot,
.cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 300;
    pointer-events: none;
    border-radius: 50%;
    opacity: 0;
    will-change: transform;
}

body.has-cursor .cursor-dot,
body.has-cursor .cursor-ring {
    opacity: 1;
}

.cursor-dot {
    width: 6px;
    height: 6px;
    background: var(--color-aqua);
    box-shadow: 0 0 10px rgba(45, 212, 191, 0.9);
}

.cursor-ring {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border: 1.5px solid rgba(45, 212, 191, 0.65);
    transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out),
        border-color 0.35s, background 0.35s, opacity 0.3s;
}

.cursor-ring__label {
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--color-navy);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.3s, transform 0.3s var(--ease-out);
}

body.cursor-hover .cursor-ring {
    width: 44px;
    height: 44px;
    border-color: rgba(45, 212, 191, 0.9);
    background: rgba(45, 212, 191, 0.08);
}

body.cursor-cta .cursor-ring {
    width: 58px;
    height: 58px;
    background: var(--color-aqua);
    border-color: var(--color-aqua);
}

body.cursor-cta .cursor-ring__label {
    opacity: 1;
    transform: scale(1);
}

body.cursor-cta .cursor-dot {
    opacity: 0;
}

body.has-cursor,
body.has-cursor a,
body.has-cursor button,
body.has-cursor select,
body.has-cursor input,
body.has-cursor textarea {
    cursor: none;
}

/* ---------- Keyframes ---------- */
@keyframes floatY {
    0%, 100% {
        transform: translateY(-10px);
    }
    50% {
        transform: translateY(10px);
    }
}

@keyframes waveSlide {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

@keyframes marqueeX {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-50%);
    }
}

@keyframes waveDash {
    to {
        stroke-dashoffset: -800;
    }
}

@keyframes scrollHint {
    0% {
        top: -50%;
    }
    100% {
        top: 110%;
    }
}

@keyframes successIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes checkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* Image reveal (reusable for future portfolio images) */
.img-reveal {
    position: relative;
    overflow: hidden;
}

.img-reveal img {
    clip-path: inset(0 100% 0 0);
    transform: scale(1.1);
    transition: clip-path 1.1s var(--ease-out), transform 1.3s var(--ease-out);
}

.img-reveal.in-view img {
    clip-path: inset(0 0 0 0);
    transform: scale(1);
}

/* Tilt cards keep their transition when returning to rest */
.tilt {
    transition: border-color 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}

.tilt.is-tilting {
    transition: border-color 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001s !important;
        transition-delay: 0s !important;
    }

    .reveal,
    .reveal-up,
    .reveal-left,
    .reveal-right,
    .reveal-scale,
    .reveal-blur {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
    }

    .hero .word-inner,
    .hero__eyebrow,
    .hero__sub,
    .hero__actions,
    .hero__cards,
    .hero__scroll {
        opacity: 1 !important;
        transform: none !important;
        filter: none !important;
        animation: none !important;
    }

    .loader {
        display: none !important;
    }

    .marquee__track,
    .hero__wave,
    .cta__waves svg,
    .footer__wave-path {
        animation: none !important;
    }
}