/* ========================================
   DERRIEL PORTFOLIO — CUSTOM STYLE
======================================== */

html {
    scroll-behavior: auto;
}

body {
    font-family: 'Inter', sans-serif;
    transition:
        background-color 0.4s ease,
        color 0.4s ease;

    overflow-x: hidden;
}

/* Lock scroll ketika loader muncul */
body.loading {
    overflow: hidden;
}


/* ========================================
   AMBIENT BACKGROUND BLOBS
======================================== */

@keyframes float-slow {
    0%,
    100% {
        transform:
            translateY(0px)
            translateX(0px)
            scale(1)
            rotate(0deg);
    }

    50% {
        transform:
            translateY(-40px)
            translateX(25px)
            scale(1.1)
            rotate(10deg);
    }
}

@keyframes float-reverse {
    0%,
    100% {
        transform:
            translateY(0px)
            translateX(0px)
            scale(1)
            rotate(0deg);
    }

    50% {
        transform:
            translateY(50px)
            translateX(-35px)
            scale(0.95)
            rotate(-10deg);
    }
}

.blob-1 {
    animation: float-slow 16s ease-in-out infinite;
}

.blob-2 {
    animation: float-reverse 18s ease-in-out infinite;
}

.blob-3 {
    animation: float-slow 14s ease-in-out infinite reverse;
}


/* ========================================
   PRELOADER
======================================== */

@keyframes fill-bar {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

.animate-progress {
    animation:
        fill-bar
        1.8s
        cubic-bezier(0.65, 0, 0.35, 1)
        forwards;
}


/* ========================================
   LIQUID GLASS — DARK MODE
======================================== */

.dark .liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.085),
            rgba(255, 255, 255, 0.025)
        );

    backdrop-filter:
        blur(26px)
        saturate(150%);

    -webkit-backdrop-filter:
        blur(26px)
        saturate(150%);

    border:
        1px solid rgba(255, 255, 255, 0.13);

    box-shadow:
        0 12px 35px -12px rgba(0, 0, 0, 0.65),
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 0 20px rgba(255, 255, 255, 0.025);

    position: relative;
}


/* highlight bagian atas glass */
.dark .liquid-glass::before {
    content: "";

    position: absolute;

    top: 0;
    left: 10%;
    right: 10%;

    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.18),
            transparent
        );

    pointer-events: none;

    opacity: 0.75;
}


/* ========================================
   LIQUID GLASS — LIGHT MODE
======================================== */

html:not(.dark) .liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.82),
            rgba(255, 255, 255, 0.55)
        );

    backdrop-filter:
        blur(26px)
        saturate(150%);

    -webkit-backdrop-filter:
        blur(26px)
        saturate(150%);

    border:
        1px solid rgba(255, 255, 255, 0.95);

    box-shadow:
        0 12px 35px -12px rgba(0, 0, 0, 0.13),
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        inset 0 0 18px rgba(255, 255, 255, 0.45);

    position: relative;
}

html:not(.dark) .liquid-glass::before {
    content: "";

    position: absolute;

    top: 0;
    left: 10%;
    right: 10%;

    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 1),
            transparent
        );

    pointer-events: none;
}


/* ========================================
   LIQUID GLASS HOVER
======================================== */

.liquid-glass-hover {
    transition:
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease;
}


@media (hover: hover) and (pointer: fine) {
/* dark */
.dark .liquid-glass-hover:hover {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.14),
            rgba(255, 255, 255, 0.04)
        );

    border-color:
        rgba(255, 255, 255, 0.26);

    box-shadow:
        0 22px 45px -18px rgba(0, 0, 0, 0.9),
        0 0 35px rgba(255, 255, 255, 0.035),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);

    transform:
        translateY(-6px)
        scale(1.01);
}


/* light */
html:not(.dark) .liquid-glass-hover:hover {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.98),
            rgba(255, 255, 255, 0.75)
        );

    border-color:
        rgba(0, 0, 0, 0.1);

    box-shadow:
        0 22px 45px -18px rgba(0, 0, 0, 0.18);

    transform:
        translateY(-6px)
        scale(1.01);
}
}


/* ========================================
   NAVBAR — LIQUID GLASS
======================================== */

header nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.10),
            rgba(255, 255, 255, 0.035)
        );

    backdrop-filter:
        blur(32px)
        saturate(170%);

    -webkit-backdrop-filter:
        blur(32px)
        saturate(170%);

    border:
        1px solid rgba(255, 255, 255, 0.14);

    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.11),
        inset 0 -1px 0 rgba(255, 255, 255, 0.025);

    isolation: isolate;
}


/* khusus navbar light */
html:not(.dark) header nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.80),
            rgba(255, 255, 255, 0.52)
        );

    border:
        1px solid rgba(255, 255, 255, 0.92);

    box-shadow:
        0 12px 35px rgba(15, 23, 42, 0.09),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
}


/* ========================================
   PROJECT CARDS
======================================== */

.project-card {
    border:
        1px solid rgba(255, 255, 255, 0.12);

    position: relative;

    overflow: hidden;

    transition:
        transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.4s ease,
        box-shadow 0.4s ease,
        background 0.4s ease;
}


/* glass border highlight */
.project-card::after {
    content: "";

    position: absolute;

    inset: 0;

    border-radius: inherit;

    padding: 1px;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.22),
            rgba(255, 255, 255, 0.03) 35%,
            rgba(255, 255, 255, 0.08) 70%,
            rgba(255, 255, 255, 0.16)
        );

    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);

    -webkit-mask-composite: xor;

    mask-composite: exclude;

    pointer-events: none;

    opacity: 0.7;
}


@media (hover: hover) and (pointer: fine) {
.dark .project-card:hover {
    border-color:
        rgba(255, 255, 255, 0.26);

    box-shadow:
        0 25px 55px -20px rgba(0, 0, 0, 0.9),
        0 0 30px rgba(255, 255, 255, 0.035);

    transform:
        translateY(-7px);
}
}


html:not(.dark) .project-card {
    border:
        1px solid rgba(0, 0, 0, 0.08);
}


@media (hover: hover) and (pointer: fine) {
html:not(.dark) .project-card:hover {
    border-color:
        rgba(0, 0, 0, 0.14);

    box-shadow:
        0 24px 50px -20px rgba(0, 0, 0, 0.2);
}
}


/* Project Image */

.project-card img {
    transition:
        transform 0.7s
        cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.5s ease;
}


@media (hover: hover) and (pointer: fine) {
.project-card:hover img {
    transform: scale(1.055);
    filter: none;
}
}


/* ========================================
   PRIMARY LIQUID BUTTON
======================================== */

.dark .liquid-btn-primary {
    background:
        linear-gradient(
            135deg,
            #ffffff,
            #e2e8f0
        );

    color:
        #020617;

    box-shadow:
        0 8px 25px
        rgba(255, 255, 255, 0.14);

    transition:
        all 0.3s
        cubic-bezier(0.16, 1, 0.3, 1);
}


