/* Tiny Strats modding docs. Hand-written; the HTML pages are generated by tools/build-mod-site.mjs. */

:root {
  --bg: #f7f7f4;
  --panel: #ffffff;
  --raised: #fbfbf9;
  --text: #1d2126;
  --muted: #5d6570;
  --faint: #8a929c;
  --line: #e4e4de;
  --line-strong: #d3d3cb;
  --accent: #2f6b4f;
  --accent-ink: #ffffff;
  --accent-soft: #e5f1ea;
  --link: #22684a;
  --code-bg: #f0f0eb;
  --pre-bg: #fbfbf8;
  --target: #fff6d6;
  --shadow: 0 1px 2px rgb(20 24 28 / 0.05), 0 6px 24px rgb(20 24 28 / 0.08);
  /* syntax */
  --t-k: #a1306c;
  --t-b: #2259a8;
  --t-f: #7a4d00;
  --t-s: #2f7a3a;
  --t-n: #b0441c;
  --t-c: #7f8790;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417;
    --panel: #181b1f;
    --raised: #1c2025;
    --text: #e4e7ea;
    --muted: #a0a8b1;
    --faint: #737c86;
    --line: #272b31;
    --line-strong: #343a41;
    --accent: #6fcf9c;
    --accent-ink: #0d1a13;
    --accent-soft: #19302a;
    --link: #7fd8a8;
    --code-bg: #22262c;
    --pre-bg: #16191d;
    --target: #33300f;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 28px rgb(0 0 0 / 0.4);
    --t-k: #f08bc0;
    --t-b: #82b4ff;
    --t-f: #f0c674;
    --t-s: #9bd88d;
    --t-n: #f6a26c;
    --t-c: #7c8591;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121417;
  --panel: #181b1f;
  --raised: #1c2025;
  --text: #e4e7ea;
  --muted: #a0a8b1;
  --faint: #737c86;
  --line: #272b31;
  --line-strong: #343a41;
  --accent: #6fcf9c;
  --accent-ink: #0d1a13;
  --accent-soft: #19302a;
  --link: #7fd8a8;
  --code-bg: #22262c;
  --pre-bg: #16191d;
  --target: #33300f;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 28px rgb(0 0 0 / 0.4);
  --t-k: #f08bc0;
  --t-b: #82b4ff;
  --t-f: #f0c674;
  --t-s: #9bd88d;
  --t-n: #f6a26c;
  --t-c: #7c8591;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
[id] { scroll-margin-top: 76px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--panel); padding: 6px 10px; }
.skip:focus { left: 8px; }

/* ---------------------------------------------------------------- top bar */

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: 58px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; white-space: nowrap; width: 236px; flex: none; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 700; }
.logo {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
  background:
    linear-gradient(var(--accent), var(--accent)) 3px 3px / 7px 7px no-repeat,
    linear-gradient(var(--accent), var(--accent)) 12px 12px / 7px 7px no-repeat,
    linear-gradient(color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent) 45%, transparent)) 12px 3px / 7px 7px no-repeat,
    var(--accent-soft);
}
.search { position: relative; flex: 1; max-width: 520px; }
.search input {
  width: 100%; height: 36px; padding: 0 40px 0 36px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a929c' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") 12px 50% no-repeat;
  border: 1px solid var(--line-strong); border-radius: 9px;
  -webkit-appearance: none; appearance: none;
}
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font: 12px/1 ui-monospace, monospace; color: var(--faint);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 3px 6px; pointer-events: none;
}
.search input:focus + kbd { display: none; }
#results {
  position: absolute; top: 42px; left: 0; right: 0; z-index: 30;
  margin: 0; padding: 6px; list-style: none;
  max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow);
}
#results li { margin: 0; }
#results a { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 7px 10px; border-radius: 7px; color: var(--text); }
#results a:hover { text-decoration: none; }
#results li[aria-selected="true"] a { background: var(--accent-soft); }
#results .r-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .r-t.mono { font: 600 14px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
#results .r-s { grid-column: 1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .r-k { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
#results mark { background: none; color: var(--link); }
#results .empty { padding: 10px; color: var(--muted); font-size: 14px; }

