/* The Strand site. Colours are the site's own palette (theme.css,
   generated by strand-site from crates/strand-site/src/theme.rs, light
   and dark); nothing here names a colour of its own. Layout: one pair of
   outer margins; docs pages are sidebar | prose | contents, the home page
   one centred column. Boxes and bars are told apart by one hairline
   (--line), and every control is one .btn. */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/inter-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-text: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* The type scale: four sizes do the work. */
  --t-1: 2.25rem;
  --t-2: 1.5rem;
  --t-body: 1.0625rem;
  --t-small: 0.875rem;

  /* One control system: every button, field and switch is one height,
     one radius and one padding, and every box (code, figure, card) one
     radius, so nothing is round beside something square. */
  --r: 6px;
  --r-box: 10px;
  --h: 34px;
  --pad-x: 14px;

  --gutter: max(16px, min(3vw, 32px));
  --measure: 70ch;
  --top-h: 56px;

  --ease-out: cubic-bezier(0.2, 0, 0, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--top-h) + 16px);
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--raised);
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--accent-soft);
  color: var(--on-accent-soft);
}

code,
pre {
  font-family: var(--font-code);
  font-variant-ligatures: none;
}

:not(pre) > code {
  font-size: 0.88em;
  background: var(--raised-2);
  padding: 0.12em 0.36em;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

/* ---- Controls -------------------------------------------------------- */

/* .btn is every button and button-like link: .primary for the one main
   action, .quiet for a button with no box until hovered, .icon for a
   square that holds only an icon, .small for one inside a box's head. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  padding: 0 var(--pad-x);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--page);
  color: var(--ink);
  font: 500 0.875rem/1 var(--font-text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.btn:hover {
  background: var(--raised-2);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

.btn.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}

.btn.quiet:hover {
  background: var(--raised-2);
  color: var(--ink);
}

.btn.icon {
  width: var(--h);
  padding: 0;
}

.btn.small {
  height: 28px;
  padding: 0 10px;
  font-size: 0.8125rem;
}

.btn.small.icon {
  width: 28px;
  padding: 0;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn[aria-pressed="true"] {
  background: var(--raised-3);
  color: var(--ink);
}

/* A three-way choice, one box of pressed and unpressed buttons. */
.seg {
  display: inline-flex;
  gap: 2px;
  height: var(--h);
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--page);
}

.seg button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.seg button:hover {
  color: var(--ink);
}

.seg button[aria-pressed="true"] {
  background: var(--raised-3);
  color: var(--ink);
}

.seg svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Top bar --------------------------------------------------------- */

.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.top-in {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--top-h);
  max-width: 1440px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.brand {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.mark {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
}

.top-nav {
  display: flex;
  gap: 2px;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  height: var(--h);
  padding: 0 12px;
  border-radius: var(--r);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
}

.top-nav a:hover {
  color: var(--ink);
  background: var(--raised-2);
}

.top-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--raised-2);
}

.top-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.menu {
  display: none;
}

.menu svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

/* The theme switch and the search need the script, which shows them. */
.theme {
  display: none;
}

.js .theme {
  display: inline-flex;
}

/* The search: a field in the top bar, a control like the rest, and its
   results in a box under it. */
.search {
  display: none;
  position: relative;
  align-items: center;
  min-width: 0;
}

.js .search {
  display: flex;
}

.search-input {
  width: 15rem;
  height: var(--h);
  padding: 0 34px 0 32px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--page);
  color: var(--ink);
  font: inherit;
  font-size: 0.875rem;
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder {
  color: var(--ink-2);
  opacity: 1;
}

.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  display: none;
}

.search-input:hover {
  background: var(--raised);
}

.search-input:focus {
  background: var(--page);
  border-color: var(--accent);
  outline: none;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.5;
  stroke-linecap: round;
  pointer-events: none;
}

.search-key {
  position: absolute;
  right: 8px;
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-2);
  font-family: var(--font-code);
  font-size: 0.75rem;
  line-height: 18px;
  text-align: center;
  pointer-events: none;
}

.search-input:focus ~ .search-key {
  display: none;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: min(36rem, calc(100vw - 2 * var(--gutter)));
  max-height: min(70vh, 34rem);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  background: var(--page);
}

.search-results[hidden] {
  display: none;
}

.search-hit {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: var(--r);
  color: var(--ink);
  text-decoration: none;
}

.search-hit[aria-selected="true"] {
  background: var(--raised-2);
}

.search-hit-title {
  font-weight: 600;
  line-height: 1.35;
}