@media (hover: hover) and (pointer: fine) {
.dark .liquid-btn-primary:hover {
    background:
        #ffffff;

    box-shadow:
        0 12px 35px
        rgba(255, 255, 255, 0.27);

    transform:
        translateY(-2px);
}
}


html:not(.dark) .liquid-btn-primary {
    background:
        linear-gradient(
            135deg,
            #0f172a,
            #1e293b
        );

    color:
        #ffffff;

    box-shadow:
        0 8px 25px
        rgba(15, 23, 42, 0.2);

    transition:
        all 0.3s
        cubic-bezier(0.16, 1, 0.3, 1);
}


@media (hover: hover) and (pointer: fine) {
html:not(.dark) .liquid-btn-primary:hover {
    background:
        #000;

    box-shadow:
        0 12px 35px
        rgba(0, 0, 0, 0.3);

    transform:
        translateY(-2px);
}
}


/* ========================================
   SCROLL REVEAL
======================================== */

.reveal-on-scroll {
    opacity: 0;

    transform:
        translateY(30px);

    transition:
        opacity 0.8s
        cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s
        cubic-bezier(0.16, 1, 0.3, 1);
}


.reveal-on-scroll.is-visible {
    opacity: 1;

    transform:
        translateY(0);
}


/* ========================================
   FORM
======================================== */

input,
textarea {
    transition:
        border-color 0.3s ease,
        background-color 0.3s ease,
        box-shadow 0.3s ease;
}


/* ========================================
   SCROLLBAR
======================================== */

::-webkit-scrollbar {
    width: 8px;
}

.dark ::-webkit-scrollbar-track {
    background:
        #020617;
}

.dark ::-webkit-scrollbar-thumb {
    background:
        rgba(255, 255, 255, 0.14);

    border-radius:
        999px;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background:
        rgba(255, 255, 255, 0.24);
}


html:not(.dark) ::-webkit-scrollbar-track {
    background:
        #f1f5f9;
}

html:not(.dark) ::-webkit-scrollbar-thumb {
    background:
        rgba(0, 0, 0, 0.20);

    border-radius:
        999px;
}


/* ========================================
   TEXT SELECTION
======================================== */

::selection {
    background:
        rgba(255, 255, 255, 0.18);

    color:
        inherit;
}


/* ========================================
   MOBILE
======================================== */

@media (max-width: 768px) {

    .liquid-glass {
        backdrop-filter:
            blur(20px)
            saturate(135%);

        -webkit-backdrop-filter:
            blur(20px)
            saturate(135%);
    }

    .liquid-glass-hover:hover {
        transform: none;
    }

    .project-card:hover {
        transform: none;
    }
}


/* ========================================
   REDUCED MOTION
======================================== */

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

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
    }
}
/* ========================================
   CINEMATIC MOTION — DERRIEL PORTFOLIO
   Added without removing existing styles
======================================== */

/* Smoother global motion language */
:root {
    --motion-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --motion-fast: 0.35s;
    --motion-medium: 0.8s;
    --motion-slow: 1.1s;
}

/* ========================================
   HERO INTRO — five deliberate stages
======================================== */

#home > .hero-intro-item {
    opacity: 0;
    transform: translateY(22px);
    filter: blur(5px);
    will-change: opacity, transform, filter;
}

#home > .hero-intro-item:nth-child(1) { --hero-delay: 60ms; }
#home > .hero-intro-item:nth-child(2) { --hero-delay: 160ms; }
#home > .hero-intro-item:nth-child(3) { --hero-delay: 260ms; }
#home > .hero-intro-item:nth-child(4) { --hero-delay: 360ms; }
#home > .hero-intro-item:nth-child(5) { --hero-delay: 460ms; }

body:not(.loading) #home > .hero-intro-item {
    animation:
        derrielHeroReveal
        0.72s
        var(--motion-ease)
        var(--hero-delay, 60ms)
        both;
}

@keyframes derrielHeroReveal {
    from {
        opacity: 0;
        transform: translateY(22px);
        filter: blur(5px);
    }

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

/* ========================================
   CINEMATIC SCROLL REVEAL
   Overrides the simpler reveal above
======================================== */

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(32px);
    filter: blur(5px);
    transition:
        opacity 0.72s var(--motion-ease),
        transform 0.72s var(--motion-ease),
        filter 0.72s var(--motion-ease);
    transition-delay: var(--delay, 0ms);
    will-change: opacity, transform, filter;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* ========================================
   NAVBAR MOTION / DEPTH
======================================== */

header {
    transition:
        transform 0.5s var(--motion-ease),
        opacity 0.4s ease;
    will-change: transform, opacity;
}

header nav.liquid-glass {
    transition:
        background 0.4s ease,
        border-color 0.4s ease,
        box-shadow 0.4s ease,
        backdrop-filter 0.4s ease,
        -webkit-backdrop-filter 0.4s ease,
        transform 0.4s var(--motion-ease);
}

header.nav-hidden {
    transform: translateY(-120%);
    opacity: 0;
}

header.nav-scrolled nav.liquid-glass {
    transform: scale(0.975);
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.13),
        rgba(255, 255, 255, 0.04)
    );
    border-color: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(34px) saturate(175%);
    -webkit-backdrop-filter: blur(34px) saturate(175%);
    box-shadow:
        0 14px 45px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

html:not(.dark) header.nav-scrolled nav.liquid-glass {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.9),
        rgba(255, 255, 255, 0.66)
    );
    border-color: rgba(255, 255, 255, 0.95);
}

/* ========================================
   SUBTLE SECTION DEPTH
======================================== */

section {
    position: relative;
}

section::before {
    content: "";
    position: absolute;
    width: min(460px, 72vw);
    height: min(460px, 72vw);
    left: 50%;
    top: 16%;
    transform: translateX(-50%);
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.032),
        transparent 68%
    );
    filter: blur(34px);
    pointer-events: none;
    z-index: -1;
}

html:not(.dark) section::before {
    background: radial-gradient(
        circle,
        rgba(15, 23, 42, 0.035),
        transparent 68%
    );
}

/* ========================================
   PROJECT CINEMATIC MOTION
======================================== */

.project-card {
    will-change: transform;
}

.project-card img {
    transform: translate3d(0, var(--parallax-y, 0px), 0) scale(1);
    will-change: transform, filter;
    transition:
        transform 0.65s var(--motion-ease),
        filter 0.6s ease;
}

/* Slight depth on project text */
.project-card h3,
.project-card p,
.project-card span,
.project-card button {
    transition:
        transform 0.45s var(--motion-ease),
        color 0.35s ease,
        opacity 0.35s ease;
}

@media (hover: hover) and (pointer: fine) {
.project-card:hover img,
.project-card.is-visible:hover img,
.reveal-on-scroll.is-visible.project-card:hover img {
    transform: translate3d(0, var(--parallax-y, 0px), 0) scale(1.04);
    filter:
        grayscale(100%)
        contrast(1.25)
        brightness(1.08);
}

.project-card:hover h3 {
    transform: translateX(2px);
}

.project-card:hover button {
    transform: translateY(-2px) scale(1.03);
}
}

