/* Beranda Blood & Destiny: adegan berlapis, hero asimetris, formulir "perjanjian". Dimuat setelah style.css. */

/* ---------- Sigil (juga dipakai topbar) ---------- */
.sigil { display: block; width: 100%; height: 100%; overflow: visible; }
.sigil .sg-drop { fill: var(--blood-hi); }
.sigil .sg-thread { stroke: var(--fate); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.sigil .sg-glint { stroke: rgba(255, 220, 200, .55); stroke-width: 2; stroke-linecap: round; }

/* ---------- Layar & topbar di beranda ---------- */
.screen-home { position: relative; min-height: calc(100dvh - var(--topbar)); padding: 0 clamp(16px, 5vw, 72px); display: grid; align-items: center; overflow-x: clip; }
body[data-screen="home"] .topbar { background: linear-gradient(180deg, rgba(10, 6, 6, .85), rgba(10, 6, 6, 0)); border-bottom: 0; box-shadow: none; backdrop-filter: none; }
/* Animasi masuk layar memakai transform (membuat containing block bagi adegan fixed -> latar melompat): di beranda cukup fade. */
.screen-home { animation-name: fade-in; }
body[data-screen="home"] .brand { visibility: hidden; } /* logo besar sudah jadi hero */

/* ---------- Adegan ---------- */
.home-scene { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--canvas); }
.hs-layer { position: absolute; inset: -4% -6%; will-change: transform;
  transform: translate3d(calc(var(--px, 0) * var(--d, 0) * -1px), calc(var(--py, 0) * var(--d, 0) * -.6px), 0); }
