/* Maylang site stylesheet.
   One accent colour, two themes, no web-font requests. */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1f23;
  --muted: #5b6070;
  --accent: #2f7a3e;
  --accent-ink: #ffffff;
  --border: #e3e0d8;
  --warn: #9a5b00;
  --code-bg: #f5f3ee;
  --code-head: #eeeae3;
  --tk-kw: #7a2f8f;
  --tk-type: #1f5f8b;
  --tk-str: #2f6b3a;
  --tk-num: #8a4b00;
  --tk-com: #646b78;
  --tk-fn: #8a3b12;
  --shadow: 0 1px 2px rgb(29 31 35 / 8%);
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 6px;
  --measure: 72ch;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1c1f24;
    --text: #e6e4df;
    --muted: #a3a8b4;
    --accent: #6fcf7f;
    --accent-ink: #0d1a10;
    --border: #2b2f36;
    --warn: #f0b45a;
    --code-bg: #191c21;
    --code-head: #22262c;
    --tk-kw: #d9a6ff;
    --tk-type: #8fd0ff;
    --tk-str: #8fd694;
    --tk-num: #f0b45a;
    --tk-com: #9aa0ab;
    --tk-fn: #ffb37a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1c1f24;
  --text: #e6e4df;
  --muted: #a3a8b4;
  --accent: #6fcf7f;
  --accent-ink: #0d1a10;
  --border: #2b2f36;
  --warn: #f0b45a;
  --code-bg: #191c21;
  --code-head: #22262c;
  --tk-kw: #d9a6ff;
  --tk-type: #8fd0ff;
  --tk-str: #8fd694;
  --tk-num: #f0b45a;
  --tk-com: #9aa0ab;
  --tk-fn: #ffb37a;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

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

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, pre, blockquote { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--mono); }
strong { font-weight: 650; }

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

.wrap { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.eyebrow {
  font-size: .82rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); font-weight: 650; margin-bottom: 12px;
}

.skip-link {
  position: absolute; left: 16px; top: -64px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: var(--radius);
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

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

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
.header-inner {
  display: flex; align-items: center; gap: 20px;
  min-height: 64px; flex-wrap: wrap; padding-block: 8px;
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--text); font-weight: 700; letter-spacing: -.02em; font-size: 1.12rem;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark { color: var(--accent); flex: none; }
.primary-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-right: auto; }
.primary-nav a {
  color: var(--text); padding: 7px 10px; border-radius: var(--radius);
  font-size: .94rem;
}
.primary-nav a:hover { background: var(--surface); text-decoration: none; }
.primary-nav a[aria-current="page"] { color: var(--accent); font-weight: 650; }
.header-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search { display: flex; align-items: center; }
.search input {
  width: 168px; padding: 7px 9px; font: inherit; font-size: .88rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
}
.search button {
  padding: 7px 10px; font-size: .88rem; cursor: pointer;
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0;
}
.github-link { color: var(--text); font-size: .9rem; }
.version-badge {
  font-size: .8rem; font-family: var(--mono); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 999px; padding: 3px 9px;
  white-space: nowrap;
}
.theme-toggle {
  cursor: pointer; font-size: .82rem; padding: 5px 9px;
  color: var(--text); background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.menu-toggle {
  display: none; cursor: pointer; margin-left: auto;
  padding: 7px 11px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}

/* Buttons ----------------------------------------------------------------- */

.button {
  display: inline-block; padding: 10px 18px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); font-weight: 650;
  border: 1px solid var(--accent);
}
.button:hover { text-decoration: none; filter: brightness(1.06); }
.button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.button.secondary:hover { border-color: var(--accent); color: var(--accent); }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 18px; }

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

.hero { padding: 64px 0 48px; border-bottom: 1px solid var(--border); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  gap: 48px; align-items: center;
}
.hero h1 {
  font-size: clamp(2rem, 4.2vw, 3.15rem); line-height: 1.12;
  letter-spacing: -.035em; max-width: 19ch;
}
.lede { color: var(--muted); font-size: 1.1rem; margin-top: 18px; max-width: 52ch; }
.hero-note { color: var(--muted); font-size: .86rem; }
.hero-code {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.hero-code pre, .terminal pre { margin: 0; padding: 18px; overflow-x: auto; background: var(--code-bg); }
.hero-code code, .terminal code { font-size: .83rem; line-height: 1.55; }
.hero-code .output { border-top: 1px solid var(--border); }

.install-strip { padding: 44px 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.install-strip h2 { font-size: 1.35rem; margin-bottom: 6px; }
.install-strip p { color: var(--muted); margin: 10px 0; }
.terminal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; margin: 12px 0;
}
.terminal pre { padding: 14px 18px; }

.section { padding: 64px 0; }
.section.alt { background: var(--surface); border-block: 1px solid var(--border); }
.section-head { max-width: 62ch; margin-bottom: 28px; }
.section-head p { color: var(--muted); margin-top: 7px; }
.section h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); letter-spacing: -.02em; }

.pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
}
.section.alt .card { background: var(--bg); }
.card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: .95rem; margin-bottom: 14px; }
.card a { font-size: .9rem; font-weight: 600; }

.feature-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
}
.feature {
  display: block; padding: 20px; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); background: var(--bg);
}
.feature:hover { text-decoration: none; border-color: var(--accent); }
.feature-kicker {
  display: block; font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); font-weight: 700;
  margin-bottom: 7px;
}
.feature h3 { font-size: 1rem; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: .9rem; }

.tooling { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tool { padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); }
.tool code { font-size: 1.05rem; font-weight: 700; color: var(--accent); }
.tool p { color: var(--muted); font-size: .9rem; margin: 8px 0 12px; }
.tool a { font-size: .88rem; font-weight: 600; }

.example-list { list-style: none; padding: 0; display: grid; gap: 12px; max-width: 74ch; }
.example-list li {
  display: grid; grid-template-columns: 14rem 1fr; gap: 18px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.example-list span { color: var(--muted); font-size: .94rem; }
.release-row { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.release-name { font-size: 1.5rem; font-weight: 700; margin: 6px 0; }
.release-highlights { margin: 12px 0 18px; padding-left: 1.2em; color: var(--muted); font-size: .94rem; }
.release-highlights li + li { margin-top: 6px; }
.link-list { list-style: none; padding: 0; margin-top: 12px; display: grid; gap: 6px; }

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

.docs-layout {
  display: grid; grid-template-columns: 232px minmax(0, 1fr) 220px;
  gap: 40px; padding-top: 36px; padding-bottom: 64px;
}
.sidebar { font-size: .92rem; }
.sidebar .side-title {
  font-weight: 700; font-size: .78rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.sidebar ul { list-style: none; padding: 0; display: grid; gap: 2px; }
.sidebar a {
  display: block; padding: 5px 8px; border-radius: 4px; color: var(--text);
}
.sidebar a:hover { background: var(--surface); text-decoration: none; }
.sidebar a[aria-current="page"] { background: var(--surface); color: var(--accent); font-weight: 650; }
.sidebar .side-group { margin-bottom: 22px; }
.side-details > summary { display: none; }
.side-details > .side-body { display: block; }

.doc { min-width: 0; }
.outline-wrap { min-width: 0; }
.outline { position: sticky; top: 88px; font-size: .88rem; max-height: calc(100vh - 108px); overflow-y: auto; padding-right: 6px; }
.outline-title { font-weight: 700; font-size: .78rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.outline ul { list-style: none; padding: 0; display: grid; gap: 3px; border-left: 1px solid var(--border); }
.outline li a { display: block; padding: 3px 0 3px 12px; color: var(--muted); }
.outline li a:hover { color: var(--accent); text-decoration: none; }
.outline-h3 a { padding-left: 24px; font-size: .84rem; }

.breadcrumbs { font-size: .84rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border); }
.breadcrumbs a { color: var(--muted); }

.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--border); }
.pager a { max-width: 46%; }
.pager .next { margin-left: auto; text-align: right; }

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

.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.05em; }
.prose h1 { font-size: clamp(1.9rem, 3.4vw, 2.55rem); line-height: 1.18; letter-spacing: -.03em; margin-bottom: .4em; }
.prose h2 { font-size: 1.5rem; letter-spacing: -.02em; margin-top: 2em; padding-top: .2em; }
.prose h3 { font-size: 1.18rem; margin-top: 1.6em; }
.prose h4 { font-size: 1rem; margin-top: 1.4em; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.35em; }
.prose li + li { margin-top: .3em; }
.prose li > p { margin: 0; }
.prose li > ul, .prose li > ol { margin-top: .35em; }
.prose blockquote {
  border-left: 3px solid var(--accent); padding: 10px 18px;
  background: var(--surface); color: var(--muted); border-radius: 0 var(--radius) var(--radius) 0;
}
.prose blockquote p { margin: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.prose code {
  background: var(--code-bg); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 4px; font-size: .88em;
}
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.prose th, .prose td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface); }
.table-wrap { overflow-x: auto; }
.prose img { border: 1px solid var(--border); border-radius: var(--radius); height: auto; }

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

