/* ============================================================================
   help.css: the help pages (help/<lang>/index.html) and the Cookies &
   Privacy pages next to them (help/<lang>/privacy.html).
   Same colors and frames as the game's dialogs (see style.css), with a
   book face for reading. The table of contents is drawn as a train line.
   ========================================================================= */
:root {
  --bg: #14100b;
  --panel: #1b140c;
  --ink: #eae2c8;
  --muted: #c9b27c;
  --rule: #5a4a2f;
  --rule-soft: #2b2114;
  --frame: #7a6238;
  --gold: #c9a13c;
  --gold-hi: #f4e2a0;
  --link: #9fd0ff;
  --sea: #4094ce;
  --pixel: "Courier New", Courier, monospace;
  --read: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--read);
  font-size: 18px;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--link); text-underline-offset: 3px; }
a:hover { color: #cfe8ff; }
a:focus-visible, summary:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.px {
  display: inline-block;
  width: 32px;
  height: 32px;
  vertical-align: middle;
  shape-rendering: crispEdges;
  flex: none;
}

/* ----- top bar ----------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 14px 20px;
  font-family: var(--pixel);
  font-size: 14px;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 #000;
}

/* every site the game lives on: each keeps its own worlds */
.sites {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
}

.sites a {
  font-weight: bold;
  color: var(--ink);
  text-decoration: none;
}

.sites a:hover { text-decoration: underline; }

.sites a[aria-current] { color: var(--gold-hi); }

.sites .sep { color: var(--rule); }

.langs {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.langs a {
  padding: 4px 10px;
  color: var(--ink);
  text-decoration: none;
  border: 2px solid var(--rule);
  border-radius: 3px;
}

.langs a:hover { background: #4a3a20; }

.langs a[aria-current] {
  font-weight: bold;
  color: var(--panel);
  text-shadow: none;
  background: var(--gold);
  border-color: var(--gold-hi);
}

/* ----- buttons (the game's rpg-btn) -------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  font-family: var(--pixel);
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--ink);
  text-decoration: none;
  text-shadow: 1px 1px 0 #000;
  background: #2b2114;
  border: 2px solid var(--ink);
  border-radius: 3px;
}

.btn:hover { color: var(--ink); background: #4a3a20; }

.btn.primary {
  font-weight: bold;
  color: var(--panel);
  text-shadow: none;
  background: var(--gold);
  border-color: var(--gold-hi);
}

.btn.primary:hover { color: var(--panel); background: #e0b84a; }

.topbar .btn { min-height: 36px; padding: 4px 14px; font-size: 14px; }

/* ----- hero: a strip of map with the welcome box over it ----------------- */
.hero { position: relative; }

.scene {
  display: block;
  width: 100%;
  height: clamp(150px, 22vw, 230px);
  object-fit: cover;
  border-top: 3px solid var(--rule-soft);
  border-bottom: 3px solid var(--rule-soft);
}

.welcome {
  position: relative;
  max-width: 760px;
  margin: -64px auto 0;
  padding: 22px 26px 26px;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 6px var(--frame), 0 14px 40px rgba(0, 0, 0, 0.6);
}

.welcome-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--rule);
}

h1, h2, h3, summary, .term {
  font-family: var(--pixel);
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 #000;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 32px);
  line-height: 1.2;
}

.pitch {
  margin: 0 0 14px;
  font-size: 20px;
  line-height: 1.6;
}

.welcome .aside { margin: 0 0 20px; color: var(--muted); }
.welcome .aside.last { margin-bottom: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ----- page body: the line on the left, the reading on the right ---------- */
.page {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 48px;
  max-width: 1120px;
  margin: 56px auto 0;
  padding: 0 20px 40px;
}

/* the table of contents is a train line: one stop per section */
.line {
  position: sticky;
  top: 24px;
  align-self: start;
  font-family: var(--pixel);
  font-size: 15px;
  letter-spacing: 1px;
}

.line ol {
  position: relative;
  margin: 0;
  padding: 0 0 0 40px;
  list-style: none;
}

/* the rails, from the first stop to the last */
.line ol::before {
  content: "";
  position: absolute;
  left: 53px;
  top: 16px;
  bottom: 16px;
  width: 6px;
  background:
    repeating-linear-gradient(to bottom, #5b3b22 0 3px, transparent 3px 8px),
    linear-gradient(to right, #4d5257 0 1px, #cfd4d8 1px 2px, transparent 2px 4px, #cfd4d8 4px 5px, #4d5257 5px 6px);
}

.line li { position: relative; }

.line a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 4px 0;
  color: var(--ink);
  text-decoration: none;
  text-shadow: 1px 1px 0 #000;
}

.line a:hover .stop-name { text-decoration: underline; }

.stop {
  position: relative;
  z-index: 1;
  flex: none;
  width: 32px;
  height: 20px;
  background: var(--c);
  border: 2px solid var(--panel);
  border-radius: 3px;
  box-shadow: 0 0 0 2px var(--ink);
}

.line a[aria-current] .stop-name { color: var(--gold-hi); font-weight: bold; }

/* the little train that waits at the section you're reading */
.line .train {
  position: absolute;
  left: 0;
  top: 0;
  width: 32px;
  height: 32px;
  opacity: 0;
  transform: translateY(var(--y, 0));
  transition: transform 0.45s ease, opacity 0.2s;
  pointer-events: none;
}

.line.has-train .train { opacity: 1; }

/* ----- reading column ---------------------------------------------------- */
main { max-width: 68ch; }

section { padding-bottom: 28px; margin-bottom: 40px; border-bottom: 2px solid var(--rule-soft); }
section:last-child { border-bottom: none; }

h2 {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  font-size: 26px;
  line-height: 1.25;
}

h2 .stop { width: 36px; height: 24px; }

h3 {
  margin: 30px 0 10px;
  font-size: 18px;
  color: var(--gold-hi);
}

p { margin: 0 0 14px; }

.lead { font-size: 20px; }

.hint { color: var(--muted); font-size: 16px; }

.inline-px { width: 24px; height: 24px; margin: -4px 2px 0; }

/* building and action lists: a sprite, a name, a few words */
.things { margin: 0 0 14px; padding: 0; list-style: none; }

.thing {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 2px 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
}

.thing:last-child { border-bottom: none; }

.thing .px { grid-row: span 3; width: 40px; height: 40px; }

.thing .term { display: block; font-size: 16px; }

.thing .desc { display: block; }

/* "Try the example": opens the use case's shared map in the game */
.thing .try {
  grid-column: 2;
  justify-self: start;
  margin-top: 6px;
  padding: 2px 0;
  font-family: var(--pixel);
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 #000;
}

.thing .try::after { content: " \2192"; }

ol.steps { margin: 0 0 14px; padding-left: 1.4em; }
ol.steps li { margin-bottom: 6px; padding-left: 4px; }
ol.steps li::marker { font-family: var(--pixel); font-weight: bold; color: var(--gold); }

/* keyboard shortcuts */
.keys-wrap { overflow-x: auto; }

.keys { width: 100%; border-collapse: collapse; font-size: 16px; }

.keys th, .keys td {
  padding: 8px 12px 8px 0;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule-soft);
}

.keys th { width: 1%; padding-right: 24px; font-weight: normal; white-space: nowrap; }

kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 1px 6px;
  font-family: var(--pixel);
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  color: var(--panel);
  background: var(--ink);
  border-radius: 3px;
  box-shadow: 0 2px 0 var(--muted);
}

/* the one box on the page: keeping worlds safe */
.keep {
  margin: 26px 0 8px;
  padding: 16px 20px;
  background: rgba(64, 148, 206, 0.08);
  border: 2px solid var(--rule);
  border-radius: 4px;
}

.keep h3 { margin-top: 0; }
.keep p:last-child { margin-bottom: 0; }

/* Missing worlds: our sites, and a few things to check */
.sites-list .term { font-size: 17px; }

.sites-list .is-here .term { color: var(--gold-hi); }

.here-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 8px;
  font-family: var(--pixel);
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--panel);
  background: var(--gold);
  border-radius: 3px;
}