.links { display: flex; gap: 4px; margin-left: auto; }
.links a { padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 14.5px; font-weight: 500; white-space: nowrap; }
.links a:hover { color: var(--text); background: var(--code-bg); text-decoration: none; }

.theme, .menu {
  flex: none; width: 36px; height: 36px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--text);
  display: grid; place-items: center; padding: 0;
}
.theme { margin-left: auto; }
.links + .theme { margin-left: 0; }
.theme::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(90deg, var(--text) 50%, transparent 50%);
  border: 2px solid var(--text);
}
.menu { display: none; }
.menu span, .menu span::before, .menu span::after {
  display: block; width: 16px; height: 2px; background: currentColor; border-radius: 1px; position: relative;
}
.menu span::before, .menu span::after { content: ""; position: absolute; left: 0; }
.menu span::before { top: -5px; }
.menu span::after { top: 5px; }

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

.layout { display: grid; grid-template-columns: 276px minmax(0, 1fr); max-width: 1240px; }
nav.side {
  position: sticky; top: 58px; align-self: start;
  height: calc(100vh - 58px); overflow-y: auto; overscroll-behavior: contain;
  padding: 22px 16px 40px 20px;
}
nav.side > a {
  display: block; padding: 6px 10px; margin: 1px 0; border-radius: 7px;
  color: var(--text); font-size: 15px; font-weight: 500;
}
nav.side > a:hover { background: var(--code-bg); text-decoration: none; }
nav.side > a.current { background: var(--accent-soft); color: var(--link); font-weight: 650; }
nav.side .toc { margin: 4px 0 10px 12px; padding-left: 10px; border-left: 1px solid var(--line-strong); }
nav.side .toc a {
  display: block; padding: 3px 8px; margin-left: -11px; border-left: 2px solid transparent;
  color: var(--muted); font-size: 14px; line-height: 1.45;
}
nav.side .toc a:hover { color: var(--text); text-decoration: none; }
nav.side .toc a.active { color: var(--link); border-left-color: var(--accent); }
nav.side .toc code { font-size: 13px; background: none; padding: 0; }

.side-links { display: none; margin: 18px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line); }
.side-links a { display: block; padding: 6px 10px; border-radius: 7px; color: var(--muted); font-size: 15px; }
.side-links a:hover { background: var(--code-bg); color: var(--text); text-decoration: none; }

main { padding: 40px 48px 64px; max-width: 880px; min-width: 0; }

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

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; position: relative; }
h1 { font-size: 34px; margin: 0 0 10px; letter-spacing: -0.02em; }
h2 { font-size: 24px; margin: 52px 0 12px; padding-top: 22px; border-top: 1px solid var(--line); }
h3 { font-size: 18.5px; margin: 32px 0 8px; }
h2 code, h3 code { font-size: 0.88em; }
.anchor {
  position: absolute; left: -0.9em; width: 0.9em; color: var(--faint); opacity: 0; font-weight: 400;
  text-decoration: none !important;
}
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
p.lead { font-size: 18.5px; line-height: 1.6; color: var(--muted); margin: 0 0 28px; max-width: 46em; }
p, ul, ol { margin: 0 0 14px; }
ul, ol { padding-left: 24px; }
li { margin: 5px 0; }
li > ul, li > ol { margin: 6px 0 0; }
strong { font-weight: 650; }

code, pre, kbd { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; }
code { font-size: 0.86em; background: var(--code-bg); padding: 0.12em 0.38em; border-radius: 5px; overflow-wrap: break-word; }
a code { color: inherit; }

