/* iNKMOTH — site styles
   Layout: one dark screen with a thin paper frame and a status bar, like the
   game's own UI. Two colours (Ink, Paper) and dither for every grey; red only
   for the Script's voice, as in MIMAI. Pixel art is always scaled with hard
   pixels. */

:root {
  --ink: #0b0b0d;
  --ink-2: #131317;
  --paper: #e8e8e8;
  --thought: #b9bec4;
  --dim: #7d8088;
  --line: #2a2b30;
  --red: #e0332b;

  --f-pixel: "DotGothic16", "MS Gothic", "Osaka-Mono", ui-monospace, monospace;
  --f-term: "VT323", "DotGothic16", ui-monospace, Consolas, monospace;

  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --wrap: 1120px;
  --frame: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font: 18px/1.75 var(--f-pixel);
  -webkit-font-smoothing: none;
  font-smooth: never;
  cursor: url("../img/studio/cursor.png") 0 0, auto;
  overflow-x: hidden;
}
a, button, [role="button"], label { cursor: url("../img/studio/cursor_hand.png") 12 0, pointer; }
img.px, .px img { image-rendering: pixelated; image-rendering: crisp-edges; }
::selection { background: var(--paper); color: var(--ink); }
a { color: var(--paper); text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { font-weight: 400; margin: 0; text-wrap: balance; letter-spacing: 0.02em; }
:focus-visible { outline: 2px solid var(--paper); outline-offset: 4px; }

/* ---------------------------------------------------------- the screen frame */
.frame {
  position: fixed; inset: var(--frame); pointer-events: none; z-index: 40;
  border: 1px solid rgba(232, 232, 232, 0.55);
}
.frame::before, .frame::after {
  content: ""; position: absolute; width: 9px; height: 9px; background: var(--paper);
}
.frame::before { top: -5px; left: -5px; }
.frame::after { bottom: -5px; right: -5px; }

/* the bottom bar: what the game's status line looks like */
.statusbar {
  position: fixed; left: var(--frame); right: var(--frame); bottom: var(--frame); z-index: 41;
  display: flex; gap: 28px; align-items: center; flex-wrap: nowrap;
  height: 40px;
  padding: 0 max(18px, env(safe-area-inset-right, 0px)) 0 max(18px, env(safe-area-inset-left, 0px));
  background: var(--ink); border-top: 1px solid rgba(232, 232, 232, 0.55);
  font: 22px/1 var(--f-term); color: var(--thought);
  white-space: nowrap; overflow: hidden;
}
.statusbar .sp { flex: 1; }
.statusbar b { color: var(--paper); font-weight: 400; }
.statusbar .keys { color: var(--dim); }
.statusbar .clock.ten { color: var(--paper); animation: blink 1s steps(1) infinite; }
@media (max-width: 760px) { .statusbar .keys, .statusbar .hide-sm { display: none; } }

/* ---------------------------------------------------------- layout */
main { position: relative; z-index: 1; }
.wrap {
  width: 100%; max-width: calc(var(--wrap) + 80px); margin: 0 auto;
  padding-left: calc(var(--gutter) + 24px); padding-right: calc(var(--gutter-r) + 24px);
}
section { padding-block: 120px; }
.eyebrow {
  font: 22px/1 var(--f-term); color: var(--dim); letter-spacing: 0.12em; text-transform: lowercase;
  display: flex; align-items: center; gap: 14px; margin-bottom: 28px;
}
.eyebrow::after { content: ""; flex: 1; height: 5px; max-width: 280px; background: url("../img/studio/ui_dither_bar.png") left center / auto 5px repeat-x; image-rendering: pixelated; opacity: 0.8; }
.h-xl { font-size: clamp(40px, 7vw, 84px); line-height: 1.05; }
.h-l { font-size: clamp(30px, 4.4vw, 52px); line-height: 1.15; }
.h-m { font-size: 28px; line-height: 1.3; }
.lede { font-size: 21px; color: var(--thought); max-width: 34em; }
.prose { max-width: 36em; color: var(--thought); display: grid; gap: 22px; }
.prose em { color: var(--paper); font-style: normal; }
.dim { color: var(--dim); }
.red { color: var(--red); }

/* a dithered rule */
.dither-rule {
  height: 8px; margin-block: 0;
  background-image: radial-gradient(var(--paper) 0.9px, transparent 1.1px);
  background-size: 4px 4px; opacity: 0.35;
  -webkit-mask-image: linear-gradient(90deg, #000, transparent);
  mask-image: linear-gradient(90deg, #000, transparent);
}

/* ---------------------------------------------------------- the thought box (menus) */
.thoughts {
  position: relative; border: 1px solid var(--paper); padding: 30px 26px 22px;
  background: var(--ink);
}
.thoughts > .legend {
  position: absolute; top: -14px; left: 22px; padding: 0 10px; background: var(--ink);
  font: 24px/1 var(--f-term); color: var(--thought);
}
.thoughts ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.thoughts li a, .thoughts li button, .thoughts li .item {
  display: grid; grid-template-columns: 46px 1fr auto; align-items: baseline; gap: 10px;
  width: 100%; padding: 10px 12px; font: inherit; color: var(--thought);
  background: none; border: 0; text-align: left;
}
.thoughts .n { font: 24px/1 var(--f-term); color: var(--dim); }
.thoughts .t { font-size: 26px; line-height: 1.2; }
.thoughts .meta { font: 20px/1 var(--f-term); color: var(--dim); }
.thoughts li a:hover, .thoughts li a:focus-visible, .thoughts li button:hover, .thoughts li button:focus-visible,
.thoughts li.on a, .thoughts li.on button {
  background: var(--paper); color: var(--ink); outline: none;
}
.thoughts li a:hover .n, .thoughts li a:focus-visible .n, .thoughts li.on a .n,
.thoughts li a:hover .meta, .thoughts li a:focus-visible .meta, .thoughts li.on a .meta,
.thoughts li button:hover .n, .thoughts li button:focus-visible .n { color: var(--ink); }
.thoughts li.locked .item { color: var(--dim); }
.thoughts li.locked .t { letter-spacing: 0.1em; }
/* the thought nobody sent: there for half a second, can't be chosen */
.thoughts li.ghost { animation: ghost 0.55s steps(1) forwards; pointer-events: none; }
.thoughts li.ghost .item { color: var(--paper); }
@keyframes ghost { 0% { opacity: 1; } 100% { opacity: 0; } }

/* ---------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 12px; padding: 12px 22px 13px;
  border: 1px solid var(--paper); background: var(--ink); color: var(--paper);
  font: 22px/1 var(--f-pixel);
}
.btn:hover, .btn:focus-visible { background: var(--paper); color: var(--ink); }
.btn.ghost-btn { border-color: var(--line); color: var(--dim); }
.btn.ghost-btn:hover { background: var(--ink); color: var(--dim); }
.btn .k { font: 20px/1 var(--f-term); opacity: 0.7; }
.btns { display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------------------------------------------------------- the boot (studio) */
.boot {
  position: fixed; inset: 0; z-index: 100; background: var(--ink);
  display: grid; place-items: center;
}
.boot.done { animation: bootout 0.5s steps(4) forwards; }
html.booting, html.booting body { overflow: hidden; }
/* another language is on its way (i18n.js): don't flash the English first */
html.i18n-wait main, html.i18n-wait .statusbar { visibility: hidden; }
@keyframes bootout { to { opacity: 0; visibility: hidden; } }
/* the game's logo, on the game's own 1920x1080 stage, scaled to fit (boot.js) */
.boot { overflow: hidden; }
.boot .stage {
  position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(var(--s, .5)); transform-origin: 50% 50%;
}
.boot .stage > * { position: absolute; left: 0; top: 0; visibility: hidden; will-change: transform; }
.boot .stage img { image-rendering: pixelated; image-rendering: crisp-edges; }
.boot .stage .sp { width: 8px; height: 8px; background: var(--paper); }
.boot .stage .ln { width: 976px; height: 4px; background: var(--dim); transform-origin: 50% 50%; }
.boot .stage .cover { width: 1920px; height: 1080px; background: var(--ink); }
.boot .stage .scanl {   /* the game's scanlines: one dark line every four pixels */
  width: 1920px; height: 1080px; visibility: visible; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(10, 10, 14, .27) 3px 4px);
}
.boot.going .skip { visibility: hidden; }
.boot .skip {
  position: absolute; bottom: 70px; left: 0; right: 0; text-align: center;
  font: 22px/1 var(--f-term); color: var(--dim);
}

/* ---------------------------------------------------------- studio hero */
.hero-studio { min-height: 100svh; display: grid; align-content: center; padding-block: 120px 140px; }
.hero-studio .mark { display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; margin-bottom: 40px; }
.hero-studio .mark h1 { margin: 0; line-height: 0; }
/* the game's wordmark (the moth sits on the i), at whole-pixel sizes: 61px art */
.hero-studio .mark img.word { display: block; width: 854px; height: auto; max-width: 100%; }
@media (max-width: 1000px) { .hero-studio .mark img.word { width: 610px; } }
@media (max-width: 700px)  { .hero-studio .mark img.word { width: 366px; } }
@media (max-width: 420px)  { .hero-studio .mark img.word { width: 305px; } }
.flight {
  position: absolute; width: 56px; height: 32px; pointer-events: none; z-index: 2;
  background: url("../img/studio/moth_a.png") center / 56px 32px no-repeat; image-rendering: pixelated;
  animation: flap 0.14s steps(1) infinite, flight 14s linear infinite;
}
@keyframes flap { 50% { background-image: url("../img/studio/moth_b.png"); } }
@keyframes flight {
  0% { transform: translate(105vw, 30vh); }
  25% { transform: translate(70vw, 18vh); }
  50% { transform: translate(40vw, 34vh); }
  75% { transform: translate(14vw, 20vh); }
  100% { transform: translate(-20vw, 28vh); }
}

/* ---------------------------------------------------------- game feature (studio) */
.feature {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 56px; align-items: center;
}
@media (max-width: 900px) { .feature { grid-template-columns: 1fr; gap: 36px; } }
.screen {
  position: relative; display: block; border: 1px solid var(--paper); background: var(--ink); overflow: hidden;
  aspect-ratio: 16 / 9; max-width: 100%;
}
a.screen:hover img, a.screen:focus-visible img { filter: contrast(1.15); }
a.screen:hover .tag, a.screen:focus-visible .tag { background: var(--ink); color: var(--paper); outline: 1px solid var(--paper); }

/* dust, drifting, like the game's content note (site.js) */
.dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; image-rendering: pixelated; }
.hero-studio { position: relative; }
.hero-studio > *:not(.dust) { position: relative; z-index: 1; }
.screen img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.screen .tag {
  position: absolute; left: 0; top: 0; padding: 6px 12px; background: var(--paper); color: var(--ink);
  font: 20px/1 var(--f-term);
}
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 22px; font: 22px/1.3 var(--f-term); color: var(--thought); margin-block: 26px 32px; }
.facts dt { color: var(--dim); }
.facts dd { margin: 0; }

