/* Gaya halaman undangan. Mobile-first; di layar lebar konten berada di kolom tengah. */

/* Font (di-host sendiri, subset latin) */
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Lora';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/lora-latin-400-normal.woff2') format('woff2');
}

@font-face {
    font-family: 'Lora';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/lora-latin-400-italic.woff2') format('woff2');
}

@font-face {
    font-family: 'Lora';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/lora-latin-600-normal.woff2') format('woff2');
}

/* Palet dan ukuran dasar */
:root {
    --color-sogan: #5C3A21;
    --color-gold: #C9A227;
    --color-cream: #F5EBDD;
    --color-text: #2B1D12;
    --color-error: #A3301F;

    --font-heading: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-body: 'Lora', Georgia, 'Times New Roman', serif;

    --column-width: 480px;
}

/* Reset ringan */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Tempat scrollbar selalu disediakan, supaya kolom tidak bergeser saat kunci scroll dilepas */
    scrollbar-gutter: stable;
}

/* Scroll dikunci selama cover tampil (class di <html>, dihapus main.js saat undangan dibuka) */
.is-locked {
    overflow: hidden;
}

[hidden] {
    display: none !important;
}

body,
h1, h2, h3, h4,
p,
figure,
blockquote {
    margin: 0;
}

img,
svg,
iframe {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

body {
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    /* Latar bermotif kawung; terlihat di kiri-kanan kolom pada layar lebar */
    background-color: var(--color-text);
    background-image: url('../img/kawung.svg');
    background-size: 56px 56px;
    overflow-wrap: break-word;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
}

/* Kolom tengah */
.page {
    max-width: var(--column-width);
    min-height: 100vh;
    margin: 0 auto;
    background-color: var(--color-cream);
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.45);
}

/* Tombol */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.75em 1.75em;
    border: 1px solid var(--color-gold);
    border-radius: 999px;
    background-color: var(--color-gold);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-decoration: none;
}

.btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
}

/* Cover: overlay layar penuh selebar kolom */
.cover {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    max-width: var(--column-width);
    margin: 0 auto;
    padding: 3rem 1.5rem;
    overflow-y: auto;
    /* Motif kawung diredupkan di tengah supaya teks tetap terbaca */
    background-color: var(--color-sogan);
    background-image:
        radial-gradient(ellipse at 50% 45%, rgba(92, 58, 33, 0.92) 0%, rgba(92, 58, 33, 0.72) 55%, rgba(43, 29, 18, 0.85) 100%),
        url('../img/kawung.svg');
    background-size: auto, 56px 56px;
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.45);
    color: var(--color-cream);
    text-align: center;
    transition:
        transform 0.9s cubic-bezier(0.65, 0, 0.35, 1),
        opacity 0.9s ease-in,
        visibility 0s linear 0.9s;
}

/* Cover keluar setelah Buka Undangan diklik: geser ke atas sambil memudar, lalu
   disembunyikan (visibility) supaya tidak bisa diklik atau difokus lagi */
