/* =========================================================================
   Atlas Lentera — kategori 3D. Buku pop-up; isi undangan di kartu kertas.

   Kanvas Three.js (atau poster) diam di belakang. Isi undangan adalah kartu
   kertas ivory yang digulir window, dengan jeda lega di antaranya (.al-gap)
   supaya diorama terlihat. Kartu tidak pernah ditransform.
   ========================================================================= */

body.al {
    --c-paper: #F6EFDF;
    --c-ink: #3B2E28;
    --c-muted: #6E5D53;
    --c-rule: rgb(59 46 40 / .16);
    --c-sunk: rgb(59 46 40 / .05);
    --c-surface: #FBF7EE;
    --c-action: color-mix(in srgb, var(--c-accent) 75%, #6E4B45);

    /* Nama: skrip; judul: serif; informasi & formulir: sans (konsep §2).
       Teks editor tampil apa adanya (tanpa kapital paksa). */
    --f-script: 'Great Vibes', cursive;
    --f-display: 'Cormorant Garamond', Georgia, serif;
    --f-body: 'Jost', system-ui, sans-serif;

    --al-gold: #B48F52;
    --al-sage: #A7B5A0;
    --al-rose: #CDA3A0;
    --al-night: #26374B;
    --al-ease: cubic-bezier(.45, 0, .2, 1);

    background: #E9DFCF;
    color: var(--c-ink);
    font-family: var(--f-body);
    font-size: 1rem;
}

/* ------------------------------------------------------------- panggung */

.al-stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #E9DFCF; transition: background 1.2s ease; }
body.al-dusk .al-stage { background: var(--al-night); }
.al-poster, .al-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.al-poster { object-fit: cover; max-width: none; opacity: 0; transition: opacity 1.2s ease; }
/* Poster cadangan mengikuti babak: sampul → taman → lentera → buku utuh. */
.al-poster--sampul { opacity: 1; }
body.is-open .al-poster--sampul { opacity: 0; }
body.is-open .al-poster--taman { opacity: 1; }
body.is-open:is([data-al-at="rsvp"], [data-al-at="greetings"], [data-al-at="gift"]) .al-poster--lentera,
body.is-open:is([data-al-at="closing"], .al-ending) .al-poster--buku { opacity: 1; }
.al-canvas { display: block; opacity: 0; transition: opacity 1s ease; touch-action: pan-y; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
body.al-3d .al-canvas { opacity: 1; }
body.al-3d .al-poster { opacity: 0 !important; }

/* --------------------------------------------------------------- sampul */

body.al .al-cover {
    background: transparent;
    display: flex; flex-direction: column; justify-content: space-between; align-items: center;
    padding: max(7dvh, 1.75rem) 1.25rem max(4dvh, 1.25rem);
    pointer-events: none;
    overflow: hidden;
}
@media (min-width: 900px) {
    body.al .al-cover { left: 0; right: 0; width: auto; }
}
body.al.is-open .al-cover { transform: none; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s .8s; }

.al-cover__top, .al-cover__bottom { display: grid; justify-items: center; gap: .35rem; text-align: center; animation: al-rise 1.2s var(--al-ease) .3s both; }
.al-cover__bottom { animation-delay: .7s; pointer-events: auto; margin-top: auto; }
/* Nama di tengah bingkai sampul buku (buku dibingkai kamera di tengah layar). */
.al-cover__top { position: absolute; inset: 0 2.5rem; align-content: center; pointer-events: none; padding-bottom: 2dvh; }
/* Teks di atas meja terang: tinta gelap + halo kertas agar tetap terbaca. */
.al-cover__eyebrow, .al-hero__eyebrow {
    margin: 0; font-family: var(--f-body); font-weight: 500; font-size: .7rem; letter-spacing: .32em; text-transform: uppercase; color: #7A5C33;
    text-shadow: 0 0 10px rgb(246 239 223 / .95), 0 0 18px rgb(246 239 223 / .8);
}
.al-names { display: grid; justify-items: center; margin: 0; line-height: 1.08; font-family: var(--f-script); font-weight: 400; font-size: clamp(2.7rem, 13vw, 4.2rem); }
.al-cover__names { display: grid; justify-items: center; margin: .15rem 0 0; line-height: 1.08; font-family: var(--f-script); font-weight: 400; font-size: clamp(2.3rem, 11vw, 3.4rem); color: var(--c-ink); }
.al-cover__names, .al-hero__names { text-shadow: 0 0 12px rgb(246 239 223 / .95), 0 0 26px rgb(246 239 223 / .85); }
/* Ekor huruf skrip tidak terpotong. */
.al-name { overflow-wrap: anywhere; padding: .1em .3em; margin: -.1em -.3em; }
.al-amp { font-size: .55em; color: var(--al-gold); }
.al-names--sm { font-size: clamp(2rem, 9vw, 2.6rem); }
.al-cover__to { margin: 0; font-size: .9rem; color: var(--c-ink); text-shadow: 0 0 8px rgb(246 239 223 / .95), 0 0 16px rgb(246 239 223 / .9); }
.al-cover__guest { margin: 0 0 .55rem; font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; overflow-wrap: anywhere; text-shadow: 0 0 8px rgb(246 239 223 / .95), 0 0 16px rgb(246 239 223 / .9); }

/* Tombol buka: menampilkan progres memuat (--load) lalu aktif. */
.al-open {
    --load: 1;
    position: relative; overflow: hidden; min-width: 15rem; min-height: 50px; padding: .8rem 1.8rem;
    border: 1px solid rgb(122 92 51 / .55); border-radius: 999px;
    background: #FBF7EE; color: var(--c-ink); cursor: pointer;
    font-family: var(--f-display); font-weight: 600; font-size: 1.12rem; letter-spacing: .04em;
    box-shadow: 0 6px 18px rgb(59 46 40 / .2), inset 0 0 0 4px #FBF7EE, inset 0 0 0 5px rgb(180 143 82 / .45);
    -webkit-tap-highlight-color: transparent;
}
.al-open__bar { position: absolute; inset: auto 0 0 0; height: 3px; background: var(--al-gold); transform-origin: left; transform: scaleX(var(--load)); transition: transform .4s ease; opacity: 0; }
.al-open__label { position: relative; }
.al-open.is-loading { cursor: progress; color: var(--c-muted); font-family: var(--f-body); font-weight: 500; font-size: .9rem; letter-spacing: .06em; }
.al-open.is-loading .al-open__bar { opacity: 1; }
.al-open.is-ready { animation: al-ready 1.1s var(--al-ease); }
.al-open:focus-visible { outline: 2px solid var(--al-gold); outline-offset: 4px; }
.al-cover__direct { color: var(--c-ink); text-shadow: 0 0 8px rgb(246 239 223 / .95); }

/* ------------------------------------------------------------- lewati */

.al-skip {
    position: fixed; z-index: 50; top: max(.9rem, env(safe-area-inset-top)); right: 1rem;
    min-height: 40px; padding: .4rem 1.1rem;
    border: 1px solid rgb(59 46 40 / .3); border-radius: 999px;
    background: rgb(251 247 238 / .85); color: var(--c-ink); cursor: pointer;
    font-family: var(--f-body); font-weight: 500; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase;
    opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility 0s .4s;
}
body.al-flying .al-skip, body.al-skippable .al-skip { opacity: 1; visibility: visible; transition: opacity .4s ease; }
body.al { --qn-bg: rgb(251 247 238 / .9); --qn-fg: var(--c-ink); --qn-active: var(--c-action); }
body.al.al-flying .inv-qn, body.al.al-ending .inv-qn { display: none; }

/* ---------------------------------------------------------------- isi */

body.al .al-main {
    position: relative; z-index: 10;
    max-width: 36rem; margin: 0 auto; padding: 0 6vw;
    pointer-events: none;
    opacity: 0; visibility: hidden;
}
@media (min-width: 600px) { body.al .al-main { padding: 0 1rem; } }
body.al.is-open:not(.al-flying):not(.al-ending) .al-main { opacity: 1; visibility: visible; transition: opacity 1s ease .2s; }
body.al.al-flying { overflow: hidden; height: 100dvh; }

.al-hero {
    min-height: 100svh;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .4rem;
    padding-top: 9svh; text-align: center;
}
.al-hero__date { margin: .3rem 0 0; font-family: var(--f-body); font-weight: 500; font-size: .85rem; letter-spacing: .28em; color: #7A5C33; text-shadow: 0 0 8px rgb(246 239 223 / .95), 0 0 16px rgb(246 239 223 / .9); }
.al-hero__cue { margin: auto 0 8svh; }
.al-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* Mouse kertas: roda turun-memudar berulang, di atas halo krem agar terbaca. */
.al-mouse {
    position: relative; display: block; width: 1.7rem; height: 2.7rem; border-radius: .9rem;
    border: 2px solid var(--c-ink); background: rgb(251 247 238 / .7);
    box-shadow: 0 0 0 4px rgb(251 247 238 / .45), 0 4px 14px rgb(59 46 40 / .22);
}
.al-mouse::before {
    content: ''; position: absolute; left: 50%; top: .45rem; width: 4px; height: .55rem; margin-left: -2px; border-radius: 2px;
    background: var(--al-gold); animation: al-wheel 1.8s ease-in-out infinite;
}
.al-mouse::after {
    content: ''; position: absolute; left: 50%; top: calc(100% + .45rem); width: .55rem; height: .55rem; margin-left: -.3rem;
    border: solid var(--c-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); opacity: .7;
    animation: al-chev 1.8s ease-in-out infinite;
}
body.al-arrived .al-hero > * { animation: al-rise 1.1s var(--al-ease) both; }
body.al-arrived .al-hero .al-hero__names { animation-delay: .15s; }
body.al-arrived .al-hero .al-hero__date { animation-delay: .4s; }
body.al-arrived .al-hero .al-hero__cue { animation-delay: .8s; }

.al-gap { height: 62svh; }
.al-gap--end { height: 45svh; }

/* Kartu kertas: ivory, tepi karton berlapis, sedikit bayangan lipatan. */
.al-panel {
    position: relative; pointer-events: auto;
    padding: 1.5rem clamp(1rem, 5vw, 1.7rem) .4rem;
    border-radius: 1.1rem;
    background: #FBF7EE;
    box-shadow: 0 1px 0 #fff inset, 0 0 0 1px rgb(180 143 82 / .25), 0 10px 0 -6px #EFE5D2, 0 10px 0 -5px rgb(180 143 82 / .2), 0 22px 40px rgb(59 46 40 / .22);
}
.al-rule {
    display: block; width: 9rem; aspect-ratio: 5 / 1; margin: 0 auto; background: var(--al-gold);
    -webkit-mask: var(--al-rule) center / contain no-repeat; mask: var(--al-rule) center / contain no-repeat;
}

/* Section _base di atas kartu kertas. */
body.al .inv-section { padding-block: 1.2rem 1.8rem; border-bottom: 0; }
body.al .inv-head { margin-bottom: 1.4rem; }
body.al .inv-head__eyebrow { font-family: var(--f-body); font-weight: 500; font-size: .68rem; color: #7A5C33; }
body.al .inv-head__title { font-family: var(--f-script); font-weight: 400; font-size: clamp(2.3rem, 10vw, 3rem); color: var(--c-ink); }
body.al .inv-head__title::after { background: var(--al-gold); }
body.al .inv-prose { font-family: var(--f-display); font-size: 1.12rem; line-height: 1.75; color: var(--c-ink); }
body.al .inv-people, body.al .inv-gifts { grid-template-columns: 1fr; }
body.al .inv-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.al .inv-person__photo { border-color: rgb(180 143 82 / .5); }
body.al .inv-person__name { font-family: var(--f-script); font-weight: 400; font-size: clamp(2rem, 10vw, 2.5rem); }
body.al .inv-story > li::before { background: var(--al-rose); outline-color: #FBF7EE; }
body.al .inv-story__title, body.al .inv-rail__title { font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; }
body.al .inv-countdown__cell { border-color: rgb(180 143 82 / .35); background: #fff; }
body.al .inv-countdown__cell b { font-family: var(--f-display); font-weight: 600; color: #7A5C33; }
body.al .inv-btn { font-family: var(--f-body); font-weight: 500; border-radius: 999px; }
body.al .inv-btn--solid { background: var(--c-action); border-color: var(--c-action); color: #fff; }
body.al .inv-input { background: #fff; border-color: rgb(59 46 40 / .2); font-family: var(--f-body); font-size: 1rem; }
body.al .inv-label { color: #7A5C33; }
body.al .inv-wish { background: #fff; border-color: rgb(59 46 40 / .12); border-left-color: var(--al-sage); }
body.al .inv-wish.is-mine { border-left-color: var(--al-gold); box-shadow: inset 0 0 0 1px rgb(180 143 82 / .35); }
body.al [data-section] { scroll-margin-top: 1.5rem; }

.al-btn {
    display: inline-flex; align-items: center; gap: .5rem; margin: 1rem 0 .4rem; min-height: 46px; padding: .6rem 1.6rem;
    border: 1px solid rgb(122 92 51 / .5); border-radius: 999px;
    background: #FBF7EE; color: var(--c-ink); cursor: pointer;
    font-family: var(--f-display); font-weight: 600; font-size: 1.05rem;
    box-shadow: 0 6px 16px rgb(59 46 40 / .15);
}
.al-btn--ghost { margin: .4rem 0 0; box-shadow: none; font-size: .98rem; }
.al-btn--ghost::before { content: ''; width: 1rem; height: 1rem; background: var(--al-gold); -webkit-mask: var(--al-lantern) center / contain no-repeat; mask: var(--al-lantern) center / contain no-repeat; }
.al-btn[hidden] { display: none; }
.al-closing__tag { margin: .2rem 0 0; font-size: .82rem; letter-spacing: .1em; color: var(--c-muted); }
.al-garden-tools { display: grid; justify-items: center; gap: .2rem; padding: 0 0 1.3rem; text-align: center; }
.al-garden-note { margin: 0; font-family: var(--f-display); font-size: 1.05rem; font-style: italic; color: var(--c-muted); }

/* ------------------------------------------------------------ album */

.al-album {
    position: fixed; left: 50%; bottom: calc(4.4rem + env(safe-area-inset-bottom)); z-index: 25; translate: -50% 0;
    display: flex; align-items: center; gap: .6rem; padding: .3rem;
    border-radius: 999px; background: rgb(251 247 238 / .92); box-shadow: 0 6px 18px rgb(59 46 40 / .2);
}
.al-album[hidden] { display: none; }
.al-album button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgb(180 143 82 / .16); color: var(--c-ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.al-album span { min-width: 3.5rem; text-align: center; font-size: .85rem; letter-spacing: .08em; }

/* --------------------------------------------- ucapan dari lentera */

.al-wish {
    position: fixed; left: var(--x, 1rem); top: var(--y, 40%); z-index: 30;
    width: min(300px, calc(100vw - 32px)); translate: 0 -100%;
    padding: .9rem 1.1rem; border-radius: 1rem;
    background: #FBF7EE; box-shadow: 0 0 0 1px rgb(180 143 82 / .35), 0 12px 30px rgb(0 0 0 / .35), 0 0 30px rgb(255 190 110 / .35);
    animation: al-rise .35s var(--al-ease) both;
}
.al-wish__name { margin: 0 0 .2rem; font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; color: #7A5C33; }
.al-wish__text { margin: 0; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }

/* ---------------------------------------------- penutup: buku utuh */

.al-finale {
    position: fixed; inset: auto 0 0; z-index: 20;
    display: grid; justify-items: center; gap: .3rem;
    padding: 1.5rem 1.25rem calc(4.2rem + env(safe-area-inset-bottom)); text-align: center; color: #FBF7EE;
    background: linear-gradient(transparent, rgb(20 29 42 / .9) 34%);
    opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s .5s;
}
body.al.al-ending .al-finale { opacity: 1; visibility: visible; transition: opacity 1.2s ease var(--al-finale-delay, 4.5s); }
.al-finale__title { margin: 0; font-family: var(--f-script); font-size: clamp(2.3rem, 11vw, 3.1rem); line-height: 1.1; }
.al-finale .al-names { font-size: clamp(1.7rem, 8vw, 2.3rem); }
.al-finale__count { margin: .2rem 0 0; font-weight: 500; font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: #F2CF95; }
.al-finale__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .4rem; }
.al-link { margin-top: .2rem; padding: .45rem .7rem; border: 0; background: none; color: inherit; opacity: .85; font: inherit; font-size: .92rem; text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.al-link[hidden] { display: none; }
/* ---------------------------------------------------- jelajahi buku */
body.al.al-ending.al-exploring .al-finale { opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility 0s .4s; }
body.al-exploring .al-canvas { touch-action: none; cursor: grab; }
body.al-exploring .al-canvas:active { cursor: grabbing; }
.al-explore {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: calc(1.1rem + env(safe-area-inset-bottom));
    display: grid; justify-items: center; gap: .6rem; padding: 0 1rem; pointer-events: none;
}
.al-explore[hidden] { display: none; }
.al-explore__hint {
    margin: 0; padding: .4rem .9rem; border-radius: 999px; max-width: 30rem; text-align: center;
    font-size: .78rem; color: #FBF7EE; background: rgb(20 29 42 / .62); backdrop-filter: blur(6px);
    transition: opacity .8s ease;
}
.al-explore__hint.is-faded { opacity: 0; }
.al-explore__bar {
    display: flex; gap: .35rem; padding: .35rem; border-radius: 999px; pointer-events: auto;
    background: rgb(251 247 238 / .9); box-shadow: 0 6px 20px rgb(20 29 42 / .3);
}
.al-explore__btn {
    min-height: 40px; padding: .4rem .95rem; border: 0; border-radius: 999px; background: transparent;
    font: inherit; font-size: .85rem; font-weight: 500; color: var(--c-ink); cursor: pointer;
}
.al-explore__btn:hover { background: rgb(59 46 40 / .07); }
.al-explore__btn--main { background: var(--c-ink); color: #FBF7EE; }
.al-explore__btn--main:hover { background: var(--c-ink); opacity: .9; }
.al-explore__btn:focus-visible { outline: 2px solid var(--al-gold); outline-offset: 2px; }
.al-finale__brand { display: grid; margin: .5rem 0 0; font-size: .66rem; letter-spacing: .1em; opacity: .75; }
.al-finale__brand a { font-weight: 500; font-size: 1.2em; letter-spacing: .24em; color: #F2CF95; text-decoration: none; }

/* ----------------------------------------------------------------- gerak */

@keyframes al-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes al-wheel { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 70% { transform: translateY(.75rem); opacity: 0; } 100% { opacity: 0; } }
@keyframes al-chev { 0%, 100% { transform: translateY(0) rotate(45deg); opacity: .25; } 50% { transform: translateY(.3rem) rotate(45deg); opacity: .8; } }
@keyframes al-ready { 30% { box-shadow: 0 0 0 6px rgb(180 143 82 / .35), 0 0 30px rgb(242 207 149 / .9), inset 0 0 0 4px #FBF7EE, inset 0 0 0 5px rgb(180 143 82 / .45); transform: scale(1.04); } }

@media (prefers-reduced-motion: reduce) {
    .al-cover__top, .al-cover__bottom, .al-mouse::before, .al-mouse::after, .al-wish, body.al-arrived .al-hero > *, .al-open.is-ready { animation: none; }
    body.al .al-main, .al-finale, body.al.al-ending .al-finale, .al-canvas, .al-poster, .al-skip, .al-stage { transition: none; }
}

/* Layar lebar dengan mouse: penanda gulir berupa ikon mouse yang rodanya
   bergulir (ponsel tetap garis turun). Di akhir berkas supaya menang atas
   aturan dasar penanda gulir. */
@media (hover: hover) and (pointer: fine) {
    .al-hero__cue::after {
        width: 1.35rem; height: 2.1rem; margin: .55rem auto 0; box-sizing: border-box;
        border: 2px solid var(--al-gold); border-radius: .7rem; transform: none;
        background: radial-gradient(circle, var(--al-gold) 0 2px, transparent 2.6px) 50% 22% / 6px 6px no-repeat;
        animation: al-wheel 1.8s cubic-bezier(.5, 0, .3, 1) infinite;
    }
}
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
    .al-hero__cue::after { animation: none; }
}
@keyframes al-wheel {
    0% { background-position: 50% 18%; background-size: 6px 6px; }
    55% { background-position: 50% 58%; background-size: 6px 6px; }
    75%, 100% { background-position: 50% 62%; background-size: 0 0; }
}
