/* ==========================================================================
   Formulir pendaftaran SIM dan halaman kode QR (form_pengisian/index, cetak_sim/cetak_barcode).
   Sejalan dengan landing 3D: malam di Satpas, satu aksen kuning; formulirnya lembar kertas putih
   seperti formulir SIM, dengan bahasa yang sama dengan layar HP di landing.
   ========================================================================== */
:root {
    --bg: #04070d;
    --navy: #0f2a4a;
    --ink: #0e1f33;
    --muted: #4b5b6d;
    --text: #eef2f7;
    --text-muted: #93a2b7;
    --paper: #ffffff;
    --tint: #eef5fb;
    --line: #a9cbe2;
    --rule: #d6dee6;
    --accent: #f2b31f;
    --danger: #c8102e;
    --display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
    --ease: cubic-bezier(.2, .75, .15, 1);
    --gutter: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; font-family: var(--sans); font-size: 17px; line-height: 1.5; color: var(--text); background: var(--bg); overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ---------- Kepala halaman ---------- */
.top { position: absolute; inset: 0 0 auto; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; padding: 0 var(--gutter); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: 44px; }
.brand-logos { display: flex; gap: 8px; }
.brand-logos img { width: 32px; height: 32px; object-fit: contain; }
.brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name strong { font: 700 20px var(--display); letter-spacing: .02em; text-transform: uppercase; }
.brand-name span { font: 500 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.top-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; font-weight: 600; font-size: 15px; text-decoration: none; border: 1px solid rgb(255 255 255 / .35); border-radius: 6px; }
.top-link:hover { border-color: #fff; }

/* ---------- Pita judul: foto gedung Satpas, malam ---------- */
.band { position: relative; isolation: isolate; overflow: hidden; padding: 112px var(--gutter) 120px; background: var(--bg); }
.band::before { content: ''; position: absolute; inset: 0; z-index: -2; background: url('../images/landing/gedung-900.jpg') center 58% / cover no-repeat; filter: grayscale(1) contrast(1.15) brightness(.5); transform: scale(1.08); transition: transform 2.4s var(--ease); }
.band::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgb(4 7 13 / .55), rgb(4 7 13 / .82) 70%, var(--bg)), linear-gradient(90deg, rgb(4 7 13 / .8), transparent 70%); }
.is-ready .band::before { transform: none; }
/* Sapuan cahaya rotator merah-biru yang lewat sekali-sekali di belakang judul. */
.band-inner::before { content: ''; position: absolute; inset: -40% -20%; z-index: -1; pointer-events: none; background: conic-gradient(from 0deg at 50% 0%, transparent 0 40%, rgb(255 29 58 / .16) 46%, transparent 52% 88%, rgb(37 99 255 / .18) 94%, transparent 100%); animation: sweep 7s linear infinite; mix-blend-mode: screen; }
@keyframes sweep { to { transform: rotate(360deg); } }
.band-inner { position: relative; max-width: 820px; margin: 0 auto; }
.band-kicker { font: 500 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.band-title { margin-top: 12px; font: 700 clamp(46px, 11vw, 96px)/.88 var(--display); text-transform: uppercase; }
.band-title span { display: inline-block; }
.js .band-title span { opacity: 0; transform: translateY(40%); transition: opacity .7s ease, transform .9s var(--ease); }
.js .band-title span + span { transition-delay: .08s; }
.is-ready .band-title span { opacity: 1; transform: none; }

.steps-ind { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 22px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--text-muted); }
.steps-ind li { display: flex; align-items: center; gap: 8px; transition: color .3s ease; }
.steps-ind b { display: inline-grid; place-items: center; width: 24px; height: 24px; font: 500 12px var(--mono); border: 1px solid rgb(255 255 255 / .3); border-radius: 3px; transition: background-color .3s ease, color .3s ease, border-color .3s ease; }
.steps-ind .is-current { color: var(--text); }
.steps-ind .is-current b { color: var(--ink); background: var(--accent); border-color: var(--accent); }
.steps-ind .is-done b { color: var(--ink); background: #fff; border-color: #fff; }

/* ---------- Lembar formulir ---------- */
.sheet-wrap { position: relative; z-index: 2; max-width: calc(820px + 2 * var(--gutter)); margin: -72px auto 0; padding: 0 var(--gutter) 64px; }
.sheet { position: relative; color: var(--ink); background: var(--paper); border-radius: 6px; box-shadow: 0 40px 80px -40px rgb(0 0 0 / .9), 0 0 0 1px rgb(255 255 255 / .06); }
.js .sheet { opacity: 0; transform: translateY(36px); transition: opacity .8s ease .15s, transform 1s var(--ease) .15s; }
.is-ready .sheet { opacity: 1; transform: none; }

.sheet-head { position: sticky; top: 0; z-index: 4; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px clamp(18px, 4vw, 36px) 16px; color: #fff; background: var(--navy); border-radius: 6px 6px 0 0; }
.sheet-head strong { display: block; font: 700 22px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.sheet-head div span { display: block; margin-top: 4px; font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #c3d0de; }
.sheet-head i { font-style: normal; color: var(--accent); }
.sheet-count { font: 500 13px var(--mono); color: #c3d0de; }
.sheet-count b { color: #fff; font-weight: 500; }
.sheet-progress { position: absolute; inset: auto 0 0; height: 5px; background: rgb(255 255 255 / .12); }
.sheet-progress span { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform .45s var(--ease); }

.banner { margin: 20px clamp(18px, 4vw, 36px) 0; padding: 12px 14px; font-size: 15px; border-radius: 6px; }
.banner--error { color: #7a0a1c; background: #fdecee; border: 1px solid #f3b6bf; }

.step { padding: 8px clamp(18px, 4vw, 36px) 32px; }
.step.enter-next { animation: enterNext .55s var(--ease); }
.step.enter-prev { animation: enterPrev .55s var(--ease); }
@keyframes enterNext { from { opacity: 0; transform: translateX(28px); } }
@keyframes enterPrev { from { opacity: 0; transform: translateX(-28px); } }

.part { display: flex; align-items: center; gap: 12px; margin: 26px 0 6px; font: 500 13px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.part b { display: inline-grid; place-items: center; width: 28px; height: 28px; font-weight: 500; color: #fff; background: var(--ink); border-radius: 3px; }

.field { min-width: 0; margin: 0; padding: 20px 0 6px; border: 0; border-bottom: 1px dashed var(--line); }
.field legend, .field > label { display: block; padding: 0; margin-bottom: 10px; font-weight: 600; font-size: 17px; }
fieldset.field legend { float: left; width: 100%; }
fieldset.field legend + * { clear: left; }
.field legend small, .sub small { font-weight: 400; font-size: 14px; color: var(--muted); }
.field i { font-style: normal; color: var(--danger); }
.sub { margin: 4px 0 8px; font: 500 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sub small { margin-left: 6px; text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.msg { min-height: 0; margin-top: 6px; font-size: 14.5px; color: var(--danger); }
.msg:empty { display: none; }
.has-error input[type=text], .has-error input[type=tel], .has-error textarea { border-color: var(--danger); background: #fff7f8; }
.has-error .tile { border-color: #e9a3ad; }
.shake { animation: shake .4s ease; }
@keyframes shake { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }

/* ---------- Pilihan berupa ubin dengan kotak centang yang tergambar ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
@media (min-width: 640px) {
    .tiles--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.tile { position: relative; display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 10px 12px; background: #fff; border: 1.5px solid var(--rule); border-radius: 6px; cursor: pointer; transition: border-color .2s ease, background-color .2s ease, transform .15s var(--ease), box-shadow .2s ease; }
.tile:hover { border-color: var(--line); }
.tile:active { transform: scale(.98); }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile-text { min-width: 0; font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
/* Di HP 390 px, 14.5px membuat "Perpanjangan" muat satu baris; tanpa itu katanya terpotong ("Perpanjanga / n"). */
@media (max-width: 420px) { .tile { gap: 8px; padding: 10px; } .tile-text { font-size: 14.5px; } }
@media (max-width: 370px) { .tile { gap: 6px; padding: 10px 8px; } .tile-text { font-size: 13.5px; } }
.box { position: relative; flex: none; width: 22px; height: 22px; background: #fff; border: 2px solid var(--ink); border-radius: 3px; transition: background-color .2s ease; }
.box svg { position: absolute; inset: -5px -7px -2px -2px; width: 27px; height: 27px; overflow: visible; fill: none; stroke: var(--ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .28s ease-out; }
/* .is-on dipasang JS (bukan :has) supaya jalan juga di peramban HP lama. */
.tile.is-on { background: var(--tint); border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.tile input:checked + .box svg { stroke-dashoffset: 0; }
.tile input:focus-visible + .box { outline: 3px solid var(--accent); outline-offset: 2px; }

.tile--gol { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 0; align-items: center; padding: 10px 12px 12px; }
.tile--gol .box { grid-row: 1; }
.tile-code { font: 700 32px/1 var(--display); text-transform: uppercase; }
.tile-desc { grid-column: 1 / -1; margin-top: 6px; font-size: 13.5px; line-height: 1.3; color: var(--muted); }

.hint { margin: 2px 0 10px; padding: 10px 12px; font-size: 15px; background: #fff8e6; border-left: 3px solid var(--accent); border-radius: 0 6px 6px 0; animation: enterNext .4s var(--ease); }

/* ---------- Kolom isian ---------- */
.field input[type=text], .field input[type=tel], .field textarea { display: block; width: 100%; min-height: 54px; padding: 12px 14px; font-size: 17px; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 6px; transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease; }
.field textarea { min-height: 84px; resize: vertical; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: #8b98a8; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgb(242 179 31 / .55); }
.suffix { position: relative; }
.suffix input { padding-right: 52px !important; }
.suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 500 14px var(--mono); color: var(--muted); pointer-events: none; }
.row-2 { display: grid; gap: 0 18px; }
@media (min-width: 640px) { .row-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Pilihan ya/tidak ---------- */
.toggles { display: grid; gap: 14px; padding: 22px 0 6px; }
@media (min-width: 640px) { .toggles { grid-template-columns: repeat(3, 1fr); } }
.toggle { margin: 0; padding: 0; border: 0; min-width: 0; }
.toggle legend { padding: 0; margin-bottom: 8px; font-weight: 600; font-size: 15px; }
.toggle label { position: relative; display: inline-block; }
.toggle input { position: absolute; opacity: 0; }
.toggle span { display: inline-flex; align-items: center; justify-content: center; min-width: 76px; min-height: 44px; padding: 0 14px; font-size: 15px; font-weight: 500; background: #fff; border: 1.5px solid var(--rule); cursor: pointer; transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
.toggle label:first-of-type span { border-radius: 6px 0 0 6px; }
.toggle label:last-of-type span { margin-left: -1.5px; border-radius: 0 6px 6px 0; }
.toggle input:checked + span { color: #fff; background: var(--navy); border-color: var(--navy); }
.toggle input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Tombol ---------- */
.actions { display: flex; gap: 10px; margin-top: 28px; }
.actions--split { justify-content: space-between; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 0 22px; font: 600 17px/1.2 var(--sans); color: var(--ink); text-decoration: none; background: var(--accent); border: 0; border-radius: 6px; box-shadow: inset 0 -3px 0 rgb(0 0 0 / .2); cursor: pointer; transition: background-color .2s ease, transform .15s var(--ease); }
.btn:hover { background: #f7c443; }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; transition: transform .25s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn--ghost { color: var(--ink); background: #fff; border: 1.5px solid var(--ink); box-shadow: none; }
.btn--ghost:hover { background: var(--tint); }
.btn--ghost:hover svg { transform: translateX(-3px); }
.actions .btn:only-child, .actions [data-next] { width: 100%; }
@media (min-width: 640px) { .actions [data-next] { width: auto; margin-left: auto; } }
.actions--split [data-submit] { flex: 1; }
@media (min-width: 640px) { .actions--split [data-submit] { flex: none; } }
.spinner { display: none; width: 20px; height: 20px; border: 3px solid rgb(14 31 51 / .25); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-sending { pointer-events: none; opacity: .85; }
.btn.is-sending .spinner { display: inline-block; }
.after { margin-top: 16px; font-size: 14.5px; color: var(--muted); }

.recap { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; padding: 10px 12px 10px 14px; font-size: 15px; font-weight: 500; background: var(--tint); border: 1px solid var(--line); border-radius: 6px; }
.recap-edit { flex: none; min-height: 40px; padding: 0 12px; font-weight: 600; font-size: 14px; background: #fff; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.recap-edit:hover { border-color: var(--navy); }

/* Tanpa JavaScript: kedua tahap tampil, tombol pindah tahap disembunyikan. */
html:not(.js) [data-next], html:not(.js) [data-prev] { display: none; }

.foot { padding: 0 var(--gutter) 40px; text-align: center; font: 500 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }

/* ==========================================================================
   Halaman kode QR (cetak_sim/cetak_barcode)
   ========================================================================== */
.qr-page { min-height: 100svh; display: grid; align-content: start; justify-items: center; padding: 104px var(--gutter) 48px; }
.qr-page .band-kicker { text-align: center; }
.qr-title { margin: 10px 0 26px; font: 700 clamp(42px, 10vw, 84px)/.9 var(--display); text-align: center; text-transform: uppercase; }
.qr-title b { color: var(--accent); }
.js .qr-title { opacity: 0; transform: translateY(20px); transition: opacity .7s ease, transform .9s var(--ease); }
.is-ready .qr-title { opacity: 1; transform: none; }

.ticket { position: relative; width: min(380px, 100%); color: var(--ink); background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 40px 80px -40px rgb(0 0 0 / .95); }
.js .ticket { opacity: 0; transform: translateY(30px) scale(.97); transition: opacity .7s ease .1s, transform .9s var(--ease) .1s; }
.is-ready .ticket { opacity: 1; transform: none; }
.ticket-head { padding: 16px 20px; color: #fff; background: var(--navy); }
.ticket-head strong { display: block; font: 700 22px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.ticket-head span { display: block; margin-top: 4px; font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #c3d0de; }
.ticket-qr { position: relative; margin: 22px auto 0; width: 260px; height: 260px; }
.ticket-qr svg { display: block; width: 100%; height: 100%; }
/* Laser memindai sekali saat kode QR muncul, seperti di loket. */
.laser { position: absolute; left: -14px; right: -14px; top: 0; height: 3px; background: #ff3b4e; box-shadow: 0 0 14px 4px rgb(255 40 60 / .55); border-radius: 2px; opacity: 0; pointer-events: none; }
.is-ready .laser { animation: scan 1.6s var(--ease) .7s 1 both; }
@keyframes scan { 0% { top: 0; opacity: 0; } 10% { opacity: 1; } 85% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
/* Kode berbentuk SIM-yymmddHHiiss + 15 karakter acak, jadi panjang; boleh patah di mana saja. */
.ticket-code { margin-top: 14px; padding: 0 20px; text-align: center; font: 500 14px var(--mono); letter-spacing: .04em; word-break: break-all; }
.ticket-meta { margin: 4px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.ticket-steps { margin: 18px 20px 22px; padding: 14px 0 0; list-style: none; border-top: 1px dashed var(--line); font-size: 15px; }
.ticket-steps li { display: flex; gap: 10px; align-items: baseline; }
.ticket-steps li + li { margin-top: 6px; }
/* inline-block + line-height, bukan grid: html2canvas (gambar unduhan) salah menengahkan isi grid. */
.ticket-steps b { flex: none; display: inline-block; width: 22px; height: 22px; font: 500 11px/22px var(--mono); text-align: center; color: #fff; background: var(--ink); border-radius: 3px; }
.ok { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; padding: 10px 14px; font-weight: 600; color: var(--ink); background: var(--accent); border-radius: 6px; }
.ok svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.is-ready .ok svg { animation: draw .5s ease-out .4s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.qr-actions { display: grid; gap: 10px; width: min(380px, 100%); margin-top: 18px; }
.qr-actions .btn { width: 100%; }
.qr-actions .btn--ghost { color: var(--text); background: transparent; border-color: rgb(255 255 255 / .4); }
.qr-actions .btn--ghost:hover { background: rgb(255 255 255 / .06); border-color: #fff; }
.qr-note { width: min(380px, 100%); margin-top: 14px; font-size: 14px; text-align: center; color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .js .band-title span, .js .sheet, .js .qr-title, .js .ticket { opacity: 1; transform: none; }
    .ok svg { stroke-dashoffset: 0; }
}
