@font-face { font-family: "Alegreya"; src: url("fonts/alegreya.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Alegreya"; src: url("fonts/alegreya-italic.woff2") format("woff2"); font-weight: 400 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Alegreya SC"; src: url("fonts/alegreya-sc-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* One idle loop: 4 frames x 180 ms. site.js scales a 0-1 phase by this. */
  --idle-length: 0.72s;
  --night: #120e23;
  --dusk: #2a2942;
  --plum: #3a1b40;
  --ash: #6f6e72;
  --parchment: #aea47e;
  --cream: #fff1a9;
  --gold: #ebb85b;
  --ember: #e67146;
  --brick: #b74132;
  --soil: #402e2b;
  /* Pixel fonts are for the art; words on the page are set in a book face. */
  --serif: "Alegreya", "Iowan Old Style", Palatino, Georgia, serif;
  --caps: "Alegreya SC", "Alegreya", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html { background: var(--night); }
body {
  margin: 0;
  background: var(--night);
  color: #f3ead0;
  font: 20px/1.55 var(--serif);
}
img { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
a { color: var(--gold); }

h2, h3 { font-family: var(--serif); font-weight: 700; margin: 0 0 12px; color: var(--gold); line-height: 1.2; }
h2 { font-family: var(--caps); font-size: 32px; letter-spacing: 0.04em; }
h3 { font-size: 21px; color: var(--cream); }
p { margin: 0 0 14px; }

/* Section headings sit between the game's divider curls (3x). */
h2 {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  text-align: center; margin-bottom: 8px;
}
h2::before, h2::after {
  content: ""; flex: none; width: 33px; height: 36px;
  background: url("img/ui/divider_dark_left.png") center / 33px 36px no-repeat;
  image-rendering: pixelated;
}
h2::after { background-image: url("img/ui/divider_dark_right.png"); }

section { position: relative; padding: 72px 20px; }
.wrap { max-width: 960px; margin: 0 auto; }
.wide { max-width: 1320px; }

/* Where two bands meet, a strip of knot tiles (12 px at 2x) sits on the
   seam so each band reads as its own page. */
main > section + section::before {
  content: ""; position: absolute; left: 0; right: 0; top: -15px; height: 30px; z-index: 1;
  background:
    url("img/ui/tile_knot.png") center / 24px 24px repeat-x,
    linear-gradient(var(--night), var(--night)) center / 100% 30px no-repeat;
  border-top: 2px solid var(--soil);
  border-bottom: 2px solid var(--soil);
  image-rendering: pixelated;
}

/* The game's button, nine-sliced at 3x (8 px corners). */
.cta {
  display: inline-block;
  padding: 4px 18px;
  border: 24px solid transparent;
  border-image: url("img/ui/button_normal.png") 8 fill / 24px stretch;
  image-rendering: pixelated;
  color: var(--cream);
  text-decoration: none;
  font: 700 23px/1.2 var(--caps);
  letter-spacing: 0.04em;
}
.cta:hover, .cta:focus-visible { border-image-source: url("img/ui/button_hover.png"); color: var(--gold); outline: none; }

/* A picture in the game's open key frame (12 px corners at 2x). */
.framed { border: 24px solid transparent; border-image: url("img/ui/title_frame.png") 12 / 24px stretch; image-rendering: pixelated; }

/* A panel in the game's popup frame (14 px corners at 2x). */
.panel { border: 28px solid transparent; border-image: url("img/ui/panel_popup.png") 14 fill / 28px stretch; image-rendering: pixelated; }

/* Title: the banner covers the band, so on narrow screens the crop lands on
   the calm middle third where the lettering sits. */
#title {
  position: relative;
  min-height: 520px;
  padding: 40px 20px 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.banner { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center; }
#title::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 35%;
  background: linear-gradient(transparent, var(--dusk));
}
#title .wrap { position: relative; z-index: 1; }
#title h1 { margin-top: 0; }
/* The wordmark straight on the banner, at 2x (3x from 700 px), over a warm
   glow so it lifts off the dark middle third. */
.splash { position: relative; margin: 0 auto 20px; width: max-content; max-width: 100%; animation: splash-in 0.9s cubic-bezier(.2, .9, .3, 1.2) both; }
.splash::before {
  content: ""; position: absolute; inset: -40% -12%; z-index: -1;
  background: radial-gradient(closest-side, rgba(230, 113, 70, 0.55), rgba(183, 65, 50, 0.25) 55%, transparent);
  animation: glow 3.2s ease-in-out infinite alternate;
}
.splash img { width: 564px; filter: drop-shadow(0 0 18px rgba(18, 14, 35, 0.8)); }
@keyframes splash-in { from { opacity: 0; transform: translateY(-18px) scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes glow { from { opacity: 0.7; } to { opacity: 1; } }

/* Square pixel embers rising off the banner's cracks. Each <i> sets its own
   column, size, speed, start and sideways drift. */
.embers { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.embers i {
  position: absolute; left: var(--x); bottom: -8px; width: var(--s); height: var(--s);
  background: var(--ember); box-shadow: 0 0 6px var(--ember);
  animation: rise var(--d) linear var(--t) infinite;
}
.embers i:nth-child(3n) { background: var(--gold); box-shadow: 0 0 6px var(--gold); }
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: 1; }
  100% { transform: translate(var(--w), -560px); opacity: 0; }
}
.pitch { font-size: 21px; text-shadow: 0 2px 0 var(--night), 0 0 12px var(--night), 0 0 24px var(--night); max-width: 30em; margin: 0 auto 20px; }

#what { background: var(--dusk); }
.beats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 28px; }
.beat { border: 24px solid transparent; border-image: url("img/ui/panel_main.png") 8 fill / 24px stretch; image-rendering: pixelated; padding: 4px; }
.beat img { width: 100%; margin-bottom: 14px; outline: 2px solid var(--soil); }
.beat h3 { color: var(--gold); }
.beat p { margin: 0; }

#world .wrap { text-align: center; }
#world .world-art { width: 100%; max-width: 840px; margin: 20px auto 28px; }
#world p { max-width: 34em; margin-left: auto; margin-right: auto; text-align: left; }

#heroes { background: var(--plum); }
.hero-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 28px; }
.hero { padding: 4px; text-align: center; }
.portrait { position: relative; width: 192px; height: 192px; margin: 0 auto 12px; }
.portrait img { width: 192px; height: 192px; }
/* The sheet is 4 frames of 64 px art, each shown at 192 px (3x), so the
   sheet is 4 x 192 = 768 px wide and the loop ends one sheet-width along. */
.idle {
  position: absolute; inset: 0;
  background-image: var(--sheet);
  background-size: 768px 192px;
  image-rendering: pixelated;
  animation: idle var(--idle-length) steps(4) infinite;
  animation-delay: calc(var(--idle-length) * var(--phase, 0) * -1);
}
@keyframes idle { from { background-position: 0 0; } to { background-position: -768px 0; } }
.realm { color: var(--ember); font-style: italic; margin-bottom: 8px; }

#cards { background: var(--dusk); }
.card-row { display: grid; grid-template-columns: repeat(2, 256px); justify-content: center; gap: 32px 40px; margin-top: 28px; }
@media (min-width: 1200px) { .card-row { grid-template-columns: repeat(4, 256px); } }
@media (max-width: 620px) { .card-row { grid-template-columns: 256px; } }
.card { margin: 0; width: 256px; text-align: center; }
.card img { width: 256px; height: 336px; margin: 0 auto 12px; filter: drop-shadow(0 8px 0 rgba(0, 0, 0, 0.35)); }
.card h3 { margin-bottom: 4px; color: var(--gold); }
.card p { margin: 0; font-size: 17px; }

#match .shot { display: grid; justify-items: center; margin-top: 20px; }
figure { margin: 0; }
#match .shot img { width: min(100%, 1328px); }
figcaption { margin-top: 10px; color: var(--parchment); font-style: italic; text-align: center; }

#closing { background: var(--dusk); text-align: center; }
#closing img { width: 100%; max-width: 736px; margin: 0 auto 24px; }
#closing p { font-size: 21px; font-style: italic; max-width: 30em; margin-left: auto; margin-right: auto; }

footer { padding: 32px 20px 40px; text-align: center; color: var(--ash); font-size: 14px; border-top: 2px solid var(--soil); }
footer p { margin: 0 0 4px; }

.notice { text-align: center; }
.notice #title { min-height: 420px; }

@media (min-width: 700px) {
  .splash img { width: 846px; }
}
@media (max-width: 600px) {
  .splash img { width: 282px; }
}
@media (max-width: 860px) {
  .beats, .hero-grid { grid-template-columns: 1fr; }
  .beats { max-width: 480px; margin-left: auto; margin-right: auto; }
  .hero-grid { max-width: 480px; margin-left: auto; margin-right: auto; }
}
@media (min-width: 861px) and (max-width: 1000px) {
  .hero-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  section { padding: 56px 16px; }
  .framed { border-width: 16px; border-image-width: 16px; }
  h2 { font-size: 26px; gap: 10px; }
}
@media (min-width: 1360px) {
  #world .world-art { max-width: 1236px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .idle { display: none; }
}