/* ========================================
   LIQUID GLASS POINTER LIGHT
   Posisi glow dikontrol JS lewat --mouse-x / --mouse-y
======================================== */

.liquid-glass:not(.project-card) {
    position: relative;
}

/* Glow putih yang mengikuti cursor */
.liquid-glass:not(.project-card)::after {
    content: "";
    position: absolute;

    width: 240px;
    height: 170px;

    left: var(--mouse-x, 50%);
    top: var(--mouse-y, 50%);

    transform:
        translate(-50%, -50%)
        scale(0.72);

    background:
        radial-gradient(
            ellipse at center,
            rgba(255, 255, 255, 0.18) 0%,
            rgba(255, 255, 255, 0.085) 28%,
            rgba(255, 255, 255, 0.028) 50%,
            transparent 72%
        );

    filter: blur(10px);

    opacity: 0;

    pointer-events: none;

    transition:
        opacity 0.25s ease,
        transform 0.38s var(--motion-ease);

    z-index: 0;
    will-change: left, top, opacity, transform;
}

/* Muncul hanya pada perangkat dengan hover presisi. */
@media (hover: hover) and (pointer: fine) {
.liquid-glass:not(.project-card):hover::after,
.liquid-glass:not(.project-card).pointer-active::after {
    opacity: 1;

    transform:
        translate(-50%, -50%)
        scale(1);
}
}

/* Semua isi glass tetap berada di atas glow */
.liquid-glass:not(.project-card) > * {
    position: relative;
    z-index: 1;
}

/* Navbar: tahan glow supaya tidak bocor keluar bentuk pill */
header nav.liquid-glass {
    overflow: hidden;
}

/* Sedikit lebih terang di dark mode */
.dark header nav.liquid-glass::after {
    background:
        radial-gradient(
            ellipse at center,
            rgba(255, 255, 255, 0.22) 0%,
            rgba(255, 255, 255, 0.10) 28%,
            rgba(255, 255, 255, 0.035) 52%,
            transparent 74%
        ) !important;
}

/* Light mode tetap putih tapi lebih subtle */
html:not(.dark) header nav.liquid-glass::after {
    background:
        radial-gradient(
            ellipse at center,
            rgba(255, 255, 255, 0.78) 0%,
            rgba(255, 255, 255, 0.34) 30%,
            rgba(255, 255, 255, 0.08) 52%,
            transparent 74%
        ) !important;
}


/* ========================================
   BUTTON MICRO-INTERACTIONS
======================================== */

.liquid-btn-primary,
header a,
header button,
.project-card button {
    will-change: transform;
}

.liquid-btn-primary:active,
header button:active,
.project-card button:active {
    transform: scale(0.97);
}

/* ========================================
   OPTIONAL MARQUEE STYLES
   Safe to keep even if markup is not added yet.
======================================== */

.motion-marquee {
    overflow: hidden;
    width: 100%;
    padding: 56px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

html:not(.dark) .motion-marquee {
    border-color: rgba(15, 23, 42, 0.08);
}

.motion-marquee-track {
    display: flex;
    width: max-content;
    gap: 56px;
    animation: derrielMarquee 28s linear infinite;
    will-change: transform;
}

.motion-marquee span {
    flex-shrink: 0;
    font-size: clamp(40px, 7vw, 100px);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.05em;
    color: rgba(255, 255, 255, 0.08);
    white-space: nowrap;
}

.motion-marquee span:nth-child(even) {
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.24);
    color: transparent;
}

html:not(.dark) .motion-marquee span {
    color: rgba(15, 23, 42, 0.08);
}

html:not(.dark) .motion-marquee span:nth-child(even) {
    -webkit-text-stroke-color: rgba(15, 23, 42, 0.22);
    color: transparent;
}

@keyframes derrielMarquee {
    from {
        transform: translate3d(0, 0, 0);
    }

    to {
        transform: translate3d(-50%, 0, 0);
    }
}

/* ========================================
   MOBILE MOTION TUNING
======================================== */

@media (max-width: 768px) {
    .reveal-on-scroll {
        transform: translateY(24px);
        filter: blur(4px);
        transition-duration: 0.65s;
    }

    section::before {
        opacity: 0.65;
        filter: blur(28px);
    }

    .project-card img,
    .project-card.is-visible img,
    .reveal-on-scroll.is-visible.project-card img,
    .project-card:hover img {
        transform: translate3d(0, 0, 0) scale(1);
    }

    .motion-marquee {
        padding: 36px 0;
    }

    .motion-marquee-track {
        gap: 34px;
        animation-duration: 34s;
    }
}

/* ========================================
   REDUCED MOTION — keep accessibility intact
======================================== */

@media (prefers-reduced-motion: reduce) {
    #home > .hero-intro-item,
    body:not(.loading) #home > .hero-intro-item {
        opacity: 1;
        transform: none;
        filter: none;
        animation: none !important;
    }

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        filter: none;
    }

    .motion-marquee-track {
        animation: none;
    }

    .project-card img,
    .project-card:hover img,
    .project-card.is-visible img,
    .reveal-on-scroll.is-visible.project-card img {
        transform: none;
    }
}

/* ========================================
   RYHAR-STYLE PRELOADER MOTION
   Based on the provided screen recording:
   blur/fade-in content -> progress -> crossfade into page.
======================================== */

#preloader {
    background: #050505 !important;
    color: #f5f5f3;
    opacity: 1;
    overflow: hidden;
    isolation: isolate;
    will-change: opacity;
    transition: opacity 0.62s cubic-bezier(0.4, 0, 0.2, 1);
}

/* soft centered halo visible in the reference */
#preloader::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(
            circle at 50% 50%,
            rgba(255, 255, 255, 0.055) 0%,
            rgba(255, 255, 255, 0.022) 16%,
            rgba(255, 255, 255, 0.008) 30%,
            transparent 48%
        );
}

/* Keep the loader composition still; the reference does not slide upward. */
#preloader > div {
    position: relative;
    transform: none;
    will-change: opacity, filter, transform;
    transition:
        opacity 0.5s ease,
        filter 0.5s ease,
        transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Brand enters from blur rather than a large vertical movement. */
#preloader h1 {
    color: #f3f3f1 !important;
    opacity: 0;
    filter: blur(9px);
    transform: scale(0.975);
    animation: loaderBrandIn 0.58s cubic-bezier(0.16, 1, 0.3, 1) 0.30s forwards;
}

/* Small loading label follows shortly after the brand. */
#preloader p {
    color: rgba(245, 245, 243, 0.48) !important;
    opacity: 0;
    filter: blur(5px);
    transform: translateY(3px);
    animation: loaderLabelIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.56s forwards;
}

/* Full dim track is already present before the logo fully resolves. */
#preloader p + div {
    height: 1px !important;
    background: rgba(255, 255, 255, 0.105) !important;
    border-radius: 999px;
    overflow: hidden;
    opacity: 0;
    animation: loaderTrackIn 0.42s ease 0.18s forwards;
}

