/* UCANSEE / Extra motion — lapisan animasi tambahan di atas motion.css.
   - Semua animasi otomatis mati kalau tombol "ANIMASI" di-OFF (html.motion-paused)
     atau pengunjung memakai prefers-reduced-motion.
   - Keadaan akhir animasi = tampilan normal, jadi konten tidak pernah tersembunyi.
   - Hapus file ini + extra-motion.js (dan 2 baris link-nya) untuk kembali ke versi lama. */

@keyframes xm-up {
    from { opacity: 0; transform: translateY(24px) }
}

@keyframes xm-drop {
    from { opacity: 0; transform: translateY(-100%) }
}

@keyframes xm-draw {
    from { transform: scaleX(0) }
}

@keyframes xm-zoom {
    from { transform: scale(1.025) }
    to { transform: scale(1.1) }
}

@keyframes xm-pulse {
    0% { box-shadow: 0 0 0 0 rgba(196, 217, 130, .55) }
    70%, 100% { box-shadow: 0 0 0 11px rgba(196, 217, 130, 0) }
}

@keyframes xm-bob {
    0%, 100% { transform: translateY(0) }
    50% { transform: translateY(6px) }
}

@keyframes xm-shimmer {
    from { background-position: 120% 0 }
    to { background-position: -120% 0 }
}

@keyframes xm-spin {
    from { transform: translateY(-50%) rotate(0deg) }
    to { transform: translateY(-50%) rotate(360deg) }
}

@keyframes xm-float {
    from { transform: translate(0, 0) scale(1) }
    to { transform: translate(-14%, 12%) scale(1.18) }
}

@keyframes xm-img {
    from { opacity: 0; filter: blur(10px) }
}

/* ---------- Dekorasi statis (aman walau animasi mati) ---------- */

.hero-topline .eyebrow:before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 10px;
    border-radius: 50%;
    background: var(--accent);
    vertical-align: middle;
    position: relative;
    top: -1px
}

.hero-video h1 em {
    position: relative
}

.hero-video h1 em:after {
    content: "";
    position: absolute;
    left: .04em;
    right: .1em;
    bottom: .03em;
    height: .045em;
    min-height: 3px;
    background: var(--accent);
    transform-origin: left
}

.page-title:after {
    content: "";
    display: block;
    width: 72px;
    height: 3px;
    margin-top: 22px;
    background: var(--accent);
    transform-origin: left
}

.cta-band:before {
    content: "✳";
    position: absolute;
    right: -.08em;
    top: 50%;
    transform: translateY(-50%);
    font-size: min(46vw, 520px);
    line-height: 1;
    color: rgba(16, 17, 16, .07);
    pointer-events: none
}

.cta-band>.container {
    position: relative;
    z-index: 1
}

.visual-panel:before {
    content: "";
    position: absolute;
    width: 70%;
    aspect-ratio: 1;
    left: 28%;
    top: -6%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 217, 130, .22), transparent 65%);
    pointer-events: none
}

/* ---------- Hover (transition sudah otomatis mati saat motion off) ---------- */

.btn,
.nav-cta {
    position: relative;
    overflow: hidden;
    isolation: isolate
}

.btn:after,
.nav-cta:after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .38) 50%, transparent 70%);
    transform: translateX(-130%);
    pointer-events: none
}

.btn:hover:after,
.nav-cta:hover:after {
    transform: translateX(130%);
    transition: transform .75s cubic-bezier(.16, 1, .3, 1)
}

.btn span {
    transition: transform .3s cubic-bezier(.16, 1, .3, 1)
}

.btn:hover span {
    transform: translate(4px, -4px)
}

.work-card>div {
    transition: transform .55s cubic-bezier(.16, 1, .3, 1)
}

.work-card:hover>div,
.work-card:focus-visible>div {
    transform: translateY(-10px)
}

.work-card:before {
    transition: background .3s, color .3s, border-color .3s
}

.work-card:hover:before,
.work-card:focus-visible:before {
    background: var(--accent);
    border-color: var(--accent);
    color: #101510
}

.service-card>* {
    position: relative;
    z-index: 1
}

.service-card:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .55s cubic-bezier(.16, 1, .3, 1)
}

.service-card:hover:before {
    transform: scaleX(1)
}

.service-card:after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity .35s;
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(196, 217, 130, .13), transparent 65%)
}

.service-card:hover:after {
    opacity: 1
}

.service-card .num {
    transition: transform .4s cubic-bezier(.16, 1, .3, 1)
}

.service-card:hover .num {
    transform: translateX(8px)
}

.footer-links a {
    position: relative
}

.footer-links a:after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .35s cubic-bezier(.16, 1, .3, 1)
}

