/* Ashenfort's page, in the game's own look: its ground, its wooden panels and buttons
   (img/ui/, cut from the game's style sheet by tools/ui.py), its letters (font.js,
   drawn by site.js), its pictures enlarged by whole numbers with hard edges. */

:root {
  --ground: #231f19;
  --ink: #0c0a0a;
  --paper: #f0e8d6;
  --dim: #b5a68b;
  --gold: #f0bc4e;
  --copper: #c8834a;
  --wood: #33211a;
  /* How many screen pixels a pixel of the game's letters takes. */
  --k: 2;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ground) url(img/ui/ground.png);
  color: var(--paper);
  font: 18px/1.6 Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--gold); }
a:hover { color: #ffd97a; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

p { margin: 0 0 1em; }

/* --- The game's letters (site.js turns .px-text into pictures of them) --- */

.px-text { font-weight: bold; letter-spacing: .02em; }
.px-text.drawn { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: calc(var(--k) * 4px) calc(var(--k) * 4px); position: relative; }
h1.px-text.drawn, h2.px-text.drawn, h3.px-text.drawn, p.px-text.drawn { display: flex; }
.px-text svg { display: block; flex: none; height: calc(var(--k) * 13px); }
/* (The words themselves, kept for those who do not see the pictures of them.) */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.px-text .shade { fill: var(--ink); }
.px-text .face { fill: currentColor; }

h1, h2, h3 { margin: 0; line-height: 1; color: var(--gold); }
h2 { --k: 4; margin-bottom: 28px; }
h3 { --k: 3; margin: 56px 0 24px; }

/* --- Pictures: enlarged by whole numbers (site.js sets the width), hard edges --- */

.pxbox { display: block; position: relative; margin: 0 auto; max-width: 100%; }
.pxbox img { display: block; width: 100%; height: auto; image-rendering: pixelated; image-rendering: crisp-edges; image-rendering: pixelated; }
.pxbox.soft img { image-rendering: auto; }

/* --- The top --- */

.top { position: relative; overflow: hidden; background: #000; min-height: min(92vh, 900px); display: grid; place-items: center; }
.top-picture { position: absolute; inset: 0; margin: 0; max-width: none; }
.top-picture img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: none; width: 100%; height: 100%; object-fit: cover; }
/* (The same scene moving, over the still picture once it can play: site.js.) */
.top-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; opacity: 0; transition: opacity 1.2s; }
.top-video.on { opacity: 1; }
.top::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12, 10, 10, .55) 0%, rgba(12, 10, 10, .35) 40%, rgba(35, 31, 25, .78) 82%, var(--ground) 100%); }
.top-words { position: relative; z-index: 1; text-align: center; padding: 72px 20px 96px; width: 100%; max-width: 1400px; min-width: 0; }
.name { --k: 10; color: var(--gold); margin-bottom: 18px; }
.line { --k: 3; color: var(--paper); margin-bottom: 30px; }
.pitch { font-size: 21px; max-width: 40em; margin: 0 auto 34px; text-shadow: 0 2px 0 var(--ink), 0 0 18px var(--ink); }

/* --- Buttons: the game's planks --- */