/* ---------------------------------------------------------- terminal (news) */
.term {
  border: 1px solid var(--line); background: #070708; padding: 24px 26px;
  font: 22px/1.45 var(--f-term); color: #cfd2d6; overflow-x: auto;
}
.term .p { color: var(--dim); }
.term .row { display: grid; grid-template-columns: 120px 1fr; gap: 18px; }
@media (max-width: 620px) { .term .row { grid-template-columns: 1fr; gap: 0; margin-bottom: 10px; } }
.term .caret { display: inline-block; width: 11px; height: 20px; background: #cfd2d6; vertical-align: -3px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------------------------------------------------------- team */
.team {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0;
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
@media (max-width: 1000px) { .team { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px)  { .team { grid-template-columns: 1fr; } }
.member {
  display: flex; flex-direction: column; min-width: 0;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 24px 24px 28px;
}
.member .m-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; min-height: 52px; }
.member .m-n { font: 20px/1 var(--f-term); color: var(--dim); letter-spacing: .06em; }
.member .who { margin: 0; font: 400 24px/1.25 var(--f-pixel); color: var(--paper); overflow-wrap: anywhere; }
.member .who .aka { display: block; font: 18px/1.3 var(--f-term); color: var(--dim); margin-top: 2px; }
.member .role { margin: 10px 0 14px; font: 20px/1.2 var(--f-term); color: var(--thought); letter-spacing: .04em; text-transform: uppercase; }
.member .does { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.member .does li { font: 18px/1 var(--f-term); color: var(--dim); border: 1px solid var(--line); padding: 4px 8px 5px; }
.member:hover .does li { color: var(--thought); border-color: var(--dim); }
/* a faceless silhouette, the studio's one rule */
.member .sil { width: 44px; height: 52px; margin-bottom: 18px; opacity: 0.85;
  background:
    radial-gradient(circle at 50% 30%, var(--paper) 0 9px, transparent 9.5px),
    radial-gradient(ellipse 22px 20px at 50% 100%, var(--paper) 0 100%, transparent 100%);
}

/* ---------------------------------------------------------- footer */
footer.site { padding-block: 80px 120px; border-top: 1px solid var(--line); color: var(--dim); }
footer.site .row { display: flex; gap: 22px 40px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
footer.site img.word { width: 183px; height: 45px; }
footer.site a:hover { color: var(--paper); }

/* ---------------------------------------------------------- MIMAI page */
.hero-game { position: relative; min-height: 100svh; overflow: hidden; display: grid; align-items: end; }
.scene { position: absolute; inset: 0; overflow: hidden; background: var(--ink); }
.scene .layer {
  position: absolute; left: 50%; top: 50%; width: calc(max(100vw, 177.78svh) * 1.06); aspect-ratio: 544 / 306;
  transform: translate(-50%, -50%); background-size: 100% 100%; image-rendering: pixelated;
  will-change: transform;
}
.scene .rain { background-repeat: repeat; background-size: calc(max(100vw, 177.78svh) * 1.06 * 576 / 544) auto; animation: rain 0.9s linear infinite; }
@keyframes rain { from { background-position: 0 0; } to { background-position: -60px 240px; } }
.scene .static { opacity: 0.06; mix-blend-mode: screen; }
.scene::after { /* the game's vignette */
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 60% 45%, transparent 40%, rgba(11,11,13,.85) 100%);
}
.hero-game .copy { position: relative; z-index: 2; padding-block: 0 140px; }
.hero-game .logo { width: min(640px, 78vw); height: auto; }
.hero-game .jp { font-size: 30px; color: var(--thought); margin: 10px 0 22px; letter-spacing: 0.15em; }
.hero-game .genre { font: 24px/1.3 var(--f-term); color: var(--thought); margin-bottom: 28px; }

/* phones and portrait screens: the scene is a picture at the top, and the
   words sit below it on ink, never on top of the dither */
@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .hero-game { display: block; min-height: 0; padding-top: calc(var(--frame) + 8px); }
  .hero-game .scene { position: relative; inset: auto; width: 100%; aspect-ratio: 544 / 306; }
  .hero-game .scene .layer, .hero-game .scene canvas { width: 106%; }
  .hero-game .scene .rain { background-size: calc(106% * 576 / 544) auto; }
  .hero-game .copy { padding-block: 28px 110px; }
  .hero-game .logo { width: min(420px, 82vw); }
  .hero-game .jp { font-size: 24px; }
}

/* the live renderer (mimai.js): one canvas, drawn at the game's own
   resolution and scaled up with hard pixels */
.scene canvas.live {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: calc(max(100vw, 177.78svh) * 1.06); aspect-ratio: 544 / 306; height: auto;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.scene.has-live .layer { display: none; }

/* the opening lines, typed */
.opening { display: grid; gap: 10px; font-size: clamp(22px, 3vw, 34px); line-height: 1.4; min-height: 7.5em; }
.opening span { opacity: 0; }
.opening span.on { opacity: 1; }
.opening .her { color: var(--paper); }

/* the alarm and the thought box demo */
.wake { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; }
@media (max-width: 900px) { .wake { grid-template-columns: 1fr; } }
.wake .said { min-height: 1.6em; font-size: 26px; margin-top: 22px; }

/* headphone check */
.ears { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.ears .btn { min-width: 140px; justify-content: center; }
.ears .btn.lit { background: var(--paper); color: var(--ink); }

/* features */
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
@media (max-width: 960px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid3 { grid-template-columns: 1fr; } }
.cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 30px 28px 34px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.cell .n { font: 22px/1 var(--f-term); color: var(--dim); }
.cell h3 { font-size: 26px; line-height: 1.25; }
.cell p { color: var(--thought); font-size: 17px; line-height: 1.7; }

/* five meters: the volume fight */
.meters { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; height: 120px; align-items: end; margin-top: 6px; }
.meter { display: grid; grid-template-rows: 1fr auto; gap: 8px; height: 100%; }
.meter .bar { position: relative; border: 1px solid var(--line); }
.meter .fill { position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  background-image: radial-gradient(var(--paper) 0.9px, transparent 1.1px); background-size: 4px 4px;
  transition: height 0.35s steps(6); }
.meter .lbl { font: 18px/1 var(--f-term); color: var(--dim); text-align: center; }

/* gallery */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 760px) { .gallery { grid-template-columns: 1fr; } }
.gallery figure { margin: 0; display: grid; gap: 10px; }
.gallery figcaption { font: 20px/1.3 var(--f-term); color: var(--dim); }

/* content note */
.note {
  border: 1px solid var(--paper); padding: 4px 4px 34px; max-width: 920px;
}
.note .bar { background: var(--paper); color: var(--ink); padding: 8px 30px 10px; font-size: 24px; }
.note .body { padding: 26px 30px 0; display: grid; gap: 16px; color: var(--paper); font-size: 18px; }
.note .soft { color: var(--thought); }

/* the script's red stage direction */
.stage-dir { font: 22px/1.4 var(--f-term); color: var(--red); letter-spacing: 0.04em; }

/* ---------------------------------------------------------- 404 */
.lost { min-height: 100svh; display: grid; place-content: center; text-align: center; gap: 26px; padding: 40px; }

/* ---------------------------------------------------------- motion */
.reveal { opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.6s steps(6), transform 0.6s steps(6); }
  .js .reveal.in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .boot { display: none; }
  .flight { display: none; }
  .opening span { opacity: 1; }
}

/* small screens: lighter frame, bigger touch targets */
@media (max-width: 620px) {
  :root { --frame: 8px; }
  body { font-size: 17px; }
  section { padding-block: 84px; }
  .wrap { padding-left: calc(var(--gutter) + 8px); padding-right: calc(var(--gutter-r) + 8px); }
  .thoughts { padding: 26px 12px 16px; }
  .thoughts li a, .thoughts li button, .thoughts li .item { grid-template-columns: 34px 1fr; }
  .thoughts .meta { grid-column: 2; }
  .thoughts .t { font-size: 22px; }
}