.footer-links a:hover:after {
    transform: scaleX(1);
    transform-origin: left
}

/* ---------- Animasi yang berjalan sendiri ---------- */

@media (prefers-reduced-motion: no-preference) {

    /* Header turun halus saat halaman dibuka */
    html:not(.motion-paused) .site-header {
        animation: xm-drop .8s cubic-bezier(.16, 1, .3, 1) backwards
    }

    /* Hero: elemen muncul berurutan setelah judul */
    html:not(.motion-paused) .hero-topline {
        animation: xm-up .9s cubic-bezier(.16, 1, .3, 1) .05s backwards
    }

    html:not(.motion-paused) .hero-video .hero-copy {
        animation: xm-up .9s cubic-bezier(.16, 1, .3, 1) .65s backwards
    }

    html:not(.motion-paused) .hero-video .hero-actions {
        animation: xm-up .9s cubic-bezier(.16, 1, .3, 1) .8s backwards
    }

    html:not(.motion-paused) .hero-foot {
        animation: xm-up .9s cubic-bezier(.16, 1, .3, 1) .95s backwards
    }

    /* Video latar zoom pelan (efek sinematik) */
    html:not(.motion-paused) .hero-media video {
        animation: xm-zoom 30s ease-in-out infinite alternate
    }

    /* Titik "live" berdenyut + garis bawah "MATTERS." tergambar */
    html:not(.motion-paused) .hero-topline .eyebrow:before {
        animation: xm-pulse 2.2s ease-out infinite
    }

    html:not(.motion-paused) .hero-video h1 em:after {
        animation: xm-draw 1.1s cubic-bezier(.16, 1, .3, 1) 1.2s backwards
    }

    /* Panah "scroll to explore" naik-turun */
    html:not(.motion-paused) .scroll-cue span {
        display: inline-block;
        animation: xm-bob 1.8s ease-in-out infinite
    }

    /* "REAL FEELING." berkilau pelan dengan warna aksen */
    html:not(.motion-paused) .outline-type {
        background: linear-gradient(100deg, #bfc4b3 0%, #bfc4b3 38%, #C4D982 50%, #bfc4b3 62%, #bfc4b3 100%);
        background-size: 250% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
        animation: xm-shimmer 7s linear infinite
    }

    /* CTA band: bintang besar berputar di belakang */
    html:not(.motion-paused) .cta-band:before {
        animation: xm-spin 60s linear infinite
    }

    /* Halaman dalam: eyebrow, garis aksen, dan subjudul */
    html:not(.motion-paused) .page-hero .eyebrow {
        animation: xm-up .8s cubic-bezier(.16, 1, .3, 1) .05s backwards
    }

    html:not(.motion-paused) .page-title:after {
        animation: xm-draw .9s cubic-bezier(.16, 1, .3, 1) .5s backwards
    }

    html:not(.motion-paused) .page-sub {
        animation: xm-up .9s cubic-bezier(.16, 1, .3, 1) .35s backwards
    }

    /* About: cahaya mengambang di panel visual */
    html:not(.motion-paused) .visual-panel:before {
        animation: xm-float 10s ease-in-out infinite alternate
    }

    /* Foto portfolio: fade-in dari blur saat muncul */
    html:not(.motion-paused) .media-preview img,
    html:not(.motion-paused) .design-preview img {
        animation: xm-img .9s ease backwards
    }

    /* Reveal saat scroll (kelas ditambah oleh extra-motion.js) */
    html.xm:not(.motion-paused) .xm-reveal {
        transition: opacity .8s ease, transform .8s cubic-bezier(.16, 1, .3, 1);
        transition-delay: var(--xm-d, 0ms)
    }

    html.xm:not(.motion-paused) .xm-reveal:not(.xm-in) {
        opacity: 0;
        transform: translateY(26px)
    }
}

/* =====================================================================
   WORK — animasi tambahan untuk kartu, teks, dan halaman detail
   ===================================================================== */

@keyframes xm-pop {
    from { transform: scale(.86) }
}

@keyframes xm-ping {
    0% { transform: scale(1); opacity: .75 }
    100% { transform: scale(1.9); opacity: 0 }
}

/* ---------- Kartu Work: lapisan gambar (dibuat oleh extra-motion.js) ---------- */

.work-card>.xm-bg {
    position: absolute;
    inset: -6% 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    translate: 0 var(--xm-py, 0px);
    filter: saturate(.88) brightness(.94);
    transition: transform .9s cubic-bezier(.16, 1, .3, 1), filter .6s;
    pointer-events: none
}

.work-card:hover>.xm-bg,
.work-card:focus-visible>.xm-bg {
    transform: scale(1.09);
    filter: saturate(1.12) brightness(1.04)
}

.work-card .eyebrow {
    transition: color .3s, letter-spacing .5s cubic-bezier(.16, 1, .3, 1)
}

.work-card:hover .eyebrow,
.work-card:focus-visible .eyebrow {
    color: var(--accent);
    letter-spacing: .16em
}

.work-card h3 {
    width: fit-content;
    padding-bottom: 6px;
    background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0% 2px no-repeat;
    transition: background-size .6s cubic-bezier(.16, 1, .3, 1)
}

.work-card:hover h3,
.work-card:focus-visible h3 {
    background-size: 100% 2px
}

/* ---------- Teks: pecah per baris / per huruf ---------- */

.xm-line {
    display: block;
    overflow: hidden;
    padding-bottom: .14em;
    margin-bottom: -.14em
}

.xm-line-in {
    display: block
}

.xm-w {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    white-space: nowrap;
    padding-bottom: .22em;
    margin-bottom: -.22em
}

.xm-c {
    display: inline-block
}

/* ---------- Halaman detail Work ---------- */

.back-link {
    display: inline-block;
    transition: color .2s, transform .35s cubic-bezier(.16, 1, .3, 1)
}

.back-link:hover {
    transform: translateX(-6px)
}

.portfolio-filter:active {
    transform: scale(.94)
}

.portfolio-info h3 {
    transition: color .25s, transform .45s cubic-bezier(.16, 1, .3, 1)
}

.portfolio-card:hover .portfolio-info h3 {
    color: var(--accent);
    transform: translateX(5px)
}

.media-preview,
.design-preview {
    transition: transform .5s cubic-bezier(.16, 1, .3, 1), box-shadow .5s, border-color .3s
}

.media-preview:hover,
.design-preview:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 50px rgba(0, 0, 0, .45), 0 0 0 1px rgba(196, 217, 130, .4)
}

