/* site.css — paperscall.com. The colours are sampled from Rhun's own paintings:
   the night of the sky painting, its red and purple bands, the moon, the grass. */
:root {
  --night: #1a1714;
  --night-deep: #110f0d;
  --ink: #0f0c0b;
  --paper: #efe4c8;
  --paper-dim: #cfc3a6;
  --moon: #cec7bd;
  --band-red: #b8302a;
  --band-purple: #5a3a5c;
  --grass: #5a7a2c;
  --serif-sc: "IM Fell English SC", Georgia, "Times New Roman", serif;
  --serif: "IM Fell English", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--night); color: var(--paper); font: 19px/1.55 var(--serif); -webkit-font-smoothing: antialiased; }
img { image-rendering: pixelated; }

/* ---- The diorama ---------------------------------------------------------------- */
.dolly { position: relative; height: 270vh; height: 270svh; }
.stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--night); }
/* The diorama is one canvas (site.js); the title and the hint sit over it. */
#scene { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
.stage::after { content: ""; position: absolute; inset: 0; background: var(--night); pointer-events: none; transition: opacity 0.7s ease-out; z-index: 3; }
.stage.ready::after { opacity: 0; }
/* The gallery's cards flip the way the game flips its paper monsters. */
.flip img { position: absolute; left: 0; bottom: 0; width: 100%; height: 100%; transition: transform 0.11s ease-in; }
.flip img.back { transform: scaleX(1); }
.flip img.front { transform: scaleX(0); }
.flip.facing img.back { transform: scaleX(0); transition-timing-function: ease-in; }
.flip.facing img.front { transform: scaleX(1); transition-delay: 0.11s; transition-timing-function: ease-out; }
.flip:not(.facing) img.back { transition-delay: 0.11s; transition-timing-function: ease-out; }

.title {
  position: absolute; left: 0; right: 0; top: 25%; text-align: center; pointer-events: none; z-index: 1;
  opacity: 0; transform: translateY(12px); will-change: opacity, transform;
  text-shadow: 0 3px 0 var(--ink), 0 0 26px rgba(0, 0, 0, 0.65);
}
.title h1 {
  margin: 0; font: 400 clamp(40px, min(11vw, 17vh), 150px)/0.9 var(--serif-sc); letter-spacing: 0.02em; color: var(--paper);
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
}
.title p { margin: 0.6em 0 0; font: italic clamp(18px, 2.6vw, 28px)/1.3 var(--serif); color: var(--paper-dim); }
.scroll-hint {
  position: absolute; left: 50%; bottom: 3.5vh; transform: translateX(-50%);
  font: 18px var(--serif-sc); letter-spacing: 0.2em; color: var(--paper-dim); text-decoration: none;
  padding: 8px 14px; z-index: 2; text-shadow: 0 2px 0 var(--ink);
}
/* The pulse lives on the line under the word, so the fade site.js puts on the link itself
   (inline opacity) is not overridden by the animation. */
.scroll-hint::after { content: ""; display: block; width: 2px; height: 30px; margin: 6px auto 0; background: var(--paper-dim); animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.3; transform: translateY(5px); } }

/* ---- The pages under it ------------------------------------------------------------ */
main { position: relative; z-index: 1; }
main section[id] { scroll-margin-top: 64px; }   /* a heading reached from the bar is not under it */
.band { max-width: 1040px; margin: 0 auto; padding: 88px 24px; }
.band.dark { max-width: none; background: var(--night-deep); }
.band.dark > * { max-width: 992px; margin-left: auto; margin-right: auto; }
h2 { font: 400 clamp(34px, 5vw, 54px)/1.1 var(--serif-sc); margin: 0 0 0.4em; color: var(--paper); text-align: center; }
h2::after { content: ""; display: block; width: 84px; height: 3px; margin: 18px auto 0; background: linear-gradient(90deg, var(--band-purple), var(--band-red)); }
.lede { max-width: 700px; margin: 0 auto 40px; text-align: center; color: var(--paper-dim); font-size: 21px; }
.note { text-align: center; color: var(--paper-dim); font-style: italic; font-size: 16px; }

