/*
  ONE UP legal pages and the "Add a friend" page. One shared stylesheet (only
  the add page has a small script, inside the page). The same look as the
  home page: flat near-black background, neutral glass boxes, lime only as a
  small accent, headings in Bebas Neue (hosted here, in assets/fonts) and
  body text in the device's own font. Nothing loads from other companies.

  On wide screens the Privacy Policy and the Terms read in two columns: the
  contents list stays in view on the left while the text scrolls on the
  right. The markup is the same as on phones.
*/

@font-face {
  font-family: "Bebas Neue";
  src: url("assets/fonts/BebasNeue-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0a0a;
  --pane: rgba(255, 255, 255, 0.045);
  --rim: rgba(255, 255, 255, 0.09);
  --rim-2: rgba(255, 255, 255, 0.17);
  --text: #f4f5f1;
  --muted: #b9beb5;
  --accent: #6ac006;
  --display: "Bebas Neue", "Arial Narrow", sans-serif;
  color-scheme: dark;
}

::selection {
  background: var(--accent);
  color: #0a0a0a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: #2c2e2a var(--bg);
  accent-color: var(--accent);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 600px) {
  .wrap {
    padding: 0 24px;
  }
}

/* Skip link for keyboard and screen reader users */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}

.skip:focus {
  left: 16px;
  top: 12px;
  background: var(--bg);
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  z-index: 10;
}

/* Header: the logo, the four page links (44px pills; the page you are on is
   underlined in lime) and a quiet link to join the test. On small phones the
   links scroll sideways in one row. */
.site-header {
  border-bottom: 1px solid var(--rim);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  max-width: 1040px;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* The real logo mark and wordmark, like the home page and the app. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  text-decoration: none;
}

.brand img {
  display: block;
  width: auto;
  height: 24px;
}

.brand .brand-word {
  height: 15px;
}

.site-nav {
  flex: 1 1 auto;
  min-width: 0;
}

.site-nav ul {
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
}

.site-nav li {
  margin: 0;
}

.site-nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--pane);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.join-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--rim-2);
  border-radius: 999px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.join-link:hover {
  background: var(--pane);
}

@media (max-width: 639.98px) {
  .site-nav {
    order: 3;
    flex-basis: 100%;
    margin: 0 -16px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav ul {
    width: max-content;
    padding: 0 4px;
  }

  .join-link {
    margin-left: auto;
  }
}

/* Text */
main,
main.wrap {
  padding-top: 48px;
  padding-bottom: 64px;
}

/* A link to a part of the page leaves a little room above it. */
[id] {
  scroll-margin-top: 24px;
}

h1,
h2 {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(56px, 8vw, 96px);
  line-height: 0.9;
  margin: 0 0 14px;
}

h2 {
  position: relative;
  font-size: 40px;
  line-height: 1;
  margin: 48px 0 14px;
  padding-top: 8px;
  scroll-margin-top: 24px;
}

/* The section a link jumps to gets a lime bar that leans like the logo. */
h2:target::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 10px;
  bottom: 4px;
  width: 3px;
  background: var(--accent);
  transform: skewX(-12deg);
}

@media (max-width: 639.98px) {
  h2 {
    font-size: 32px;
  }

  h2:target::before {
    left: -10px;
  }
}

h3 {
  font-size: 1.1rem;
  line-height: 1.35;
  margin: 28px 0 8px;
}

p,
ul,
ol {
  margin: 0 0 14px;
}

ul,
ol {
  padding-left: 1.4em;
}

li {
  margin-bottom: 6px;
}

li > ul,
li > ol {
  margin-top: 6px;
}