/* code blocks (site.js wraps them in .codeblock and adds a copy button) */
.codeblock { position: relative; margin: 16px 0 22px; }
pre.code {
  margin: 16px 0 22px; padding: 16px 18px; overflow-x: auto;
  background: var(--pre-bg); border: 1px solid var(--line); border-radius: 10px;
  font-size: 13.5px; line-height: 1.6; tab-size: 4; -moz-tab-size: 4;
}
.codeblock pre.code { margin: 0; }
pre.code code { background: none; padding: 0; font-size: inherit; border-radius: 0; overflow-wrap: normal; }
.codeblock .file {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 8px 16px; font-size: 13px; color: var(--muted);
  background: var(--raised); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0;
}
.codeblock .file code { background: none; padding: 0; color: var(--text); font-weight: 600; }
.codeblock .file + pre.code { border-radius: 0 0 10px 10px; }
.codeblock .file .copy { position: static; margin-left: auto; opacity: 1; }
.copy {
  position: absolute; top: 8px; right: 8px;
  font: 500 12.5px/1 system-ui, sans-serif; color: var(--muted);
  padding: 6px 9px; border-radius: 6px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line-strong);
  opacity: 0; transition: opacity .12s;
}
.codeblock:hover .copy, .copy:focus-visible, .copy.done { opacity: 1; }
.copy.done { color: var(--link); border-color: var(--accent); }
@media (hover: none) { .copy { opacity: 1; } }
.t-k { color: var(--t-k); font-weight: 600; }
.t-b { color: var(--t-b); }
.t-f { color: var(--t-f); }
.t-s { color: var(--t-s); }
.t-n { color: var(--t-n); }
.t-c { color: var(--t-c); font-style: italic; }

/* tables */
.table-wrap { overflow-x: auto; margin: 14px 0 24px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; line-height: 1.55; }
th, td { text-align: left; vertical-align: top; padding: 9px 14px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
th {
  font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  background: var(--raised); white-space: nowrap;
}
td:first-child { min-width: 9em; }
td:first-child code { white-space: normal; }
tr:target td, tr.flash td { background: var(--target); }
tr.flash td { transition: background 1.6s ease-out; }

/* overview cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 6px 0 12px; }
.card {
  display: block; padding: 15px 16px; border-radius: 11px; color: var(--text);
  background: var(--panel); border: 1px solid var(--line);
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.card strong { display: block; margin-bottom: 3px; font-size: 15.5px; }
.card span { color: var(--muted); font-size: 14px; line-height: 1.5; display: block; }

/* examples */
.example-index { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.example-index li { margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.example-index span { display: block; color: var(--muted); font-size: 14px; }
.example p.shows { font-size: 14.5px; color: var(--muted); }
.example p.shows > span {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--link); background: var(--accent-soft); padding: 2px 7px; border-radius: 5px; margin-right: 4px;
}

/* pager & footer */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; }
.pager a {
  display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font-weight: 600; background: var(--panel);
}
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager small { display: block; font-weight: 400; font-size: 12.5px; color: var(--muted); }
.pager .next { text-align: right; grid-column: 2; }
footer { color: var(--faint); font-size: 13px; margin-top: 36px; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 900px) {
  .top { padding: 0 12px; gap: 10px; }
  .menu { display: grid; }
  .brand { width: auto; }
  .brand b { display: none; }
  .links { display: none; }
  .side-links { display: block; }
  .links + .theme { margin-left: auto; }
  .layout { display: block; }
  nav.side {
    position: fixed; top: 58px; left: 0; bottom: 0; z-index: 15; width: min(300px, 85vw); height: auto; align-self: auto;
    background: var(--panel); border-right: 1px solid var(--line); box-shadow: var(--shadow);
    transform: translateX(-102%); transition: transform .18s ease-out; visibility: hidden;
  }
  body.nav-open nav.side { transform: none; visibility: visible; }
  body.nav-open::after { content: ""; position: fixed; inset: 58px 0 0; z-index: 10; background: rgb(0 0 0 / 0.25); }
  main { padding: 28px 16px 56px; }
  h1 { font-size: 28px; }
  h2 { font-size: 21px; margin-top: 40px; }
  p.lead { font-size: 17px; }
  .anchor { display: none; }
  th, td { padding: 8px 10px; }
}
@media (max-width: 520px) {
  .search kbd { display: none; }
  .brand { display: none; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