/* Rhun's letter: his own words, set like a page. */
.letter .letter-body { max-width: 680px; margin: 0 auto; font-size: 21px; line-height: 1.65; color: var(--paper); }
.letter .letter-body p { margin: 0 0 1.1em; }
.letter .signature { text-align: right; font: italic 22px var(--serif); color: var(--paper-dim); margin-top: 1.4em; }
.letter .signature::before { content: "— "; }
/* Five monsters in a row that turn round, then the two big ones side by side, each with a line. */
.gallery { display: grid; grid-template-columns: repeat(10, 1fr); gap: 18px; }
.gallery .card { grid-column: span 2; }
.gallery .card.wide { grid-column: span 5; aspect-ratio: auto; display: grid; grid-template-columns: 42% 1fr; align-items: center; gap: 4px; min-height: 260px; }
.card.wide .wide-art { position: relative; height: 100%; min-height: 240px; }
.card.wide .wide-art .flip { position: absolute; left: 8%; right: 0; top: 7%; bottom: 7%; }
.card.wide .wide-art .flip img { object-fit: contain; object-position: 50% 100%; }
.card.wide figcaption { position: static; padding: 20px 22px 20px 6px; text-align: left; }
.card.wide figcaption strong { display: block; font: 400 24px/1.2 var(--serif-sc); color: var(--paper); margin-bottom: 8px; }
.card.wide figcaption span { display: block; font: 17px/1.5 var(--serif); color: var(--paper-dim); }
@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(6, 1fr); }
  .gallery .card.wide { grid-column: span 6; }
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .gallery .card { grid-column: span 1; }
  .gallery .card.wide { grid-column: span 2; grid-template-columns: 40% 1fr; min-height: 220px; }
  .card.wide .wide-art { min-height: 200px; }
}
.card { position: relative; margin: 0; aspect-ratio: 3 / 4; border: 2px solid #2c2622; background: radial-gradient(ellipse at 50% 88%, #2e2823, #171412 72%); cursor: pointer; overflow: hidden; border-radius: 3px; }
.card:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.card:hover { border-color: #4a3f37; }
/* In a card each drawing is cut to its own outline (…_card.png) and stands on the floor line. */
.card .flip { position: absolute; left: 8%; right: 8%; top: 7%; bottom: 17%; }
.card .flip img { object-fit: contain; object-position: 50% 100%; }
.card figcaption { position: absolute; left: 0; right: 0; bottom: 3.5%; text-align: center; font: 17px var(--serif-sc); color: var(--paper-dim); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 22px; }
.features article { padding: 22px 24px; border: 2px solid #2c2622; background: #1b1815; border-radius: 3px; }
.features article.later { border-style: dashed; opacity: 0.86; }
.features h3 { margin: 0 0 8px; font: 400 23px/1.2 var(--serif-sc); color: var(--paper); }
.features p { margin: 0; color: var(--paper-dim); }

details { border-bottom: 1px solid #2f2925; padding: 16px 4px; }
details summary { cursor: pointer; font: 22px var(--serif-sc); color: var(--paper); list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "+"; display: inline-block; width: 1.2em; color: var(--band-red); }
details[open] summary::before { content: "–"; }
details p { margin: 10px 0 4px 1.2em; color: var(--paper-dim); }

/* Rhun's drawn button (ui_button.png; art/button_even.png is it with the panel centred, made by
   tools_site.py), framed the way the game frames it: the drawn ends and edges keep their pixels,
   only the dark middle panel stretches, and the word sits in that panel. Slices: 4 px of air and
   10 rows of frame over and under the panel, 4 + 27 px at the ends. Shown at 2x (the panel's 16
   rows make the 32 px line), .small at 1.25x. */
.drawn-button {
  display: inline-block; box-sizing: border-box; min-width: 260px; height: 88px; padding: 0 0.1em; cursor: pointer;
  border-style: solid; border-color: transparent; border-width: 28px 62px;
  border-image: url(art/button_even.png) 14 31 fill / 28px 62px stretch; image-rendering: pixelated;
  background: none; color: var(--paper); text-decoration: none; text-align: center; white-space: nowrap;
  font: 26px/32px var(--serif-sc); letter-spacing: 0.06em; text-shadow: 0 2px 0 var(--ink);
  transition: filter 0.12s, transform 0.06s;
}
.drawn-button.small { min-width: 0; height: 55px; border-width: 17.5px 38.75px; border-image-width: 17.5px 38.75px; font-size: 18px; line-height: 20px; }
.drawn-button:hover, .drawn-button:focus-visible { filter: brightness(1.18); }
.drawn-button:active { transform: translateY(2px); filter: brightness(0.95); }
.drawn-button:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
a.inline { color: var(--paper); text-decoration: underline; text-decoration-color: var(--band-red); text-underline-offset: 3px; }
a.inline:hover, a.inline:focus-visible { color: #fff; }

/* The title's call to play: under the name, over the sky. */
.title .cta { margin-top: 1.4em; pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.cta-note { font: italic 17px/1.4 var(--serif); color: var(--paper); text-shadow: 0 0 4px var(--ink), 0 0 10px var(--ink), 0 2px 0 var(--ink); }

/* The bar that comes down once the title has gone. */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; gap: 28px;
  padding: 6px max(20px, env(safe-area-inset-right)) 6px max(20px, env(safe-area-inset-left));
  background: rgba(17, 15, 13, 0.94); border-bottom: 1px solid #2c2622;
  transform: translateY(-110%); transition: transform 0.35s ease; will-change: transform;
}
.topbar.on { transform: none; }
.brand { font: 26px/1 var(--serif-sc); color: var(--paper); text-decoration: none; white-space: nowrap; }
.topbar nav { display: flex; gap: 24px; margin-left: auto; }
.topbar nav a { font: 18px var(--serif-sc); color: var(--paper-dim); text-decoration: none; }
.topbar nav a:hover, .topbar nav a:focus-visible { color: var(--paper); }

/* The three paths, each with one of his drawings. */
.paths { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.path { padding: 26px 24px 24px; border: 2px solid #2c2622; background: #1b1815; border-radius: 3px; text-align: center; }
.path-art { height: 190px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
  background: radial-gradient(ellipse at 50% 60%, #2e2823, transparent 70%); }
.path-art img { max-height: 180px; max-width: 150px; width: auto; height: auto; }
.path h3 { margin: 0 0 8px; font: 400 26px/1.2 var(--serif-sc); color: var(--paper); }
.path p { margin: 0; color: var(--paper-dim); }
#paths .note { margin-top: 26px; }

/* The last word: play. */
.final { text-align: center; }
.final .drawn-button { margin-top: 6px; }
.final .cta-note { display: block; margin: 12px 0 0; text-shadow: none; }
.follow-line { margin: 34px 0 0; color: var(--paper-dim); font-size: 17px; }

footer { padding: 40px 24px 56px; text-align: center; color: #8d8270; font-size: 15px; background: var(--night-deep); }
footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; margin-bottom: 14px; }
footer nav a { color: var(--paper-dim); font: 18px var(--serif-sc); text-decoration: none; }
footer nav a:hover, footer nav a:focus-visible { color: var(--paper); }
footer p { margin: 0; }

/* On a phone, Play says the game is made for a computer and offers to send the link there. */
.pc-sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 8, 7, 0.72); padding: 16px; }
.pc-sheet[hidden] { display: none; }
.pc-card { position: relative; width: min(440px, 100%); padding: 28px 24px 26px; text-align: center;
  background: var(--night); border: 2px solid #3a322c; border-radius: 4px; }
.pc-card h3 { margin: 0 0 10px; font: 400 28px var(--serif-sc); color: var(--paper); }
.pc-card p { margin: 0 0 18px; color: var(--paper-dim); font-size: 18px; }
.pc-card .drawn-button { min-width: 240px; max-width: 100%; }
.pc-card .pc-done { min-height: 1.4em; margin: 8px 0 10px; font-style: italic; }
.pc-close { position: absolute; top: 6px; right: 10px; width: 44px; height: 44px; border: 0; background: none;
  color: var(--paper-dim); font: 30px/1 var(--serif); cursor: pointer; }
.pc-close:hover, .pc-close:focus-visible { color: var(--paper); }
a.mail { color: var(--paper); text-decoration: underline; text-decoration-color: var(--band-red); text-underline-offset: 3px; overflow-wrap: anywhere; }
a.mail:hover, a.mail:focus-visible { color: #fff; }

@media (max-width: 760px) {
  .topbar nav { display: none; }
  .topbar .drawn-button { margin-left: auto; }
  .brand { font-size: 22px; }
}
@media (max-width: 640px) {
  body { font-size: 18px; }
  .band { padding: 64px 16px; }
  .title { top: 6%; }
  .lede { font-size: 19px; }
  .letter .letter-body { font-size: 19px; }
  .drawn-button { min-width: 230px; }
  .title .cta { margin-top: 1.1em; }
  .cta-note { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .dolly { height: 100vh; height: 100svh; }
  .scroll-hint::after { animation: none; }
  .title { opacity: 1; transform: none; }
  .topbar { transition: none; }
}
