/* ==========================================================================
   Forum Literasi Hukum PERSAJA — data entry + result
   Poster-style theme: sky bg1 · campus (bottom layer) · golden book + "sulur"
   light animation on top. Gold / cream / green tone, elegant serif type.
   Used only by index.php & result.php (wishing/ keeps style.css).
   ========================================================================== */

/* Libre Baskerville (local, assets/fonts/). Weights 600–900 map to Bold. */
@font-face {
    font-family: 'Libre Baskerville';
    src: url('../fonts/LibreBaskerville-Regular.woff2') format('woff2'),
         url('../fonts/LibreBaskerville-Regular.ttf') format('truetype');
    font-weight: 100 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Libre Baskerville';
    src: url('../fonts/LibreBaskerville-Bold.woff2') format('woff2'),
         url('../fonts/LibreBaskerville-Bold.ttf') format('truetype');
    font-weight: 600 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Libre Baskerville';
    src: url('../fonts/LibreBaskerville-Italic.woff2') format('woff2'),
         url('../fonts/LibreBaskerville-Italic.ttf') format('truetype');
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --gold-light: #F5E3A8;
    --gold:       #D2A53C;
    --gold-deep:  #9C6F1C;
    --gold-ink:   #6B4A12;
    --green:      #1E6B39;
    --green-deep: #124727;
    --sky:        #37A6E6;
    --cream:      #FBF5E6;
    --cream-soft: #FFFDF7;
    --ink:        #23201A;
    --ink-soft:   #6a6152;
    --err:        #C0392B;
    --serif:      'Libre Baskerville', Georgia, 'Times New Roman', serif;
    --body:       'Libre Baskerville', Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

body {
    font-family: var(--body);
    color: var(--ink);
    background: linear-gradient(#8fd2f3 0%, #bfe6f7 40%, #eaf7fd 100%);
    background-image: url('../images/bg1.webp');
    background-repeat: no-repeat;
    background-position: center top;
    background-size: cover;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    line-height: 1.4;
    height: 100dvh;
    overflow: hidden;
}

/* ============================ Scenic backdrop ============================= */
.scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

/* bottom layer — campus building, anchored to the floor, full width */
.scene-campus {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;                     /* docked flush to the very bottom */
    width: 100%;
    aspect-ratio: 1672 / 875;      /* bottom-trimmed image, no transparent padding */
    background: url('../images/campus-docked-r3.webp') no-repeat center bottom;
    background-size: 100% 100%;    /* full width, flush bottom — no cloud gap */
    opacity: 1;
    filter: saturate(1.03);
}

/* aksen gelombang hijau-gold — selalu menempel di dasar layar, di belakang buku */
.scene-aksen {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    aspect-ratio: 1080 / 93;
    background: url('../images/aksen-bawah.webp') no-repeat center bottom;
    background-size: 100% 100%;
    transform: translateY(35%);    /* diturunkan: sebagian gelombang masuk ke bawah layar */
    pointer-events: none;
}

/* golden "sulur" light — rotating glow + pulsing halo behind the book */
.scene-sulur,
.scene-sulur::before,
.scene-sulur::after {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}
.scene-sulur {
    left: 50%;
    bottom: calc(clamp(-40px, -2vh, 30px) + 2.5vh);   /* follows the book */
    width: min(360px, 62vw);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, 35%);
    background:
        conic-gradient(from 0deg,
            rgba(245,227,168,0)   0deg,
            rgba(245,227,168,.55) 40deg,
            rgba(210,165,60,0)    110deg,
            rgba(245,227,168,.5)  200deg,
            rgba(210,165,60,0)    270deg,
            rgba(245,227,168,.55) 330deg,
            rgba(245,227,168,0)   360deg);
    filter: blur(26px);
    opacity: .75;
    animation: sulur-spin 26s linear infinite;
    mix-blend-mode: screen;
}
.scene-sulur::before {
    content: "";
    inset: 14%;
    background: radial-gradient(circle, rgba(255,246,214,.9) 0%, rgba(245,210,120,.35) 38%, rgba(245,210,120,0) 68%);
    filter: blur(8px);
    animation: sulur-pulse 4.5s ease-in-out infinite;
}
.scene-sulur::after {
    content: "";
    inset: -8%;
    border: 2px solid rgba(245,227,168,.45);
    box-shadow: 0 0 40px 6px rgba(245,210,120,.35), inset 0 0 40px 6px rgba(245,210,120,.25);
    filter: blur(1px);
    animation: sulur-spin 38s linear infinite reverse;
}

/* the hero visual — golden book, swan, scales (on top of campus) */
.scene-buku {
    position: absolute;
    left: 50%;
    bottom: calc(clamp(-32px, -3vh, -8px) + 2.5vh);   /* raised 2.5vh */
    transform: translateX(-50%);
    width: min(336px, 56vw);   /* 60% dari ukuran awal */
    aspect-ratio: 1672 / 941;
    background: url('../images/buku.webp') no-repeat center bottom;
    background-size: contain;
    filter: drop-shadow(0 16px 24px rgba(90,60,10,.35));
    animation: buku-float 7s ease-in-out infinite;
}

/* twinkling golden sparkles sprinkled around the book */
.scene-sparks { position: absolute; inset: 0; }
.scene-sparks i {
    position: absolute;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff6d4 0%, #f3cf6e 45%, rgba(243,207,110,0) 72%);
    opacity: 0;
    animation: twinkle 3.6s ease-in-out infinite;
}
.scene-sparks i:nth-child(1){ left:30%; bottom:30%; animation-delay:0s;   transform:scale(1.2); }
.scene-sparks i:nth-child(2){ left:44%; bottom:40%; animation-delay:.5s;  transform:scale(.8); }
.scene-sparks i:nth-child(3){ left:56%; bottom:46%; animation-delay:1s;   transform:scale(1.4); }
.scene-sparks i:nth-child(4){ left:64%; bottom:34%; animation-delay:1.6s; transform:scale(.9); }
.scene-sparks i:nth-child(5){ left:38%; bottom:22%; animation-delay:2.1s; transform:scale(1.1); }
.scene-sparks i:nth-child(6){ left:70%; bottom:24%; animation-delay:.9s;  transform:scale(1.3); }
.scene-sparks i:nth-child(7){ left:25%; bottom:44%; animation-delay:2.6s; transform:scale(.85);}
.scene-sparks i:nth-child(8){ left:52%; bottom:52%; animation-delay:1.3s; transform:scale(1); }

@keyframes sulur-spin  { to { transform: translate(-50%, 35%) rotate(360deg); } }
@keyframes sulur-pulse { 0%,100% { opacity:.55; transform:scale(.96); } 50% { opacity:1; transform:scale(1.06); } }
@keyframes buku-float  { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-10px); } }
@keyframes twinkle     { 0%,100% { opacity:0; } 45%,55% { opacity:1; } }

