/* Zyn docs. Layout after the Kotlin docs: pages on the left, the page in the middle, its outline on the right. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #f6f6f8;
  --ink: #19191c;
  --ink-soft: #4d4d55;
  --ink-faint: #75757e;
  --line: #e6e6ea;
  --accent: #6b47ff;
  --accent-ink: #5434e0;
  --accent-soft: #efebff;
  --top: #19191c;
  --top-ink: #ffffff;
  --code-bg: #f7f7f9;
  --code-line: #e8e8ee;
  --out-bg: #fbfbfc;
  --inline-code: #f1f0f5;
  --tip: #12a36b;
  --tip-bg: #ebf8f2;
  --note: #2f6fe4;
  --note-bg: #edf3fe;
  --warn: #c7740a;
  --warn-bg: #fdf5e8;
  --err: #d0283c;
  --pass: #12a36b;
  --hl-k: #0033b3;
  --hl-t: #00627a;
  --hl-f: #00627a;
  --hl-fc: #00627a;
  --hl-s: #067d17;
  --hl-e: #0037a6;
  --hl-i: #0037a6;
  --hl-n: #1750eb;
  --hl-l: #0033b3;
  --hl-c: #8c8c8c;
  --hl-a: #9e880d;
  --hl-o: #871094;
  --shadow: 0 8px 30px rgba(25, 25, 28, .14);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #19191c;
  --bg-soft: #202024;
  --ink: #e9e9ee;
  --ink-soft: #b9b9c3;
  --ink-faint: #8b8b96;
  --line: #303036;
  --accent: #9d85ff;
  --accent-ink: #b3a1ff;
  --accent-soft: #2a2540;
  --top: #0f0f11;
  --code-bg: #232327;
  --code-line: #323238;
  --out-bg: #1d1d21;
  --inline-code: #2a2a30;
  --tip: #3fcf8e;
  --tip-bg: #17291f;
  --note: #6ea1ff;
  --note-bg: #182133;
  --warn: #f0a63a;
  --warn-bg: #2c2214;
  --err: #ff6b7d;
  --pass: #3fcf8e;
  --hl-k: #cf8e6d;
  --hl-t: #c3a5ef;
  --hl-f: #56a8f5;
  --hl-fc: #57aaf7;
  --hl-s: #6aab73;
  --hl-e: #cf8e6d;
  --hl-i: #cf8e6d;
  --hl-n: #2aacb8;
  --hl-l: #cf8e6d;
  --hl-c: #7a7e85;
  --hl-a: #b3ae60;
  --hl-o: #c77dbb;
  --shadow: 0 8px 30px rgba(0, 0, 0, .5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #19191c;
    --bg-soft: #202024;
    --ink: #e9e9ee;
    --ink-soft: #b9b9c3;
    --ink-faint: #8b8b96;
    --line: #303036;
    --accent: #9d85ff;
    --accent-ink: #b3a1ff;
    --accent-soft: #2a2540;
    --top: #0f0f11;
    --code-bg: #232327;
    --code-line: #323238;
    --out-bg: #1d1d21;
    --inline-code: #2a2a30;
    --tip: #3fcf8e;
    --tip-bg: #17291f;
    --note: #6ea1ff;
    --note-bg: #182133;
    --warn: #f0a63a;
    --warn-bg: #2c2214;
    --err: #ff6b7d;
    --pass: #3fcf8e;
    --hl-k: #cf8e6d;
    --hl-t: #c3a5ef;
    --hl-f: #56a8f5;
    --hl-fc: #57aaf7;
    --hl-s: #6aab73;
    --hl-e: #cf8e6d;
    --hl-i: #cf8e6d;
    --hl-n: #2aacb8;
    --hl-l: #cf8e6d;
    --hl-c: #7a7e85;
    --hl-a: #b3ae60;
    --hl-o: #c77dbb;
    --shadow: 0 8px 30px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; min-width: 0; }
html { scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.65 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: clip;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
/* No ligatures: `|>` and `->` must look like what you type */
code, pre, kbd { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  background: var(--top); color: var(--top-ink);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--top-ink); font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.version { font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .55); margin-left: 2px; padding: 1px 6px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 4px; }
.top-links { display: flex; gap: 22px; font-size: 15px; }
.top-links a { color: rgba(255, 255, 255, .72); padding: 16px 0; border-bottom: 2px solid transparent; }
.top-links a:hover { color: #fff; text-decoration: none; }
.top-links a.active { color: #fff; border-bottom-color: #fff; }
.search { position: relative; margin-left: auto; width: 300px; }
.search input {
  width: 100%; height: 36px; padding: 0 34px 0 12px;
  border: 1px solid rgba(255, 255, 255, .18); border-radius: 6px;
  background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 15px; outline: none;
}
.search input::placeholder { color: rgba(255, 255, 255, .55); }
.search input:focus { border-color: rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .13); }
.search kbd {
  position: absolute; right: 8px; top: 8px; font-size: 12px; line-height: 18px; padding: 0 6px;
  border: 1px solid rgba(255, 255, 255, .25); border-radius: 4px; color: rgba(255, 255, 255, .6);
}
.search input:focus + kbd { display: none; }
.search-results {
  position: absolute; right: 0; top: 44px; width: min(520px, calc(100vw - 32px)); max-height: min(70vh, 560px); overflow-y: auto;
  background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 6px;
}
.search-results a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--ink); }
.search-results a:hover, .search-results a.selected { background: var(--accent-soft); text-decoration: none; }
.search-results .r-title { font-weight: 600; font-size: 15px; }
.search-results .r-where { font-size: 13px; color: var(--ink-faint); }
.search-results .r-text { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; margin-top: 2px; }
.search-results mark { background: none; color: var(--accent-ink); font-weight: 700; }
.search-results .empty { padding: 14px 12px; color: var(--ink-faint); font-size: 14px; }
.theme-toggle, .menu-button {
  width: 36px; height: 36px; border: 0; border-radius: 6px; background: transparent; color: #fff; cursor: pointer; flex: none;
  display: grid; place-items: center;
}
.theme-toggle:hover, .menu-button:hover { background: rgba(255, 255, 255, .12); }
.theme-toggle span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; background: linear-gradient(90deg, #fff 50%, transparent 50%); }
.menu-button { display: none; }
.menu-button span, .menu-button span::before, .menu-button span::after { display: block; width: 18px; height: 2px; background: #fff; border-radius: 1px; position: relative; }
.menu-button span::before, .menu-button span::after { content: ""; position: absolute; left: 0; }
.menu-button span::before { top: -6px; }
.menu-button span::after { top: 6px; }

/* Three columns */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr) 240px; max-width: 1480px; margin: 0 auto; }
.sidebar {
  position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  padding: 24px 12px 40px 20px; border-right: 1px solid var(--line); background: var(--bg);
}
.nav-section { margin-bottom: 18px; }
.nav-title { font-size: 13px; font-weight: 700; color: var(--ink); padding: 4px 12px; }
.sidebar ul { list-style: none; margin: 2px 0 0; padding: 0; }
.sidebar a { display: block; padding: 5px 12px; border-radius: 6px; color: var(--ink-soft); font-size: 14.5px; line-height: 1.45; }
.sidebar a:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.sidebar a.current { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }

.content { padding: 36px max(5vw, 20px) 64px; max-width: 900px; width: 100%; justify-self: center; }
.toc { position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto; padding: 40px 20px 40px 8px; font-size: 13.5px; }
.toc-title { font-weight: 700; margin-bottom: 8px; color: var(--ink); }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-faint); line-height: 1.4; }
.toc .toc-h3 a { padding-left: 26px; }
.toc a:hover { color: var(--ink); text-decoration: none; }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent); }

/* The page */
article h1 { font-size: clamp(32px, 5vw, 44px); line-height: 1.12; letter-spacing: -.025em; margin: 0 0 20px; font-weight: 700; }
article h2 { font-size: 27px; line-height: 1.25; letter-spacing: -.015em; margin: 48px 0 14px; font-weight: 700; }
article h3 { font-size: 20px; line-height: 1.3; margin: 34px 0 10px; font-weight: 650; }
article h4 { font-size: 17px; margin: 26px 0 8px; }
article h2, article h3, article h4 { position: relative; }
.anchor { position: absolute; left: -1.1em; width: 1em; color: var(--ink-faint); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, h4:hover .anchor { opacity: 1; text-decoration: none; }
article p { margin: 0 0 16px; }
article ul, article ol { margin: 0 0 16px; padding-left: 26px; }
article li { margin: 5px 0; }
article li > ul, article li > ol { margin: 6px 0; }
article strong { font-weight: 650; }
article :not(pre) > code {
  font-size: .875em; padding: 2px 6px; border-radius: 4px; background: var(--inline-code); color: var(--ink); white-space: break-spaces; overflow-wrap: anywhere;
}
article a code { color: var(--accent-ink); }
blockquote { margin: 0 0 16px; padding: 2px 18px; border-left: 3px solid var(--line); color: var(--ink-soft); }
.lead { font-size: 19px; color: var(--ink-soft); line-height: 1.6; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-soft); font-weight: 650; font-size: 14px; }
tbody tr:last-child td { border-bottom: 0; }

