/* ============================================================================
   31 · "Sweet Simplicity" (insan, putih) — HOUSE UX LAYER
   Loaded LAST (after refined.css): converts the locked gate shell into the
   house pattern of natural continuous scroll while keeping the template's
   own aesthetic:

     · Desktop keeps the side-by-side design (§0): fixed hero pane left,
       scrolling column right — now starting below the house header.
     · Mobile: the fixed top-cover gate is gone. body.insan scrolls
       naturally; the top-cover is the first stacked scene, the
       "Buka Undangan" button a scroll cue.
     · House chrome on tokens: --header-h enforced on the header, cover cap
       and anchor offsets derived from it; scroll-spy header + dock; mobile
       slide-down sheet; zoom lightbox; print + no-JS fallbacks.

   Palette: the template's own monochrome — paper #FFFFFF, ink #1C1C1C.
   Nothing here changes the platform morph bindings (selectors, ids, the
   RSVP/guestbook forms, countdown, copy buttons, calendar export).
   ============================================================================ */

/* ── 1. Tokens ──────────────────────────────────────────────────────────── */
html {
    --header-h: 56px;                                   /* enforced on .site-head */
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --head-chrome: calc(var(--header-h) + var(--safe-t));
    --dock-space: 124px;                                /* end-of-page reserve above the dock */
    --ease: cubic-bezier(.23, .56, .38, .78);
    /* Anchor offsets live ONLY on [data-panel] scroll-margin-top (§2 below):
       the container-level scroll-padding would add on top of it and land
       every jump a header-height too far down. */
}

/* ── 2. Page under the chrome ───────────────────────────────────────────── */
body.insan {
    --body-height: 100dvh;                              /* exclusive-10 sizes its covers with this */
    padding-top: var(--head-chrome);                    /* fixed header reserve */
    overflow: visible !important;                        /* the scroll lock is gone — belt & braces */
}
body.insan.js-dock {                                     /* set by house.js when the dock shows */
    padding-bottom: var(--dock-space);
}
/* The end-of-page reserve must live on the FOOTER itself: body has a fixed
   height (global.css) and overflowing content does not include the body's
   own padding in the scrollable area, so a body-only reserve never clears
   the dock at max scroll. */
body.insan.js-dock section.footer .footer-inner {
    padding-bottom: calc(16px + var(--dock-space));
}
html { -webkit-text-size-adjust: 100%; }

/* Sections land exactly below the header — native anchors included. */
body.insan [data-panel] {
    scroll-margin-top: calc(var(--head-chrome) + 10px);
}

/* ── 3. Header ──────────────────────────────────────────────────────────── */
.site-head {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 900;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, .12);
    transition: box-shadow .25s var(--ease), background .25s var(--ease);
}
.site-head.is-scrolled {
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .10);
}
.head-inner {
    width: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}
.head-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
    flex-shrink: 0;
    cursor: pointer;
}
.head-mark {
    width: 30px; height: 30px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--background-tertiary);
    color: var(--text-secondary);
    font-family: 'Instrument Serif', serif;
    font-size: 13px;
    letter-spacing: .04em;
}
.head-word {
    font-family: 'Instrument Serif', serif;
    font-size: 19px;
    line-height: 1.1;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.head-nav {
    margin-left: auto;
    display: none;
    align-items: center;
    gap: 2px;
    min-width: 0;
}
.tab-btn {
    appearance: none;
    border: 0;
    background: none;
    padding: 8px 9px;
    font-family: var(--body-text-family);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, .66);
    cursor: pointer;
    position: relative;
    white-space: nowrap;
    transition: color .2s var(--ease);
}
.tab-btn::after {
    content: '';
    position: absolute;
    left: 9px; right: 9px; bottom: 2px;
    height: 2px;
    border-radius: 2px;
    background: var(--background-tertiary);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform .25s var(--ease);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.is-current { color: var(--text-primary); }
.tab-btn.is-current::after { transform: scaleX(1); }
@media (min-width: 1200px) {
    .head-nav { display: flex; }
    .menu-btn { display: none !important; }
}

/* Burger */
.menu-btn {
    appearance: none;
    margin-left: auto;
    width: 42px; height: 42px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background .2s var(--ease);
}
.menu-btn:hover { background: rgba(0, 0, 0, .07); }
.menu-box {
    width: 20px; height: 14px;
    position: relative;
    display: block;
}
.menu-box span {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .25s var(--ease), opacity .2s var(--ease), top .25s var(--ease);
}
.menu-box span:nth-child(1) { top: 0; }
.menu-box span:nth-child(2) { top: 6px; }
.menu-box span:nth-child(3) { top: 12px; }
.menu-btn[aria-expanded="true"] .menu-box span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-box span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .menu-box span:nth-child(3) { top: 6px; transform: rotate(-45deg); }
@media (min-width: 1200px) {
    .menu-btn { display: none; }
}

/* Progress hairline */
.scroll-progress {
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, rgba(0,0,0,.25), var(--background-tertiary));
    transform: scaleX(0);
    transform-origin: left center;
    pointer-events: none;
}