/* ============================== Layout =================================== */
.page {
    position: relative;
    z-index: 1;
    height: 100dvh;                 /* exactly one screen — no scroll */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: clamp(5px, 1.3vh, 13px);
    padding: clamp(8px, 2.2vh, 26px) 16px clamp(120px, 23vh, 230px);   /* logo & header lebih ke atas */
    overflow: hidden;
}

.brand {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}
.brand::before {
    content: "";
    position: absolute;
    inset: -14% -12% -6%;
    background: radial-gradient(ellipse at 50% 42%, rgba(255,255,255,.72) 0%, rgba(255,255,255,.35) 45%, rgba(255,255,255,0) 72%);
    filter: blur(6px);
    z-index: -1;
}
.brand-emblem {
    height: clamp(30px, 5.2vh, 52px);   /* logo sayap+tameng (lebar), tanpa timbangan besar */
    width: auto;
    filter: drop-shadow(0 5px 12px rgba(30,40,60,.3));
}
.brand-text {
    height: clamp(78px, 15vh, 150px);   /* sized by height so it fits one screen */
    width: auto;
    max-width: 92vw;
    margin-top: -4px;
    filter: drop-shadow(0 1px 1px rgba(90,55,8,.5)) drop-shadow(0 4px 9px rgba(120,80,10,.38));
}

/* small gold "SERI #1"-style eyebrow, optional heading */
.page-title {
    text-align: center;
    font-family: var(--serif);
    color: #fff;
    text-shadow: 0 2px 10px rgba(20,60,110,.45), 0 1px 2px rgba(0,0,0,.3);
    line-height: 1.05;
}
.page-title b {
    display: block;
    font-weight: 900;
    font-size: clamp(1.5rem, 6vw, 2.3rem);
    letter-spacing: .5px;
}
.page-title span {
    display: inline-block;
    margin-top: 8px;
    font-family: var(--body);
    font-size: clamp(.72rem, 3vw, .9rem);
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--gold-ink);
    background: linear-gradient(#fdf3d2, #f0d78c);
    border: 1.5px solid var(--gold);
    border-radius: 999px;
    padding: 4px 16px;
    text-shadow: none;
    box-shadow: 0 4px 12px rgba(120,90,20,.25);
}

