/* ==========================================================================
   Game pages (game.css): /games/internet-cafe-98/ and /games/pupple-pop/.
   Shared pieces live in site.css. Each page is a "room": the body takes the
   game's tone (body.page-ic / body.page-pp), the studio chrome (header,
   footer) stays on ink, and "More from GrindWill" fades back to ink through
   the shared tone mechanism (data-tone="studio").
   ========================================================================== */

:root { --tone-studio: var(--ink); }

/* ---------- Rooms ---------- */
body.page-ic {
  background: var(--tone-ic);
  --acc: #6bdbbf;              /* IC98 logo mint, 11:1 on the purple tone */
}
body.page-pp {
  background: var(--tone-pp);
  --acc: #8fdcf0;              /* bubble rim cyan, 11:1 on the sea tone */
}
.page-ic .site-foot, .page-pp .site-foot { background: var(--ink); }
/* the Games item marks the section this page belongs to */
.nav a[aria-current="true"] { color: var(--paper); }
.nav a[aria-current="true"]::after { transform: scaleX(1); transform-origin: 0 50%; }
.foot-grid a[aria-current="page"] { color: var(--paper); }

/* ---------- Hero ---------- */
.gh { position: relative; min-height: min(100svh, 1000px); display: flex; flex-direction: column; padding-top: var(--head-h); isolation: isolate; }
.gh-in {
  flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: clamp(28px, 5vh, 64px) var(--g) 32px;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: center; gap: clamp(28px, 5vw, 88px);
}
.gh--pp .gh-in { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.gh-copy { position: relative; }
.gh .lede { max-width: 31em; }
.gh .actions { margin-top: 36px; }
.gh-foot {
  width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--g) 28px;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 24px; font-size: var(--t-small); color: var(--mute);
}
.gh-foot b { color: var(--paper); font-weight: 500; white-space: nowrap; }
.cue { display: flex; align-items: center; gap: 14px; }
.cue i { position: relative; display: block; width: 1px; height: 56px; background: var(--line-2); overflow: hidden; }
.cue i::after { content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 22px; background: var(--red); transform: translateY(-100%); }
.fx .cue i::after { animation: gw-drip 2.6s cubic-bezier(.65, 0, .35, 1) infinite; }
@keyframes gw-drip { 0% { transform: translateY(-100%); } 70%, 100% { transform: translateY(260%); } }

/* IC98 logo: the artwork sits at x 411-876, y 66-351 inside the 920x430 PNG and is drawn
   on a 5 px grid, so it is only shown at 0.6 / 0.8 / 1 / 1.2 scale (3, 4, 5, 6 px per art pixel). */
.ic-logo { --s: 1; position: relative; display: block; width: calc(465px * var(--s)); height: calc(285px * var(--s)); margin: 26px 0 30px; overflow: hidden; }
.ic-logo-i { position: absolute; inset: 0; display: block; }
.ic-logo img {
  position: absolute; left: calc(-411px * var(--s)); top: calc(-66px * var(--s));
  width: calc(920px * var(--s)); height: calc(430px * var(--s)); max-width: none; image-rendering: pixelated;
}
@media (min-width: 1600px) { .ic-logo { --s: 1.2; } }
@media (max-width: 1199px) { .ic-logo { --s: 0.8; } }
@media (max-width: 419px) { .ic-logo { --s: 0.6; } }

/* IC98 hero art: the key art cropped to the player at the desk (the logo is the h1) */
.gh-art { aspect-ratio: 4 / 5; width: min(100%, calc((100svh - var(--head-h) - 150px) * 0.8)); min-width: min(100%, 300px); justify-self: end; }
.gh-art img { object-position: 0% 50%; }
/* the hero artwork is held slightly enlarged so its scroll drift never shows an edge
   (and, on IC98, so the baked-in CRT border and the logo stay outside the crop) */
.gh-media .px { transform: scale(1.1); }