/* Callouts */
.callout { margin: 0 0 20px; padding: 14px 18px 2px; border-radius: 8px; border-left: 4px solid; }
.callout-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.callout.tip { background: var(--tip-bg); border-color: var(--tip); }
.callout.tip .callout-title { color: var(--tip); }
.callout.note { background: var(--note-bg); border-color: var(--note); }
.callout.note .callout-title { color: var(--note); }
.callout.warning { background: var(--warn-bg); border-color: var(--warn); }
.callout.warning .callout-title { color: var(--warn); }
.callout :not(pre) > code { background: rgba(127, 127, 140, .14); }

/* Examples: code, then what it printed */
.example { margin: 0 0 22px; border: 1px solid var(--code-line); border-radius: 8px; overflow: hidden; background: var(--code-bg); }
.file-name { font: 500 13px "JetBrains Mono", monospace; padding: 7px 16px; border-bottom: 1px solid var(--code-line); color: var(--ink-soft); background: var(--bg-soft); }
.code { position: relative; }
.example pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-size: 14px; line-height: 1.6; tab-size: 4; }
.copy {
  position: absolute; top: 8px; right: 8px; padding: 3px 10px; font: 500 12.5px Inter, system-ui, sans-serif;
  color: var(--ink-soft); background: var(--bg); border: 1px solid var(--code-line); border-radius: 5px; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code:hover .copy, .copy:focus-visible { opacity: 1; }
.copy.done { color: var(--pass); border-color: var(--pass); opacity: 1; }
.result { border-top: 1px dashed var(--code-line); background: var(--out-bg); }
.result-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 8px 18px 0; font-size: 12.5px; font-weight: 600; color: var(--ink-faint); }
.result-label .command { font-size: 12.5px; font-weight: 400; color: var(--ink-faint); }
.result pre { padding-top: 6px; color: var(--ink-soft); }
.result.error .result-label span { color: var(--err); }
.err-head { color: var(--err); font-weight: 700; }
.err-loc, .err-caret { color: var(--ink-faint); }
.err-caret { color: var(--err); }
.pass { color: var(--pass); }
.fail { color: var(--err); }

/* Highlighting */
.k, .l { color: var(--hl-k); font-weight: 600; }
.t { color: var(--hl-t); }
.f { color: var(--hl-f); font-weight: 600; }
.fc { color: var(--hl-fc); }
.s { color: var(--hl-s); }
.e, .i { color: var(--hl-e); font-weight: 600; }
.ie { color: var(--ink); }
.n { color: var(--hl-n); }
.c { color: var(--hl-c); font-style: italic; }
.a { color: var(--hl-a); }
.o { color: var(--hl-o); }
.lang-bash .k { font-weight: 400; color: var(--ink-faint); }
.lang-bash .f { color: var(--accent-ink); }

/* Standard library reference */
.api-list { margin: 0 0 24px; }
.api { padding: 14px 0 12px; border-bottom: 1px solid var(--line); }
.api-name { font: 700 15.5px "JetBrains Mono", monospace; margin-bottom: 6px; }
.api-name a { color: var(--ink); }
.api-sig { margin: 0 0 4px; padding: 7px 12px; background: var(--code-bg); border-radius: 6px; overflow-x: auto; font-size: 13.5px; line-height: 1.5; }
.api-doc { color: var(--ink-soft); font-size: 15px; margin-top: 6px; }
.api:target { background: linear-gradient(90deg, var(--accent-soft), transparent); }

/* Home page */
.hero { margin: -8px 0 32px; }
.hero h1 { font-size: clamp(36px, 6vw, 54px); margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; margin: 0 0 28px; }
.card { display: block; padding: 18px 18px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--bg); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.card b { display: block; font-size: 16.5px; margin-bottom: 4px; }
.card span { color: var(--ink-soft); font-size: 14.5px; line-height: 1.5; display: block; }

/* Previous / next */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; }
.pager a { flex: 1; max-width: 50%; padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); font-weight: 600; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager a span { display: block; font-size: 13px; font-weight: 400; color: var(--ink-faint); }
.pager .next { text-align: right; margin-left: auto; }
.page-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; color: var(--ink-faint); }

/* Narrower screens */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 260px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 900px) {
  .layout { display: block; }
  .menu-button { display: grid; margin-left: -8px; }
  .top-links { display: none; }
  .topbar { gap: 12px; }
  .search { width: auto; flex: 1; max-width: 360px; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; height: auto; width: min(320px, 86vw); z-index: 25;
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  body.menu-open .sidebar { transform: none; }
  body.menu-open::after { content: ""; position: fixed; inset: 56px 0 0; background: rgba(0, 0, 0, .35); z-index: 20; }
  .content { padding: 26px 18px 48px; }
  .anchor { display: none; }
}
@media (max-width: 520px) {
  .brand .version { display: none; }
  .search kbd { display: none; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
  .example pre { font-size: 13px; padding: 14px; }
  th, td { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