.buttons { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin: 0; }
.btn {
  display: inline-block;
  border: 28px solid transparent;
  border-image: url(img/ui/button.png) 28 fill / 28px / 0 stretch;
  image-rendering: pixelated;
  padding: 0 10px;
  background: none;
  color: var(--paper);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  line-height: 0;
}
.btn .px-text, .btn .px-text.drawn { display: flex; flex-wrap: nowrap; margin: -11px 0 -13px; line-height: 0; white-space: nowrap; }
.btn:hover, .btn:focus-visible { border-image-source: url(img/ui/button-hover.png); color: #fff; }
.btn:active { border-image-source: url(img/ui/button-pressed.png); }
.btn.chosen { border-image-source: url(img/ui/button-chosen.png); color: var(--gold); }
.btn[hidden] { display: none; }
.btn.off { border-image-source: url(img/ui/button-disabled.png); color: #a9a39a; cursor: default; }

/* --- Sections --- */

main { max-width: 1560px; margin: 0 auto; padding: 0 20px; }
section { padding: 72px 0 24px; text-align: center; }
.lead { font-size: 20px; max-width: 43em; margin: 0 auto 36px; color: var(--paper); }

figure { margin: 0; }
figcaption, .cap { display: block; color: var(--dim); font-size: 16px; font-style: italic; margin-top: 10px; }

.shot { display: block; color: inherit; text-decoration: none; cursor: zoom-in; }
.shot .pxbox { box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px #5a3a26, 0 0 0 12px var(--ink); }
.shot:hover .pxbox, .shot:focus-visible .pxbox { box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px var(--gold), 0 0 0 12px var(--ink); }
.shot:focus-visible { outline: none; }
.shot.wide { margin: 0 auto 44px; }
.shot.plain img { display: block; width: 100%; max-width: 1440px; height: auto; margin: 0 auto; box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px #5a3a26, 0 0 0 12px var(--ink); }
.shot.plain:hover img { box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px var(--gold), 0 0 0 12px var(--ink); }

.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px 36px; max-width: 1020px; margin: 0 auto 20px; }
.shots.three { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 44px 40px; max-width: 1520px; }
.maps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 36px; max-width: 1400px; margin: 0 auto; }

/* The trailer, framed as the pictures are. */
.film { max-width: 1440px; margin: 0 auto; box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px #5a3a26, 0 0 0 12px var(--ink); background: #000; }
.film video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; }

/* The town growing: four pictures of one view, one shown at a time. */
.grow { margin-bottom: 52px; }
.grow .frames { box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px #5a3a26, 0 0 0 12px var(--ink); aspect-ratio: 16 / 9; }
.grow .frames img { position: absolute; inset: 0; opacity: 0; transition: opacity .7s; }
.grow .frames img.on { opacity: 1; }
.days { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 26px; }

/* --- The game's panel, for the two sections of words --- */

.panel {
  max-width: 900px;
  margin: 84px auto 0;
  padding: 0 8px 8px;
  border: 64px solid transparent;
  border-image: url(img/ui/panel.png) 64 fill / 64px / 0 round;
  image-rendering: pixelated;
  text-align: left;
}
.panel > * { image-rendering: auto; }
.panel h2 { --k: 3; margin: -8px 0 22px; }
.panel p { max-width: 38em; }
.panel .buttons { justify-content: flex-start; }
.panel .px-text.drawn { justify-content: flex-start; }

pre { margin: 0 0 1.2em; padding: 16px 18px; background: #1b120e; border: 4px solid #5a3a26; outline: 4px solid var(--ink); overflow-x: auto; }
code { font: 16px/1.5 ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace; color: #f3dfb0; }

.figures { display: grid; grid-template-columns: repeat(4, auto); gap: 14px 40px; justify-content: start; margin: 26px 0 22px; }
.figures div { display: flex; flex-direction: column; }
.figures dt { font-size: 34px; line-height: 1.1; color: var(--gold); font-weight: bold; font-variant-numeric: tabular-nums; }
.figures dd { margin: 0; color: var(--dim); }
.small { font-size: 16px; color: var(--dim); }
.small.center { text-align: center; }
.buttons.try { margin: 40px 0 14px; }
#download .buttons { margin-bottom: 14px; }

/* --- The foot --- */

footer { text-align: center; padding: 96px 20px 64px; color: var(--dim); }
footer .px-text { --k: 4; color: var(--gold); }
footer p { margin-bottom: .6em; }

/* --- A picture opened large --- */

.lightbox { position: fixed; inset: 0; z-index: 10; background: rgba(12, 10, 10, .93); display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
.lightbox[hidden] { display: none; }
.lightbox figure { grid-column: 2; text-align: center; min-width: 0; }
.lightbox figcaption { font-size: 18px; margin-top: 18px; }
.lightbox .pxbox { box-shadow: 0 0 0 4px var(--ink), 0 0 0 8px #5a3a26; }
.lightbox button { background: none; border: 0; color: var(--paper); cursor: pointer; padding: 0; }
.lightbox .close { position: absolute; top: 14px; right: 18px; --k: 3; padding: 8px; }
.lightbox .prev, .lightbox .next { height: 100%; font: bold 54px/1 Georgia, serif; }
.lightbox .prev::before { content: "\2039"; }
.lightbox .next::before { content: "\203A"; }
.lightbox .prev { grid-column: 1; }
.lightbox .next { grid-column: 3; }
.lightbox button:hover { color: var(--gold); }

/* --- Narrow screens --- */

@media (max-width: 1599px) {
  /* (Three across need 3 x 480: below that, two and one.) */
  .shots.three { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px 36px; max-width: 1020px; }
  .shots.three .shot:last-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .maps { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 700px; }
}
@media (max-width: 900px) {
  .name { --k: 6; }
  h2 { --k: 3; }
  .line { --k: 2; }
  .figures { grid-template-columns: repeat(2, auto); }
}
@media (max-width: 620px) {
  body { font-size: 17px; }
  .name { --k: 4; }
  h2, h3, footer .px-text { --k: 2; }
  .panel h2 { --k: 2; }
  .pitch { font-size: 18px; }
  .lead { font-size: 18px; }
  .shots, .shots.three { grid-template-columns: minmax(0, 1fr); }
  .top-words { padding: 56px 14px 72px; }
  /* (A long button's words go onto two lines rather than off the screen.) */
  .btn { max-width: 100%; }
  .btn .px-text, .btn .px-text.drawn { flex-wrap: wrap; justify-content: center; white-space: normal; }
  .days { display: grid; grid-template-columns: repeat(2, max-content); }
  main { padding: 0 14px; }
  .shots.three .shot:last-child { grid-column: auto; }
  .panel { border-width: 32px; border-image-width: 32px; padding: 0 0 4px; margin-top: 56px; }
  section { padding-top: 52px; }
  .lightbox { grid-template-columns: 36px 1fr 36px; }
  .figures dt { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grow .frames img { transition: none; }
}
