/* The palette is the boat's own: japanned black for the case, brass for whatever is
   live, ivory for dial faces, vermilion for a pointer. Taken from the instruments
   rather than invented, so the page and the game are recognisably the same object. */

@font-face {
  font-family: "VT323";
  src: url("VT323-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --japan: #10141a;
  --japan-raised: #171c24;
  --case: #1f252e;
  --brass: #c69b4a;
  --brass-bright: #e6c478;
  --ivory: #e8e3d4;
  --ivory-dim: #a8a496;
  --vermilion: #c2452d;
  --rule: #39414d;
  --sea: #1a2b33;
  --measure: 34rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--japan);
  color: var(--ivory);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 18px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

/* ---- the common furniture ------------------------------------------------ */

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.narrow {
  max-width: var(--measure);
}

h1,
h2,
h3,
.plate,
.key,
nav a,
.stat b,
figcaption b {
  font-family: "VT323", "Courier New", monospace;
  letter-spacing: 0.04em;
}

h2 {
  font-size: 2rem;
  font-weight: normal;
  color: var(--brass-bright);
  margin: 0 0 0.3rem;
  text-transform: uppercase;
}

h3 {
  font-size: 1.5rem;
  font-weight: normal;
  color: var(--ivory);
  margin: 2.2rem 0 0.4rem;
}

p {
  margin: 0 0 1.1rem;
}

a {
  color: var(--brass-bright);
  text-decoration-color: rgba(198, 155, 74, 0.45);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ivory);
}

code,
kbd,
pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* A section heading with a rule running off it, the way a nameplate is screwed to a
   plate: the line is part of the instrument, not a divider dropped between sections. */
.heading {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 1.6rem;
}

.heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--rule), transparent);
}

.lede {
  color: var(--ivory-dim);
  font-size: 1.12rem;
}

section {
  padding: 4.5rem 0;
  border-top: 1px solid var(--rule);
}

/* ---- masthead ------------------------------------------------------------ */

header.mast {
  padding: 3rem 0 0;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(198, 155, 74, 0.09), transparent 60%),
    var(--japan);
}

.title {
  font-size: clamp(4rem, 14vw, 9rem);
  line-height: 0.86;
  margin: 0;
  color: var(--ivory);
  font-weight: normal;
}

.title span {
  color: var(--brass);
}

.standfirst {
  max-width: 36rem;
  font-size: 1.3rem;
  color: var(--ivory-dim);
  margin: 1.2rem 0 1.6rem;
}

.standfirst strong {
  color: var(--ivory);
  font-weight: normal;
}

nav.top {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  padding: 1rem 0 2.2rem;
  font-size: 1.15rem;
}

nav.top a {
  text-decoration: none;
  color: var(--ivory-dim);
  text-transform: uppercase;
}

nav.top a:hover {
  color: var(--brass-bright);
}

/* ---- the brass button ---------------------------------------------------- */

.buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1.8rem 0 0;
}

.button {
  display: inline-block;
  padding: 0.55rem 1.3rem;
  border: 1px solid var(--brass);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(198, 155, 74, 0.16), rgba(198, 155, 74, 0.05));
  color: var(--brass-bright);
  font-family: "VT323", monospace;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}

.button:hover {
  background: var(--brass);
  color: var(--japan);
}

.button.quiet {
  border-color: var(--rule);
  background: none;
  color: var(--ivory-dim);
}

.button.quiet:hover {
  border-color: var(--ivory-dim);
  background: none;
  color: var(--ivory);
}

/* ---- figures ------------------------------------------------------------- */

figure {
  margin: 0 0 2.5rem;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--sea);
}

figcaption {
  margin-top: 0.7rem;
  font-size: 0.95rem;
  color: var(--ivory-dim);
  max-width: 44rem;
}

figcaption b {
  display: block;
  color: var(--brass);
  font-size: 1.15rem;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero {
  margin: 2.5rem 0 0;
}

.hero img {
  border-color: var(--rule);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  gap: 2rem;
}

/* ---- code ---------------------------------------------------------------- */

pre {
  background: var(--japan-raised);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--brass);
  border-radius: 2px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ivory);
}

pre.polar {
  font-size: 0.78rem;
  color: var(--ivory-dim);
  border-left-color: var(--rule);
}

/* ---- the key list -------------------------------------------------------- */

.keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr));
  /* A card is as tall as its own list — stretched to the row's height, the short
     groups grow a foot of empty case under the last line. */
  align-items: start;
  gap: 1.5rem 2.5rem;
  margin-top: 1.5rem;
}

.group {
  background: var(--case);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 1rem 1.2rem 1.2rem;
}

.plate {
  color: var(--brass);
  font-size: 1.2rem;
  text-transform: uppercase;
  margin: 0 0 0.7rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
}

.row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.8rem;
  padding: 0.3rem 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.key {
  color: var(--brass-bright);
  font-size: 1.05rem;
  text-align: right;
}

.row .what {
  color: var(--ivory-dim);
}

/* A continuation line — the help has rows whose key column is blank on purpose,
   because the sentence belongs to the key above it. */
.row.cont .what {
  color: #8d8a7f;
  font-style: italic;
}

/* ---- numbers ------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(10rem, 100%), 1fr));
  gap: 1.5rem;
  margin: 2rem 0 0;
}

.stat {
  border-left: 2px solid var(--brass);
  padding-left: 0.9rem;
}

.stat b {
  display: block;
  font-size: 2.1rem;
  font-weight: normal;
  color: var(--ivory);
  line-height: 1.1;
}

.stat span {
  font-size: 0.85rem;
  color: var(--ivory-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- the model table ----------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 1.5rem 0;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.9rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}

th {
  font-family: "VT323", monospace;
  font-size: 1.1rem;
  font-weight: normal;
  color: var(--brass);
  text-transform: uppercase;
}

td:first-child {
  color: var(--ivory);
  white-space: nowrap;
  padding-right: 1.5rem;
}

td {
  color: var(--ivory-dim);
}

/* ---- the aside that says what is missing --------------------------------- */

.caveat {
  border: 1px solid var(--rule);
  border-left: 2px solid var(--vermilion);
  background: var(--japan-raised);
  border-radius: 2px;
  padding: 1.1rem 1.3rem;
  margin: 2rem 0;
  font-size: 0.95rem;
}

.caveat b {
  font-family: "VT323", monospace;
  font-size: 1.15rem;
  font-weight: normal;
  color: var(--vermilion);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 0.3rem;
}

.caveat p:last-child {
  margin-bottom: 0;
}

/* ---- install ------------------------------------------------------------- */

.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
  gap: 2.5rem;
}

footer {
  border-top: 1px solid var(--rule);
  padding: 3rem 0 4rem;
  color: var(--ivory-dim);
  font-size: 0.9rem;
}

footer a {
  color: var(--ivory-dim);
}

/* ---- the manual ---------------------------------------------------------- */

.manual-body {
  max-width: 44rem;
}

.manual-body h2 {
  margin-top: 3.5rem;
  font-size: 1.8rem;
}

.manual-body ul {
  padding-left: 1.2rem;
  color: var(--ivory-dim);
}

.manual-body li {
  margin-bottom: 0.5rem;
}

.toc {
  columns: 2;
  column-gap: 2.5rem;
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  font-size: 0.95rem;
}

.toc li {
  margin-bottom: 0.35rem;
  break-inside: avoid;
}

/* Marked `screen` so the print renderer skips it knowingly: WeasyPrint cannot parse a
   bare width query in rem and warns that it has ignored the whole block. */
@media screen and (max-width: 40rem) {
  body {
    font-size: 17px;
  }
  .toc {
    columns: 1;
  }
  .row {
    grid-template-columns: 4.5rem 1fr;
  }
}

/* The moving picture sits between the prose and the stills, and wants a little air
   round it so it does not read as one of the gallery tiles. */
.reel {
  margin: 2.5rem 0 3rem;
}

.reel img {
  border-color: var(--brass);
}

/* ---- the language switcher ----------------------------------------------

   Top of the masthead, before the title: somebody who has landed on the wrong
   language wants out of it before they read anything, not after. Small, because it
   is a correction rather than a feature. */

.langs {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin: 0 0 1.2rem;
  font-family: "VT323", monospace;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.langs span {
  color: var(--ivory-dim);
  text-transform: uppercase;
  opacity: 0.7;
}

.langs a {
  color: var(--brass-bright);
  text-decoration: none;
  border-bottom: 1px solid rgba(198, 155, 74, 0.4);
}

.langs a:hover {
  color: var(--ivory);
  border-bottom-color: var(--ivory);
}