.cover.is-closed {
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* margin auto (bukan justify-content) supaya isi tetap bisa di-scroll di layar pendek */
.cover-content {
    margin: auto 0;
    animation: rise-in 1s ease-out both;
}

/* Gunungan: gambar latar supaya file SVG bisa diganti tanpa mengubah kode */
.cover-ornament {
    height: clamp(110px, 22vh, 190px);
    margin-bottom: 1.5rem;
    background: url('../img/gunungan.svg') center / contain no-repeat;
}

.cover-label {
    font-size: 0.8125rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.cover-names {
    margin-top: 1.25rem;
    font-size: clamp(2.5rem, 12vw, 3.25rem);
    line-height: 1.1;
    color: var(--color-gold);
    overflow-wrap: anywhere;
}

.cover-names span {
    display: block;
}

.cover-names .cover-amp {
    margin: 0.15em 0;
    font-size: 0.6em;
}

.cover-guest {
    margin-top: 2.5rem;
    padding: 1.25rem 1rem;
    border: 1px solid rgba(201, 162, 39, 0.5);
    border-radius: 12px;
}

.cover-to {
    font-size: 0.875rem;
}

.cover-guest-name {
    margin-top: 0.5rem;
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.cover-button {
    margin-top: 2rem;
}

.cover .btn:focus-visible {
    outline-color: var(--color-cream);
}

/* Section halaman */
.section {
    padding: 3.5rem 1.5rem;
    text-align: center;
}

/* Pembatas antar-section bermotif kawung */
.section + .section::before {
    content: "";
    display: block;
    height: 27px;
    margin: -1.75rem 0 2.5rem;
    background: url('../img/kawung-divider.svg') center / contain no-repeat;
}

.section-title {
    margin-bottom: 1.5rem;
    font-size: 2rem;
    color: var(--color-sogan);
    overflow-wrap: anywhere;
}

/* Baris baru di teks config tetap tampil sebagai baris baru */
.text-multiline {
    white-space: pre-line;
}

/* Pembuka */
.quote {
    margin-top: 2rem;
    padding: 1.5rem 1.25rem;
    border: 1px solid rgba(201, 162, 39, 0.6);
    border-radius: 12px;
}

.quote-text {
    margin: 0;
    font-style: italic;
}

.quote-source {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-sogan);
}

/* Mempelai */
.person-photo {
    width: 100%;
    max-width: 240px;
    aspect-ratio: 4 / 5;
    margin: 0 auto;
    object-fit: cover;
    border: 3px solid var(--color-gold);
    /* Bentuk lengkung di atas */
    border-radius: 50% 50% 12px 12px / 40% 40% 12px 12px;
    background-color: rgba(92, 58, 33, 0.12);
}

.person-name {
    margin-top: 1.25rem;
    font-size: 1.75rem;
    color: var(--color-sogan);
    overflow-wrap: anywhere;
}

.person-parents {
    margin-top: 0.5rem;
    font-size: 0.9375rem;
}

.couple-amp {
    margin: 2rem 0;
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1;
    color: var(--color-gold);
}

/* Acara */
.event-card {
    padding: 2rem 1.25rem;
    border: 1px solid rgba(201, 162, 39, 0.6);
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.35);
}

.event-name {
    font-size: 1.75rem;
    color: var(--color-sogan);
    overflow-wrap: anywhere;
}

.event-date {
    margin-top: 1rem;
    font-weight: 600;
}

.event-venue {
    margin-top: 1.25rem;
    font-weight: 600;
    color: var(--color-sogan);
}

.event-address {
    margin-top: 0.25rem;
    font-size: 0.9375rem;
}

.countdown {
    margin-top: 1.5rem;
}

.countdown-timer {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.countdown-unit {
    padding: 0.75rem 0.25rem;
    border-radius: 12px;
    background-color: var(--color-sogan);
    color: var(--color-cream);
}

.countdown-value {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.1;
    color: var(--color-gold);
    /* Angka bawaan Cormorant bergaya old-style (tinggi tidak rata); lining + tabular supaya
       rata dan lebarnya tetap saat berganti tiap detik */
    font-variant-numeric: lining-nums tabular-nums;
}

.countdown-label {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.countdown-done {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-sogan);
}

.calendar-button {
    margin-top: 1.5rem;
}

/* Lokasi */
.map-frame {
    width: 100%;
    height: 300px;
    border: 0;
    border-radius: 12px;
    background-color: rgba(92, 58, 33, 0.12);
}

.location-button {
    margin-top: 1.5rem;
}

/* Galeri */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.gallery-item {
    display: block;
    padding: 0;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    background-color: rgba(92, 58, 33, 0.12);
    cursor: zoom-in;
}

/* Foto terakhir yang tersisa sendirian berada di tengah, selebar satu kolom */
.gallery-item:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 0.375rem);
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    transition: transform 0.4s ease-out;
}

.gallery-item:focus-visible {
    outline: 2px solid var(--color-sogan);
    outline-offset: 3px;
}

@media (hover: hover) {
    .gallery-item:hover img {
        transform: scale(1.04);
    }
}

