/* aycode.app/docs: three columns (chapters, article, on this page), built on the tokens in site.css */

.docs { background: var(--bg); }
.docs-top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.docs-top__inner { max-width: 1440px; gap: 14px; }
.docs-badge { padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--accent-ink); background: var(--accent-soft); font: 600 0.78rem/1 var(--font-mono); letter-spacing: 0.04em; text-decoration: none; }
.docs-menu { display: none; }
.docs-menu svg, .docs-search-btn svg, .docs-search__field svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.docs-search-btn { display: flex; align-items: center; gap: 10px; flex: 0 1 320px; margin-inline: auto 0; height: 38px; padding: 0 8px 0 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); color: var(--faint); font: 500 0.88rem/1 var(--font-ui); cursor: pointer; transition: border-color 0.2s ease, color 0.2s ease; }
.docs-search-btn:hover { border-color: var(--accent); color: var(--muted); }
.docs-search-btn span { flex: 1; text-align: left; }
.docs-top .top__tools { margin-left: 0; }
kbd { display: inline-grid; place-items: center; min-width: 1.6em; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--panel-2); color: var(--ink); font: 600 0.78em/1.2 var(--font-mono); white-space: nowrap; }

.docs-shell { display: grid; grid-template-columns: 272px minmax(0, 1fr) 232px; max-width: 1440px; margin-inline: auto; }

/* chapters */
.docs-side { position: sticky; top: 64px; align-self: start; height: calc(100dvh - 64px); overflow-y: auto; padding: 28px 18px 48px 24px; border-right: 1px solid var(--line); scrollbar-width: thin; }
.docs-nav__group { margin-bottom: 22px; }
.docs-nav__label { margin: 0 0 8px 10px; color: var(--faint); font: 600 0.7rem/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.docs-nav ul { margin: 0; padding: 0; list-style: none; }
.docs-nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--muted); font-size: 0.92rem; text-decoration: none; transition: background-color 0.2s ease, color 0.2s ease; }
.docs-nav a:hover { background: var(--panel); color: var(--ink); }
.docs-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.docs-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent-bar); }
.docs-nav__icon { display: grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 7px; background: var(--panel-2); color: var(--accent-ink); }
.docs-nav a[aria-current="page"] .docs-nav__icon { background: var(--accent); color: #fff; }
.docs-nav__icon svg, .docs-card__icon svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.docs-nav__sub { margin: 2px 0 6px 34px !important; border-left: 1px solid var(--line); }
.docs-nav__sub a { padding: 5px 10px; font-size: 0.84rem; border-radius: 0 8px 8px 0; }

/* article */
.docs-main { min-width: 0; padding: 44px clamp(20px, 4.5vw, 64px) 96px; }
.doc { max-width: 780px; margin-inline: auto; }
.doc__crumb { display: flex; gap: 8px; align-items: center; color: var(--faint); font: 600 0.74rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; }
.doc__crumb span { color: var(--accent-ink); }
.doc h1 { margin-top: 14px; font: 750 clamp(2.2rem, 1.5rem + 2.6vw, 3.25rem)/1.05 var(--font-display); letter-spacing: -0.035em; background: linear-gradient(180deg, var(--ink) 30%, color-mix(in srgb, var(--accent-ink) 70%, var(--ink))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc__lead { margin-top: 16px; color: var(--muted); font-size: 1.16rem; line-height: 1.65; max-width: 680px; }
.doc__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.doc__pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; }
.doc h2 { position: relative; margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line); font: 700 1.6rem/1.2 var(--font-display); letter-spacing: -0.025em; scroll-margin-top: 84px; }
.doc h3 { margin-top: 34px; font: 650 1.14rem/1.3 var(--font-display); letter-spacing: -0.01em; scroll-margin-top: 84px; }
.doc h2 .anchor, .doc h3 .anchor { position: absolute; margin-left: -1.1em; padding-right: 0.3em; color: var(--faint); text-decoration: none; opacity: 0; transition: opacity 0.2s ease; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc .anchor:focus-visible { opacity: 1; }
.doc p, .doc li { color: var(--ink-2); font-size: 1.01rem; line-height: 1.75; }
.doc p { margin-top: 14px; }
.doc a:not(.btn, .anchor, .docs-card, .docs-pager a) { color: var(--accent-ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); text-underline-offset: 3px; }
.doc strong { color: var(--ink); font-weight: 650; }
.doc code { padding: 2px 6px; border-radius: 6px; background: var(--panel-2); color: var(--ink); font: 500 0.86em/1.4 var(--font-mono); }
.doc ul.doc-list { margin-top: 12px; padding-left: 0; list-style: none; }
.doc ul.doc-list li { position: relative; padding-left: 22px; margin-top: 8px; }
.doc ul.doc-list li::before { content: ""; position: absolute; left: 4px; top: 0.72em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bar); box-shadow: 0 0 0 4px var(--accent-soft); }

/* numbered steps with a thread between them */
.doc-steps { counter-reset: step; margin: 18px 0 0; padding: 0; list-style: none; }
.doc-steps li { position: relative; counter-increment: step; padding: 0 0 18px 48px; }
.doc-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-ink); font: 700 0.85rem/1 var(--font-mono); }
.doc-steps li:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 1px; background: linear-gradient(var(--line-2), transparent); }

