/* chæ1 docs — mint and black, the same palette as the dashboard. */
@font-face {
  font-family: "chae1 Sans";
  src: url("/assets/fonts/chae1-sans.woff2") format("woff2");
  font-weight: 45 920;
  font-display: swap;
}

:root {
  --bg: #0a0c0b; --bg-2: #0e1110; --surface: #121615; --surface-2: #181d1b; --line: #232a27; --line-2: #2d3632;
  --text: #edf2ef; --muted: #96a59e; --faint: #6c7a73;
  --mint: #cee5d5; --mint-2: #a6dcbf; --mint-ink: #0c1a13; --mint-soft: rgba(206, 229, 213, .08); --mint-line: rgba(206, 229, 213, .22);
  --tip: #a6dcbf; --note: #9fc7e6; --warn: #e6c56b;
  --r: 14px;
  --top: 60px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 16px); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15.5px/1.65 "chae1 Sans", system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  letter-spacing: -0.005em;
}
body::before {
  content: ""; position: fixed; inset: -30vh -20vw auto -20vw; height: 80vh; z-index: -1; pointer-events: none;
  background: radial-gradient(45% 55% at 25% 15%, rgba(206, 229, 213, .06), transparent 70%);
}
a { color: var(--mint-2); text-underline-offset: 3px; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .86em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .08rem .38rem; color: var(--mint); white-space: nowrap; }
pre { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem 1.1rem; overflow-x: auto; }
pre code { background: none; border: 0; padding: 0; white-space: pre; color: var(--text); }
.muted { color: var(--muted); }
kbd { font: 600 .72rem ui-monospace, monospace; color: var(--muted); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 .35rem; }

/* ── Header ─────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top); display: flex; align-items: center; gap: 1rem;
  padding: 0 clamp(16px, 3vw, 28px); background: rgba(10, 12, 11, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.08rem; letter-spacing: -.02em; }
.brand img { border-radius: 50%; }
.brand .tag { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--mint-2); background: var(--mint-soft); border: 1px solid var(--mint-line); border-radius: 6px; padding: .05rem .4rem; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; background: var(--mint); color: var(--mint-ink); border-radius: 10px; padding: .45rem .95rem; font-weight: 700; font-size: .9rem; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #dcefe2; }
.menu-btn { display: none; cursor: pointer; font-size: 1.3rem; color: var(--text); padding: .2rem .4rem; }

/* Search */
.search { position: relative; width: min(380px, 40vw); }
.search input { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font: inherit; font-size: .92rem; padding: .5rem 2.2rem .5rem .8rem; }
.search input:focus { outline: none; border-color: var(--mint-line); box-shadow: 0 0 0 3px var(--mint-soft); }
.search kbd { position: absolute; right: .55rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 18px 40px rgba(0, 0, 0, .5); max-height: 60vh; overflow-y: auto; padding: .35rem; }
.results a { display: block; padding: .5rem .65rem; border-radius: 8px; color: var(--text); text-decoration: none; }
.results a:hover, .results a.on { background: var(--surface-2); }
.results .rt { font-weight: 700; font-size: .92rem; }
.results .rs { display: block; font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results .empty { padding: .7rem; color: var(--muted); font-size: .9rem; }
.results mark { background: var(--mint-soft); color: var(--mint); border-radius: 3px; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: clamp(24px, 3vw, 48px); max-width: 1320px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 28px); }
.side, .toc { position: sticky; top: var(--top); align-self: start; max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 1.6rem 0 2rem; }
.side ul, .toc ul { list-style: none; margin: 0 0 1.1rem; padding: 0; }
.nav-group { margin: 0 0 .45rem; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); }
.side a { display: block; padding: .32rem .7rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: .93rem; }
.side a:hover { color: var(--text); background: var(--bg-2); }
.side a.on { color: var(--mint); background: var(--mint-soft); font-weight: 650; }
.toc a { display: block; padding: .2rem 0 .2rem .8rem; border-left: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .84rem; }
.toc a:hover { color: var(--text); border-left-color: var(--mint-line); }
.toc .l3 a { padding-left: 1.5rem; font-size: .8rem; }