/* Lightbox galeri: layar penuh, di atas tombol musik (z-index 50) */
.lightbox {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4.5rem 1rem;
    background-color: rgba(20, 13, 8, 0.97);
    /* Geser satu jari ditangani main.js (tidak menggulir halaman di belakang); cubit untuk zoom tetap bisa */
    touch-action: pinch-zoom;
    animation: fade-in 0.25s ease-out;
}

.lightbox-image {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 9rem);
    max-height: calc(100dvh - 9rem);
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* Foto baru masuk dari arah geser (class dipasang main.js) */
.lightbox-image.is-from-next {
    animation: slide-from-right 0.3s ease-out;
}

.lightbox-image.is-from-prev {
    animation: slide-from-left 0.3s ease-out;
}

.lightbox-button {
    position: absolute;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(201, 162, 39, 0.6);
    border-radius: 50%;
    background-color: rgba(43, 29, 18, 0.65);
    color: var(--color-cream);
}

.lightbox-button:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 3px;
}

.lightbox-button svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lightbox-close {
    top: 1rem;
    right: 1rem;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev {
    left: 0.5rem;
}

.lightbox-next {
    right: 0.5rem;
}

.lightbox-counter {
    position: absolute;
    right: 0;
    bottom: 1.5rem;
    left: 0;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    color: var(--color-cream);
    text-align: center;
}

/* RSVP & Ucapan */
.rsvp-intro {
    margin-bottom: 1.75rem;
}

.rsvp-form {
    position: relative; /* acuan posisi honeypot */
    padding: 1.75rem 1rem;
    border: 1px solid rgba(201, 162, 39, 0.6);
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.35);
    text-align: left;
}

/* Dipakai untuk div dan fieldset; min-width 0 supaya fieldset tidak melebar melewati kolom */
.field {
    min-width: 0;
    margin: 0 0 1.25rem;
    padding: 0;
    border: 0;
}

.field-label {
    display: block;
    margin-bottom: 0.375rem;
    padding: 0;
    font-weight: 600;
    color: var(--color-sogan);
}

.field-optional {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--color-text);
}

/* font-size minimal 16px supaya iOS tidak memperbesar halaman saat kolom difokus */
.field-input {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 0.625rem 0.875rem;
    border: 1px solid rgba(92, 58, 33, 0.4);
    border-radius: 10px;
    background-color: #FFFCF7;
    font-size: 1rem;
    line-height: 1.4;
}

.field-input:focus {
    border-color: var(--color-gold);
    outline: none;
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.35);
}

.field-input::placeholder {
    color: rgba(43, 29, 18, 0.5);
}

textarea.field-input {
    min-height: 7.5rem;
    resize: vertical;
}

select.field-input {
    padding-right: 2.5rem;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235C3A21' stroke-width='1.5'/%3E%3C/svg%3E");
    background-position: right 0.875rem center;
    background-repeat: no-repeat;
    background-size: 12px 8px;
}

.choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
}

.choice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.5rem 0.625rem;
    border: 1px solid rgba(92, 58, 33, 0.4);
    border-radius: 10px;
    background-color: #FFFCF7;
    line-height: 1.3;
    cursor: pointer;
}

.choice input {
    flex-shrink: 0;
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--color-sogan);
}

.choice:has(input:checked) {
    border-color: var(--color-gold);
    background-color: rgba(201, 162, 39, 0.18);
    box-shadow: inset 0 0 0 1px var(--color-gold);
}

.choice:has(input:focus-visible) {
    outline: 2px solid var(--color-sogan);
    outline-offset: 2px;
}

