/*
 * The scorer guide's pages (/help, /help/questions). The colours are the
 * scorer's (src/scorer/ui.tsx); light or dark follows the scorer's own switch
 * when the referee has set one (data-theme, set in each page's head),
 * otherwise the device.
 */
/*
 * The headings' font, shared with the scorer (public/fonts; preloaded in each
 * page's head, kept a year by vercel.json, so a new version needs a new name).
 * block: the headings wait for it rather than show in a system font and then
 * change, the browser's own limit (about 3 s) giving way to the fallback on a
 * very slow line.
 */
@font-face {
  font-family: 'Barlow Condensed';
  font-weight: 700;
  font-display: block;
  src: url('/fonts/barlow-condensed-700-v1.woff2') format('woff2');
}
:root {
  --bg: #0b0f14;
  --panel: #151b23;
  --line: #2a3340;
  --text: #f5f7fa;
  --muted: #9aa6b2;
  --accent: #facc15;
  --on-accent: #111827;
  --mark: #facc15;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #eef1f5;
    --panel: #ffffff;
    --line: #b3bcc8;
    --text: #0b1220;
    --muted: #4b5565;
    --mark: #6d28d9;
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #eef1f5;
  --panel: #ffffff;
  --line: #b3bcc8;
  --text: #0b1220;
  --muted: #4b5565;
  --mark: #6d28d9;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.5 system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  -webkit-text-size-adjust: 100%;
}
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}
h1,
h2 {
  font-family: 'Barlow Condensed', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}
h1 {
  font-size: 34px;
}
h2 {
  font-size: 24px;
  margin-bottom: 8px;
}
h3 {
  font-size: 17px;
  margin: 20px 0 6px;
}
section > h3:first-of-type {
  margin-top: 12px;
}
/* A step inside a long subsection (the analysis). */
h4 {
  font-size: 15px;
  margin: 16px 0 4px;
}
p,
ul,
ol {
  margin: 0 0 10px;
}
ul,
ol {
  padding-left: 22px;
}
li {
  margin-bottom: 4px;
}
a {
  color: inherit;
  text-decoration-color: var(--muted);
  text-underline-offset: 3px;
}
.back {
  display: inline-block;
  margin-bottom: 12px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-decoration: none;
  font-weight: 600;
}

/* The two pages, side by side under the title. */
.pages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 12px 0 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
/* Two to a row on a phone (four didn't fit on a line), all four from 600 px. */
.pages a {
  flex: 1 1 calc(50% - 2px);
  padding: 8px 6px;
  font-size: 15px;
  border-radius: 9px;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  color: var(--muted);
}
@media (min-width: 600px) {
  .pages a {
    flex: 1 1 0;
  }
}
.pages a[aria-current='page'] {
  background: var(--accent);
  color: var(--on-accent);
}

nav.toc {
  margin-top: 12px;
}
nav.toc ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}
nav.toc a {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  font-size: 14px;
}
section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}
.checklist {
  border-color: var(--accent);
}
.note {
  color: var(--muted);
  font-size: 14px;
}
.warn {
  border-left: 4px solid var(--mark);
  padding-left: 12px;
}
kbd {
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
}

/* Screenshots: the phone's screen, framed, at most its real size. */
.shots {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 14px;
}
/* Two to a row even on a phone: stacked, each pair was two screens tall. */
figure {
  margin: 0;
  flex: 1 1 130px;
  max-width: 260px;
}
figure.wide {
  flex-basis: 100%;
  max-width: 500px;
}
figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eef1f5;
}
figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

details {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
}
details[open] {
  padding-bottom: 6px;
}
summary {
  padding: 10px 0;
  font-weight: 600;
  cursor: pointer;
}

/* Text to copy, e.g. what the desk receives, or a brief for referees. */
pre {
  margin: 8px 0 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font:
    14px/1.5 ui-monospace,
    'Cascadia Mono',
    Menlo,
    Consolas,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/*
 * Desktop: two columns. Each block of screenshots floats into a column on the
 * right, beside the text that follows it, and each heading starts below the
 * last block, so screenshots stay with their own part. The text keeps about
 * the line length it has at 720 px. Phones and tablets are as above.
 */
@media (min-width: 1024px) {
  main {
    max-width: 1120px;
  }
  section {
    display: flow-root;
  }
  section h2,
  section h3,
  section h4 {
    clear: both;
  }
  .shots {
    float: right;
    clear: right;
    width: 420px;
    margin: 4px 0 16px 32px;
  }
  /* Text keeps a readable line length: in a section with screenshots, the
     left column, beside them or not; in one without, about the old width. */
  section > p,
  section > ul,
  section > ol,
  section > pre,
  section > details {
    max-width: 760px;
  }
  section:has(.shots) > p,
  section:has(.shots) > ul,
  section:has(.shots) > ol,
  section:has(.shots) > pre,
  section:has(.shots) > details {
    max-width: calc(100% - 452px);
  }
  figure {
    max-width: 204px;
  }
  figure.wide {
    max-width: none;
  }
}