/* ============================= Form card ================================= */
#wishForm {
    width: 100%;
    max-width: 440px;
    margin-top: clamp(8px, 1.8vh, 20px);    /* breathing room below the header text */
    display: flex;
    flex-direction: column;
    gap: clamp(9px, 1.8vh, 16px);
    padding: clamp(16px, 2.6vh, 26px) clamp(18px, 4.5vw, 24px);
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(255,253,247,.97), rgba(251,245,230,.95));
    border: 1px solid rgba(210,165,60,.55);
    box-shadow:
        0 0 0 4px rgba(255,255,255,.55),
        0 0 0 5px rgba(210,165,60,.6),
        0 22px 50px rgba(60,45,10,.28),
        inset 0 1px 0 rgba(255,255,255,.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.form-field { display: flex; flex-direction: column; gap: clamp(4px, 0.9vh, 7px); }

.form-field label,
.field-label {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(1rem, 4.2vw, 1.18rem);
    color: var(--green-deep);
    letter-spacing: .2px;
}

.form-field input,
.form-field textarea {
    font-family: var(--body);
    font-size: 1rem;
    color: var(--ink);
    background: #fffdf8;
    border: 1.5px solid rgba(156,111,28,.4);
    border-radius: 12px;
    padding: 12px 14px;
    width: 100%;
    transition: border-color .18s, box-shadow .18s, background .18s;
    box-shadow: inset 0 1px 3px rgba(90,70,20,.08);
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: #a79b84; }

.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    background: #fff;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(210,165,60,.28), inset 0 1px 3px rgba(90,70,20,.06);
}

.form-field--grow textarea {
    resize: none;
    /* exactly 4 lines: 4 × line-height + vertical padding (12+12) + border (1.5×2) */
    height: calc(4 * 1.45em + 27px);
    min-height: 0;
    line-height: 1.45;
}

.char-count {
    align-self: flex-end;
    font-size: .76rem;
    color: var(--ink-soft);
    font-family: var(--body);
    letter-spacing: .3px;
}
.char-count span { color: var(--gold-deep); font-weight: 600; }

.field-error {
    display: none;
    font-size: .82rem;
    color: var(--err);
    font-family: var(--body);
}
.form-field.has-error input,
.form-field.has-error textarea { border-color: var(--err); box-shadow: 0 0 0 3px rgba(192,57,43,.14); }
.form-field.has-error .field-error { display: block; }

/* submit — gold plated, engraved serif */
.submit-btn {
    margin-top: 4px;
    font-family: var(--serif);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 3px;
    color: #4a3410;
    background: linear-gradient(180deg, #fbe7b0 0%, #e7c266 45%, #cf9f33 100%);
    border: 1.5px solid #b9892a;
    border-radius: 14px;
    padding: 13px 18px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 22px rgba(150,110,20,.35), inset 0 1px 0 rgba(255,255,255,.7);
    transition: transform .12s, box-shadow .18s, filter .18s;
}
.submit-btn::after {
    content: "";
    position: absolute;
    top: 0; left: -120%;
    width: 60%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.75), transparent);
    transform: skewX(-18deg);
    animation: sheen 3.6s ease-in-out infinite;
}
.submit-btn:hover { filter: brightness(1.05); box-shadow: 0 14px 28px rgba(150,110,20,.45), inset 0 1px 0 rgba(255,255,255,.8); }
.submit-btn:active { transform: translateY(1px); }
.submit-btn:disabled { filter: grayscale(.3) brightness(.95); cursor: default; }
.submit-btn:disabled::after { display: none; }
@keyframes sheen { 0% { left:-120%; } 55%,100% { left:130%; } }

/* ============================ Thank-you modal =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at 50% 40%, rgba(20,60,40,.55), rgba(10,30,20,.78));
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
    width: 100%;
    max-width: 380px;
    text-align: center;
    padding: 30px 26px 26px;
    border-radius: 24px;
    background: linear-gradient(180deg, #fffdf7, #faf2dd);
    border: 1px solid rgba(210,165,60,.6);
    box-shadow: 0 0 0 4px rgba(255,255,255,.5), 0 0 0 5px rgba(210,165,60,.6), 0 26px 60px rgba(40,30,8,.45);
    transform: translateY(14px) scale(.96);
    transition: transform .3s cubic-bezier(.2,.9,.3,1.2);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal .drop {
    display: block;
    width: clamp(160px, 46vw, 210px);   /* logo-fa.png is wide (≈3.7:1) */
    height: auto;
    margin: 0 auto 10px;
    filter: drop-shadow(0 6px 13px rgba(40,60,90,.35));
    animation: drop-float 4s ease-in-out infinite;
}
@keyframes drop-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
.modal h2 {
    font-family: var(--serif);
    font-weight: 900;
    font-size: clamp(1.5rem, 6.5vw, 1.95rem);
    line-height: 1.12;
    color: var(--green-deep);
    margin-bottom: 8px;
}
.modal p {
    font-family: var(--body);
    color: var(--ink-soft);
    font-size: .98rem;
    margin-bottom: 20px;
}