.field-counter {
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Pesan error per field dari server (respons 422) */
.field-error {
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: var(--color-error);
}

.field-input[aria-invalid="true"],
.choice:has(input[aria-invalid="true"]) {
    border-color: var(--color-error);
}

/* Honeypot: tidak terlihat di layar dan dilewati Tab, tapi tetap bagian dari form */
.honeypot {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.rsvp-submit {
    width: 100%;
    margin-top: 0.25rem;
}

.rsvp-status:not(:empty) {
    margin-top: 1rem;
    font-weight: 600;
    color: var(--color-sogan);
    text-align: center;
}

.rsvp-status.is-error {
    color: var(--color-error);
}

/* Pengganti form saat rsvp.deadline sudah lewat */
.rsvp-closed {
    padding: 1.75rem 1rem;
    border: 1px solid rgba(201, 162, 39, 0.6);
    border-radius: 16px;
    background-color: rgba(255, 255, 255, 0.35);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-sogan);
}

.wishes {
    margin-top: 2.75rem;
}

.wishes-title {
    font-size: 1.625rem;
    color: var(--color-sogan);
}

.wish-list {
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
    text-align: left;
}

.wish {
    padding: 1rem 1.125rem;
    border: 1px solid rgba(201, 162, 39, 0.45);
    border-radius: 14px;
    background-color: rgba(255, 255, 255, 0.45);
    animation: wish-in 0.4s ease-out;
}

.wish + .wish {
    margin-top: 0.75rem;
}

@keyframes wish-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.wish-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.625rem;
}

/* overflow-wrap anywhere: nama atau kata panjang tanpa spasi tetap terbungkus di 360px */
.wish-name {
    min-width: 0;
    font-weight: 600;
    color: var(--color-sogan);
    overflow-wrap: anywhere;
}

.wish-attendance {
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    background-color: rgba(201, 162, 39, 0.25);
    font-size: 0.75rem;
    color: var(--color-sogan);
    white-space: nowrap;
}

.wish-attendance.is-absent {
    background-color: rgba(92, 58, 33, 0.1);
}

.wish-message {
    margin-top: 0.375rem;
    overflow-wrap: anywhere;
}

.wish-time {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: rgba(43, 29, 18, 0.7);
}

.wishes-status:not(:empty) {
    margin-top: 1.25rem;
    font-style: italic;
}

.wishes-more {
    margin-top: 1.25rem;
}

/* Tombol garis: tanpa isi warna, untuk aksi sekunder */
.btn-outline {
    background-color: transparent;
    color: var(--color-sogan);
}

/* Penutup */
.closing {
    padding-bottom: 4.5rem;
}

.closing-names {
    margin-top: 1.75rem;
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1.15;
    color: var(--color-sogan);
    overflow-wrap: anywhere;
}

.closing-names span {
    display: block;
}

.closing-names .closing-amp {
    margin: 0.15em 0;
    font-size: 0.6em;
    color: var(--color-gold);
}

.closing-family {
    margin-top: 0.75rem;
    font-style: italic;
}

/* Tombol musik mengambang di pojok kanan bawah kolom; muncul setelah undangan dibuka */
.music-toggle {
    position: fixed;
    right: max(1rem, calc(50% - var(--column-width) / 2 + 1rem));
    bottom: 1rem;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--color-gold);
    border-radius: 50%;
    background-color: var(--color-sogan);
    color: var(--color-gold);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    animation: rise-in 0.6s ease-out 0.6s both;
}

.music-toggle:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 3px;
}

.music-toggle svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

/* is-playing dipasang main.js mengikuti status audio */
.music-toggle .music-icon-pause,
.music-toggle.is-playing .music-icon-play {
    display: none;
}

.music-toggle.is-playing .music-icon-pause {
    display: block;
}

/* Animasi */
@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes slide-from-right {
    from {
        opacity: 0;
        transform: translateX(32px);
    }
}

@keyframes slide-from-left {
    from {
        opacity: 0;
        transform: translateX(-32px);
    }
}

/* Animasi scroll (AOS): geser pendek, bukan 100px bawaan aos.css */
[data-aos="fade-up"] {
    transform: translate3d(0, 24px, 0);
}

/* prefers-reduced-motion: semua animasi dan transisi dimatikan. Elemen data-aos langsung
   tampil, juga sebelum aos.js selesai dimuat (main.js lalu mematikan AOS). */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0s !important;
        scroll-behavior: auto !important;
    }

    [data-aos] {
        opacity: 1 !important;
        transform: none !important;
    }
}