/* Pupple Pop hero: key visual with the capsule laid over its corner */
.gh--pp .gh-title { margin: 22px 0 28px; }
.pp-media { position: relative; padding-bottom: clamp(44px, 6vw, 96px); }
.pp-capsule {
  position: absolute; left: clamp(-56px, -3vw, -12px); bottom: 0; display: block; width: min(46%, 616px);
  background: var(--ink-2); box-shadow: 0 0 0 6px var(--tone-pp);
}
.pp-capsule img { width: 100%; height: auto; aspect-ratio: 616 / 353; }
.pop-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none;
  /* bubbles fade out as they rise under the header */
  -webkit-mask-image: linear-gradient(to bottom, transparent var(--head-h), #000 calc(var(--head-h) + 160px));
  mask-image: linear-gradient(to bottom, transparent var(--head-h), #000 calc(var(--head-h) + 160px));
}
.gh--pp.is-over { cursor: pointer; }
.pop-ui { position: relative; display: grid; justify-items: end; margin: 0; font-size: var(--t-small); color: var(--mute); }
.pop-ui > span { grid-area: 1 / 1; transition: opacity .6s var(--ease-soft), transform .8s var(--ease); }
.pop-cash { opacity: 0; transform: translateY(8px); }
.pop-cash b { display: inline-block; min-width: 3ch; font-family: var(--fd); font-weight: 500; font-size: 17px; letter-spacing: -0.01em; color: var(--paper); font-variant-numeric: tabular-nums; }
.pop-ui.is-cash .pop-hint { opacity: 0; transform: translateY(-8px); }
.pop-ui.is-cash .pop-cash { opacity: 1; transform: none; }

/* hidden until game.js plays the intro (the boot failsafe removes .fx if it never does) */
.fx .gh .h-fade, .fx .gh-title, .fx .gh-media, .fx .pp-capsule,
.fx-rm .gh .h-fade, .fx-rm .gh-title, .fx-rm .gh-media { opacity: 0; }

/* ---------- Numbers band ---------- */
.band { position: relative; padding: clamp(24px, 3vw, 40px) 0 0; }
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px clamp(24px, 4vw, 64px); padding-top: clamp(24px, 2.6vw, 36px); }
.stats--3 .stat dd { font-size: clamp(2.4rem, 4.2vw, 4.4rem); }
.stats--3 .stat dd.is-word { font-size: clamp(1.6rem, 2.5vw, 2.6rem); padding-top: 0.3em; }
.stats--3 .stat dt { font-size: 15px; margin-top: 10px; }

/* ---------- Section heads ---------- */
.section-head .sub { margin-top: 22px; max-width: 32em; }