#preloader p + div > div {
    height: 1px !important;
    width: 100%;
    background: rgba(245, 245, 243, 0.9) !important;
    border-radius: 999px;
    transform: scaleX(0);
    transform-origin: left center;
    animation: ryharProgress 1.55s cubic-bezier(0.45, 0, 0.2, 1) 0.65s forwards !important;
}

@keyframes loaderBrandIn {
    0% {
        opacity: 0;
        filter: blur(9px);
        transform: scale(0.975);
    }

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

@keyframes loaderLabelIn {
    0% {
        opacity: 0;
        filter: blur(5px);
        transform: translateY(3px);
    }

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

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

@keyframes ryharProgress {
    0% {
        transform: scaleX(0);
    }

    100% {
        transform: scaleX(1);
    }
}

/* The recording shows a crossfade into the rendered page, not a panel slide. */
#preloader.loader-leaving {
    opacity: 0;
    transform: translateY(-18px);

    transition:
        opacity 0.85s ease,
        transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
}

#preloader.loader-leaving > div {
    opacity: 0;
    filter: blur(0px);
    transform: scale(0.985);
}

/* Avoid Tailwind's opacity utility being necessary for the exit. */
#preloader.loader-hidden {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    #preloader,
    #preloader > div,
    #preloader h1,
    #preloader p,
    #preloader p + div,
    #preloader p + div > div {
        animation: none !important;
        transition: none !important;
        filter: none !important;
        transform: none !important;
    }

    #preloader h1,
    #preloader p,
    #preloader p + div {
        opacity: 1 !important;
    }

    #preloader p + div > div {
        transform: scaleX(1) !important;
    }
}


/* ========================================
   FINAL THEME + NAVBAR GLASS OVERRIDES
   - Neutral black/white theme
   - Loader follows current theme
   - Removes inner menu capsule background
   - Stronger frosted liquid-glass navbar
======================================== */

/* Neutral page surfaces */
.dark body {
    background-color: #050505 !important;
}

html:not(.dark) body {
    background-color: #f5f5f3 !important;
}


/* ========================================
   PRELOADER — FOLLOW LIGHT / DARK THEME
======================================== */

/* Light mode */
html:not(.dark) #preloader {
    background: #f5f5f3 !important;
    color: #111111 !important;
}

/* Dark mode */
.dark #preloader {
    background: #050505 !important;
    color: #f5f5f3 !important;
}

/* Loader halo — light */
html:not(.dark) #preloader::before {
    background:
        radial-gradient(
            circle at 50% 50%,
            rgba(0, 0, 0, 0.045) 0%,
            rgba(0, 0, 0, 0.018) 16%,
            rgba(0, 0, 0, 0.006) 30%,
            transparent 48%
        ) !important;
}

/* Loader halo — dark */
.dark #preloader::before {
    background:
        radial-gradient(
            circle at 50% 50%,
            rgba(255, 255, 255, 0.055) 0%,
            rgba(255, 255, 255, 0.022) 16%,
            rgba(255, 255, 255, 0.008) 30%,
            transparent 48%
        ) !important;
}

/* Brand */
html:not(.dark) #preloader h1 {
    color: #111111 !important;
}

.dark #preloader h1 {
    color: #f3f3f1 !important;
}

/* Loading label */
html:not(.dark) #preloader p {
    color: rgba(17, 17, 17, 0.50) !important;
}

.dark #preloader p {
    color: rgba(245, 245, 243, 0.48) !important;
}

/* Progress track */
html:not(.dark) #preloader p + div {
    background: rgba(17, 17, 17, 0.11) !important;
}

.dark #preloader p + div {
    background: rgba(255, 255, 255, 0.105) !important;
}

/* Progress fill */
html:not(.dark) #preloader p + div > div {
    background: rgba(17, 17, 17, 0.90) !important;
}

.dark #preloader p + div > div {
    background: rgba(245, 245, 243, 0.90) !important;
}


/* ========================================
   NAVBAR — ONE OUTER LIQUID GLASS SURFACE
======================================== */

/*
   Remove the extra background/border that currently wraps
   only the desktop menu links. The outer nav is now the
   single glass surface.
*/
header nav > div[class~="md:flex"] {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
}

/* Dark mode: frosted graphite glass */
.dark header nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.105) 0%,
            rgba(255, 255, 255, 0.045) 42%,
            rgba(255, 255, 255, 0.025) 100%
        ),
        rgba(10, 10, 10, 0.64) !important;

    backdrop-filter:
        blur(42px)
        saturate(175%)
        contrast(108%) !important;

    -webkit-backdrop-filter:
        blur(42px)
        saturate(175%)
        contrast(108%) !important;

    border:
        1px solid rgba(255, 255, 255, 0.16) !important;

    box-shadow:
        0 14px 44px rgba(0, 0, 0, 0.50),
        0 2px 10px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        inset 0 -1px 0 rgba(255, 255, 255, 0.035),
        inset 18px 0 38px rgba(255, 255, 255, 0.018),
        inset -18px 0 38px rgba(255, 255, 255, 0.012) !important;
}

/* Light mode: frosted milky glass */
html:not(.dark) header nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.78) 0%,
            rgba(255, 255, 255, 0.56) 46%,
            rgba(255, 255, 255, 0.40) 100%
        ),
        rgba(245, 245, 243, 0.54) !important;

    backdrop-filter:
        blur(42px)
        saturate(155%)
        contrast(104%) !important;

    -webkit-backdrop-filter:
        blur(42px)
        saturate(155%)
        contrast(104%) !important;

    border:
        1px solid rgba(255, 255, 255, 0.82) !important;

    box-shadow:
        0 14px 38px rgba(0, 0, 0, 0.10),
        0 2px 8px rgba(0, 0, 0, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.96),
        inset 0 -1px 0 rgba(255, 255, 255, 0.28),
        inset 16px 0 34px rgba(255, 255, 255, 0.20),
        inset -16px 0 34px rgba(255, 255, 255, 0.12) !important;
}

/* Stronger glass rim / highlight across the outer nav */
header nav.liquid-glass::before {
    left: 4% !important;
    right: 4% !important;
    height: 1px !important;
    opacity: 1 !important;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.16) 12%,
            rgba(255, 255, 255, 0.52) 50%,
            rgba(255, 255, 255, 0.16) 88%,
            transparent
        ) !important;
}

html:not(.dark) header nav.liquid-glass::before {
    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.40) 12%,
            rgba(255, 255, 255, 1) 50%,
            rgba(255, 255, 255, 0.40) 88%,
            transparent
        ) !important;
}

/* Keep the interactive pointer glow subtle on the navbar */
header nav.liquid-glass::after {
    width: 230px !important;
    height: 150px !important;

    background:
        radial-gradient(
            ellipse,
            rgba(255, 255, 255, 0.13) 0%,
            rgba(255, 255, 255, 0.05) 35%,
            transparent 72%
        ) !important;

    filter: blur(8px);
}