/* ── 4. Mobile slide-down sheet ─────────────────────────────────────────── */
.menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 940;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--ease);
}
.menu-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}
.menu-sheet {
    position: fixed;
    top: var(--head-chrome);
    left: 0; right: 0;
    z-index: 950;
    max-height: calc(100dvh - var(--head-chrome) - 24px);
    overflow-y: auto;
    background: var(--background-primary);
    border-bottom: 1px solid rgba(0, 0, 0, .14);
    border-radius: 0 0 18px 18px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, .22);
    padding: 8px 10px calc(10px + var(--safe-b));
    transform: translateY(-12px);
    opacity: 0;
    transition: transform .25s var(--ease), opacity .25s var(--ease);
}
.menu-sheet.is-open {
    transform: translateY(0);
    opacity: 1;
}
.menu-sheet:focus { outline: none; }
.menu-sheet-list {
    list-style: none;
    margin: 0; padding: 0;
    display: block;
}
.menu-item {
    width: 100%;
    appearance: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .08);
    background: none;
    border-radius: 10px;
    font-family: var(--body-text-family);
    font-size: 15px;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background .2s var(--ease);
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:hover { background: rgba(0, 0, 0, .05); }
.menu-item.is-current { background: rgba(0, 0, 0, .08); }
.menu-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.menu-label { flex: 1 1 auto; min-width: 0; }
.menu-num {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .12em;
    color: rgba(0, 0, 0, .4);
    flex-shrink: 0;
}

/* ── 5. Dock (bottom-center pill, <1200px) ──────────────────────────────── */
.dock {
    position: fixed;
    z-index: 900;
    left: 50%;
    bottom: calc(10px + var(--safe-b));
    transform: translateX(-50%);
    display: none;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px;
    max-width: min(320px, calc(100vw - 24px));
    padding: 5px;
    background: rgba(255, 255, 255, .94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, .14);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, .2);
}
.dock button {
    appearance: none;
    border: 0;
    width: 34px; height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: none;
    color: rgba(0, 0, 0, .66);
    cursor: pointer;
    transition: background .2s var(--ease), color .2s var(--ease);
}
.dock button svg { width: 17px; height: 17px; }
.dock button:hover { background: rgba(0, 0, 0, .07); color: var(--text-primary); }
.dock button.is-current { background: var(--background-tertiary); color: var(--text-secondary); }
@media (max-width: 1199.98px) {
    html.js .dock { display: flex; }
}

/* ── 6. No-JS: the document reads perfectly, chrome is gone ─────────────── */
html:not(.js) .site-head,
html:not(.js) .dock,
html:not(.js) .menu-sheet,
html:not(.js) .menu-backdrop,
html:not(.js) .scroll-progress,
html:not(.js) .menu-btn { display: none !important; }
html:not(.js) body.insan { padding-top: 0; padding-bottom: 0; }

