/*
 * The page in front of the application. It carries the same palette as the app itself
 * (src/styles.css), so opening the app is a continuation rather than a jump, and it follows
 * the theme the app stored: `landing.js` writes `data-theme` on the root before paint.
 */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #d9dde5;
  --accent: #2563c9;
  --accent-ink: #ffffff;
  --accent-soft: #e6eefc;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 1px 2px rgb(29 35 48 / 5%), 0 10px 28px rgb(29 35 48 / 6%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #15181e;
    --panel: #1d2129;
    --text: #e5e7eb;
    --muted: #9aa3b2;
    --border: #323846;
    --accent: #6d9cf2;
    --accent-ink: #12161d;
    --accent-soft: #24324d;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 28px rgb(0 0 0 / 34%);
  }
}

:root[data-theme='dark'] {
  --bg: #15181e;
  --panel: #1d2129;
  --text: #e5e7eb;
  --muted: #9aa3b2;
  --border: #323846;
  --accent: #6d9cf2;
  --accent-ink: #12161d;
  --accent-soft: #24324d;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 28px rgb(0 0 0 / 34%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 2;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
}

.wrap {
  max-width: 64rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 4rem) clamp(1rem, 5vw, 2.5rem);
}

.top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.mark {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
}

.wordmark {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.sub {
  font-size: 0.82rem;
  color: var(--muted);
}

.lang {
  margin-left: auto;
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lang button {
  background: var(--panel);
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
}

.lang button + button {
  border-left: 1px solid var(--border);
}

.lang button[aria-pressed='true'] {
  background: var(--accent-soft);
  color: var(--accent);
}

.lang button:hover[aria-pressed='false'] {
  color: var(--text);
}

h1 {
  font-weight: 640;
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 0.7rem;
  text-wrap: balance;
}

h1 em {
  font-style: normal;
  color: var(--accent);
}

.lede {
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.1rem);
  max-width: 54ch;
  margin: 0 0 2rem;
}

.cta {
  margin: 0 0 0.6rem;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 650;
  font-size: 1.02rem;
  padding: 0.7rem 1.5rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.button:hover {
  filter: brightness(1.07);
}

.cta-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3rem 0 0.9rem;
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

@media (min-width: 46rem) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }

  /* An odd number of cards would otherwise leave the last cell of the grid empty, and an empty
     cell shows the list's own background, which is the hairline colour: a coloured block rather
     than a rule. The last card takes the whole row instead. */
  .cards li:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* The cells are the `li`s and the hairlines between them are the grid gap showing the list's
   border colour, so every cell has to fill its row: a shorter card would otherwise leave a band
   of that colour under it, which reads as a stray patch rather than a rule. */
.cards li {
  background: var(--panel);
  padding: 1.3rem 1.45rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.cards h3 {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 650;
  line-height: 1.3;
}

.cards p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* The films are a card list too, but each one wants the whole width: a recording of an interface
   at 1920 by 1080 is unreadable in half a column. Declared after the two-column media query, with
   the same specificity, so the single column wins at every width. */
.films {
  grid-template-columns: 1fr;
}

.films li {
  gap: 0.7rem;
}

.films video {
  display: block;
  width: 100%;
  /* `height` is explicit because the element's own width and height attributes, which give the
     recording's shape before it has loaded, come through as a height of 1080 pixels otherwise. */
  height: auto;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #000;
}

.note {
  color: var(--muted);
  max-width: 68ch;
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
}

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

caption,
th,
td {
  text-align: left;
}

thead th {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 0.8rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

tbody th {
  font-weight: 600;
  white-space: nowrap;
}

tbody th,
tbody td {
  padding: 0.65rem 1.1rem;
  vertical-align: top;
}

tbody tr + tr th,
tbody tr + tr td {
  border-top: 1px solid var(--border);
}

tbody td:last-child {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

footer {
  margin-top: 3rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.84rem;
}

footer p {
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.93em;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The three pages, as one row under the wordmark. The page you are on is not a destination, so
   it is marked rather than offered, and the application stands at the end of the row as the one
   thing a reader may have come for. */
.pages {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
  margin: 0 0 2.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.pages a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
}

.pages a:hover {
  color: var(--text);
  background: var(--panel);
}

.pages a[aria-current='page'] {
  color: var(--accent);
  background: var(--accent-soft);
}

.pages .go {
  margin-left: auto;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid var(--border);
}

.pages .go:hover {
  color: var(--accent-ink);
  background: var(--accent);
}

/* The two doors on the front page: the same card list, but each card is a destination, so its
   heading is the link and the pair stands taller than a feature card does. */
.doors li {
  padding: 1.6rem 1.5rem;
  gap: 0.5rem;
}

.doors h3 {
  font-size: 1.22rem;
}

.doors h3 a {
  color: var(--text);
  text-decoration: none;
}

.doors h3 a::after {
  content: ' →';
  color: var(--accent);
}

.doors h3 a:hover {
  color: var(--accent);
}

/* What stands on the detail page, which is long enough that scrolling is not navigation. */
.contents {
  margin-bottom: 2.6rem;
}

.contents .section-label {
  margin-top: 2.2rem;
}

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem 1.4rem;
  font-size: 0.93rem;
}

@media (min-width: 40rem) {
  .toc {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 60rem) {
  .toc {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* A link inside a sentence. The text of a card is muted, so a link in it has to carry the accent
   to be seen at all; `.button` and the rows above set their own colour and keep it. */
a {
  color: var(--accent);
  text-underline-offset: 2px;
}
