/* The website's one stylesheet: system fonts, no request to another site, pixel art scaled without smoothing. */

:root {
  --ink: #1b2233;
  --muted: #5b6478;
  --paper: #fbf8f1;
  --night: #1d2a44;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --sky: #3b82c4;
  --ok: #2e7d4f;
  --bad: #b3261e;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

/* The section headings' pixel font, served from the site itself: Jersey 15, SIL Open Font License
   (fonts/Jersey15-OFL.txt) */
@font-face { font-family: "Jersey 15"; src: url("fonts/Jersey15-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }

* { box-sizing: border-box; }
/* hidden hides, whatever display a part's own rule gives it: the one rule for every part the script shows */
[hidden] { display: none !important; }
/* The footer stays at the window's foot on a short page */
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--sky); }
a:hover { color: var(--accent-dark); }
img.pixel, .land, .logo, .brand img, .shot img, .sprite, .orb { image-rendering: pixelated; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }

/* The header: the logo, the sections, the download and the account */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: 0.4rem 1.2rem; background: var(--night); color: #fff;
}
.brand img { display: block; height: 44px; width: auto; }
.top nav { display: flex; gap: 1rem; flex-wrap: wrap; flex: 1; }
.top nav a { color: #e8edf6; text-decoration: none; font-weight: 600; }
.top nav a:hover { color: #9cc0ff; }
.top nav a[aria-current] { color: #9cc0ff; text-decoration: underline; text-underline-offset: 0.35em; text-decoration-thickness: 2px; }
.top-buttons { display: flex; align-items: center; gap: 0.6rem; margin: 0; }
/* The theme switch is a fixed square, so its sun or moon, whatever font draws it, never moves the buttons beside it */
.top-buttons .theme { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 2.2rem; height: 2.2rem; padding: 0; overflow: hidden; line-height: 1; font-size: 1rem; }

/* Buttons and links that look like them, on the parchment panel (the Parchment section below) */
.button, button {
  display: inline-block; padding: 0.6rem 1.15rem; border: 0; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button.small, button.small { padding: 0.4rem 0.85rem; font-size: 0.9rem; }
.buttons { display: flex; gap: 0.8rem; flex-wrap: wrap; }

/* The hero: the landscape across the whole width, edge to edge, the logo and the line on it */
.hero { position: relative; overflow: hidden; padding: 0; }
.hero .land { display: block; width: 100%; height: clamp(360px, 50vw, 66vh); object-fit: cover; object-position: center 20%; }
.hero-text {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 1rem; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.hero .logo { width: min(360px, 66vw); height: auto; }
.hero h1 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hero .lead { font-size: 1.3rem; font-weight: 600; max-width: 36rem; margin: 0.5rem 0 1.2rem; }
.hero .buttons { justify-content: center; }
.hero .button { text-shadow: none; }

/* Sections */
section { padding: 3rem max(1.2rem, calc((100% - 70rem) / 2)); scroll-margin-top: 4rem; }
h2 { font-family: "Jersey 15", system-ui, sans-serif; font-weight: 400; font-size: 2.6rem; letter-spacing: 0.02em; line-height: 1; margin: 0 0 1rem; color: var(--night); }
h3 { margin: 0.2rem 0 0.5rem; color: var(--night); }
h3 .orb { width: 22px; height: 22px; vertical-align: -4px; margin-right: 0.45rem; }
.unseen { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.blocks { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.4rem; }
.blocks article { background: #fff; border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: 0 1px 3px rgba(20, 30, 60, 0.12); }

/* The creatures, each its sheet's front-facing middle frame, three times its size */
/* The row scaled whole, so every figure keeps its size against the others */
.creatures { display: flex; gap: 2rem; justify-content: center; align-items: flex-start; margin: 2rem 0 1rem; zoom: 0.85; }
.sprite { display: inline-block; width: 72px; height: 96px; background-size: 216px 384px; background-position: -72px -192px; }
.sprite.golem { background-image: url("img/golem.png"); }
.sprite.skeleton { background-image: url("img/skeleton.png"); }
.sprite.slime { background-image: url("img/slime.png"); }
.sprite.chicken { background-image: url("img/chicken.png"); }
/* The warrior and the magician are one figure each, not a sheet: their frame and the weapon below it (tools/art/Figure.java),
   three times their size as the creatures are */
.sprite.warrior, .sprite.magician { width: 72px; height: 114px; background-size: 72px 114px; background-position: 0 0; position: relative; top: -2px; transform: scale(0.93); transform-origin: 50% 96px; }
.sprite.warrior { background-image: url("img/warrior.png"); }
.sprite.magician { background-image: url("img/magician.png"); }

/* The landing page's rows: a screenshot on the left, what it shows beside it */
.features { display: flex; flex-direction: column; gap: 2.75rem; }
/* A screenshot as wide as one of four in a row of the page's width; it opens whole when clicked */
.feature { display: grid; grid-template-columns: 16.75rem minmax(0, 1fr); gap: 2rem; align-items: center; }
.feature h3 { margin-top: 0; }
.shot { margin: 0; }
.shot a.zoom { display: block; cursor: zoom-in; }
.shot img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; box-shadow: 0 2px 8px rgba(20, 30, 60, 0.25); transition: transform 0.15s; }
.shot a.zoom:hover img { transform: scale(1.03); }

/* A screenshot shown large over the page (main.js): a click anywhere or Escape closes it */
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.8rem; padding: 2rem; background: rgba(10, 14, 24, 0.88); cursor: zoom-out; }
.overlay img { max-width: min(96vw, 1400px); max-height: 82vh; width: auto; height: auto; image-rendering: pixelated;
  border-radius: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
.overlay p { color: #e8edf6; margin: 0; font-weight: 600; }

.steps li { margin-bottom: 0.5rem; }
.release { background: #fff; border-radius: var(--radius); padding: 0.8rem 1.3rem; margin-top: 1.5rem; }
.release h4 { margin: 0.8rem 0 0.2rem; }
.release ul { margin: 0.2rem 0; }
/* A long release scrolls inside its box; the heading and the link to every version stay in view */
.release-body { max-height: 16rem; overflow-y: auto; padding-right: 0.5rem; }
.date { color: var(--muted); font-weight: normal; }

/* The league */
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.4rem 0; }
.tab { padding: 0.25rem 0.8rem; border-radius: 999px; border: 1px solid #c3cbd9; background: #fff; text-decoration: none; color: var(--ink); }
.tab.on { background: var(--night); color: #fff; border-color: var(--night); }
.table .caption { font-size: 1rem; color: var(--muted); margin-top: 1rem; }
table { border-collapse: collapse; width: 100%; background: #fff; font-size: 0.95rem; }
th, td { padding: 0.35rem 0.6rem; text-align: right; border-bottom: 1px solid #e3e7ee; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
.panel td:first-child, .panel th:first-child { text-align: left; }
thead th { background: var(--night); color: #fff; font-weight: 600; }
.tables, .panel { overflow-x: auto; }
.panel { position: relative; }
.panel .close { position: absolute; top: 0.4rem; right: 0.6rem; font-size: 1.6rem; line-height: 1; text-decoration: none; color: var(--muted); padding: 0.1rem 0.4rem; border-radius: 6px; }
.panel .close:hover { color: var(--ink); background: rgba(127, 140, 160, 0.18); }
th abbr { text-decoration: underline dotted; cursor: help; }
.panel { margin-top: 1.5rem; padding: 1rem; background: #fff; border-radius: var(--radius); border: 2px solid var(--accent); }
.empty { color: var(--muted); }

.bibtex { background: var(--night); color: #e8edf6; padding: 1rem; border-radius: var(--radius); overflow-x: auto; }
.ticks li { margin-bottom: 0.3rem; }

/* The account */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.4rem; align-items: start; }
.card { background: #fff; border-radius: var(--radius); padding: 1.1rem 1.3rem; box-shadow: 0 1px 3px rgba(20, 30, 60, 0.12); display: flex; flex-direction: column; gap: 0.5rem; }
.card.narrow { max-width: 24rem; }
.card form { margin: 0; }
/* A card's buttons are as wide as their words, at the card's left edge */
.card button { align-self: flex-start; padding: 0.5rem 0.9rem; font-size: 0.9rem; line-height: 1.2; }
label { display: flex; flex-direction: column; font-weight: 600; font-size: 0.92rem; gap: 0.2rem; }
label.check { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: normal; }
input[type=text], input[type=email], input[type=password] { font: inherit; padding: 0.45rem 0.6rem; border: 1px solid #b9c2d2; border-radius: 6px; }
.note { color: var(--muted); font-size: 0.85rem; margin: 0; }
/* A field's tooltip, shown under it while the pointer is on the field or the field has focus (so on a phone too) */
label.tipped { position: relative; }
.tip { display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin-top: 0.3rem; padding: 0.4rem 0.6rem; border-radius: 6px;
  background: var(--night); color: #e8edf6; font-size: 0.85rem; font-weight: normal; line-height: 1.4; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
label.tipped:hover .tip, label.tipped:focus-within .tip { display: block; }
[data-theme="dark"] .tip { background: #3a4763; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.flash { padding: 0.7rem 1rem; border-radius: var(--radius); font-weight: 600; }
.flash.good { background: #e3f3e8; color: var(--ok); }
.flash.bad { background: #fbe4e2; color: var(--bad); }
.ok { color: var(--ok); font-weight: 600; margin-left: 0.3rem; }
.warn { color: #a8740c; font-weight: 600; margin-left: 0.3rem; }

footer { background: var(--night); color: #cdd5e3; text-align: center; padding: 1.5rem 1rem; font-size: 0.9rem; }
footer a { color: #fff; }

/* The dark theme: the page's colours turned for a dark background, chosen by theme.js */
[data-theme="dark"] { color-scheme: dark; --ink: #e3e8f2; --muted: #9aa5bb; --paper: #171e2c; --night: #0a0e16; --sky: #7fb2ff; --accent-dark: #3b74f0; }
[data-theme="dark"] a:hover { color: #b6d1ff; }
[data-theme="dark"] h2, [data-theme="dark"] h3 { color: #f3f6fb; }
[data-theme="dark"] .blocks article, [data-theme="dark"] .release, [data-theme="dark"] .card, [data-theme="dark"] .panel, [data-theme="dark"] table { background: #263047; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
[data-theme="dark"] .tab { background: #263047; border-color: #33405a; color: var(--ink); }
[data-theme="dark"] .tab.on { background: var(--accent); border-color: var(--accent); }
[data-theme="dark"] th, [data-theme="dark"] td { border-color: #2c3850; }
[data-theme="dark"] input[type=text], [data-theme="dark"] input[type=email], [data-theme="dark"] input[type=password] { background: #10151f; color: var(--ink); border-color: #3a4763; }
[data-theme="dark"] .flash.good { background: #16321f; color: #8fd6a8; }
[data-theme="dark"] .ok { color: #8fd6a8; }
[data-theme="dark"] .warn { color: #f0c36a; }
[data-theme="dark"] .flash.bad { background: #3a1714; color: #ff9d94; }
[data-theme="dark"] code { color: #f0d9a8; }

/* Parchment: the game's parchment panel, an outline with its corners cut and three
   rings inside it in two-pixel steps, the parchment within, the words dark, in either theme: the buttons.
   A button darkens to the shade the lobby's rows take turns with. */
:root { --pm-outline: #1e1420; --pm-brown: #7a3e10; --pm-rim: #c8a060; --pm-paper: #f2e2b8; --pm-shade: #e8d4a4; --pm-band: #d6ba82; }
.button, button {
  background: var(--pm-paper); border-radius: 0;
  box-shadow: inset 0 0 0 2px var(--pm-outline), inset 0 0 0 4px var(--pm-brown), inset 0 0 0 6px var(--pm-rim);
  clip-path: polygon(2px 0, calc(100% - 2px) 0, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 0 calc(100% - 2px), 0 2px);
}
.button, button, .button:hover, button:hover { color: var(--pm-outline); }
.button:hover, button:hover { background: var(--pm-shade); }
.button:active, button:active { background: var(--pm-band); }
button.danger, button.danger:hover { color: var(--bad); }

/* A narrow window stacks each row: the screenshot first, what it shows below */
@media (max-width: 40rem) {
  .feature .shot { max-width: 16.75rem; }
  .feature { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .top nav { order: 3; flex-basis: 100%; gap: 0.7rem; font-size: 0.9rem; }
  h2 { font-size: 2.1rem; }
  .hero .lead { font-size: 1.05rem; }
}