.continue-btn {
    font-family: var(--serif);
    font-weight: 800;
    letter-spacing: 3px;
    font-size: 1rem;
    color: #4a3410;
    background: linear-gradient(180deg, #fbe7b0 0%, #e7c266 45%, #cf9f33 100%);
    border: 1.5px solid #b9892a;
    border-radius: 13px;
    padding: 12px 30px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(150,110,20,.35), inset 0 1px 0 rgba(255,255,255,.7);
    transition: transform .12s, filter .18s;
}
.continue-btn:hover { filter: brightness(1.05); }
.continue-btn:active { transform: translateY(1px); }

/* ================================ Toast ================================= */
.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%) translateY(20px);
    z-index: 60;
    max-width: 90vw;
    font-family: var(--body);
    font-size: .92rem;
    color: #fff6e2;
    background: linear-gradient(180deg, #4a3410, #2c1f08);
    border: 1px solid var(--gold);
    border-radius: 12px;
    padding: 11px 20px;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 12px 30px rgba(0,0,0,.4);
    transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================ Result page =============================== */
.page--result { justify-content: center; padding-bottom: clamp(120px, 22vh, 220px); }

.result-wrap {
    width: 100%;
    max-width: 480px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 30px 24px 32px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255,253,247,.97), rgba(251,245,230,.95));
    border: 1px solid rgba(210,165,60,.55);
    box-shadow: 0 0 0 4px rgba(255,255,255,.5), 0 0 0 5px rgba(210,165,60,.6), 0 22px 50px rgba(60,45,10,.28);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.result-wrap h1 {
    font-family: var(--serif);
    font-weight: 900;
    font-size: clamp(1.7rem, 7vw, 2.3rem);
    line-height: 1.1;
    color: var(--green-deep);
}
.result-wrap .subtitle {
    font-family: var(--body);
    font-style: italic;
    color: var(--gold-deep);
    font-size: 1rem;
}
.wish-card {
    width: 100%;
    margin-top: 6px;
    padding: 20px 20px;
    border-radius: 16px;
    background: linear-gradient(180deg, #fffdf6, #fbf3dd);
    border: 1px solid rgba(210,165,60,.45);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 6px 16px rgba(120,90,20,.12);
}
.wish-card .quote {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 600;
    font-size: clamp(1.1rem, 5vw, 1.4rem);
    color: var(--ink);
    line-height: 1.35;
}
.wish-card .who {
    margin-top: 12px;
    font-family: var(--body);
    color: var(--ink-soft);
    font-size: .95rem;
}
.wish-card .who strong { color: var(--green-deep); font-weight: 600; }

.link-btn {
    display: inline-block;
    margin-top: 6px;
    text-decoration: none;
    font-family: var(--serif);
    font-weight: 800;
    letter-spacing: 3px;
    font-size: .98rem;
    color: #4a3410;
    background: linear-gradient(180deg, #fbe7b0 0%, #e7c266 45%, #cf9f33 100%);
    border: 1.5px solid #b9892a;
    border-radius: 13px;
    padding: 12px 34px;
    box-shadow: 0 10px 20px rgba(150,110,20,.3), inset 0 1px 0 rgba(255,255,255,.7);
    transition: transform .12s, filter .18s;
}
.link-btn:hover { filter: brightness(1.05); }
.link-btn:active { transform: translateY(1px); }

/* ============================ Responsive ================================ */
@media (min-width: 560px) {
    .page { justify-content: center; }
    #wishForm { padding: 28px 28px 30px; }
}

/* short / landscape phones — tighten so everything still fits one screen */
@media (max-height: 680px) {
    .page { padding-bottom: clamp(92px, 19vh, 150px); gap: 5px; }
    .brand-emblem { height: clamp(26px, 4.4vh, 40px); }
    .brand-text { height: clamp(58px, 12vh, 92px); }
    .form-field--grow textarea { line-height: 1.3; padding-top: 8px; padding-bottom: 8px; height: calc(4 * 1.3em + 19px); }
    #wishForm { gap: clamp(7px, 1.4vh, 12px); margin-top: clamp(6px, 1.4vh, 10px); }
}

/* very wide screens — cap the scene and centre the content */
@media (min-width: 1024px) {
    .scene-buku  { width: min(360px, 26vw); bottom: calc(clamp(-34px, -3.4vh, -8px) + 2.5vh); }
    .scene-sulur { width: min(384px, 29vw); }
    .page { justify-content: center; padding-bottom: clamp(190px, 30vh, 330px); }
}

@media (prefers-reduced-motion: reduce) {
    .scene-sulur, .scene-sulur::before, .scene-sulur::after,
    .scene-buku, .scene-sparks i, .submit-btn::after, .modal .drop { animation: none !important; }
}