/* ---------- IC98: inside the cafe ---------- */
.shots h2 { max-width: 19ch; }
.shot-list { display: grid; gap: clamp(72px, 10vw, 160px); margin-top: clamp(56px, 7vw, 112px); }
.shot { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(24px, 4vw, 72px); align-items: end; }
.shot-media { grid-row: 1; grid-column: 1 / span 8; display: block; aspect-ratio: 16 / 9; cursor: zoom-in; }
.shot-text { grid-row: 1; grid-column: 9 / span 4; padding-bottom: 4px; }
.shot:nth-child(even) .shot-media { grid-column: 5 / span 8; }
.shot:nth-child(even) .shot-text { grid-column: 1 / span 4; }
.shot-media picture { transition: transform 1.4s var(--ease); }
.shot-media:hover picture { transform: scale(1.025); }
.shot-media:focus-visible { outline-color: var(--paper); }
.shot-open {
  position: absolute; right: 14px; bottom: 14px; z-index: 2; display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 13px; background: rgba(10, 13, 20, 0.86); color: var(--paper); font-size: 13px; font-weight: 500; border-radius: 2px;
  transition: opacity .6s var(--ease-soft), transform .8s var(--ease);
}
.shot-open svg { width: 12px; height: 12px; }
@media (hover: hover) and (pointer: fine) {
  .shot-open { opacity: 0; transform: translateY(6px); }
  .shot-media:hover .shot-open, .shot-media:focus-visible .shot-open { opacity: 1; transform: none; }
}
.shot-n { display: flex; align-items: center; gap: 16px; font-family: var(--fd); font-size: 15px; color: var(--acc); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.shot-n::after { content: ""; display: block; width: 56px; height: 1px; background: var(--line-2); }
.shot-text h3 { margin-top: 18px; }
.shot-text h3 + p { margin-top: 14px; color: var(--paper-2); max-width: 26em; text-wrap: pretty; }

/* ---------- Screenshot viewer (native <dialog>) ---------- */
html.v-open { overflow: hidden; }
.viewer {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: transparent; color: var(--paper); overflow: hidden; overscroll-behavior: contain;
}
.viewer::backdrop { background: transparent; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer:focus { outline: none; }
.viewer-bg { position: absolute; inset: 0; z-index: -1; background: #080a10; }
.viewer-bar, .viewer-foot { position: relative; z-index: 1; display: flex; gap: 16px 24px; padding-left: max(var(--g), env(safe-area-inset-left)); padding-right: max(var(--g), env(safe-area-inset-right)); }
.viewer-bar { align-items: center; min-height: var(--head-h); padding-top: env(safe-area-inset-top); }
.viewer-count { font-family: var(--fd); font-size: 15px; color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.viewer-count [data-v-i] { color: var(--acc); }
.viewer-title { font-family: var(--fd); font-size: 17px; font-weight: 500; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-close, .viewer-nav button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 44px; background: transparent; color: var(--paper);
  border: 1px solid var(--line-2); border-radius: 2px; cursor: pointer; font-size: 14px; font-weight: 600;
  transition: border-color .5s var(--ease), background-color .5s var(--ease);
}
.viewer-close { margin-left: auto; padding: 0 14px 0 16px; }
.viewer-close svg { width: 12px; height: 12px; }
.viewer-nav { display: flex; gap: 8px; flex: none; }
.viewer-nav button { width: 52px; }
.viewer-nav svg { width: 14px; height: 14px; transition: transform .7s var(--ease); }
.viewer-nav [data-v-prev]:hover svg { transform: translateX(-3px); }
.viewer-nav [data-v-next]:hover svg { transform: translateX(3px); }
.viewer-close:hover, .viewer-nav button:hover { border-color: var(--red); }
.viewer-close:focus-visible, .viewer-nav button:focus-visible { outline-color: var(--paper); }
.viewer-stage { position: relative; flex: 1; min-height: 0; margin: 8px max(var(--g), env(safe-area-inset-left)); touch-action: pinch-zoom; }
.viewer-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none;
  -webkit-user-drag: none; will-change: transform, opacity;
}
.viewer-img + .viewer-img { opacity: 0; }
.viewer-foot { align-items: flex-start; justify-content: space-between; padding-top: 18px; padding-bottom: calc(env(safe-area-inset-bottom) + 22px); }
.viewer-cap { max-width: 44em; min-height: 3.2em; color: var(--paper-2); font-size: 15px; line-height: 1.6; text-wrap: pretty; }
@media (max-width: 640px) {
  .viewer-foot { flex-direction: column; }
  .viewer-nav { align-self: stretch; }
  .viewer-nav button { flex: 1; }
  .viewer-cap { min-height: 4.8em; font-size: 14px; }
}

/* ---------- Pupple Pop: how it plays ---------- */
.loop h2 { max-width: 13ch; }
.loop-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px clamp(24px, 4vw, 64px); margin-top: clamp(48px, 6vw, 88px); }
.loop-list li { border-top: 1px solid var(--line); padding-top: 22px; }
.loop-n { font-family: var(--fd); font-size: 15px; color: var(--acc); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.loop-list h3 { margin-top: 18px; }
.loop-list h3 + p { margin-top: 12px; color: var(--paper-2); max-width: 22em; text-wrap: pretty; }
.thousand { margin-top: clamp(80px, 10vw, 150px); }
.thousand-n { font-family: var(--fd); font-weight: 500; font-size: clamp(5rem, 19vw, 19rem); line-height: 0.86; letter-spacing: -0.055em; margin-left: -0.05em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.thousand .stroke { height: 6px; margin-top: clamp(18px, 2.6vw, 32px); background: var(--acc); transform-origin: 0 50%; }
.thousand-t { margin-top: clamp(18px, 2.4vw, 28px); font-size: clamp(1.25rem, 2vw, 1.9rem); color: var(--paper); font-family: var(--fd); letter-spacing: -0.015em; line-height: 1.3; }

/* ---------- Fact sheet ---------- */
.facts-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 7vw, 120px); align-items: start; }
.facts h2 { max-width: 12ch; }
.facts-link { margin-top: 22px; }
.facts .spec > div { grid-template-columns: minmax(0, 2fr) minmax(0, 4fr); padding: 15px 0; }
.facts .spec dd { text-wrap: pretty; }
@media (min-width: 1000px) {
  .facts-grid { row-gap: clamp(40px, 4.4vw, 64px); grid-template-rows: auto 1fr; }
  .facts-grid > .section-head { grid-column: 1; grid-row: 1; }
  .facts-grid > .spec { grid-column: 2; grid-row: 1 / span 2; }
}

/* ---------- Steam call to action ---------- */
.cta-grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(40px, 7vw, 120px); align-items: center; }
.cta-art { aspect-ratio: 2 / 3; width: min(100%, 400px); }
.cta-art--pp img { object-position: 100% 50%; }
.cta-copy h2 { margin-top: 22px; max-width: 16ch; }
.cta-copy .t-lede { margin-top: 24px; max-width: 30em; }
.cta-copy .actions { margin-top: 36px; }

/* ---------- More from GrindWill ---------- */
.more-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.more-head .link { flex: none; }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(56px, 6vw, 96px) clamp(28px, 4vw, 72px); margin-top: clamp(48px, 6vw, 88px); align-items: start; }
.mcard-media { display: block; aspect-ratio: 16 / 10; }
.mcard-media picture { transition: transform 1.4s var(--ease); }
.mcard-media:hover picture { transform: scale(1.025); }
.mcard-text { margin-top: clamp(24px, 3vw, 36px); }
.mcard .eyebrow { margin-bottom: 16px; }
.mcard .desc { margin-top: 18px; color: var(--paper-2); max-width: 30em; text-wrap: pretty; }
.mcard .desc b { color: var(--paper); font-weight: 600; }
.mcard-link { margin-top: 22px; }