.code { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--code-head); border-bottom: 1px solid var(--border);
  padding: 6px 10px 6px 14px; font-size: .78rem; color: var(--muted);
}
.code-lang { font-family: var(--mono); }
.copy {
  cursor: pointer; font-size: .76rem; padding: 3px 8px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 4px;
}
.copy:hover { border-color: var(--accent); color: var(--accent); }
.code pre, .prose .code pre {
  margin: 0; padding: 16px; overflow-x: auto; background: var(--code-bg);
  font-size: .84rem; line-height: 1.55;
}
.code pre:focus, .hero-code pre:focus, .terminal pre:focus { outline-offset: -2px; }
.output { border-top: 1px solid var(--border); background: var(--surface); }
.output-label {
  margin: 0; padding: 5px 14px; font-size: .74rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border);
}
.output pre { margin: 0; padding: 12px 16px; overflow-x: auto; background: var(--code-bg); font-size: .84rem; }
.output-exit { color: var(--warn); text-transform: none; letter-spacing: 0; }

.tk-kw { color: var(--tk-kw); font-weight: 600; }
.tk-type { color: var(--tk-type); }
.tk-str { color: var(--tk-str); }
.tk-num { color: var(--tk-num); }
.tk-com { color: var(--tk-com); font-style: italic; }
.tk-fn { color: var(--tk-fn); }

/* Callouts ---------------------------------------------------------------- */

.callout {
  border: 1px solid var(--border); border-left-width: 4px;
  border-radius: var(--radius); padding: 14px 16px; background: var(--surface);
}
.callout-label { font-weight: 700; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.callout.note { border-left-color: var(--accent); }
.callout.tip { border-left-color: var(--accent); }
.callout.gotcha { border-left-color: var(--warn); }
.callout.frozen { border-left-color: var(--muted); }

/* API entries ------------------------------------------------------------- */

.api-entry { border-top: 1px solid var(--border); padding-top: 22px; margin-top: 26px; }
.api-entry h3 { margin-top: 0; font-family: var(--mono); font-size: 1.02rem; }
.api-signature { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; overflow-x: auto; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.badge { font-size: .72rem; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.badge.supported { color: var(--accent); border-color: var(--accent); }
.badge.frozen { color: var(--warn); border-color: var(--warn); }

/* Search ------------------------------------------------------------------ */

.search-page .prose { max-width: 78ch; }
.search-large { margin: 24px 0; }
.search-large label { display: block; font-weight: 650; margin-bottom: 8px; }
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1; min-width: 0; padding: 10px 12px; font: inherit;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.search-row button {
  padding: 10px 16px; cursor: pointer; font-weight: 650;
  color: var(--accent-ink); background: var(--accent);
  border: 1px solid var(--accent); border-radius: var(--radius);
}
.search-results { display: grid; gap: 18px; margin-top: 22px; }
.search-result h2 { font-size: 1.05rem; margin: 0 0 4px; }
.search-result .url { color: var(--muted); font-size: .8rem; font-family: var(--mono); }
.search-result p { color: var(--muted); font-size: .94rem; margin-top: 4px; }
.search-empty { color: var(--muted); }

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

.site-footer { border-top: 1px solid var(--border); padding: 36px 0; background: var(--surface); font-size: .9rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 36px; }
.footer-brand { font-weight: 700; color: var(--text); }
.site-footer p { color: var(--muted); }
.site-footer nav { display: grid; gap: 6px; align-content: start; }
.build-stamp { font-size: .82rem; }
.build-stamp p { margin-bottom: 4px; }

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1100px) {
  .docs-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .outline-wrap { display: none; }
  .tooling { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero { padding-top: 40px; }
  .pillars, .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header-tools .search { order: 3; width: 100%; }
  .header-tools .search input { width: 100%; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .release-row { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 760px) {
  .wrap { width: min(100% - 32px, 1120px); }
  .menu-toggle { display: inline-block; }
  .primary-nav {
    display: none; order: 5; width: 100%; padding: 8px 0 12px;
    border-top: 1px solid var(--border);
  }
  .primary-nav.is-open { display: flex; }
  .header-tools { width: 100%; }
  .github-link, .version-badge { display: none; }
  .docs-layout { display: block; padding-top: 20px; }
  .sidebar { margin-bottom: 26px; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
  .side-details > summary { display: block; cursor: pointer; font-weight: 650; }
  .side-details:not([open]) > .side-body { display: none; }
  .sidebar .side-group { margin-bottom: 12px; }
  .pillars, .feature-grid, .tooling { grid-template-columns: 1fr; }
  .example-list li { grid-template-columns: 1fr; gap: 2px; }
  .footer-grid { grid-template-columns: 1fr; gap: 22px; }
  .search input { width: 100%; }
  .prose { max-width: none; }
  .code pre, .prose .code pre { font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .site-header, .site-footer, .sidebar, .outline-wrap, .copy, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .docs-layout { display: block; }
}