.search-hit-page {
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.search-hit-text {
  font-size: var(--t-small);
  line-height: 1.45;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.search-results mark {
  background: var(--accent-soft);
  color: var(--on-accent-soft);
  border-radius: 3px;
  padding: 0 1px;
}

.search-note {
  margin: 0;
  padding: 10px 12px;
  font-size: var(--t-small);
  color: var(--ink-2);
}

/* ---- Docs layout ----------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 208px;
  gap: 48px;
  max-width: 1440px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

.sidebar {
  position: sticky;
  top: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  align-self: start;
  max-height: calc(100vh - var(--top-h) - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  padding: 28px 4px 48px 0;
  font-size: var(--t-small);
}

.side-title {
  margin: 22px 0 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
}

.side-title:first-child {
  margin-top: 0;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar a {
  display: block;
  padding: 4px 10px;
  border-radius: var(--r);
  color: var(--ink);
  text-decoration: none;
  line-height: 1.45;
}

.sidebar a:hover {
  background: var(--raised-2);
}

.sidebar a[aria-current="page"] {
  color: var(--on-accent-soft);
  background: var(--accent-soft);
  font-weight: 600;
}

.main {
  padding: 44px 0 96px;
  min-width: 0;
}

.aside {
  padding: 44px 0 48px;
  min-width: 0;
}

.aside-in {
  position: sticky;
  top: calc(var(--top-h) + 44px);
}

.toc {
  font-size: 0.8125rem;
}

/* The page as markdown and llms.txt, under the contents. */
.page-md {
  display: grid;
  gap: 2px;
  margin: 20px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
}

.toc:empty + .page-md,
.aside-in > .page-md:first-child {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.page-md a {
  padding: 3px 0;
  color: var(--ink-2);
  text-decoration: none;
}

.page-md a:hover {
  color: var(--ink);
}

.toc-title {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--ink);
}

.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc a {
  display: block;
  padding: 3px 0;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.4;
}

.toc a:hover {
  color: var(--ink);
}

.toc .toc-3 a {
  padding-left: 12px;
}

/* ---- Prose ----------------------------------------------------------- */

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

.prose > * + * {
  margin-top: 1.1em;
}

.prose h1 {
  font-size: var(--t-1);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 650;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

.prose h2 {
  font-size: var(--t-2);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 650;
  margin-top: 2.2em;
  text-wrap: balance;
}

.prose h3 {
  font-size: 1.125rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  font-weight: 620;
  margin-top: 1.8em;
}

.prose h2,
.prose h3 {
  position: relative;
}

.anchor {
  position: absolute;
  left: -1.1em;
  color: var(--ink-2);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
}

.prose h2:hover .anchor,
.prose h3:hover .anchor,
.anchor:focus-visible {
  opacity: 1;
}

.prose p,
.prose li {
  text-wrap: pretty;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 14px 20px;
  background: var(--raised);
  border-radius: var(--r-box);
}

/* A type or element named in the reference's code links to its page. */
.prose code a,
.code pre a {
  color: inherit;
  text-decoration-color: var(--accent);
}

.prose h1 code {
  background: none;
  padding: 0;
  font-size: 0.86em;
  letter-spacing: -0.04em;
}

/* Tables keep their lines: they are tables. */
.table {
  overflow-x: auto;
  margin: 1.4em 0;
}

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 9px 14px 9px 0;
  border-bottom: 1px solid var(--line);
}

.prose th {
  font-weight: 650;
  color: var(--ink);
}

.prose td code {
  white-space: nowrap;
}

/* ---- Code ------------------------------------------------------------ */

.code {
  position: relative;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  overflow: hidden;
  margin: 1.4em 0;
  min-width: 0;
}

.code-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 41px;
  padding: 6px 6px 6px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.code-file {
  font-family: var(--font-code);
  color: var(--ink);
  font-weight: 600;
}

.code-src {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.copy {
  margin-left: auto;
}

.code pre {
  margin: 0;
  padding: 14px 16px 16px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.65;
  tab-size: 2;
}

.code-head + pre {
  padding-top: 14px;
}

/* A block with no file name keeps its copy button in its corner. */
.code > .copy {
  position: absolute;
  top: 6px;
  right: 6px;
}

.code > .copy + pre {
  padding-right: 84px;
}

.hl-keyword,
.hl-keyword-conditional,
.hl-keyword-conditional-ternary,
.hl-keyword-repeat,
.hl-keyword-function,
.hl-keyword-coroutine,
.hl-operator {
  color: var(--hl-keyword);
}

.hl-keyword,
.hl-keyword-conditional,
.hl-keyword-repeat,
.hl-keyword-function,
.hl-keyword-coroutine {
  font-weight: 600;
}

.hl-type,
.hl-module {
  color: var(--hl-type);
}

.hl-function,
.hl-function-call,
.hl-function-method,
.hl-function-method-call {
  color: var(--hl-function);
}

.hl-property {
  color: var(--hl-property);
}

.hl-attribute,
.hl-tag {
  color: var(--hl-attribute);
}

.hl-variable-parameter {
  color: var(--hl-parameter);
}

.hl-string,
.hl-string-escape {
  color: var(--hl-string);
}

.hl-number,
.hl-constant,
.hl-constant-builtin,
.hl-boolean {
  color: var(--hl-number);
}

.hl-comment {
  color: var(--hl-comment);
  font-style: italic;
}

/* `strand check`'s answer, beside the file it was asked of. */
.check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 12px;
  margin: 1.4em 0;
}

.check .code {
  margin: 0;
}

.check-out {
  background: var(--out-bg);
  color: var(--out-fg);
  border-radius: var(--r-box);
  overflow: hidden;
  min-width: 0;
}

.check-cmd {
  font-family: var(--font-code);
  font-size: 0.8125rem;
  padding: 12px 18px 0;
  opacity: 0.8;
}

.prompt {
  color: var(--out-accent);
  margin-right: 0.5em;
}

.check-out pre {
  margin: 0;
  padding: 10px 18px 18px;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* ---- Examples -------------------------------------------------------- */

/* The file, then one box: the frames on a tone of their own, the value
   curve, and a bar of the player's controls. */
.example {
  margin: 2em 0;
  display: grid;
  gap: 12px;
  min-width: 0;
}

.ex-view {
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  background: var(--raised);
  overflow: hidden;
  min-width: 0;
}

/* A stage wider than the box (a bar keeps its size) scrolls sideways
   here, not the page. */
.ex-frame {
  background: var(--raised-2);
  padding: 28px;
  overflow-x: auto;
}

.ex-stage {
  position: relative;
  overflow: hidden;
  width: 100%;
  margin-inline: auto;
  border-radius: 4px;
}

/* The first frame whole, and over it the part that changes: a strip of
   that part of every distinct frame, one under another, from which the
   player picks one by its place in the strip. */
.ex-sprite,
.ex-still {
  position: absolute;
  inset: 0;
}

.ex-still {
  background-size: 100% 100%;
  background-repeat: no-repeat;
}

/* The still frame without the part that changes (example.rs, `hole`),
   once that part has loaded: it is drawn there alone, so see-through
   pixels are not doubled. */
.ex-loaded > .ex-holed {
  -webkit-mask:
    linear-gradient(#000 0 0) var(--hole-x) var(--hole-y) / var(--hole-w) var(--hole-h) no-repeat,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) var(--hole-x) var(--hole-y) / var(--hole-w) var(--hole-h) no-repeat exclude,
    linear-gradient(#000 0 0);
}

.ex-moving {
  position: absolute;
  background-size: 100% auto;
  background-repeat: no-repeat;
  background-position: 0 0;
}

.ex-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ex-dark {
    display: block;
  }
  :root:not([data-theme="light"]) .ex-light {
    display: none;
  }
}

:root[data-theme="dark"] .ex-dark {
  display: block;
}

:root[data-theme="dark"] .ex-light {
  display: none;
}

.ex-plot {
  display: grid;
  gap: 10px;
  padding: 16px 16px 14px;
  border-top: 1px solid var(--line);
}

/* The bar: the player's, or the playground's. */
.ex-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.ex-bar svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.ex-icon-pause {
  display: none;
}

.ex-play[aria-pressed="true"] .ex-icon-pause {
  display: inline;
}

.ex-play[aria-pressed="true"] .ex-icon-play {
  display: none;
}

.ex-scrub {
  flex: 1 1 120px;
  min-width: 80px;
  margin: 0 6px;
  accent-color: var(--accent);
}

.ex-time {
  font-variant-numeric: tabular-nums;
  font-size: var(--t-small);
  color: var(--ink-2);
  min-width: 6ch;
  text-align: right;
  padding-right: 6px;
}

.ex-curve {
  width: 100%;
  height: auto;
  display: block;
}

.ex-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.ex-axis {
  fill: var(--ink-2);
  font-family: var(--font-text);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ex-mark {
  stroke: var(--ink-2);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}

.ex-line {
  fill: none;
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ex-cursor {
  stroke: var(--ink);
  stroke-width: 1.5;
}

.ex-c0 {
  stroke: var(--c0);
  background: var(--c0);
}

.ex-c1 {
  stroke: var(--c1);
  background: var(--c1);
}

.ex-c2 {
  stroke: var(--c2);
  background: var(--c2);
}

.ex-c3 {
  stroke: var(--c3);
  background: var(--c3);
}

.ex-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: var(--t-small);
  color: var(--ink-2);
}

.ex-swatch {
  display: inline-block;
  width: 14px;
  height: 4px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 8px;
}

.example figcaption {
  font-size: var(--t-small);
  color: var(--ink-2);
  margin: 0;
}

.example .code {
  margin: 0;
}

/* ---- The playground's runs (assets/live.js, docs/live-examples.md) -- */

.lv-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* Next step names the step it runs, in code, cut when long. */
.lv-next-what {
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0;
  background: none;
  color: var(--ink-2);
  font-size: 0.8125rem;
}

.lv-status {
  font-size: var(--t-small);
  color: var(--ink-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv-status:empty {
  display: none;
}

/* An empty stage says so. */
.lv-empty {
  display: none;
  position: absolute;
  inset: 0;
  margin: 0;
  place-items: center;
  padding: 0 16px;
  text-align: center;
  font-size: var(--t-small);
  color: var(--ink-2);
}

.lv-blank .lv-empty {
  display: grid;
}

/* An empty stage keeps a height to say it in. */
.lv-blank .ex-stage {
  min-height: 72px;
}

.lv-edit {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.lv-file {
  margin: 0;
}

.lv-file .code-head .lv-reset {
  margin-left: auto;
}

/* The editor: a textarea over its own text, highlighted. The two share
   every metric, so the caret lies on the letters. */
.lv-editor {
  display: grid;
  min-width: 0;
}

.lv-hl,
.lv-code {
  grid-area: 1 / 1;
  margin: 0;
  padding: 10px 18px 18px;
  font-family: var(--font-code);
  font-size: 0.875rem;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  border: 0;
  min-width: 0;
}

.lv-hl {
  pointer-events: none;
  overflow: hidden;
}

.lv-code {
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--ink);
  outline: none;
  overflow-wrap: normal;
}

.lv-code::selection {
  background: var(--accent-soft);
  color: transparent;
}

.lv-file:focus-within {
  background: var(--raised-2);
}

.lv-out-box {
  margin: 0;
}

.lv-out {
  margin: 0;
  padding: 14px 18px;
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* The playground: the picker, then the run, larger. */
.playground {
  display: grid;
  gap: 16px;
  margin: 1.5em 0;
}

.pg-note {
  margin: 0;
  color: var(--ink-2);
}

.pg-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pg-choice[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--on-accent-soft);
}

.pg-stage {
  min-height: 48px;
}

/* On a phone the frames keep less margin, Next step drops the step it
   names, and a bar that still cannot fit on one line takes two. */
@media (max-width: 520px) {
  .ex-frame {
    padding: 16px;
  }
  .ex-bar {
    flex-wrap: wrap;
  }
  .lv-next-what {
    display: none;
  }
}

/* ---- Pager ----------------------------------------------------------- */

.pager {
  max-width: var(--measure);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 72px;
}

.pager a {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}

.pager a span {
  font-size: var(--t-small);
  font-weight: 450;
  color: var(--ink-2);
}

.pager a:hover {
  background: var(--raised);
}

.pager .next {
  grid-column: 2;
  text-align: right;
}

.edit {
  max-width: var(--measure);
  font-size: var(--t-small);
  margin-top: 28px;
}

.edit {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.edit a {
  color: var(--ink-2);
}

/* Beside the contents, the markdown links are in the contents column. */
@media (min-width: 1181px) {
  .edit a:not(:first-child) {
    display: none;
  }
}

/* ---- Reference index ------------------------------------------------- */

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 8px;
  margin: 1em 0 2em;
}

.ref-card {
  display: grid;
  gap: 4px;
  align-content: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--t-small);
  line-height: 1.45;
}

.ref-card > code {
  background: none;
  padding: 0;
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 650;
}

.ref-card:hover {
  background: var(--raised);
}

/* ---- Home ------------------------------------------------------------ */

/* One centred column: the name and what Strand is, the hello bar, two
   sections each with one example, and a map of the documentation. */
.home-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 96px max(var(--gutter), env(safe-area-inset-left, 0px));
}

.home-main h1 {
  font-size: 2.75rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 650;
  margin: 0;
}

.home-main h2 {
  font-size: var(--t-2);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 650;
  margin: 0;
  text-wrap: balance;
}

.home-main p {
  margin: 0.75em 0 0;
  max-width: 62ch;
  text-wrap: pretty;
}

.intro {
  max-width: 680px;
  padding: 72px 0 8px;
}

.lede {
  font-size: 1.1875rem;
  color: var(--ink-2);
}

.home-main .lede {
  margin-top: 14px;
}

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

.home-main .actions {
  margin-top: 24px;
}

.hello {
  margin-top: 40px;
}

.hello .example {
  margin: 0;
}

/* The hello bar's file first, and the bar it draws under it. */
.hello .example > .code {
  order: -1;
}

/* A long config beside its words scrolls in its box, so the section
   stays about as tall as its example. */
.row .example > .code pre {
  max-height: 22rem;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
  align-items: start;
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.row > .example,
.row > .check {
  margin: 0;
}

/* Beside the words, the file and its check stack. */
.row .check {
  grid-template-columns: minmax(0, 1fr);
}

.docs {
  margin-top: 72px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

.index {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.index a {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  color: var(--ink);
  text-decoration: none;
}

.index a:hover {
  background: var(--raised);
}

.index b {
  font-weight: 600;
}

.index span {
  color: var(--ink-2);
  font-size: var(--t-small);
  line-height: 1.45;
}

.home-main .note {
  margin-top: 20px;
  font-size: var(--t-small);
  color: var(--ink-2);
}

.foot {
  border-top: 1px solid var(--line);
}

.foot-in {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
  align-items: center;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px max(var(--gutter), env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px))
    max(var(--gutter), env(safe-area-inset-left, 0px));
  font-size: var(--t-small);
  color: var(--ink-2);
}

.foot-in > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

@media (prefers-reduced-motion: reduce) {
  .ex-play,
  .ex-step {
    transition: none;
  }
}

/* ---- Narrow screens -------------------------------------------------- */

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 40px;
  }
  .aside {
    display: none;
  }
}

@media (max-width: 1180px) and (min-width: 881px) {
  .search-input {
    width: 11rem;
  }
}

@media (max-width: 880px) {
  .menu {
    display: inline-flex;
    margin-left: -8px;
  }
  .top-in {
    gap: 10px;
  }
  .top-nav {
    display: none;
  }
  .top-end {
    flex: 1 1 auto;
    gap: 6px;
    justify-content: flex-end;
  }
  .search {
    flex: 1 1 auto;
    max-width: 18rem;
  }
  .search-input {
    width: 100%;
    min-width: 0;
  }
  .search-key {
    display: none;
  }
  .search-results {
    position: fixed;
    top: calc(var(--top-h) + env(safe-area-inset-top, 0px));
    left: max(var(--gutter), env(safe-area-inset-left, 0px));
    right: max(var(--gutter), env(safe-area-inset-right, 0px));
    width: auto;
  }
  .layout {
    display: block;
  }
  .sidebar {
    position: fixed;
    inset: calc(var(--top-h) + 1px + env(safe-area-inset-top, 0px)) auto 0 0;
    width: min(86vw, 320px);
    max-height: none;
    z-index: 15;
    padding: 20px 16px 48px max(16px, env(safe-area-inset-left, 0px));
    background: var(--page);
    border-right: 1px solid var(--line);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 240ms var(--ease-out), visibility 0s linear 240ms;
  }
  .sidebar.open {
    transform: none;
    visibility: visible;
    transition: transform 240ms var(--ease-out);
  }
  .main {
    padding: 28px 0 72px;
  }
  .prose h1 {
    font-size: 1.875rem;
  }
  .check {
    grid-template-columns: minmax(0, 1fr);
  }
  .intro {
    padding-top: 40px;
  }
  .home-main h1 {
    font-size: 2.25rem;
  }
  .row {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    margin-top: 56px;
    padding-top: 32px;
  }
  .docs {
    margin-top: 56px;
    padding-top: 32px;
  }
  .index {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .index {
    grid-template-columns: minmax(0, 1fr);
  }
  .gh {
    display: none;
  }
  /* The search is a square until it is used, then the bar's width. */
  .search {
    flex: none;
  }
  .search-input {
    width: var(--h);
    padding: 0;
    cursor: pointer;
  }
  .search-input::placeholder {
    color: transparent;
  }
  .search-icon {
    left: 9.5px;
  }
  .search:focus-within {
    position: absolute;
    inset: 0 max(var(--gutter), env(safe-area-inset-right, 0px)) 0 max(var(--gutter), env(safe-area-inset-left, 0px));
    z-index: 25;
    max-width: none;
    background: var(--page);
  }
  .search:focus-within .search-input {
    width: 100%;
    padding: 0 12px 0 32px;
    cursor: text;
  }
  .search:focus-within .search-input::placeholder {
    color: var(--ink-2);
  }
  .search:focus-within .search-icon {
    left: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar.open {
    transition: none;
  }
}