/* ── 7. Gate removal — the top-cover becomes scene one ──────────────────── */
/* The fixed overlay + body lock are gone (overflow unlock above; the slide
   transition and 999999 z-index are meaningless in flow). On ≤960px it is
   the first full-viewport scene; on desktop it stays display:none — the
   side-by-side cover (fixed hero pane + invitation column) IS the cover. */
body.insan section.top-cover {
    position: static;
    z-index: auto;
    height: calc(var(--body-height) - var(--head-chrome));
    transition: none;
    -webkit-transition: none;
}
body.insan section.top-cover.hide {
    top: auto; bottom: auto;
    pointer-events: auto;
}
body.insan section.top-cover .inner .details {
    /* lifted clear of the floating dock so the CTA + cue are never covered */
    margin-bottom: calc(clamp(24px, 9vh, 15vh) + var(--dock-space) - 16px);
}
/* The scroll cue (former gate button) */
section.top-cover .inner .details a.link,
section.top-cover .inner .details a.link:focus {
    outline: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
section.top-cover .cue-hint {
    position: relative;
    z-index: 2;
    display: block;
    margin: 18px auto 0;
    width: 22px; height: 22px;
    color: #ffffff;
    opacity: .85;
    animation: cue-bob 2.2s var(--ease) infinite;
}
@keyframes cue-bob {
    0%, 100% { transform: translateY(0); opacity: .85; }
    50% { transform: translateY(6px); opacity: .45; }
}
/* Cover photo missing (morph stripped) → ink texture fallback, never a white hole */
section.top-cover .inner .highlight,
.kat-page__side-to-side .primary-pane .inner .highlight {
    background-color: var(--background-tertiary);
    background-image: radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.4px);
    background-size: 14px 14px;
}
section.top-cover .highlight.is-empty,
.kat-page__side-to-side .primary-pane .highlight.is-empty { display: none; }

/* ── 8. Invitation cover — exactly one screen ───────────────────────────── */
body.insan section.cover {
    min-height: calc(var(--body-height) - var(--head-chrome));
}
@media only screen and (min-width: 961px) {
    body.insan section.cover {
        height: calc(var(--body-height) - var(--head-chrome));
    }
}
/* Landscape / short viewports: the flex column already keeps head top and
   foot bottom; the trim ladder (js) removes decorations before content. */

/* ── 9. Side-by-side geometry under the header (desktop untouched elsewise) */
@media only screen and (min-width: 961px) {
    body.insan .kat-page__side-to-side .primary-pane {
        top: var(--head-chrome);
        width: 61%;
    }
}

/* ── 10. Gallery: the single-photo slider becomes a stacked wall ──────────
   The slick wheel-hijack is disabled at the root (GALLERY_SINGLE_SLIDER =
   false), so the wall scrolls with the page. The alternating petal corners
   and the offset cascade are kept. */
.gallery__single-slider .slider-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 15px 14px;
    max-width: 640px;
    margin: 0 auto;
}
.gallery__single-slider .slider-item {
    transform: none;
    transition: none;
    display: block;
}
.gallery__single-slider .slider-item .preview {
    aspect-ratio: 3 / 4;
    width: 100%;
    cursor: zoom-in;
    overflow: hidden;
}
.gallery__single-slider .slider-item:nth-child(even) {
    transform: translateY(14px);
}
.gallery__single-slider .slider-item .preview .anchor {
    display: block;
    width: 100%; height: 100%;
    cursor: zoom-in;
}
.gallery__single-slider .slider-item .preview img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .5s var(--ease);
}
.gallery__single-slider .slider-item .preview:hover img {
    transform: scale(1.04);
}

/* ── 11. Media click affordances (house lightbox owns every image) ──────── */
.couple-picture a,
.story-picture a,
.wedding-gift-bank-wrap a.bank-img-link,
.free-figure {
    cursor: zoom-in;
}
.agenda-head img { cursor: zoom-in; }
#cover-main .picture img,
#cover-opening .picture img,
#cover-pane .picture img { cursor: zoom-in; }

