/* Telegram — "Mau jadi pacarku?" bergaya telegram klasik: kertas krem, pita biru, mesin ketik, stempel merah.
   Palet: klasik (default), hijau, sepia, mawar (field tone). */
@font-face { font-family: "Special Elite"; src: url("fonts/special-elite.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 800; src: url("fonts/playfair-display.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400 800; src: url("fonts/playfair-display-italic.woff2") format("woff2"); font-display: swap; }

:root {
  --desk: #3b3127; --desk-ink: #e9dcbc; --desk-soft: #cdbe9c;
  --paper: #efe4c8; --paper-2: #f6eeda; --card: #e9dcbc;
  --band: #2d4b73; --band-ink: #efe4c8;
  --ink: #2b2620; --muted: #5c5243; --line: #cdbe9c; --line-2: #8f806a;
  --red: #a8322d; --off: #b9ad93;
  --type: "Special Elite", "Courier New", monospace; --serif: "Playfair Display", Georgia, serif;
}
:root[data-tone="hijau"] { --desk: #263229; --desk-ink: #e6e2c6; --desk-soft: #c2c3a0; --paper: #eee6c8; --paper-2: #f5efd8; --card: #e2dcbc; --band: #2f5d46; --band-ink: #eee6c8; --ink: #232a22; --muted: #55583f; --line: #cbc59f; --line-2: #8c8a68; --red: #9c4a1d; --off: #b6b496; }
:root[data-tone="sepia"] { --desk: #2e2118; --desk-ink: #ecdcbc; --desk-soft: #cdb994; --paper: #f1e3c6; --paper-2: #f7ecd4; --card: #e8d6b0; --band: #6b4a2f; --band-ink: #f1e3c6; --ink: #2d2218; --muted: #5f4d38; --line: #d3c09a; --line-2: #947d5c; --red: #8f2f2f; --off: #bba98a; }
:root[data-tone="mawar"] { --desk: #3a2530; --desk-ink: #f1dcd6; --desk-soft: #d3b5b0; --paper: #f6e6dd; --paper-2: #fbf0e8; --card: #f0d8cd; --band: #7a2e47; --band-ink: #f6e6dd; --ink: #33202a; --muted: #6a4b55; --line: #e0c3b8; --line-2: #a07c80; --red: #c2375f; --off: #c9b0ac; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--desk); }
body { margin: 0; background: var(--desk); color: var(--ink); font: 400 16px/1.6 var(--type); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
h1, h2, p { margin: 0; }
a { color: var(--desk-ink); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
main { max-width: 480px; margin: 0 auto; padding: 22px 18px; min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.js-only { display: none; }
.js .js-only { display: inline-flex; }

/* Telegram tertutup (hanya mode "amplop" dengan JS) */
.envelope { display: none; }
.js body[data-opener="amplop"]:not(.opened) .envelope { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px; text-align: center; cursor: pointer; }
.js body[data-opener="amplop"]:not(.opened) .letter { display: none; }
.kicker { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: var(--desk-ink); }
.card { position: relative; width: min(330px, 100%); aspect-ratio: 3 / 2; background: var(--card); color: var(--ink); text-align: left; box-shadow: 0 24px 40px rgba(0, 0, 0, .45); transition: translate .3s, rotate .3s; }
.envelope:hover .card { translate: 0 -4px; rotate: -.8deg; }
.card .band { position: absolute; top: 0; left: 0; right: 0; height: 34px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; background: var(--band); color: var(--band-ink); font: 800 15px/1 var(--serif); letter-spacing: 4px; }
.card .no { font: 400 11px/1 var(--type); letter-spacing: 1px; }
.pm { position: absolute; right: 16px; top: 50px; width: 96px; height: 96px; color: var(--red); text-transform: uppercase; }
.addr { position: absolute; left: 18px; top: 64px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; max-width: 58%; }
.addr b { font-weight: 400; font-size: 22px; line-height: 1.1; text-transform: uppercase; overflow-wrap: anywhere; }
.addr small { font-size: 12px; text-transform: uppercase; }
.foot { position: absolute; left: 18px; right: 18px; bottom: 18px; padding-top: 8px; border-top: 1px dashed var(--line-2); display: flex; justify-content: space-between; gap: 8px; font-size: 12px; text-transform: uppercase; }
.envelope h1 { font: italic 500 34px/1.15 var(--serif); color: var(--desk-ink); }
.hint { font-size: 13px; color: var(--desk-soft); }

/* Kertas telegram */
.letter { flex: 1; display: flex; flex-direction: column; background: var(--paper); box-shadow: 0 20px 40px rgba(0, 0, 0, .45); }
.letter > .band { height: 40px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; background: var(--band); color: var(--band-ink); font: 800 17px/1 var(--serif); letter-spacing: 5px; }
.letter > .band span:last-child { font: 400 11px/1 var(--type); letter-spacing: 0; }
.meta { padding: 10px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.meta .r { text-align: right; }
.meta span { overflow-wrap: anywhere; }
.body { position: relative; flex: 1; padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 16px; }
.msg { min-height: 200px; font-size: 17px; line-height: 1.75; letter-spacing: .5px; white-space: pre-line; text-transform: uppercase; overflow-wrap: anywhere; }
.cursor { animation: kedip .8s steps(1) infinite; }
.skip { align-self: flex-start; min-height: 44px; padding: 0 14px; align-items: center; border: 1px solid var(--line-2); background: transparent; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.body .skip { display: none; }
.js body.typing .body .skip { display: inline-flex; }
.ask { display: flex; flex-direction: column; gap: 4px; }
.ask h2 { font: 800 32px/1.05 var(--serif); text-transform: uppercase; overflow-wrap: anywhere; }
.ask p { font-size: 14px; }
.lampiran .lbl { margin-bottom: 8px; font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.photos { display: flex; flex-wrap: wrap; gap: 10px; }
.photos figure { margin: 0; flex: 0 0 calc(50% - 5px); padding: 6px 6px 18px; background: #fffdf6; box-shadow: 0 6px 14px rgba(43, 38, 32, .22); rotate: -2deg; position: relative; }
.photos figure:nth-child(even) { rotate: 2deg; }
.photos figure:first-child:nth-last-child(1) { flex-basis: 70%; margin-inline: auto; }
.photos figure::before { content: ""; position: absolute; top: -8px; left: 50%; width: 46px; height: 16px; margin-left: -23px; background: color-mix(in srgb, var(--line) 80%, transparent); rotate: 3deg; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; filter: sepia(.25); }

/* Dengan JS: bagian bawah menunggu ketikan selesai */
.js body.typing :is(.ask, .lampiran, .reply) { display: none; }

.stamp { position: absolute; right: 20px; top: 150px; padding: 8px 16px; border: 4px double var(--red); color: var(--red); font: 800 34px/1 var(--serif); letter-spacing: 4px; opacity: .85; rotate: -12deg; pointer-events: none; animation: cap .5s ease-out both; }
.stamp.wait { border-color: var(--band); color: var(--band); }
.stamp[hidden] { display: none; }

/* Formulir balasan */
.reply { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.note { padding: 10px 12px; border: 1px dashed var(--line-2); font-size: 13px; color: var(--muted); }
.form { padding: 14px; border: 2px dashed var(--line-2); background: var(--paper-2); display: flex; flex-direction: column; gap: 8px; }
.form[hidden] { display: none; }
.form fieldset { margin: 0; padding: 0; border: 0; }
.form legend { padding: 0; margin-bottom: 6px; font-size: 12px; letter-spacing: 2px; color: var(--muted); }
.opt { position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 10px; border-bottom: 1px solid var(--line); font-size: 16px; cursor: pointer; }
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.opt .box { flex-shrink: 0; width: 22px; height: 22px; border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--red); }
.opt input:checked + .box::after { content: "✕"; }
.opt input:focus-visible + .box { outline: 2px solid var(--red); outline-offset: 2px; }
.send { margin-top: 4px; min-height: 50px; border: 0; background: var(--off); color: #fff; font: inherit; font-size: 15px; letter-spacing: 2px; cursor: not-allowed; }
.send.on { background: var(--red); cursor: pointer; }
html:not(.js) .send { background: var(--red); cursor: pointer; }
.end { padding: 16px; background: var(--ink); color: var(--paper); display: flex; flex-direction: column; gap: 6px; }
.end[hidden] { display: none; }
.end-title { font: italic 500 22px/1.2 var(--serif); }
.end-text { font-size: 13px; line-height: 1.5; color: var(--line); }
.again { align-self: flex-start; min-height: 44px; padding: 0; align-items: center; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
footer { padding: 14px 16px 24px; text-align: center; font-size: 12px; color: var(--desk-soft); }

.music-toggle { position: fixed; bottom: 16px; right: max(14px, calc(50% - 226px)); z-index: 50; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--desk-ink); border-radius: 50%; background: var(--desk); color: var(--desk-ink); cursor: pointer; }
.music-toggle svg { width: 18px; height: 18px; }
.music-toggle[aria-pressed="false"]::after { content: ""; position: absolute; width: 24px; height: 1.5px; background: var(--desk-ink); rotate: -45deg; }
html:not(.js) .music-toggle { display: none; }

/* Gerak */
@media (prefers-reduced-motion: no-preference) {
  .opening .envelope .card { translate: 0 -46px; rotate: -5deg; opacity: 0; transition: translate .75s ease-in, rotate .75s ease-in, opacity .55s ease-in .15s; }
  .opening .envelope :is(.kicker, h1, .hint) { opacity: 0; transition: opacity .3s; }
  .js body.opened .letter { animation: surat .9s cubic-bezier(.2, .8, .2, 1) both; }
  .js body.done .ask, .js body.done .lampiran, .js body.done .reply { animation: muncul .7s ease both; }
  .js body.done .lampiran { animation-delay: .15s; }
  .js body.done .reply { animation-delay: .3s; }
  .envelope .card { animation: apung 4s ease-in-out infinite; }
  .opt .box { transition: background .2s; }
}
@keyframes cap { 0% { opacity: 0; scale: 2.2; rotate: -24deg; } 70% { opacity: 1; scale: .92; rotate: -12deg; } 100% { opacity: .85; scale: 1; rotate: -12deg; } }
@keyframes kedip { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes surat { from { opacity: 0; translate: 0 70px; rotate: 1.5deg; } to { opacity: 1; translate: 0 0; rotate: 0deg; } }
@keyframes muncul { from { opacity: 0; translate: 0 14px; } to { opacity: 1; translate: 0 0; } }
@keyframes apung { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }

/* Video opsional (field "video"). */
.vk { width: min(100%, 440px); margin: 34px auto; padding: 0 20px; text-align: center; flex-direction: column; align-items: center; justify-content: center; }
.vk-judul { margin: 0 0 12px; font-weight: 700; font-size: 13px; letter-spacing: .2em; text-transform: uppercase; opacity: .85; }
.vk-layar { position: relative; width: 100%; margin: 0; padding: 10px; border-radius: 20px; border: 1px solid color-mix(in srgb, currentColor 28%, transparent); background: color-mix(in srgb, currentColor 7%, transparent); box-shadow: 0 16px 34px rgba(0, 0, 0, .16); }
.vk-layar video { display: block; width: 100%; max-height: 70vh; border-radius: 12px; background: #000; }
.vk-layar figcaption { margin-top: 10px; font-size: 14px; font-style: italic; opacity: .75; }
.vk-lampiran .vk-layar { border-radius: 4px; }
.vk-lampiran .vk-layar video { border-radius: 2px; }