/* Keep menu links clean now that the inner capsule is gone */
header nav > div[class~="md:flex"] > a {
    background: transparent;
    border: 1px solid transparent;
    transition:
        color 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        background 0.25s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (hover: hover) and (pointer: fine) {
.dark header nav > div[class~="md:flex"] > a:hover {
    background: rgba(255, 255, 255, 0.07) !important;
    border-color: rgba(255, 255, 255, 0.08);
}

html:not(.dark) header nav > div[class~="md:flex"] > a:hover {
    background: rgba(255, 255, 255, 0.48) !important;
    border-color: rgba(255, 255, 255, 0.62);
}
}

/* NAV ACTIVE STATE */
header nav a.nav-active {
    font-weight: 700;
}

.dark header nav a.nav-active {
    background: rgba(255, 255, 255, 0.11) !important;
    color: #fff !important;
}

html:not(.dark) header nav a.nav-active {
    background: rgba(255, 255, 255, 0.72) !important;
    color: #111 !important;
}


/* Scrolled state keeps the same frosted language */
.dark header.nav-scrolled nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.12),
            rgba(255, 255, 255, 0.04)
        ),
        rgba(8, 8, 8, 0.70) !important;

    backdrop-filter:
        blur(46px)
        saturate(180%)
        contrast(110%) !important;

    -webkit-backdrop-filter:
        blur(46px)
        saturate(180%)
        contrast(110%) !important;
}

html:not(.dark) header.nav-scrolled nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.84),
            rgba(255, 255, 255, 0.58)
        ),
        rgba(245, 245, 243, 0.58) !important;

    backdrop-filter:
        blur(46px)
        saturate(160%) !important;

    -webkit-backdrop-filter:
        blur(46px)
        saturate(160%) !important;
}


/* Mobile dropdown keeps its own glass surface because it is separate from the navbar */
#mobile-menu.liquid-glass {
    backdrop-filter: blur(30px) saturate(160%);
    -webkit-backdrop-filter: blur(30px) saturate(160%);
}


/* Neutral dark scrollbar, matching #050505 instead of blue-black slate */
.dark ::-webkit-scrollbar-track {
    background: #050505 !important;
}


/* POINTER LIGHT FINAL OVERRIDE */
@media (hover: hover) and (pointer: fine) {
header nav.liquid-glass.pointer-active::after,
header nav.liquid-glass:hover::after {
    opacity: 1 !important;
}
}


/* ========================================
   NAVBAR — KEEP ORIGINAL LAYOUT, STRONGER BLUR ONLY
   Layout tetap seperti sebelumnya.
   Hanya glass dibuat lebih frosted / blur.
======================================== */

/* DARK MODE */
.dark header nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.10) 0%,
            rgba(255, 255, 255, 0.038) 45%,
            rgba(255, 255, 255, 0.018) 100%
        ),
        rgba(8, 8, 8, 0.82) !important;

    backdrop-filter:
        blur(64px)
        saturate(150%)
        contrast(112%) !important;

    -webkit-backdrop-filter:
        blur(64px)
        saturate(150%)
        contrast(112%) !important;

    border:
        1px solid rgba(255, 255, 255, 0.17) !important;

    box-shadow:
        0 16px 46px rgba(0, 0, 0, 0.56),
        0 3px 12px rgba(0, 0, 0, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.035) !important;
}


/* LIGHT MODE */
html:not(.dark) header nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.92) 0%,
            rgba(255, 255, 255, 0.76) 48%,
            rgba(255, 255, 255, 0.66) 100%
        ),
        rgba(245, 245, 243, 0.82) !important;

    backdrop-filter:
        blur(60px)
        saturate(140%)
        contrast(104%) !important;

    -webkit-backdrop-filter:
        blur(60px)
        saturate(140%)
        contrast(104%) !important;

    border:
        1px solid rgba(255, 255, 255, 0.94) !important;

    box-shadow:
        0 14px 38px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.055),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -1px 0 rgba(255, 255, 255, 0.34) !important;
}


/* Saat discroll, tetap layout lama tapi sedikit lebih frosted */
.dark header.nav-scrolled nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.115),
            rgba(255, 255, 255, 0.028)
        ),
        rgba(6, 6, 6, 0.87) !important;

    backdrop-filter:
        blur(70px)
        saturate(155%)
        contrast(114%) !important;

    -webkit-backdrop-filter:
        blur(70px)
        saturate(155%)
        contrast(114%) !important;
}

html:not(.dark) header.nav-scrolled nav.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.95),
            rgba(255, 255, 255, 0.78)
        ),
        rgba(245, 245, 243, 0.86) !important;

    backdrop-filter:
        blur(66px)
        saturate(145%) !important;

    -webkit-backdrop-filter:
        blur(66px)
        saturate(145%) !important;
}


/* Mobile dropdown ikut lebih blur, posisi/ukuran tidak diubah */
#mobile-menu.liquid-glass {
    backdrop-filter:
        blur(60px)
        saturate(145%) !important;

    -webkit-backdrop-filter:
        blur(60px)
        saturate(145%) !important;
}

.dark #mobile-menu.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.095),
            rgba(255, 255, 255, 0.025)
        ),
        rgba(8, 8, 8, 0.88) !important;
}

html:not(.dark) #mobile-menu.liquid-glass {
    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.95),
            rgba(255, 255, 255, 0.76)
        ),
        rgba(245, 245, 243, 0.88) !important;
}

html {
    scroll-behavior: auto;
    scroll-padding-top: 0 !important;
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 0 !important;
    }
}

/* ========================================
   NAVBAR ACTIVE SECTION
======================================== */

.nav-link {
    position: relative;
    color: inherit;

    transition:
        background 0.35s cubic-bezier(0.16, 1, 0.3, 1),
        color 0.35s ease,
        box-shadow 0.35s ease;
}


/* DARK MODE */

.dark .nav-link.nav-active {
    color: #fff !important;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.16),
            rgba(255, 255, 255, 0.07)
        ) !important;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.13),
        0 4px 14px rgba(0,0,0,0.18);
}


/* LIGHT MODE */

html:not(.dark) .nav-link.nav-active {
    color: #111 !important;

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.90),
            rgba(255, 255, 255, 0.58)
        ) !important;

    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.9),
        0 4px 14px rgba(0,0,0,0.08);
}


/* ========================================
   ANCHOR OFFSET — FINAL FIX
   Section sudah punya py-20, jadi offset cukup kecil.
======================================== */

html {
    scroll-padding-top: 0 !important;
}

section[id] {
    scroll-margin-top: 16px !important;
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 0 !important;
    }

    section[id] {
        scroll-margin-top: 8px !important;
    }
}

/* ========================================
   MOBILE NAV — FINAL FIX
   - Dropdown tidak mendorong hero
   - Lebih compact
   - Open/close responsif, tanpa stagger delay
   - Hero mobile tidak terlalu turun
======================================== */

.mobile-menu-panel {
    position: absolute;

    /* Nempel rapi di bawah navbar */
    top: calc(100% + 6px);
    left: 16px;
    right: 16px;

    /* Override p-5 / space-y-3 jika masih ada di HTML */
    padding: 12px !important;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-6px) scale(0.985);
    transform-origin: top center;

    transition:
        opacity 0.14s ease,
        transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s linear 0.18s;

    z-index: 50;
}

