/* Arah 1B · Tinta Biru-Hitam — kertas putih dingin, satu warna tinta pena */
:root {
  --paper: #f3f4f1;
  --paper-2: #e9ebe6;
  --ink: #1c2b4a;
  --ink-deep: #14203a;
  --ink-wash: #3b4f7a;
  --ink-soft: #56647e;
  --rule: #d6dad3;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --serif: "Newsreader", Georgia, serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--serif); color: var(--ink); overflow: hidden;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .15 0 0 0 0 .25 0 0 0 .055 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
button:focus-visible, a:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 4px; }
[hidden] { display: none !important; }

#inkFill .s1 { stop-color: var(--ink-deep); }
#inkFill .s2 { stop-color: var(--ink); }
#inkFill .s3 { stop-color: var(--ink-wash); }
.flood-c { fill: var(--ink); }

.stage { position: relative; height: 100dvh; max-width: 440px; margin: 0 auto; }
.meta { position: absolute; z-index: 5; top: max(22px, env(safe-area-inset-top)); left: 32px; right: 76px;
  display: flex; justify-content: space-between; gap: 12px; font-size: 15px; font-style: italic; color: var(--ink-soft); transition: opacity .6s; }
.meta.gone { opacity: 0; }

.scene {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 70px 32px max(30px, env(safe-area-inset-bottom));
  opacity: 0; visibility: hidden; transition: opacity 1s var(--ease), visibility 0s 1s;
}
.scene.active { opacity: 1; visibility: visible; transition-delay: 0s; }

.quiet { margin: 0; font-size: 16px; font-style: italic; color: var(--ink-soft); line-height: 1.5; }
.text-btn { min-height: 44px; padding: 0 6px; font-size: 16px; font-style: italic; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.pen-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px; border-radius: 999px;
  border: 1px solid var(--ink); color: var(--ink); font-size: 18px; font-style: italic; text-decoration: none; background: transparent;
  transition: background .3s, color .3s; animation: appear .9s var(--ease) both;
}
.pen-btn:active { background: var(--ink); color: var(--paper); }
@keyframes appear { from { opacity: 0; filter: blur(4px); } }

/* ---------- 1. Kunci ---------- */
.big-name { margin: 6px 0 26px; font-size: clamp(64px, 20vw, 84px); font-weight: 300; font-style: italic; letter-spacing: -.025em; line-height: 1; }
.dots { display: flex; gap: 10px; margin-bottom: 14px; }
.dots svg { width: 30px; height: 30px; overflow: visible; }
.dots circle { fill: transparent; stroke: var(--ink); stroke-width: 1; transition: fill .35s var(--ease), transform .35s var(--ease); transform-origin: center; transform-box: fill-box; }
.dots svg.on circle { fill: var(--ink); stroke-width: 0; transform: scale(1.18); }
.dots.wrong { animation: shake .45s; }
.dots.wrong circle { fill: transparent !important; transition: none; }
@keyframes shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.hint { min-height: 24px; margin: 0 0 22px; font-size: 16px; font-style: italic; color: var(--ink-soft); }
.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 6px 28px; }
.keypad button { width: 74px; height: 64px; font-size: 30px; font-weight: 300; position: relative; border-radius: 50%; }
.keypad button::after { content: ""; position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%;
  border: 1px solid var(--ink); opacity: 0; transform: scale(.6); transition: opacity .3s, transform .3s var(--ease); }
.keypad button:active::after, .keypad button.tap::after { opacity: .35; transform: none; transition-duration: 0s; }
.keypad .blank { visibility: hidden; }
.keypad svg { vertical-align: middle; }

/* ---------- 2. Tetes tinta ---------- */
.blot-wrap { position: relative; width: 240px; height: 240px; margin-bottom: 34px; }
.blot { position: absolute; inset: 0; border-radius: 50%; touch-action: none; user-select: none; -webkit-user-select: none; }
.blot svg { width: 100%; height: 100%; overflow: visible; }
.blot-g { transform-origin: 110px 110px; animation: breathe 5s var(--ease) infinite alternate; transition: transform .2s; }
@keyframes breathe { from { transform: scale(.94) rotate(-4deg); } to { transform: scale(1.03) rotate(3deg); } }
.blot.holding .blot-g { animation: none; }
.blot-name { position: absolute; inset: 0; display: grid; place-items: center; color: var(--paper); font-size: 64px; font-weight: 300; font-style: italic; letter-spacing: -.02em; pointer-events: none; }
.drop-intro { margin: 0 0 14px; font-size: 20px; line-height: 1.55; font-weight: 300; white-space: pre-line; }
.flood { position: fixed; inset: 0; z-index: 30; pointer-events: none; display: grid; place-items: center; opacity: 0; }
.flood svg { width: 240px; height: 240px; overflow: visible; transition: transform 1.3s cubic-bezier(.6, 0, .2, 1); }
.flood.on { opacity: 1; }
.flood.on svg { transform: scale(9); }
.flood.out { opacity: 0; transition: opacity 1.4s var(--ease); }