.here-tag[hidden] { display: none; }

.checks { margin: 0 0 14px; padding-left: 1.2em; }
.checks li { margin-bottom: 6px; padding-left: 4px; }
.checks li::marker { color: var(--gold); }

/* ----- FAQ ---------------------------------------------------------------- */
.faq-group { margin-bottom: 26px; }

.faq-group h3 { margin-top: 26px; }

details { border-bottom: 1px solid var(--rule-soft); }

summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  list-style: none;
}

summary::-webkit-details-marker { display: none; }

summary::before {
  content: "+";
  flex: none;
  width: 22px;
  height: 22px;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  color: var(--panel);
  text-shadow: none;
  background: var(--gold);
  border-radius: 3px;
}

details[open] summary::before { content: "\2212"; }

summary:hover { color: var(--gold-hi); }

details .answer { padding: 0 0 14px 34px; }
details .answer p:last-child { margin-bottom: 0; }

/* ----- footer -------------------------------------------------------------- */
.foot {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--muted);
  border-top: 2px solid var(--rule-soft);
}

.foot .langs { margin-left: 0; }

/* ----- Cookies & Privacy page: one reading column -------------------------- */
.doc {
  max-width: calc(68ch + 40px);
  margin: 40px auto 0;
  padding: 0 20px 24px;
}