/* Hilangkan gap bawaan Tailwind space-y-* jika class lama masih ada */
.mobile-menu-panel > :not([hidden]) ~ :not([hidden]) {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* OPEN */
.mobile-menu-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0) scale(1);

    transition:
        opacity 0.14s ease,
        transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
        visibility 0s;
}

/* Link dibuat compact dan langsung tampil tanpa delay */
.mobile-menu-panel .mobile-link {
    opacity: 1 !important;
    transform: none !important;

    padding-top: 9px !important;
    padding-bottom: 9px !important;

    transition:
        color 0.14s ease,
        background-color 0.14s ease,
        opacity 0.14s ease !important;

    transition-delay: 0s !important;
}

/* Pastikan semua nth-child lama tidak bikin stagger lagi */
.mobile-menu-panel.is-open .mobile-link:nth-child(1),
.mobile-menu-panel.is-open .mobile-link:nth-child(2),
.mobile-menu-panel.is-open .mobile-link:nth-child(3),
.mobile-menu-panel.is-open .mobile-link:nth-child(4),
.mobile-menu-panel.is-open .mobile-link:nth-child(5) {
    transition-delay: 0s !important;
}

/* Mobile spacing — FINAL */
@media (max-width: 768px) {
    /*
       Header sticky tetap mengambil ruang di layout.
       Jadi main tidak perlu tambahan pt-16 dari Tailwind.
    */
    main {
        padding-top: 0 !important;
    }

    /*
       Hero mobile jangan dipaksa setinggi 80vh
       dan jangan center vertikal.
    */
    #home {
        min-height: 0 !important;
        height: auto !important;
        justify-content: flex-start !important;

        padding-top: 24px !important;
        padding-bottom: 48px !important;
    }

    .mobile-menu-panel {
        left: 8px;
        right: 8px;
    }
}

/* HP pendek: rapatkan sedikit lagi */
@media (max-width: 768px) and (max-height: 700px) {
    #home {
        padding-top: 16px !important;
        padding-bottom: 40px !important;
    }

    .mobile-menu-panel .mobile-link {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }
}

/* ========================================
   GLOBAL BUTTON HOVER SYSTEM
   Subtle monochrome motion for every interactive control.
======================================== */

/* Shared motion baseline for controls that visually behave like buttons. */
button,
.liquid-btn-primary,
a.liquid-glass-hover,
.filter-btn,
.nav-link,
.mobile-link,
footer a[aria-label],
#project-modal a,
#project-modal button {
    transition:
        transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.22s ease,
        background 0.22s ease,
        border-color 0.22s ease,
        color 0.22s ease,
        opacity 0.22s ease;
}

/* Only elements explicitly marked as cards receive the lift interaction. */
.motion-card {
    transition:
        transform 0.42s cubic-bezier(0.16, 1, 0.3, 1),
        border-color 0.35s ease,
        box-shadow 0.42s ease,
        background 0.35s ease;
    will-change: transform;
}

/* Desktop / pointer devices only, so hover does not stick on touch screens */
@media (hover: hover) and (pointer: fine) {
    /* Every real <button> */
    button:hover {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.4);
    }

    /* Theme + hamburger */
    #theme-toggle:hover,
    #menu-btn:hover {
        background: rgba(255, 255, 255, 0.16) !important;
        box-shadow:
            0 8px 18px rgba(0, 0, 0, 0.22),
            inset 0 1px 0 rgba(255, 255, 255, 0.14);
    }

    html:not(.dark) #theme-toggle:hover,
    html:not(.dark) #menu-btn:hover {
        background: rgba(255, 255, 255, 0.92) !important;
        box-shadow:
            0 8px 18px rgba(0, 0, 0, 0.10),
            inset 0 1px 0 rgba(255, 255, 255, 0.95);
    }

    /* Desktop navbar pills */
    .nav-link:hover {
        transform: translateY(-2px) scale(1.01);
    }

    /* Mobile dropdown links */
    .mobile-link:hover {
        transform: translateY(-2px) scale(1.01);
        background: rgba(255, 255, 255, 0.06);
        border-radius: 12px;
    }

    html:not(.dark) .mobile-link:hover {
        background: rgba(0, 0, 0, 0.045);
    }

    /* Primary CTA + submit */
    .liquid-btn-primary:hover {
        transform: translateY(-3px) scale(1.02) !important;
    }

    .dark .liquid-btn-primary:hover {
        box-shadow: 0 13px 32px rgba(255, 255, 255, 0.22);
    }

    html:not(.dark) .liquid-btn-primary:hover {
        box-shadow: 0 13px 32px rgba(0, 0, 0, 0.26);
    }

    /* Secondary glass CTA */
    a.liquid-glass-hover:hover {
        transform: translateY(-3px) scale(1.02);
    }

    /* Project category filter pills */
    .filter-btn:hover {
        transform: translateY(-2px) scale(1.02);
        background: rgba(255, 255, 255, 0.08);
        box-shadow: 0 7px 18px rgba(0, 0, 0, 0.16);
    }

    html:not(.dark) .filter-btn:hover {
        background: rgba(0, 0, 0, 0.06);
        box-shadow: 0 7px 18px rgba(0, 0, 0, 0.08);
    }

    /* Small project arrow buttons */
    .project-card button:hover {
        transform: translateY(-2px) scale(1.03) !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.20);
    }

    /* Footer social buttons */
    footer a[aria-label]:hover {
        transform: translateY(-3px) scale(1.03);
        border-color: rgba(255, 255, 255, 0.22);
        box-shadow: 0 9px 22px rgba(0, 0, 0, 0.18);
    }

    html:not(.dark) footer a[aria-label]:hover {
        border-color: rgba(0, 0, 0, 0.10);
        box-shadow: 0 9px 22px rgba(0, 0, 0, 0.08);
    }

    /* Modal close / modal CTA */
    #project-modal button:hover,
    #project-modal a:hover {
        transform: translateY(-2px) scale(1.025);
    }

    /* Brand mark gets a tiny tactile response too */
    header nav > a:hover {
        opacity: 0.88;
    }

    header nav > a:hover > div {
        transform: translateY(-2px) scale(1.025);
    }

    /* Liquid-glass cards: subtle lift and highlight only. */
    .dark .motion-card:hover,
    .dark .project-card:hover {
        transform: translateY(-5px);
        border-color: rgba(255, 255, 255, 0.23);
        box-shadow:
            0 22px 44px -20px rgba(0, 0, 0, 0.88),
            inset 0 1px 0 rgba(255, 255, 255, 0.12);
    }

    html:not(.dark) .motion-card:hover,
    html:not(.dark) .project-card:hover {
        transform: translateY(-5px);
        border-color: rgba(0, 0, 0, 0.11);
        box-shadow:
            0 20px 38px -20px rgba(0, 0, 0, 0.22),
            inset 0 1px 0 rgba(255, 255, 255, 0.96);
    }

    .project-card:hover img {
        transform: translate3d(0, var(--parallax-y, 0px), 0) scale(1.04);
    }

    /* Directional icon feedback. */
    #home a[href="#projects"]:hover i {
        transform: translateY(3px);
    }

    #home a[href="#contact"]:hover i,
    #contact button[type="submit"]:hover i {
        transform: translate(2px, -2px);
    }

    .project-card button:hover i {
        transform: translateX(3px);
    }

    #theme-toggle:hover i {
        transform: rotate(10deg) scale(1.06);
    }

    #menu-btn:hover i {
        transform: rotate(6deg) scale(1.05);
    }
}