/* callouts */
.callout { display: flex; gap: 14px; margin-top: 22px; padding: 16px 18px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--panel); }
.callout p { margin: 0; font-size: 0.95rem; line-height: 1.65; }
.callout__icon { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; font: 700 0.85rem/1 var(--font-mono); }
.callout--warn { border-color: color-mix(in srgb, #f2a73b 40%, var(--line)); background: linear-gradient(135deg, rgb(242 167 59 / 0.12), transparent 70%), var(--panel); }
.callout--warn .callout__icon { background: #f2a73b; color: #241a08; }
.callout--tip .callout__icon { background: var(--done); color: #06281c; }
.callout--tip { border-color: color-mix(in srgb, var(--done) 35%, var(--line)); background: linear-gradient(135deg, rgb(52 211 153 / 0.1), transparent 70%), var(--panel); }

/* screenshots in a lit frame; click to look closer */
.shot { margin: 28px 0 8px; }
.shot__frame { position: relative; display: block; width: 100%; padding: 6px; border: 1px solid var(--line-2); border-radius: 18px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); cursor: zoom-in; transition: transform 0.4s var(--ease), border-color 0.3s ease; }
.shot__frame::before { content: ""; position: absolute; inset: 12% 6% -6%; z-index: -1; border-radius: 40%; background: radial-gradient(closest-side, var(--accent-glow), transparent); filter: blur(30px); opacity: 0.55; transition: opacity 0.4s ease; }
.shot__frame:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--line-2)); }
.shot__frame:hover::before { opacity: 0.9; }
.shot__frame img { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--bg-2); }
.shot figcaption { margin-top: 12px; color: var(--faint); font-size: 0.86rem; line-height: 1.5; text-align: center; }
.shot--narrow { max-width: 520px; margin-inline: auto; }

/* key tables and plain tables */
.doc-table { width: 100%; margin-top: 18px; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: 0.93rem; }
.doc-table th { padding: 11px 14px; background: var(--panel-2); color: var(--muted); font-weight: 600; text-align: left; }
.doc-table td { padding: 11px 14px; border-top: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
.doc-table td:first-child { white-space: nowrap; }
.doc-table-wrap { overflow-x: auto; }

/* chapter cards on the overview */
.docs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 26px; }
.docs-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); color: inherit; text-decoration: none; overflow: hidden; isolation: isolate; transition: transform 0.35s var(--ease), border-color 0.3s ease; }
.docs-card::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 65%); opacity: 0; transition: opacity 0.3s ease; }
.docs-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.docs-card:hover::before { opacity: 1; }
.docs-card__icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }
.docs-card__icon svg { width: 17px; height: 17px; }
.docs-card b { font-size: 1.02rem; letter-spacing: -0.01em; }
.docs-card span { color: var(--muted); font-size: 0.88rem; line-height: 1.5; }

/* the overview opens with a lit hero */
.docs-hero { position: relative; margin: -44px calc(-1 * clamp(20px, 4.5vw, 64px)) 0; padding: 72px clamp(20px, 4.5vw, 64px) 56px; overflow: hidden; isolation: isolate; border-bottom: 1px solid var(--line); }
.docs-hero::before { content: ""; position: absolute; inset: -30% -20% -10%; z-index: -1; background: radial-gradient(640px circle at 28% 55%, var(--accent-glow), transparent 70%), radial-gradient(520px circle at 82% 22%, rgb(79 142 245 / 0.16), transparent 70%); animation: docs-breathe 9s ease-in-out infinite alternate; }
.docs-hero__mark { position: absolute; right: -40px; top: 20px; z-index: -1; width: 340px; opacity: 0.1; transform: rotate(-8deg); }
@keyframes docs-breathe { to { transform: translate3d(4%, 6%, 0) scale(1.08); } }
.docs-hero .doc { max-width: 900px; }
.docs-hero h1 { font-size: clamp(2.6rem, 1.6rem + 3.6vw, 4.2rem); }
.docs-hero__search { display: flex; align-items: center; gap: 12px; width: min(100%, 520px); height: 52px; margin-top: 28px; padding: 0 12px 0 16px; border-radius: 16px; border: 1px solid var(--line-2); background: color-mix(in srgb, var(--panel) 88%, transparent); color: var(--faint); font: 500 1rem/1 var(--font-ui); cursor: text; box-shadow: 0 20px 60px -30px var(--accent-glow); transition: border-color 0.2s ease; }
.docs-hero__search:hover { border-color: var(--accent); }
.docs-hero__search svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.docs-hero__search span { flex: 1; text-align: left; }