/* ---------- 3. Surat ---------- */
#finale { justify-content: safe center; overflow-y: auto; scrollbar-width: none; }
#finale::-webkit-scrollbar { display: none; }   /* pesan panjang bisa digulir */
#letter { justify-content: flex-start; padding-top: calc(max(22px, env(safe-area-inset-top)) + 40px); }
.sheet { width: 100%; flex: 1; min-height: 0; overflow-y: auto; text-align: left; padding: 18px 2px 30px; scroll-behavior: smooth;
  -webkit-mask: linear-gradient(transparent, #000 24px, #000 calc(100% - 40px), transparent); mask: linear-gradient(transparent, #000 24px, #000 calc(100% - 40px), transparent); }
.greet { margin: 0 0 20px; font-size: 44px; font-weight: 300; font-style: italic; letter-spacing: -.02em; }
.body p { margin: 0 0 22px; font-size: 19px; line-height: 1.75; font-weight: 400; }
.body .w { opacity: 0; filter: blur(5px); color: var(--ink-wash); transition: opacity .9s var(--ease), filter .9s var(--ease), color 1.6s var(--ease); }
.body .w.in { opacity: 1; filter: none; color: var(--ink); }
.sign { margin-top: 10px; opacity: 0; transition: opacity 1.2s var(--ease); }
.sign.show { opacity: 1; }
.closing { margin: 0; font-size: 18px; font-style: italic; color: var(--ink-soft); }
.signature { margin: 4px 0 0; font-size: 40px; font-style: italic; font-weight: 300; letter-spacing: -.02em; }
.actions { min-height: 76px; display: flex; align-items: center; justify-content: center; padding-top: 10px; }

/* ---------- 4. Foto ---------- */
#memories { padding-left: 0; padding-right: 0; }
.strip { width: 100%; display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 26px 0 18px 15%; scrollbar-width: none; }
.strip::after { content: ""; flex: 0 0 calc(15% - 18px); } /* ruang di ujung kanan supaya foto terakhir bisa di tengah */
.strip::-webkit-scrollbar { display: none; }
.strip { cursor: grab; }
.strip.grabbing { cursor: grabbing; scroll-snap-type: none; }
.strip.grabbing .print { pointer-events: none; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 2px 0 6px; }
.pg-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--rule); background: transparent; color: var(--ink); display: grid; place-items: center; transition: opacity .2s, background .2s; }
.pg-btn:hover { background: var(--paper-2); }
.pg-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.pg-dots { display: flex; gap: 4px; }
.pg-dots button { width: 24px; height: 24px; display: grid; place-items: center; }
.pg-dots button::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--ink); transition: background .2s, transform .2s; }
.pg-dots button.on::before { background: var(--ink); transform: scale(1.15); }
.print { flex: 0 0 70%; scroll-snap-align: center; text-align: left; }
.print button { display: block; width: 100%; aspect-ratio: 4 / 5; position: relative; overflow: hidden; background: var(--paper-2); }
.print img { width: 100%; height: 100%; object-fit: cover; display: block; filter: grayscale(1) contrast(1.15) brightness(1.05); transition: filter 1.4s var(--ease); }
.print .tone { position: absolute; inset: 0; background: var(--ink); mix-blend-mode: screen; transition: opacity 1.4s var(--ease); }
.print .wash { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px; border-radius: 50%; background: transparent;
  box-shadow: 0 0 0 0 rgba(243, 244, 241, .0); pointer-events: none; }
.print.dev img { filter: none; }
.print.dev .tone { opacity: 0; }
.print.dev .wash { animation: wash 1.2s var(--ease); }
@keyframes wash { from { box-shadow: 0 0 0 0 rgba(243, 244, 241, .7); } to { box-shadow: 0 0 0 260px rgba(243, 244, 241, 0); } }
.print h3 { margin: 14px 0 2px; font-size: 22px; font-weight: 400; font-style: italic; }
.print time { font-size: 14px; color: var(--ink-soft); }
.print p { margin: 8px 0 0; font-size: 16px; line-height: 1.55; color: var(--ink); opacity: 0; transition: opacity 1s var(--ease) .4s; }
.print.dev p { opacity: 1; }
.count { margin: 4px 0 18px; font-size: 15px; font-style: italic; color: var(--ink-soft); min-height: 22px; }

/* ---------- 5. Penutup ---------- */
.hug-zone { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.hug { position: relative; width: 220px; height: 220px; border-radius: 50%; touch-action: none; user-select: none; -webkit-user-select: none; }
.hug svg { width: 100%; height: 100%; overflow: visible; }
.hug-ring { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 6; animation: turn 30s linear infinite; transform-origin: center; transform-box: fill-box; }
@keyframes turn { to { transform: rotate(360deg); } }
.hug-label { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-style: italic; transition: color .3s; pointer-events: none; }
.hug.deep .hug-label { color: var(--paper); }
.end { display: flex; flex-direction: column; align-items: center; animation: appear 1.4s var(--ease) both; max-width: 340px; }
.end-title { margin: 0 0 14px; font-size: 50px; font-weight: 300; font-style: italic; letter-spacing: -.025em; line-height: 1.05; }
.end-msg { margin: 0 0 6px; font-size: 21px; line-height: 1.6; font-weight: 300; }
.end-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 30px; }

/* tombol musik */
.os-music { position: fixed; z-index: 40; top: max(12px, calc(env(safe-area-inset-top) - 8px)); right: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--rule); background: rgba(243, 244, 241, .8); color: var(--ink); display: grid; place-items: center; }
.os-music.on svg { animation: turn 6s linear infinite; }

@media (max-height: 700px) {
  .big-name { font-size: 54px; margin-bottom: 16px; }
  .keypad button { height: 56px; }
  .blot-wrap { width: 190px; height: 190px; margin-bottom: 22px; }
  .blot-name { font-size: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .2s !important; }
}