/* Touch / click feedback */
button:active,
.liquid-btn-primary:active,
.liquid-glass-hover:active,
.filter-btn:active,
.nav-link:active,
.mobile-link:active,
footer a[aria-label]:active,
#project-modal a:active {
    transform: scale(0.975) !important;
}

/* Icon motion should feel smooth */
button i,
.liquid-btn-primary i,
.liquid-glass-hover i,
footer a[aria-label] i,
#project-modal i {
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

#menu-btn[aria-expanded="true"] i {
    transform: rotate(8deg) scale(1.04);
}

/* ========================================
   MOBILE RESPONSIVE FIX
======================================== */

@media (max-width: 767px) {

    header {
        position: sticky !important;
        top: 16px !important;
        z-index: 40 !important;
    }

    main {
        padding-top: 0 !important;
    }

    /* LANGSUNG TARGET ID HOME */
    #home {
        min-height: 0 !important;
        height: auto !important;

        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;

        justify-content: flex-start !important;

        margin: 0 !important;

        padding-top: 72px !important;
        padding-bottom: 48px !important;
    }

    /* DROPDOWN MOBILE */
    #mobile-menu {
        position: absolute !important;

        top: calc(100% + 8px) !important;

        left: 16px !important;
        right: 16px !important;

        width: auto !important;

        margin-left: 0 !important;
        margin-right: 0 !important;

        box-sizing: border-box !important;
    }
}

/* ========================================
   SMOOTH SCROLL
======================================== */

html {
    scroll-behavior: auto;
}


/* ========================================
   SCROLL REVEAL
======================================== */

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(40px) scale(0.985);
    filter: blur(6px);

    transition:
        opacity 0.75s ease,
        transform 0.85s cubic-bezier(0.16, 1, 0.3, 1),
        filter 0.75s ease;

    will-change: opacity, transform, filter;
}


/* Saat elemen masuk viewport */
.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
}


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

    .reveal-on-scroll {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }
}

/* ========================================
   PRELOADER INTRO ANIMATION
======================================== */

#preloader h1 {
    opacity: 0;
    transform: translateY(42px);

    animation:
        preloaderTitleIn
        1.25s
        cubic-bezier(0.16, 1, 0.3, 1)
        0.25s
        forwards;
}

#preloader p {
    opacity: 0;
    transform: translateY(32px);

    animation:
        preloaderSubtitleIn
        1.15s
        cubic-bezier(0.16, 1, 0.3, 1)
        0.7s
        forwards;
}

#preloader .animate-progress {
    transform-origin: left center;
    transform: scaleX(0);

    animation:
        preloaderProgress
        2.8s
        cubic-bezier(0.16, 1, 0.3, 1)
        1.05s
        forwards;
}


/* RiellHae naik dari bawah */
@keyframes preloaderTitleIn {

    0% {
        opacity: 0;
        transform: translateY(42px);
        filter: blur(8px);
    }

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

}


/* PORTFOLIO LOADING nyusul */
@keyframes preloaderSubtitleIn {

    0% {
        opacity: 0;
        transform: translateY(32px);
        filter: blur(5px);
    }

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

}


/* Loading bar lebih santai */
@keyframes preloaderProgress {

    0% {
        transform: scaleX(0);
    }

    100% {
        transform: scaleX(1);
    }

}

/* ========================================
   CINEMATIC SHOWCASE V2
   More expressive motion without making mobile heavy.
======================================== */

:root {
    --cinema-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --cinema-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Thin progress line: subtle, but makes the whole page feel alive. */
#scroll-progress {
    position: fixed;
    inset: 0 0 auto 0;
    width: 100%;
    height: 3px;
    z-index: 80;
    pointer-events: none;
    transform: scaleX(var(--scroll-progress, 0));
    transform-origin: left center;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.28);
    transition: transform 0.08s linear;
}

html:not(.dark) #scroll-progress {
    background: rgba(5, 5, 5, 0.9);
    box-shadow: 0 0 16px rgba(0, 0, 0, 0.18);
}

/* Hero word-mask reveal: title feels designed, not like a generic fade-up. */
.cinematic-hero-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    column-gap: 0.22em;
    row-gap: 0.03em;
}

.hero-word-mask {
    display: inline-block;
    overflow: hidden;
    padding: 0.08em 0.02em 0.12em;
    margin: -0.08em -0.02em -0.12em;
}

.hero-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(118%) rotate(2deg);
    filter: blur(7px);
}

body:not(.loading) .cinematic-hero-title .hero-word {
    animation: heroWordRise 0.95s var(--cinema-ease) calc(0.18s + var(--word-delay, 0ms)) forwards;
}

@keyframes heroWordRise {
    0% {
        opacity: 0;
        transform: translateY(118%) rotate(2deg);
        filter: blur(7px);
    }
    65% {
        opacity: 1;
    }
    100% {
        opacity: 1;
        transform: translateY(0) rotate(0);
        filter: blur(0);
    }
}

/* Stronger directional reveals. Higher specificity beats the inline reveal block. */
body .reveal-on-scroll:not(.hero-intro-item) {
    transition:
        opacity 0.82s ease,
        transform 1.02s var(--cinema-ease),
        filter 0.82s ease;
    transition-delay: var(--reveal-delay, var(--delay, 0ms));
}

body .reveal-on-scroll:not(.hero-intro-item)[data-reveal="left"] {
    opacity: 0;
    transform: translate3d(-54px, 24px, 0) rotate(-1.6deg) scale(0.975);
    filter: blur(8px);
}

body .reveal-on-scroll:not(.hero-intro-item)[data-reveal="right"] {
    opacity: 0;
    transform: translate3d(54px, 24px, 0) rotate(1.6deg) scale(0.975);
    filter: blur(8px);
}

body .reveal-on-scroll:not(.hero-intro-item)[data-reveal="zoom"] {
    opacity: 0;
    transform: translate3d(0, 34px, 0) scale(0.92);
    filter: blur(9px);
}

body .reveal-on-scroll:not(.hero-intro-item).is-visible,
body .reveal-on-scroll:not(.hero-intro-item)[data-reveal].is-visible {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0) scale(1);
    filter: blur(0);
}

/* Big headings get a small cinematic settle after their section enters. */
.cinematic-title,
.cinematic-contact-title {
    transform-origin: 50% 100%;
    transition: letter-spacing 0.9s var(--cinema-ease), transform 0.9s var(--cinema-ease);
}

.reveal-on-scroll.is-visible .cinematic-title,
.reveal-on-scroll.is-visible .cinematic-contact-title,
.cinematic-title.title-in-view,
.cinematic-contact-title.title-in-view {
    animation: titleSettle 0.9s var(--cinema-ease) both;
}