/* previous / next */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 780px; margin: 80px auto 0; }
.docs-pager a { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); color: inherit; text-decoration: none; transition: border-color 0.2s ease, transform 0.3s var(--ease); }
.docs-pager a:hover { border-color: var(--accent); transform: translateY(-2px); }
.docs-pager small { color: var(--faint); font: 600 0.72rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.docs-pager b { font-size: 1rem; }
.docs-pager .is-next { grid-column: 2; text-align: right; }

/* on this page */
.docs-toc { position: sticky; top: 64px; align-self: start; max-height: calc(100dvh - 64px); overflow-y: auto; padding: 44px 24px 40px 8px; }
.docs-toc p { margin: 0 0 10px; color: var(--faint); font: 600 0.7rem/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.docs-toc ul { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.docs-toc a { display: block; margin-left: -1px; padding: 5px 12px; border-left: 2px solid transparent; color: var(--muted); font-size: 0.84rem; line-height: 1.4; text-decoration: none; transition: color 0.2s ease, border-color 0.2s ease; }
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.is-active { color: var(--ink); border-left-color: var(--accent-bar); }
.docs-toc__top { display: inline-block; margin-top: 18px; color: var(--faint); font-size: 0.8rem; text-decoration: none; }

/* search */
.docs-search { position: fixed; inset: 0; z-index: 90; display: grid; justify-items: center; align-items: start; padding: 12vh 16px 16px; background: rgb(8 8 10 / 0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.docs-search[hidden] { display: none; }
.docs-search__panel { width: min(100%, 620px); max-height: 70vh; display: flex; flex-direction: column; border-radius: 20px; border: 1px solid var(--line-2); background: var(--panel); box-shadow: 0 40px 120px -30px rgb(0 0 0 / 0.7), 0 0 0 1px var(--accent-soft); overflow: hidden; animation: docs-pop 0.28s var(--ease); }
@keyframes docs-pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.docs-search__field { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); color: var(--faint); }
.docs-search__field input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: 500 1.05rem/1.2 var(--font-ui); }
.docs-search__field input::-webkit-search-cancel-button { display: none; }
.docs-search__results { margin: 0; padding: 8px; list-style: none; overflow-y: auto; }
.docs-search__results a { display: block; padding: 10px 12px; border-radius: 12px; color: inherit; text-decoration: none; }
.docs-search__results a[aria-selected="true"] { background: var(--accent-soft); }
.docs-search__results small { display: block; color: var(--accent-ink); font: 600 0.7rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.docs-search__results b { display: block; margin-top: 5px; font-size: 0.98rem; }
.docs-search__results span { display: block; margin-top: 3px; color: var(--muted); font-size: 0.85rem; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-search__results mark { background: none; color: var(--ink); font-weight: 700; }
.docs-search__empty { margin: 0; padding: 22px; color: var(--muted); text-align: center; }

/* zoomed screenshot */
.docs-zoom { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 3vw; background: rgb(8 8 10 / 0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); cursor: zoom-out; }
.docs-zoom[hidden] { display: none; }
.docs-zoom img { max-width: 100%; max-height: 92vh; border-radius: 14px; box-shadow: 0 40px 120px -20px rgb(0 0 0 / 0.8); animation: docs-pop 0.3s var(--ease); }

/* a figure rises in once it is near */
.js .doc .shot, .js .docs-card { opacity: 0; transform: translateY(16px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .doc .shot.is-in, .js .docs-card.is-in { opacity: 1; transform: none; }
.js .docs-card.is-in:hover { transform: translateY(-3px); }

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 256px minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 880px) {
  .docs-shell { grid-template-columns: minmax(0, 1fr); }
  .docs-menu { display: grid; }
  .docs-side { position: fixed; z-index: 60; top: 64px; left: 0; width: min(86vw, 320px); background: var(--bg); transform: translateX(-102%); transition: transform 0.4s var(--ease); box-shadow: 30px 0 80px -30px rgb(0 0 0 / 0.6); }
  .docs-side.is-open { transform: none; }
  .docs-scrim { position: fixed; inset: 64px 0 0; z-index: 55; background: rgb(8 8 10 / 0.5); }
  .docs-scrim[hidden] { display: none; }
  .docs-search-btn span, .docs-search-btn kbd { display: none; }
  .docs-search-btn { flex: none; width: 38px; padding: 0; justify-content: center; margin-left: auto; }
  .docs-badge { display: none; }
  .docs-main { padding-top: 28px; }
  .docs-hero { margin-top: -28px; padding-top: 48px; }
  .docs-hero__mark { width: 200px; right: -50px; }
}
@media (max-width: 560px) {
  .docs-top .btn--small { display: none; }
  .docs-pager { grid-template-columns: 1fr; }
  .docs-pager .is-next { grid-column: 1; }
  .shot__frame { padding: 4px; border-radius: 14px; }
  .shot__frame img { border-radius: 10px; }
  .doc h2 { margin-top: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-hero::before { animation: none; }
  .js .doc .shot, .js .docs-card { opacity: 1; transform: none; transition: none; }
  .docs-search__panel, .docs-zoom img { animation: none; }
}