.media-preview:after,
.design-preview:after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .17) 50%, transparent 65%);
    transform: translateX(-120%)
}

.media-preview:hover:after,
.design-preview:hover:after {
    transform: translateX(120%);
    transition: transform .9s cubic-bezier(.16, 1, .3, 1)
}

.media-play:before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    opacity: 0;
    pointer-events: none
}

/* Lightbox: buka lebih halus dengan efek memantul pelan */
.portfolio-modal {
    transition: opacity .25s ease
}

.portfolio-modal-dialog {
    transform: translateY(32px) scale(.95);
    transition: transform .55s cubic-bezier(.16, 1, .3, 1)
}

/* ---------- Animasi yang berjalan sendiri ---------- */

@media (prefers-reduced-motion: no-preference) {

    /* Kartu Work muncul seperti tirai naik, berurutan */
    html.xm:not(.motion-paused) .work-card.xm-curtain:not(.xm-done) {
        transition: background-size .65s, border-color .3s, box-shadow .3s, clip-path 1.1s cubic-bezier(.16, 1, .3, 1);
        transition-delay: 0s, 0s, 0s, var(--xm-d, 0ms);
        clip-path: inset(0 0 0 0)
    }

    html.xm:not(.motion-paused) .work-card.xm-curtain:not(.xm-in):not(.xm-done) {
        clip-path: inset(100% 0 0 0)
    }

    /* Judul section: tiap baris naik dari balik "topeng" */
    html.xm:not(.motion-paused) .xm-split .xm-line-in {
        transition: transform 1s cubic-bezier(.16, 1, .3, 1);
        transition-delay: calc(var(--i, 0) * 120ms)
    }

    html.xm:not(.motion-paused) .xm-split:not(.xm-in) .xm-line-in {
        transform: translateY(112%)
    }

    /* Judul halaman: huruf naik satu per satu */
    html.xm:not(.motion-paused) .xm-split .xm-c {
        transition: transform .9s cubic-bezier(.16, 1, .3, 1);
        transition-delay: calc(var(--i, 0) * 55ms)
    }

    html.xm:not(.motion-paused) .xm-split:not(.xm-in) .xm-c {
        transform: translateY(118%) rotate(7deg)
    }

    /* Halaman detail: filter, info samping, dan tombol play */
    html:not(.motion-paused) .portfolio-filters {
        animation: xm-up .8s cubic-bezier(.16, 1, .3, 1) .25s backwards
    }

    html:not(.motion-paused) .portfolio-filter.active {
        animation: xm-pop .5s cubic-bezier(.34, 1.56, .64, 1)
    }

    html:not(.motion-paused) .work-detail-top .meta {
        animation: xm-up .9s cubic-bezier(.16, 1, .3, 1) .45s backwards
    }

    html:not(.motion-paused) .media-preview:hover .media-play:before {
        animation: xm-ping 1.3s ease-out infinite
    }
}