/* ── Content ────────────────────────────────────────────────────────── */
.doc { min-width: 0; padding: 1.8rem 0 3rem; }
.crumb { margin: 0 0 .2rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--mint-2); }
.doc h1 { font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.4rem); line-height: 1.15; letter-spacing: -.03em; margin: 0 0 .6rem; }
.lead { font-size: 1.08rem; color: var(--muted); margin: 0 0 1.6rem; }
.doc h2 { font-size: 1.4rem; letter-spacing: -.02em; margin: 2.4rem 0 .8rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.doc h3 { font-size: 1.08rem; margin: 1.7rem 0 .5rem; }
.doc h2, .doc h3 { position: relative; }
.anchor { position: absolute; left: -1.1em; color: var(--faint); text-decoration: none; opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.doc p, .doc li { color: #d6dfda; }
.doc ul, .doc ol { padding-left: 1.3rem; }
.doc li { margin: .25rem 0; }
.doc strong { color: var(--text); }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* Callouts */
.callout { border: 1px solid var(--line); border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 6%, var(--surface)); border-radius: 10px; padding: .75rem 1rem; margin: 1.1rem 0; }
.callout.tip { --c: var(--tip); } .callout.note { --c: var(--note); } .callout.warning { --c: var(--warn); }
.callout-title { margin: 0 0 .25rem; font-weight: 750; color: var(--c) !important; font-size: .9rem; }
.callout p { margin: .25rem 0; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.4rem; border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); font-weight: 700; padding: .7rem .9rem; background: var(--bg-2); border-bottom: 1px solid var(--line); }
td { padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; color: #d6dfda; }
tr:last-child td { border-bottom: 0; }
tr:target td { background: var(--mint-soft); }
td.cmd { white-space: nowrap; }
td.aliases code, td.perm code { margin: 0 .15rem .2rem 0; display: inline-block; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--mint-2); border: 1px solid var(--mint-line); border-radius: 999px; padding: 0 .45rem; margin-left: .2rem; }
.usage { margin-top: .3rem; }

/* Slash commands */
.slash { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: .85rem 1rem; margin: 1rem 0; }
.slash-head { margin-bottom: .4rem; }
.slash-subs { margin: 0; }
.slash-subs ul { margin: .2rem 0 .4rem; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3rem; }
.pager a { display: block; border: 1px solid var(--line); border-radius: var(--r); padding: .8rem 1rem; text-decoration: none; color: var(--text); font-weight: 700; }
.pager a:hover { border-color: var(--mint-line); background: var(--bg-2); }
.pager a span { display: block; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.pager .next { text-align: right; }

/* Cards on the intro page */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; margin: 1.2rem 0; }
.cards a { display: block; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: .9rem 1rem; text-decoration: none; color: var(--text); }
.cards a:hover { border-color: var(--mint-line); }
.cards b { display: block; color: var(--mint); margin-bottom: .2rem; }
.cards span { color: var(--muted); font-size: .88rem; }

.foot { text-align: center; color: var(--faint); font-size: .8rem; padding: 2rem 16px 2.5rem; border-top: 1px solid var(--line); }
.spark { color: var(--mint-2); }

/* ── Narrow screens ─────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: block; }
  .side { display: none; position: fixed; top: var(--top); left: 0; width: min(300px, 85vw); height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); max-height: none; background: var(--bg); border-right: 1px solid var(--line); padding: 1.2rem 16px; z-index: 15; }
  .menu-toggle:checked + .layout .side { display: block; }
  .search { width: auto; flex: 1; }
  .search kbd { display: none; }
  .brand .tag, .brand .name { display: none; }
  .top .btn { display: none; }
  .commands td.aliases, .commands th:nth-child(3) { display: none; }
}
@media (max-width: 520px) {
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
}
