/* Homse: a PS1 split-screen phone call. Two rooms, one seam, one endless call. */
@font-face { font-family: "Alfa Slab One"; src: url("/fonts/alfa-slab.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("/fonts/rubik.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jbmono.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #3a2f2f; --ink: #f4efe8; --accent: #ffd34d;
  --grey: #8d8682; --wood: #6b4430; --chestnut: #a4532a; --mauve: #8a5c74; --pink: #f0a3c0; --cream: #efe6dc;
  --seam: #141012; --paper-ink: #2b2220; --stamp: #b3261e;
  --font-display: "Alfa Slab One", Georgia, serif;
  --font-body: "Rubik", system-ui, sans-serif;
  --sw: clamp(56px, 6.5vw, 120px);
}
html, body { background: var(--bg); }
body { overflow-x: hidden; }
img { image-rendering: pixelated; user-select: none; -webkit-user-drag: none; }

/* ---------- desktop: two halves side by side ---------- */
.game { position: relative; width: 100%; height: 100vh; height: 100svh; overflow: hidden; }
.room { position: absolute; top: 0; height: 100%; overflow: hidden; container-type: size; }
.room.his { left: 0; width: 50%; }
.room.hers { left: calc(50% - var(--sw) / 2); width: calc(50% + var(--sw) / 2);
  -webkit-mask: url("/img/seam-mask.png") 0 0 / var(--sw) 100% no-repeat, linear-gradient(#000 0 0) var(--sw) 0 / 100% 100% no-repeat;
          mask: url("/img/seam-mask.png") 0 0 / var(--sw) 100% no-repeat, linear-gradient(#000 0 0) var(--sw) 0 / 100% 100% no-repeat; }
.stage { position: absolute; left: 50%; top: 50%; width: max(100cqw, 100cqh); aspect-ratio: 1;
  transform: translate(calc(-50% + var(--px, 0px)), calc(-50% + var(--py, 0px))); transition: transform .9s cubic-bezier(.2,.7,.2,1); }
.room.hers .stage { left: calc(50% + var(--sw) / 4); }
.stage > .bg, .close-stage > .bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lay { position: absolute; max-width: none; pointer-events: none; }
.seam { position: absolute; pointer-events: none; z-index: 5; max-width: none; }
.seam.v { left: calc(50% - var(--sw) / 2); top: 0; width: var(--sw); height: 100%; }
.seam.h { display: none; }

/* ---------- title: game type, inverted across the seam ---------- */
.title { position: absolute; z-index: 6; left: 0; right: 0; top: clamp(-46px, -3.6vh, -22px); text-align: center; pointer-events: none; }
.title h1, .title .tick { margin: 0; padding: 20px 32px; font-family: var(--font-display); font-weight: 400; line-height: 1.4; letter-spacing: .01em;
  background: linear-gradient(90deg, var(--pink) 50%, #cfc6c2 50%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(20,16,18,.55)); }
.title { display: flex; flex-direction: column; align-items: center; }
.title h1 { font-size: clamp(56px, min(8.4vw, 11.5vh), 150px); text-transform: capitalize; }
.title .tick { font-size: clamp(20px, min(2.2vw, 3.4vh), 40px); margin-top: calc(-1 * clamp(60px, 7.4vh, 90px)); background: #f4efe8; -webkit-background-clip: text; background-clip: text; }
.title h1 { background-attachment: fixed; }

/* ---------- the paper on his wall: contract, lore, risk ---------- */
.paper { position: absolute; z-index: 3; color: var(--paper-ink); container-type: inline-size; }
.paper-in { position: absolute; inset: 7% 5.5% 6%; display: flex; flex-direction: column; gap: max(6px, 2.6cqw); }
.p-head { margin: 0; font: 400 max(20px, 5.4cqw)/1 var(--font-display); color: #3a2420; letter-spacing: .02em; transform: rotate(-1.2deg); }
.paper [data-ca] { display: block; font: 500 max(16px, 3.6cqw)/1.3 "JetBrains Mono", ui-monospace, monospace; color: #1d1414; }
.paper .lore { margin: 0; font: 500 max(16px, 4.6cqw)/1.3 var(--font-body); max-width: 96%; }
.paper .risk { margin: auto 0 0; font: 400 max(16px, 3.2cqw)/1.25 var(--font-body); color: #74625c; }
.copied { position: absolute; right: 5%; bottom: 8%; width: 30%; opacity: 0; transform: rotate(-9deg) scale(1.25); pointer-events: none; transition: opacity .15s, transform .15s ease-out; }
.paper.is-copied .copied { opacity: .92; transform: rotate(-9deg) scale(1); }

/* the stamp on the table: Copy */
.stamp { position: absolute; left: 53.5%; top: 136%; width: 12.5%; aspect-ratio: 217 / 330; padding: 0; min-height: 0; border: 0; background: none; cursor: pointer; z-index: 4; }
.stamp img { position: absolute; left: 0; bottom: 0; width: 100%; transition: transform .6s cubic-bezier(.2,.9,.3,1.2); }
.stamp .st-down { opacity: 0; width: 122%; left: -10%; }
.stamp .st-label { position: absolute; left: 50%; bottom: 6%; transform: translateX(-50%); font: 700 16px/1 var(--font-body); color: #fff3e8; letter-spacing: .04em; white-space: nowrap; text-shadow: 0 1px 0 #5c120d; text-transform: uppercase; }
.stamp:hover .st-up { transform: translateY(-6%); transition-duration: .25s; }
.stamp:active .st-up, .stamp.is-down .st-up { opacity: 0; transition: none; }
.stamp:active .st-down, .stamp.is-down .st-down { opacity: 1; }

/* ---------- his phone: the call button ---------- */
.phone { position: absolute; z-index: 3; padding: 0; min-height: 0; border: 0; background: none; cursor: pointer; }
.phone > img { position: absolute; inset: 0; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.2,.9,.3,1.2); }
.phone .dial { position: absolute; left: 41.2%; top: 28.6%; width: 42%; aspect-ratio: 1; transform: scaleY(.8); transform-origin: 50% 0; filter: brightness(.82) contrast(1.05); }
.phone .dial img { width: 100%; transition: transform .6s cubic-bezier(.3,.7,.3,1); }
.phone:hover > img, .phone:hover .dial { translate: 0 -3%; transition: translate .25s cubic-bezier(.3,1.6,.5,1); }
.phone:active > img { transform: translateY(3%) scale(.98); transition-duration: 35ms; }
.game.dialing .phone .dial img { transform: rotate(-290deg); transition-duration: .7s; }
.prompt { position: absolute; z-index: 3; margin: 0; display: flex; align-items: center; justify-content: center; gap: .35em; pointer-events: none; white-space: nowrap;
  font: 700 clamp(16px, 2.2cqw, 22px)/1 var(--font-body); color: #fff6e6; letter-spacing: .06em;
  text-shadow: 2px 0 #1a1214, -2px 0 #1a1214, 0 2px #1a1214, 0 -2px #1a1214, 2px 2px #1a1214; animation: blink 1.6s steps(2) infinite; }
.prompt span { color: #f0a3c0; font-size: 1.2em; }
@keyframes blink { 50% { opacity: .55; } }

/* ---------- her frames: pump.fun, X, chart ---------- */
.frame { position: absolute; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6%;
  text-decoration: none; color: #3a2420; transition: transform .25s cubic-bezier(.3,1.6,.5,1); transform-origin: 50% -12%; }
.frame img { width: 40%; height: auto; aspect-ratio: 1; object-fit: contain; image-rendering: auto; }
.frame .cap { font: 700 16px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; }
.frame:hover { transform: rotate(-4deg); }
@container (max-width: 640px) { .frame .cap { display: none; } .frame img { width: 52%; } }
.frame:active { transform: rotate(2deg) scale(.97); transition-duration: 35ms; }
.frame.is-off { opacity: .55; }

/* ---------- subtitles: game type ---------- */
.sub { position: absolute; z-index: 4; left: 8%; right: 8%; bottom: 3.5%; margin: 0; text-align: center; min-height: 1.3em;
  font: 700 clamp(18px, 2.6cqw, 28px)/1.25 var(--font-body); color: #fff;
  text-shadow: 2px 0 #140f10, -2px 0 #140f10, 0 2px #140f10, 0 -2px #140f10, 2px 2px #140f10, -2px 2px #140f10; }
.sub b { font-weight: 800; }
.sub[data-sub="h"] b { color: #ffb37a; }
.sub[data-sub="m"] b { color: var(--pink); }
.room.his .sub { bottom: 2%; }

/* ---------- rig states ---------- */
.head { opacity: 0; }
.head.on { opacity: 1; }
.fx { opacity: 0; }
.game[data-state="laugh"] .h-dash, .game[data-state="laugh"] .m-dash { opacity: 1; animation: shout .32s steps(2) infinite; }
.game[data-state="sleep"] .zz { opacity: 1; animation: zz 2.4s steps(6) infinite; }
.game.ringing .ring { opacity: 1; animation: shout .2s steps(2) infinite; }
.game.ringing .mphone { animation: ringer .12s steps(2) infinite; }
@keyframes shout { 50% { transform: translate(4%, -6%) scale(1.08); } }
@keyframes zz { 0% { transform: translate(0,0) scale(.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(40%,-120%) scale(1.1); opacity: 0; } }
@keyframes ringer { 50% { transform: rotate(4deg) translateY(-3%); } }
.game[data-state="laugh"] .room .head.on { animation: guffaw .28s steps(2) infinite; }
@keyframes guffaw { 50% { transform: rotate(-3deg) translateY(-1.5%); } }
.leg { animation: tap 1.8s ease-in-out infinite; }
@keyframes tap { 50% { transform: rotate(-6deg); } }
.mlegs { animation: swing 2.6s ease-in-out infinite; }
@keyframes swing { 0%,100% { transform: rotate(-3.5deg); } 50% { transform: rotate(3.5deg); } }
.game[data-state="sleep"] .leg, .game[data-state="sleep"] .mlegs { animation-play-state: paused; }
.static { position: absolute; inset: 0; z-index: 3; background: url("/img/static.webp") 0 0 / 9% auto; image-rendering: pixelated; opacity: 0; pointer-events: none; transition: opacity .12s steps(2); }
.game[data-state="drop"] .static { opacity: .93; animation: snow .18s steps(3) infinite; }
@keyframes snow { 33% { background-position: 37% 61%; } 66% { background-position: 71% 13%; } }
.game.paused * { animation-play-state: paused !important; }

/* ---------- the close-up of the paper (phones only) ---------- */
.close { display: none; }

/* ---------- phones and portrait screens: rooms stacked, paper close-up below ---------- */
@media (max-aspect-ratio: 1/1), (max-width: 700px) {
  :root { --sh: clamp(40px, 11vw, 80px); --gw: min(100vw, 900px); }
  .game { height: auto; overflow: visible; }
  .room { position: relative; height: auto; width: 100% !important; left: 0 !important; aspect-ratio: 1 / 1.02; }
  .room.hers { margin-top: calc(var(--sh) / -2);
    -webkit-mask: url("/img/seam-mask-h.png") 0 0 / 100% var(--sh) no-repeat, linear-gradient(#000 0 0) 0 var(--sh) / 100% 100% no-repeat;
            mask: url("/img/seam-mask-h.png") 0 0 / 100% var(--sh) no-repeat, linear-gradient(#000 0 0) 0 var(--sh) / 100% 100% no-repeat; }
  .room .stage { width: 112%; left: 50%; }
  .room.his .stage { left: 52%; top: 52%; }
  .room.hers .stage { left: 47%; top: 53%; }
  .seam.v { display: none; }
  .seam.h { display: block; left: 0; width: 100%; height: var(--sh); top: calc(var(--gw) * 1.02 - var(--sh) / 2); }
  .title { top: -22px; }
  .title h1 { font-size: clamp(40px, 13vw, 110px); background: var(--pink); -webkit-background-clip: text; background-clip: text; }
  .title .tick { font-size: clamp(20px, 5vw, 34px); margin-top: -48px; }
  .sub { font-size: clamp(16px, 4.2vw, 22px); bottom: 3%; }
  .prompt { font-size: 16px; }
  .close { display: block; position: relative; }
  .close-stage { position: relative; width: 100%; aspect-ratio: 615 / 710; overflow: hidden; }
  .close-stage .paper { left: 2.44% !important; top: 3.94% !important; width: 95.12% !important; height: 51.69% !important; }
  .close-stage .paper .stamp { width: 13%; }
  .close-stage .paper-in { inset: 4.5% 4.5% 2.5%; gap: 5px; }
  .room.hers .stage { width: max(112%, 440px); }
}
@media (max-aspect-ratio: 1/1) and (min-width: 701px) {
  .game { max-width: 900px; margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .stage { transition: none; }
}

/* 404: the line is dead */
.lost .tick { font-family: var(--font-body); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.lost .phone { display: block; }
.lost .static { opacity: .93; }
