@import url("fonts.css");

/* ---------------------------------------------------------------------------
   sayd — documentation page

   Unlike the landing page, this one follows the reader's colour scheme.
   Dark is the default and matches the landing page; light redefines the
   same tokens. Nothing outside the two token blocks names a colour.
   --------------------------------------------------------------------------- */

:root {
  --bg: #07080a;
  --surface: #0d0f12;
  --sunk: #050607;
  --fg: #c6cfc9;
  --fg-dim: #7c8a84;
  --fg-faint: #48524e;
  --accent: #2bf08a;
  --accent-dim: #2bf08a3d;
  --accent-bg: #2bf08a12;
  --line: #1a2025;
  --line-soft: #12171b;

  --display: "JetBrains Mono", ui-monospace, monospace;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f6f2;
    --surface: #fffefb;
    --sunk: #efeee9;
    --fg: #23281f;
    --fg-dim: #5a635c;
    --fg-faint: #8f978f;
    --accent: #0b7a46;
    --accent-dim: #0b7a4655;
    --accent-bg: #0b7a460d;
    --line: #d9d8d0;
    --line-soft: #e6e5de;
    color-scheme: light;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: clamp(0.85rem, 0.81rem + 0.2vw, 0.93rem);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

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

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.12;
  margin: 0;
  text-transform: lowercase;
  text-wrap: balance;
}

.wrap {
  width: min(100% - clamp(2rem, 8vw, 6rem), 52rem);
  margin-inline: auto;
}

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

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.06em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55ch;
  color: var(--fg);
}

.wordmark__bot { width: 1.15em; height: 1.15em; color: var(--accent); }

.masthead nav { display: flex; gap: 1.4rem; font-size: 0.76rem; color: var(--fg-dim); }
.masthead nav a { text-decoration: none; }
.masthead nav a::before { content: "/"; color: var(--fg-faint); margin-right: 0.35ch; }

/* --- layout: ToC left, content right ------------------------------------- */

.docs {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 2.75rem);
  padding-block: clamp(2rem, 5vw, 3.5rem) clamp(3rem, 7vw, 5rem);
  align-items: start;
}

.toc {
  position: sticky;
  top: 1.5rem;
  font-size: 0.78rem;
}

.toc__title {
  margin: 0 0 0.8rem;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid var(--line);
}

.toc li a {
  display: block;
  padding: 0.28rem 0 0.28rem 0.9rem;
  color: var(--fg-dim);
  text-decoration: none;
  border-left: 2px solid transparent;
  margin-left: -1.5px;
}

.toc li a:hover { color: var(--accent); border-left-color: var(--accent-dim); }

.toc li.toc--sub a { padding-left: 1.8rem; font-size: 0.73rem; }

@media (max-width: 52rem) {
  .docs { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; border: 1px solid var(--line); padding: 1rem 1.1rem; }
  .toc ol { border-left: 0; column-count: 2; column-gap: 1.5rem; }
  .toc li a { padding-left: 0; border-left: 0; }
}

/* --- content ------------------------------------------------------------- */

.content > h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); }

.content .lede { color: var(--fg-dim); margin: 1rem 0 0; }

.content section { margin-top: clamp(2.5rem, 5vw, 3.5rem); scroll-margin-top: 1.5rem; }

.content h2 {
  font-size: clamp(1.2rem, 1rem + 0.9vw, 1.55rem);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line-soft);
}

.content h2::before { content: "// "; color: var(--accent); font-weight: 400; }

.content h3 { font-size: 0.98rem; margin-top: 1.8rem; }
.content h3::before { content: "▸ "; color: var(--accent); }

.content p { color: var(--fg-dim); }
.content p b, .content li b { color: var(--fg); font-weight: 600; }
.content ul { color: var(--fg-dim); padding-left: 1.2rem; }
.content li { margin-block: 0.3rem; }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--accent);
}

pre {
  margin: 1rem 0 0;
  padding: 0.95rem 1.05rem;
  background: var(--sunk);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--accent-dim);
  overflow-x: auto;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--fg-dim);
}

pre code { color: inherit; }
pre .c { color: var(--fg-faint); }
pre .k { color: var(--accent); }

/* --- settings tables ------------------------------------------------------ */

.scroller { overflow-x: auto; overscroll-behavior-x: contain; }

table {
  width: 100%;
  min-width: 30rem;
  border-collapse: collapse;
  margin-top: 1.1rem;
  font-size: 0.78rem;
}

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

th {
  color: var(--fg-faint);
  font-weight: 400;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

/* On a phone the tables fit instead of scrolling: the default-value column
   is allowed to wrap, and the min-width comes off. */
@media (max-width: 36rem) {
  table { min-width: 0; }
  td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; }
}

td:nth-child(1) { color: var(--accent); white-space: nowrap; }
td:nth-child(2) { color: var(--fg); white-space: nowrap; font-size: 0.74rem; }
td:nth-child(3) { color: var(--fg-dim); }

/* --- notes ---------------------------------------------------------------- */

.note {
  margin-top: 1.2rem;
  padding: 0.9rem 1.05rem;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  background: var(--accent-bg);
  font-size: 0.8rem;
  color: var(--fg-dim);
}

.note b { color: var(--fg); }

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

footer {
  border-top: 1px solid var(--line-soft);
  padding-block: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 2.5rem;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--fg-faint);
}

footer a { color: var(--fg-dim); }