strong {
  font-weight: 700;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.meta {
  color: var(--muted);
  font-size: 1rem;
  margin-bottom: 24px;
}

.lead {
  font-size: 1.1rem;
}

.muted {
  color: var(--muted);
}

/* Panes: flat, neutral glass */
.box {
  background: var(--pane);
  border: 1px solid var(--rim);
  border-radius: 20px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 20px 24px;
  margin: 0 0 24px;
}

.box > :last-child {
  margin-bottom: 0;
}

.box h2,
.box h3 {
  margin-top: 0;
  padding-top: 0;
}

.box-title {
  font-weight: 700;
  margin-bottom: 8px;
}

/* Table of contents */
.toc ol {
  margin: 0;
  columns: 2 220px;
  column-gap: 24px;
}

.toc li {
  break-inside: avoid;
}

/* Wide screens: the contents list stays in view beside the text. */
@media (min-width: 1100px) {
  main.wrap:has(> .toc) {
    max-width: 1040px;
    display: grid;
    grid-template-columns: 240px minmax(0, 720px);
    column-gap: 80px;
    align-items: start;
  }

  main > .toc {
    grid-column: 1;
    grid-row: 1 / span 400;
    align-self: start;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 48px);
    overflow: auto;
    font-size: 15px;
  }

  main > .toc ol {
    columns: auto;
  }

  main > :not(.toc) {
    grid-column: 2;
  }
}

/* Numbered steps, with the numbers in the heading face */
.steps {
  padding-left: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  margin-bottom: 12px;
  padding-left: 40px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1em;
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--muted);
}

.path {
  font-weight: 700;
}

/* Tables scroll sideways on small phones instead of widening the page */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 20px;
  background: var(--pane);
  border: 1px solid var(--rim);
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rim);
}

tr:last-child td {
  border-bottom: 0;
}

th {
  background: var(--pane);
  font-weight: 700;
}

caption {
  caption-side: bottom;
  padding: 10px 12px;
  text-align: left;
  color: var(--muted);
  font-size: 1rem;
}

td:first-child {
  font-weight: 600;
  min-width: 140px;
}

/* Add a friend page (add/index.html). Its script shows or hides parts with
   the hidden attribute, which no rule below may undo. */
[hidden] {
  display: none !important;
}

.friend-code {
  font-family: var(--display);
  font-size: clamp(64px, 16vw, 120px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
  margin: 6px 0 14px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 22px;
  border: 1px solid var(--rim-2);
  border-radius: 999px;
  background: var(--pane);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.button:hover {
  border-color: var(--muted);
}

.button-lime {
  min-height: 56px;
  padding: 10px 28px;
  border-color: var(--accent);
  background: var(--accent);
  color: #0a0a0a;
}

.button-lime:hover {
  border-color: var(--accent);
}

.button-lime:focus-visible {
  outline-color: var(--text);
}

/* Things the owner still has to decide. Replace every one before publishing. */
.todo {
  font-style: italic;
  color: var(--text);
  background: transparent;
  border: 1px dashed var(--muted);
  border-radius: 4px;
  padding: 0 4px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rim);
  color: var(--muted);
  font-size: 1rem;
}

.site-footer .wrap {
  max-width: 1040px;
  padding-top: 16px;
  padding-bottom: 32px;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.site-footer li {
  margin: 0;
}

.site-footer ul a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover {
  color: var(--text);
}

.site-footer p {
  margin: 0 0 6px;
}

/* Reduced transparency and more contrast */
@media (prefers-reduced-transparency: reduce) {
  :root {
    --pane: #141414;
  }
}

@media (prefers-contrast: more) {
  :root {
    --rim: rgba(255, 255, 255, 0.3);
  }
}

/* Printing: black on white, no header, and every link shows its address. */
@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .site-header,
  .skip,
  .site-footer ul {
    display: none;
  }

  main,
  main.wrap {
    padding: 0;
  }

  main.wrap:has(> .toc) {
    display: block;
  }

  main > .toc {
    position: static;
    max-height: none;
  }

  a {
    color: #000;
  }

  a[href^="http"]::after,
  a[href^="mailto:"]::after {
    content: " (" attr(href) ")";
    font-size: 0.9em;
  }

  .box,
  .table-wrap,
  th {
    background: none;
    box-shadow: none;
    border-color: #999;
  }

  .muted,
  .meta,
  .site-footer {
    color: #333;
  }
}