/* Dirty Dispatch: the sealed envelope, as on the home page */
.envelope { container-type: inline-size; position: relative; aspect-ratio: 16 / 10; background: #0c0809; border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; isolation: isolate; }
.envelope .ink-canvas { z-index: -1; }
.dd-title { position: relative; font-family: var(--fd); font-weight: 600; font-size: clamp(2rem, 5vw, 5rem); font-size: 10.5cqw; white-space: nowrap; letter-spacing: -0.03em; line-height: 1; text-align: center; padding: 0 6%; color: var(--paper); }
.dd-title span { display: block; }
.dd-title .b1 { filter: blur(18px); opacity: 0.9; }
.dd-title .b2 { position: absolute; inset: 0; padding: 0 6%; filter: blur(7px); opacity: 0.5; }
.stamp { position: absolute; right: 4.5%; bottom: 7%; width: clamp(64px, 13cqw, 104px); padding: 10px; background: #0c0809; border-radius: 50%; }
.stamp img { width: 100%; height: auto; aspect-ratio: 192 / 188; }
.dd-date { font-family: var(--fd); font-size: var(--t-h3); line-height: 1.02; letter-spacing: -0.03em; white-space: nowrap; }
.redact { display: grid; gap: 10px; margin-top: 28px; }
.redact span { display: block; height: 12px; background: var(--ink-3); transform-origin: 0 50%; }
.redact span:nth-child(1) { width: 92%; }
.redact span:nth-child(2) { width: 78%; }
.redact span:nth-child(3) { width: 54%; }

/* ---------- Responsive ---------- */
@media (max-width: 999px) {
  .facts-grid, .cta-grid { grid-template-columns: minmax(0, 1fr); }
  .more-grid { grid-template-columns: minmax(0, 1fr); }
  .cta-art { width: min(100%, 320px); }
  .cta-art--pp { aspect-ratio: 16 / 9; width: 100%; }
  .cta-art--pp img { object-position: 50% 50%; }
}
@media (max-width: 860px) {
  .gh-in, .gh--pp .gh-in { grid-template-columns: minmax(0, 1fr); align-content: center; padding-top: 24px; gap: 40px; }
  .gh-art { aspect-ratio: 5 / 4; width: 100%; min-width: 0; justify-self: stretch; }
  .gh-art img { object-position: 50% 100%; }
  .pp-capsule { left: 0; width: min(54%, 340px); box-shadow: 0 0 0 5px var(--tone-pp); }
  .pp-media { padding-bottom: 0; margin-bottom: 52px; }
  .pp-capsule { bottom: -52px; left: 5px; }
  .shot { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .shot .shot-media, .shot:nth-child(even) .shot-media { grid-column: 1; grid-row: 1; }
  .shot .shot-text, .shot:nth-child(even) .shot-text { grid-column: 1; grid-row: 2; }
  .loop-list { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}
@media (max-width: 640px) {
  .gh { min-height: 0; }
  .gh-in { padding-bottom: 36px; }
  .gh-foot .cue { display: none; }
  .gh-foot { flex-direction: column; align-items: flex-start; }
  .pop-ui { justify-items: start; }
  .stats--3 { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 0; }
  .stats--3 .stat { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: baseline; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
  .stats--3 .stat dt { order: 2; margin-top: 0; }
  .stats--3 .stat dd { font-size: clamp(2rem, 9vw, 2.6rem); }
  .stats--3 .stat dd.is-word { font-size: clamp(1.25rem, 5.4vw, 1.6rem); padding-top: 0; }
  .more-head { flex-direction: column; align-items: flex-start; }
  .stamp { padding: 8px; }
  .cta-art:not(.cta-art--pp) { width: min(72%, 260px); }
  .shot-open { right: 10px; bottom: 10px; padding: 7px 10px; }
  .facts .spec > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
@media (max-width: 760px) {
  /* no JS: the header wraps to two rows and scrolls with the page */
  html:not(.js) .gh { padding-top: 104px; }
}
@media (prefers-reduced-motion: reduce) {
  .shot-media picture, .mcard-media picture, .shot-open, .pop-ui > span, .viewer-nav svg { transition: none !important; }
}