/* Click-to-open switch OFF: media renders inline only, no affordances */
html[data-media-lightbox="off"] .couple-picture a,
html[data-media-lightbox="off"] .story-picture a,
html[data-media-lightbox="off"] .gallery .anchor,
html[data-media-lightbox="off"] a.bank-img-link,
html[data-media-lightbox="off"] .free-figure,
html[data-media-lightbox="off"] .agenda-head img,
html[data-media-lightbox="off"] #cover-main .picture img,
html[data-media-lightbox="off"] #cover-opening .picture img,
html[data-media-lightbox="off"] #cover-pane .picture img { pointer-events: none; cursor: default; }
html[data-media-lightbox="off"] .video-chip { display: none !important; }
html[data-media-lightbox="off"] .video-inline { pointer-events: auto; }

/* ── 12. Free pages ─────────────────────────────────────────────────────── */
.free-page {
    position: relative;
    overflow: hidden;
    background-color: var(--background-secondary);
    padding: 40px 0 48px;
}
.free-inner {
    max-width: 560px;
    margin: 0 auto;
    padding: 10px 20px;
    text-align: center;
}
.free-eyebrow {
    font-family: var(--body-text-family) !important;
    font-size: 11px !important;
    font-weight: 700;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}
.free-page .free-page-title {
    font-family: 'Instrument Serif', serif !important;
    font-size: clamp(28px, 7.5vw, 34px) !important;
    line-height: 1.2 !important;
    color: var(--text-primary);
    margin-bottom: 22px;
}
.free-figure {
    margin: 0 0 18px;
    display: block;
    cursor: zoom-in;
}
.free-figure img {
    width: 100%;
    height: auto;
    display: block;
    /* the template's alternating petal corners */
    border-radius: 20px 60px 20px 60px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .16);
    background: #fff;
}
.free-text {
    font-family: var(--body-text-family) !important;
    font-size: 15px;
    color: var(--text-tertiary);
    max-width: 420px;
    margin: 0 auto;
}
.film-figure { margin: 0; }
.film-frame {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .16);
    background: #000;
}
.film-frame .video-inline {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #000;
}
.video-chip {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 11px 22px;
    border: 1px solid var(--background-tertiary);
    border-radius: 8px;
    background: var(--background-tertiary);
    color: var(--button-text-primary);
    font-family: var(--body-text-family);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .25s var(--ease), color .25s var(--ease);
}
.video-chip svg { width: 14px; height: 14px; }
.video-chip:hover { background: #000; color: #fff; }
.film-cap {
    margin-top: 14px;
    font-family: var(--body-text-family) !important;
    font-size: 14px;
    color: var(--text-tertiary);
}

/* ── 13. Empty-state + trim classes: visual only, print restores ────────── */
.is-empty, .fit-hidden { display: none !important; }

/* ── 14. Lightbox — ink veil over the monochrome palette ────────────────── */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
    background: rgba(20, 20, 20, .96);
}
.lightbox.is-open { display: flex; }
html.lb-open, html.lb-open body.insan { overflow: hidden; }
.lightbox-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: min(92vw, 980px);
    max-height: 76vh;
    touch-action: none;
}
.lightbox img, .lightbox video, .lightbox iframe {
    display: block;
    max-width: min(92vw, 980px);
    max-height: 76vh;
    width: auto;
    height: auto;
    border: 1px solid rgba(255, 255, 255, .4);
    border-radius: 6px;
    background: #161616;
}
.lightbox img { cursor: zoom-in; touch-action: none; user-select: none; -webkit-user-select: none; transition: transform .2s var(--ease); }
.lightbox.is-zoomed .lightbox-media { overflow: visible; }
.lightbox.is-panning img { transition: none; cursor: grabbing; }
.lightbox iframe { width: min(92vw, 960px); height: min(51.75vw, 540px); }
.lightbox-cap, .lightbox-hint, .lightbox-original { align-self: center; }
.lightbox-cap {
    margin: 14px 0 0;
    font-family: 'Instrument Serif', serif;
    font-size: 17px;
    color: #f4f4f4;
    text-align: center;
}
.lightbox-hint {
    margin: 6px 0 0;
    font-family: var(--body-text-family);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .62);
    text-align: center;
}
.lightbox-original {
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 6px;
    font-family: var(--body-text-family);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    line-height: 1;
    color: #f4f4f4;
    text-decoration: none;
    transition: color .2s var(--ease), border-color .2s var(--ease);
}
.lightbox-original:hover { border-color: #fff; color: #fff; }
.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 50%;
    background: rgba(20, 20, 20, .88);
    color: #f4f4f4;
    font-size: 16px;
    cursor: pointer;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { border-color: #fff; color: #fff; }
.lightbox-close { top: calc(14px + var(--safe-t)); right: 14px; }
.lightbox-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 14px; top: 50%; transform: translateY(-50%); }
.lightbox-prev.is-hidden, .lightbox-next.is-hidden { display: none; }
.lightbox-original.is-hidden { display: none; }
@media (max-width: 560px) {
    .lightbox { padding: 12px; }
    .lightbox-prev { left: 6px; }
    .lightbox-next { right: 6px; }
}

/* ── 15. Scrollbars in the palette (sheet + lightbox panes) ─────────────── */
.menu-sheet::-webkit-scrollbar { width: 8px; }
.menu-sheet::-webkit-scrollbar-track { background: #f4f4f4; }
.menu-sheet::-webkit-scrollbar-thumb {
    border-radius: 8px;
    background: var(--background-tertiary);
    border: 2px solid #f4f4f4;
}

/* ── 16. Small screens & landscape compaction ───────────────────────────── */
@media (max-width: 380px) {
    .dock { padding: 4px; bottom: calc(8px + var(--safe-b)); }
    .dock button { width: 30px; height: 32px; }
    .dock button svg { width: 15px; height: 15px; }
    .head-word { font-size: 17px; }
    :root { --dock-space: 112px; }
}
@media (max-height: 520px) {
    :root { --dock-space: 68px; }
    .dock { bottom: calc(6px + var(--safe-b)); }
    .dock button { width: 30px; height: 28px; }
    .dock button svg { width: 14px; height: 14px; }
    body.insan section.top-cover .inner .details { margin-bottom: calc(12px + var(--dock-space)); }
}

/* ── 17. Print — the full document on paper ─────────────────────────────── */
@media print {
    @page { margin: 12mm; }
    .site-head, .dock, .menu-sheet, .menu-backdrop, .scroll-progress,
    .lightbox, .video-chip, .cue-hint { display: none !important; }
    /* Visual-only hiding is undone on paper */
    .is-empty, .fit-hidden { display: revert !important; }
    html, body.insan { background: #fff; }
    body.insan { padding: 0 !important; }
    body.insan [data-panel] { scroll-margin-top: 0; }
    /* The gate scene is a mobile concept — print shows the invitation only */
    body.insan section.top-cover { display: none !important; }
    body.insan .kat-page__side-to-side .primary-pane {
        position: relative;
        width: 100%;
        height: auto;
        min-height: 420px;
        display: block;
        page-break-after: always;
    }
    body.insan .kat-page__side-to-side .primary-pane .inner .details h1 {
        color: var(--text-primary);
    }
    body.insan .kat-page__side-to-side .primary-pane .inner::before { display: none; }
    body.insan section.cover,
    body.insan section.love-story,
    body.insan section.guestbook-section { break-before: page; }
    .story-outer, .bank-item, .free-figure, .film-figure { break-inside: avoid; }
    /* AOS never decides what paper shows */
    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    body.insan img { max-width: 100%; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    a { color: inherit; }
}

/* ── 18. Reduced motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cue-hint { animation: none; }
    *, *::before, *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