.doc h1 { margin-bottom: 6px; }

.doc .updated { margin: 0 0 24px; font-size: 16px; color: var(--muted); }

.doc .keep { margin: 0 0 36px; }

.doc .keep p { font-size: 20px; }

.doc section { padding-bottom: 12px; margin-bottom: 28px; }

.doc h2 { margin-bottom: 12px; font-size: 22px; }

.doc ul { margin: 0 0 14px; padding-left: 1.2em; }

.doc li { margin-bottom: 10px; padding-left: 4px; }

.doc li::marker { color: var(--gold); }

.doc li strong { font-family: var(--pixel); font-size: 16px; letter-spacing: 1px; }

.doc a[href^="mailto:"] { overflow-wrap: anywhere; }

/* ----- narrow screens: the line runs across the top ----------------------- */
@media (max-width: 860px) {
  body { font-size: 17px; }
  .page { display: block; margin-top: 36px; }
  .line { position: static; margin-bottom: 36px; overflow-x: auto; }
  .line ol { display: flex; gap: 4px; width: max-content; padding: 0 0 6px; }
  .line ol::before {
    left: 40px; right: 40px; top: 12px; bottom: auto; width: auto; height: 6px;
    background:
      repeating-linear-gradient(to right, #5b3b22 0 3px, transparent 3px 8px),
      linear-gradient(to bottom, #4d5257 0 1px, #cfd4d8 1px 2px, transparent 2px 4px, #cfd4d8 4px 5px, #4d5257 5px 6px);
  }
  .line a { flex-direction: column; gap: 6px; padding: 4px 10px; font-size: 13px; white-space: nowrap; }
  .line .train { display: none; }
  .welcome { margin: -40px 12px 0; padding: 18px 18px 22px; }
  .pitch, .lead { font-size: 18px; }
  .doc { margin-top: 28px; }
  .doc .keep p { font-size: 18px; }
  .topbar { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
  /* the site addresses get a row of their own above the language and Play buttons */
  .topbar .sites { order: -1; flex-basis: 100%; }
}

@media (max-width: 480px) {
  .topbar .sites { font-size: 13px; }
  .langs { margin-left: 0; }
  .topbar .btn { margin-left: auto; }
  details .answer { padding-left: 0; }
}

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