.hs-sky { --d: 6; background: radial-gradient(120% 80% at 30% 0%, #2a1212, var(--canvas) 70%); }
.hs-moon { --d: 14; }
.hs-moon-disc { position: absolute; left: 14%; top: 8%; width: clamp(120px, 16vw, 240px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #d9574a, #8a1f1c 58%, #4a0f0e 72%, transparent 73%);
  box-shadow: 0 0 90px 24px rgba(184, 50, 44, .28); }
.hs-far { --d: 22; }
.hs-far path { fill: #3a1b19; }
.hs-near path { fill: #22100f; stroke: rgba(184, 50, 44, .25); stroke-width: 1.5; }
.hs-mist { --d: 34; }
.hs-near { --d: 48; }
.hs-svg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 70%; }
.hs-mist-band { position: absolute; left: 0; bottom: 6%; width: 200%; height: 38%;
  background:
    radial-gradient(ellipse 12% 50% at 8% 60%, rgba(150, 86, 80, .4), transparent),
    radial-gradient(ellipse 14% 45% at 27% 50%, rgba(100, 60, 60, .25), transparent),
    radial-gradient(ellipse 12% 55% at 44% 62%, rgba(130, 76, 70, .35), transparent),
    radial-gradient(ellipse 14% 50% at 58% 58%, rgba(120, 70, 66, .3), transparent),
    radial-gradient(ellipse 12% 45% at 77% 52%, rgba(100, 60, 60, .25), transparent),
    radial-gradient(ellipse 14% 55% at 93% 60%, rgba(130, 76, 70, .32), transparent);
  animation: mist-drift 70s linear infinite; }
@keyframes mist-drift { to { transform: translateX(-50%); } }
.hs-window { animation: win-flicker 3.2s steps(1) infinite; }
.hs-window-b { animation-delay: -1.4s; }
@keyframes win-flicker { 0% { opacity: 1; } 55% { opacity: .75; } 70% { opacity: 1; } 90% { opacity: .8; } }
.hs-embers { position: absolute; inset: 0; width: 100%; height: 100%; }
.hs-vignette { position: absolute; inset: 0;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 40%), transparent 0, rgba(8, 4, 4, .35) 45%, rgba(8, 4, 4, .7) 100%); }

/* ---------- Hero ---------- */
.home-hero { position: relative; z-index: 2; width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: clamp(24px, 6vw, 96px); align-items: center; }
.home-brand { transform: perspective(900px) rotateY(calc(var(--px, 0) * 4deg)) rotateX(calc(var(--py, 0) * -3deg)); }
.home-title { font-family: var(--font-logo); font-weight: 400; font-size: clamp(3rem, 7.2vw, 6rem); line-height: .92;
  letter-spacing: .01em; color: var(--ink); display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .16em;
  text-shadow: 0 3px 14px rgba(0, 0, 0, .7); text-wrap: balance; font-size-adjust: none; }
.ht-a { flex-basis: 100%; }
.ht-amp { display: inline-block; width: .62em; height: 1em; align-self: center; }
.home-hook { margin-top: 18px; max-width: 34ch; font-size: clamp(1.05rem, 1.6vw, 1.3rem); font-style: italic; color: var(--ink); }
.home-brand .tagline { margin-top: 8px; color: var(--muted); font-size: .95rem; }

/* Animasi masuk: hanya "from"; status akhir = gaya dasar (reduced-motion mematikan animasi global). */
.ht-word { animation: ink-seep 1.4s cubic-bezier(.16, 1, .3, 1) both; }
.ht-b { animation-delay: .55s; }
@keyframes ink-seep { from { clip-path: inset(0 100% 0 0); filter: blur(8px); color: #6d1512; } }
.ht-amp .sg-drop { animation: drop-fall .7s cubic-bezier(.3, 0, .2, 1) .35s both; transform-box: fill-box; }
@keyframes drop-fall { from { transform: translateY(-40%); opacity: 0; } }
.ht-amp .sg-thread { animation: thread-draw 1.2s ease-out .9s both; }
@keyframes thread-draw { from { stroke-dashoffset: 1; } }
.home-hook, .home-brand .tagline { animation: fade-up .8s ease-out 1.3s both; }
.home-pact { animation: fade-in .6s ease-out .2s both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade-in { from { opacity: 0; } }

@media (hover: hover) {
  .home-title:hover .sg-drop { animation: drop-beat 1.3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .home-title .ht-word { transition: text-shadow .4s; }
  .home-title:hover .ht-word { text-shadow: 0 0 22px rgba(184, 50, 44, .55), 0 3px 14px rgba(0, 0, 0, .7); }
}
@keyframes drop-beat { 50% { transform: scale(1.08); filter: brightness(1.25); } }

/* ---------- Formulir perjanjian ---------- */
.home-pact { display: flex; flex-direction: column; gap: 10px; padding: 24px;
  transform: translate3d(calc(var(--px, 0) * 6px), calc(var(--py, 0) * 4px), 0); }
.pact-title { font-size: 1.6rem; color: var(--ink); margin-bottom: 2px; }
.home-pact label { font-size: .85rem; color: var(--muted); letter-spacing: .04em; margin-bottom: -4px; }
.home-pact input { width: 100%; min-width: 0; min-height: 44px; padding: 8px 12px; background: rgba(10, 6, 6, .7);
  border: 1px solid var(--line); border-radius: 8px; color: var(--ink); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5); }
.home-pact input::placeholder { color: rgba(194, 178, 155, .7); }
.home-pact input:focus { outline: none; border-color: var(--blood-hi); box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(184, 50, 44, .25); }
#in-code { font-family: var(--mono); letter-spacing: .3em; text-transform: uppercase; }
#btn-create { min-height: 50px; font-size: 1.15rem; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-style: italic; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line), transparent); }
.join-row { display: flex; gap: 8px; }
.join-row input { flex: 1; }
.home-pact .btn { min-height: 44px; position: relative; overflow: hidden; }
.btn-continue { border-style: dashed; }
.home-more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.home-more .btn { flex: 1 1 auto; margin: 0; width: auto; }
.pwa-hint { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; font-size: .9rem;
  line-height: 1.35; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }
.pwa-hint span { flex: 1; min-width: 0; }
.pwa-hint-x { margin-left: 0; width: 32px; height: 32px; font-size: 1.1rem; }
.home-pact .btn { white-space: normal; text-wrap: balance; line-height: 1.15; }

@media (hover: hover) {
  .home-pact .btn:hover:not(:disabled) { animation: quiver .3s ease-out 1; }
  #btn-create:hover:not(:disabled) { box-shadow: 0 0 0 1px #c9473f, 0 6px 22px rgba(184, 50, 44, .55); }
}
@keyframes quiver { 25% { transform: translateX(-1px) rotate(-.4deg); } 50% { transform: translateX(1px) rotate(.4deg); } 75% { transform: translateX(-.5px); } }
.home-pact .btn.is-slash::after { content: ""; position: absolute; left: -20%; top: 50%; width: 140%; height: 2px;
  background: linear-gradient(90deg, transparent, #ffd9c8, transparent); transform: rotate(-12deg) scaleX(0);
  animation: slash .32s ease-out forwards; pointer-events: none; }
@keyframes slash { to { transform: rotate(-12deg) scaleX(1); opacity: 0; } }

/* ---------- Responsif ---------- */
@media (max-width: 760px) and (min-height: 501px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .home-title { font-size: clamp(2.4rem, 11vw, 3.4rem); }
  .home-brand { transform: none; }
}
@media (max-height: 500px) {
  .screen-home { padding: 0 16px; }
  .home-hero { grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: 20px; padding: 8px 0; }
  .home-title { font-size: 2.6rem; flex-wrap: nowrap; }
  .ht-a { flex-basis: auto; }
  .home-hook { font-size: .95rem; margin-top: 8px; }
  .home-brand .tagline, .pact-title, .divider { display: none; }
  .home-pact { padding: 12px 14px; gap: 8px; }
  .home-pact label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .hs-embers { display: none; }
  .hs-layer, .home-brand, .home-pact { transform: none !important; }
}
