/* Shared shell for the SahiScript static pages (documentation, FAQ, release notes). */

:root {
  color-scheme: light dark;

  --brand: #c80e7d;
  --brand-deep: #8a1157;

  --surface: #12161d;
  --surface-raised: #181d26;
  --border: #272d39;
  --text: #f4f6fb;
  --text-muted: #a3adc0;
  --code-bg: #0d1116;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --measure: 760px;
  --gutter: 24px;
}

:root[data-theme="light"] {
  color-scheme: light;

  --surface: #fafafa;
  --surface-raised: #ffffff;
  --border: #e3e5ea;
  --text: #27282c;
  --text-muted: #5f6673;
  --code-bg: #f1f2f5;
}

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

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

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 16px var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand__mark {
  width: 26px;
  height: 26px;
  flex: none;
  background: url("/icons/stride_white.svg") center / contain no-repeat;
}

:root[data-theme="light"] .brand__mark {
  background-image: url("/icons/stride_purple.svg");
}

.brand__script {
  color: var(--brand);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-left: auto;
  font-size: 15px;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}

.site-nav a:hover {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--brand);
}

/* ---------- Page ---------- */

main {
  width: min(var(--measure), 100%);
  margin: 0 auto;
  padding: 56px var(--gutter) 88px;
}

.page-title {
  margin: 0;
  font-size: clamp(30px, 6vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.lede {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 19px;
}

section {
  margin-top: 48px;
}

h2 {
  margin: 0 0 16px;
  font-size: 22px;
  letter-spacing: -0.01em;
}

h3 {
  margin: 32px 0 8px;
  font-size: 17px;
  font-weight: 650;
}

p {
  margin: 0 0 14px;
}

ul {
  margin: 0 0 14px;
  padding-left: 22px;
}

li {
  margin-bottom: 6px;
}

a {
  color: var(--brand);
  text-underline-offset: 2px;
}

:root:not([data-theme="light"]) a {
  color: #ff5eb0;
}

code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.note {
  margin: 0;
  padding: 14px 18px;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  background: var(--surface-raised);
  color: var(--text-muted);
  font-size: 15px;
}

/* ---------- Placeholder pages ---------- */

.placeholder {
  margin-top: 40px;
  padding: 40px 32px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
  text-align: center;
  color: var(--text-muted);
}

.placeholder p:last-child {
  margin-bottom: 0;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
}

.site-footer__inner {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 24px var(--gutter);
}

@media (max-width: 560px) {
  main {
    padding-top: 40px;
  }

  .site-nav {
    margin-left: 0;
    width: 100%;
  }
}

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

.page-reference .site-header__inner,
.page-reference .site-footer__inner {
  width: min(1440px, 100%);
}

.ref {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(1440px, 100%);
  margin: 0 auto;
}

.ref-main {
  width: 100%;
  min-width: 0;
  padding: 40px var(--gutter) 96px;
}

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

.ref-nav__panel {
  padding: 16px var(--gutter);
  border-bottom: 1px solid var(--border);
}

.ref-nav__summary {
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.ref-nav__filter {
  width: 100%;
  margin: 14px 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.ref-nav__filter:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
}

.ref-nav__list,
.ref-nav__list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ref-nav__group {
  margin-bottom: 14px;
}

.ref-nav__heading {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
}

.ref-nav__list ul a {
  display: block;
  padding: 2px 0 2px 10px;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.ref-nav__list ul a:hover {
  border-left-color: var(--brand);
  color: var(--text);
}

/* ---------- Entries ---------- */

.entry {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 16px;
}

.entry h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.entry__doc {
  margin: 6px 0 0;
  color: var(--text-muted);
}

.entry__label {
  margin: 18px 0 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

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

.entry__args li {
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.entry__args li:last-child {
  border-bottom: 0;
}

.entry__type {
  margin-left: 6px;
  color: var(--brand);
  font-family: var(--font-mono);
  font-size: 13px;
}

.entry__optional {
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

.entry__argdoc {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
}

.entry__returns {
  margin: 0;
}

pre {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--code-bg);
  overflow-x: auto;
}

pre code {
  padding: 0;
  background: none;
  font-size: 14px;
  line-height: 1.6;
}

.entry__syntax,
.entry__example {
  margin-bottom: 0;
}

.entry__syntax code {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

section[id] {
  scroll-margin-top: 16px;
}

@media (min-width: 900px) {
  .ref {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
  }

  .ref-nav {
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
  }

  .ref-nav__panel {
    padding: 28px 20px 40px var(--gutter);
    border-bottom: 0;
  }

  .ref-nav__summary {
    display: none;
  }

  .ref-nav__filter {
    margin-top: 0;
  }

  .ref-main {
    padding-right: var(--gutter);
    padding-left: 0;
  }
}

.entry__returnnote {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}
