/* Documentation styling for Slice.
 *
 * The palette, the radii and the type stack are lifted from the application's own
 * stylesheet (`web/slice.css`) so that the docs and the tool look like one thing. The
 * accent is the orange-red of the blade in the Slice logo; the dark theme follows the
 * reader's system setting, exactly as the application does. */

:root {
  --bg: #f4f4f5;
  --panel: #ffffff;
  --panel-alt: #fafafa;
  --ink: #18181b;
  --ink-soft: #52525b;
  --ink-faint: #8a8a94;
  --line: #d8d8de;
  --line-strong: #b9b9c2;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e9;
  --warn-soft: #fffaeb;
  --warn-line: #f5d78e;
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", "IBM Plex Mono", "JetBrains Mono", Menlo, Consolas,
    monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131316;
    --panel: #1c1c20;
    --panel-alt: #232329;
    --ink: #f2f2f4;
    --ink-soft: #b4b4bd;
    --ink-faint: #8a8a94;
    --line: #33333b;
    --line-strong: #45454f;
    --accent: #fb923c;
    --accent-ink: #1a1005;
    --accent-soft: #2c1a0d;
    --warn-soft: #2b2312;
    --warn-line: #6b5a20;
  }
}

* { box-sizing: border-box; }

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

/* ------------------------------------------------------------------ masthead */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: 0.9rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand img { display: block; }

.masthead nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.1rem;
  margin-left: auto;
  font-size: 0.94rem;
}

.masthead nav a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
}

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

.masthead nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.masthead nav a.cta {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius);
  border-bottom: none;
  font-weight: 600;
}

.masthead nav a.cta:hover { filter: brightness(1.08); color: var(--accent-ink); }

/* ---------------------------------------------------------------------- page */

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 2.2rem 0 0.8rem;
}

h1 { font-size: 2.1rem; margin-top: 0; }
h2 { font-size: 1.45rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; color: var(--ink-soft); }

p, ul, ol { margin: 0 0 1rem; }
li { margin-bottom: 0.35rem; }

.lede {
  font-size: 1.12rem;
  color: var(--ink-soft);
  margin-top: -0.4rem;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

strong { font-weight: 650; }

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.08em 0.34em;
}

pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
}

blockquote {
  margin: 1.2rem 0;
  padding: 0.8rem 1.1rem;
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  color: var(--ink);
}

blockquote > :last-child { margin-bottom: 0; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.94rem;
  display: block;
  overflow-x: auto;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--panel-alt);
  font-weight: 650;
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }

hr { border: none; border-top: 1px solid var(--line); margin: 2.5rem 0; }

img { max-width: 100%; height: auto; }

/* ------------------------------------------------------------------ landing */

.hero {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.hero img { width: 96px; height: auto; }

.hero h1 {
  font-size: 2.6rem;
  margin: 1rem 0 0.4rem;
}

.hero p {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 34rem;
  margin: 0 auto 1.6rem;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius);
  font-weight: 650;
  font-size: 1.05rem;
  text-decoration: none;
}

.button:hover { filter: brightness(1.08); color: var(--accent-ink); }

.button.secondary {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.cards li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0;
}

.cards h3 { margin: 0 0 0.3rem; font-size: 1.02rem; }
.cards p { margin: 0; font-size: 0.93rem; color: var(--ink-soft); }

/* ------------------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 1.6rem 1.5rem 2.4rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

footer p { margin: 0 0 0.4rem; }
footer .small { font-size: 0.85rem; color: var(--ink-faint); }
footer a { color: var(--ink-soft); }

@media (max-width: 34rem) {
  .masthead { padding: 0.8rem 1rem; }
  .masthead nav { margin-left: 0; width: 100%; }
  main { padding: 1.8rem 1.1rem 3rem; }
  h1 { font-size: 1.7rem; }
  .hero h1 { font-size: 2rem; }
}

/* A card is already a link target; underlining its heading as well reads as noise. */
.cards h3 a { text-decoration: none; }
.cards h3 a:hover { text-decoration: underline; }