@keyframes titleSettle {
    from {
        opacity: 0;
        transform: translateY(26px) scaleY(1.08);
        letter-spacing: 0.025em;
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
        letter-spacing: normal;
        filter: blur(0);
    }
}

/* Project cards: alternating angle + image depth. */
.project-card {
    --image-tilt-x: 0deg;
    --image-tilt-y: 0deg;
    --image-shift-x: 0px;
    --image-shift-y: 0px;
    --card-glare-x: 50%;
    --card-glare-y: 50%;
    isolation: isolate;
}

.project-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    border-radius: inherit;
    background: radial-gradient(
        360px circle at var(--card-glare-x) var(--card-glare-y),
        rgba(255,255,255,0.16),
        rgba(255,255,255,0.045) 34%,
        transparent 68%
    );
    transition: opacity 0.32s ease;
}

html:not(.dark) .project-card::after {
    background: radial-gradient(
        360px circle at var(--card-glare-x) var(--card-glare-y),
        rgba(255,255,255,0.72),
        rgba(255,255,255,0.16) 34%,
        transparent 68%
    );
}

.project-card img {
    transform:
        perspective(900px)
        translate3d(var(--image-shift-x), calc(var(--parallax-y, 0px) + var(--image-shift-y)), 0)
        rotateX(var(--image-tilt-x))
        rotateY(var(--image-tilt-y))
        scale(var(--project-image-scale, 1));
    transition: transform 0.45s var(--cinema-ease), filter 0.45s ease;
}

@media (hover: hover) and (pointer: fine) {
    .project-card:hover {
        --project-image-scale: 1.075;
    }

    .project-card:hover::after {
        opacity: 1;
    }

    /* Keep project screenshots in color; depth is enough. */
    .project-card:hover img,
    .project-card.is-visible:hover img,
    .reveal-on-scroll.is-visible.project-card:hover img {
        filter: saturate(1.05) contrast(1.03) brightness(1.03) !important;
    }
}

/* About portrait gets a soft floating perspective on desktop. */
.about-portrait {
    --portrait-x: 0deg;
    --portrait-y: 0deg;
    transform: perspective(950px) rotateX(var(--portrait-x)) rotateY(var(--portrait-y));
    transition: transform 0.55s var(--cinema-ease), box-shadow 0.55s ease;
    will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
    .about-portrait:hover {
        box-shadow: 0 28px 55px -26px rgba(0,0,0,0.6);
    }
}

/* Skill cards: pop, then icon settles with a tiny overshoot. */
.skills-grid .motion-card.is-visible {
    animation: skillCardPop 0.72s var(--cinema-spring) both;
    animation-delay: var(--reveal-delay, 0ms);
}

.skills-grid .motion-card img {
    transition: transform 0.5s var(--cinema-spring), filter 0.4s ease;
}

.skills-grid .motion-card.is-visible img {
    animation: skillIconPop 0.72s var(--cinema-spring) calc(var(--reveal-delay, 0ms) + 120ms) both;
}

@keyframes skillCardPop {
    0% { transform: translateY(28px) scale(0.86) rotate(-2deg); }
    70% { transform: translateY(-3px) scale(1.025) rotate(0.4deg); }
    100% { transform: translateY(0) scale(1) rotate(0); }
}

@keyframes skillIconPop {
    0% { transform: scale(0.5) rotate(-10deg); opacity: 0; }
    75% { transform: scale(1.12) rotate(3deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@media (hover: hover) and (pointer: fine) {
    .skills-grid .motion-card:hover img {
        transform: translateY(-4px) scale(1.12) rotate(-3deg);
        filter: drop-shadow(0 10px 12px rgba(0,0,0,0.18));
    }
}

/* Social cards cascade after the whole right panel enters. */
.contact-social-panel .social-list > * {
    opacity: 0;
    transform: translateX(24px) scale(0.975);
}

.contact-social-panel.is-visible .social-list > * {
    animation: socialCascade 0.65s var(--cinema-ease) forwards;
}

.contact-social-panel.is-visible .social-list > *:nth-child(1) { animation-delay: 120ms; }
.contact-social-panel.is-visible .social-list > *:nth-child(2) { animation-delay: 185ms; }
.contact-social-panel.is-visible .social-list > *:nth-child(3) { animation-delay: 250ms; }
.contact-social-panel.is-visible .social-list > *:nth-child(4) { animation-delay: 315ms; }
.contact-social-panel.is-visible .social-list > *:nth-child(5) { animation-delay: 380ms; }
.contact-social-panel.is-visible .social-list > *:nth-child(6) { animation-delay: 445ms; }

@keyframes socialCascade {
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Magnetic elements use CSS variables so they can coexist with hover micro-motion. */
.magnetic-motion {
    --mag-x: 0px;
    --mag-y: 0px;
}

@media (hover: hover) and (pointer: fine) {
    .magnetic-motion {
        transform: translate3d(var(--mag-x), var(--mag-y), 0) !important;
    }

    .magnetic-motion:hover {
        transform: translate3d(var(--mag-x), calc(var(--mag-y) - 2px), 0) scale(1.02) !important;
    }
}

/* Ambient blobs react gently to mouse/scroll through variables set in JS. */
.blob-1,
.blob-2,
.blob-3 {
    translate: var(--blob-x, 0px) var(--blob-y, 0px);
    transition: translate 0.25s ease-out;
    will-change: translate;
}

/* Modal entrance feels intentional rather than simply appearing. */
#project-modal > .liquid-glass {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
    transition: opacity 0.42s ease, transform 0.55s var(--cinema-spring);
}

#project-modal.modal-cinematic-open > .liquid-glass {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Mobile: keep the expressive reveal, remove pointer-only depth work. */
@media (max-width: 767px) {
    body .reveal-on-scroll:not(.hero-intro-item)[data-reveal="left"],
    body .reveal-on-scroll:not(.hero-intro-item)[data-reveal="right"] {
        transform: translate3d(0, 38px, 0) scale(0.97);
        rotate: 0deg;
    }

    body .reveal-on-scroll:not(.hero-intro-item)[data-reveal].is-visible {
        transform: translate3d(0, 0, 0) scale(1);
    }

    #scroll-progress {
        height: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #scroll-progress { display: none; }

    .hero-word,
    .contact-social-panel .social-list > *,
    #project-modal > .liquid-glass {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
        filter: none !important;
    }

    .blob-1,
    .blob-2,
    .blob-3 {
        translate: 0 0 !important;
    }
}


/* ========================================
   SCROLL TO TOP — FINAL POSITION FIX
   .liquid-glass memakai position: relative,
   jadi tombol perlu override khusus agar benar-benar fixed.
======================================== */
#scroll-top {
    position: fixed !important;
    right: 20px !important;
    bottom: 20px !important;
    z-index: 9999 !important;

    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9999px;
}

@media (min-width: 640px) {
    #scroll-top {
        right: 28px !important;
        bottom: 28px !important;
    }
}
