/* Docs theme (from the Wherry site's docs.css, in Glimmer's tokens). Everything docs-specific lives here and in templates/docs.html, so the docs can be re-skinned to match
   other documentation sites without touching the marketing pages. Uses tokens.css; prose basics come from site.css. */

.docs { --docs-sidebar: 264px; --docs-toc: 220px; --docs-content: 760px; }
.docs .site-footer { margin-top: 48px; }
.docs .site-header .wrap { max-width: 1440px; }

.docs-layout {
  display: grid;
  grid-template-columns: var(--docs-sidebar) minmax(0, 1fr) var(--docs-toc);
  gap: 48px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Left navigation */
.docs-sidebar { position: sticky; top: 60px; align-self: start; max-height: calc(100vh - 60px); overflow-y: auto; padding: 28px 0 40px; scrollbar-width: thin; }
.docs-nav-toggle > summary { display: none; }
.docs-nav { font-size: 14px; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav a { display: block; color: var(--text-secondary); padding: 6px 10px; border-radius: 0; line-height: 1.35; }
.docs-nav a:hover { color: var(--text-primary); background: var(--bg-surface); text-decoration: none; }
.docs-nav a.is-current, .docs-nav a[aria-current="page"] { color: var(--text-primary); background: var(--bg-raised); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent-blue); }
.docs-nav-root { font-weight: 600; margin-bottom: 8px; }
.docs-nav > ul > li.is-section { margin-top: 18px; }
.docs-nav > ul > li.is-section > a { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); }
.docs-nav > ul > li.is-section > a:hover, .docs-nav > ul > li.is-section > a.is-current { color: var(--text-primary); }
/* Indent nested pages inside the link, so hover and current rows still span the full sidebar width. */
.docs-nav li li li > a { padding-left: 22px; }

/* Content */
.docs-content { min-width: 0; max-width: var(--docs-content); padding: 36px 0 24px; }
.docs-content > h1 { font-size: clamp(30px, 3.6vw, 40px); letter-spacing: -0.025em; margin-bottom: 12px; }
.docs-lede { font-size: 19px; color: var(--text-secondary); margin-bottom: 28px; }
.docs-crumbs { font-size: 13px; color: var(--text-tertiary); display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.docs-crumbs a { color: var(--text-secondary); }
.docs-prose { font-size: 16px; line-height: 1.72; }
.docs-prose > :first-child { margin-top: 0; }
.docs-prose h2 { font-size: 24px; margin-top: 2.1em; padding-top: 0.2em; }
.docs-prose h3 { font-size: 18px; margin-top: 1.7em; }
.docs-prose h4 { font-size: 16px; margin-top: 1.4em; }
.docs-prose p, .docs-prose li { color: var(--text-secondary); }
.docs-prose a { text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.docs-prose a:hover { text-decoration-color: currentColor; }
.docs-prose a.anchor { text-decoration: none; }
.docs-prose pre { position: relative; font-size: 14px; }
.docs-prose pre[data-lang]::before { content: attr(data-lang); position: absolute; top: 6px; right: 12px; font: 600 11px var(--font-sans); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary); }
.docs-prose pre[data-lang]:has(.copy-btn)::before { display: none; }
.copy-btn {
  position: absolute; top: 8px; right: 8px; font: 600 12px var(--font-sans); color: var(--text-secondary);
  background: var(--bg-raised); border: 1px solid var(--border-strong); border-radius: var(--radius-control); padding: 4px 8px;
  cursor: pointer; opacity: 0; transition: opacity var(--motion-fast) var(--ease);
}
pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 1; } }
.docs-prose kbd { font-size: 0.8em; }
.docs-prose input[type="checkbox"] { margin-right: 0.5em; }

/* GitHub-style alerts: > [!NOTE], > [!TIP], > [!IMPORTANT], > [!WARNING], > [!CAUTION] */
.docs-prose blockquote[class^="markdown-alert-"] { border-left-width: 3px; border-radius: 0 var(--radius-card) var(--radius-card) 0; background: var(--bg-surface); padding: 12px 18px; color: var(--text-secondary); }
.docs-prose blockquote[class^="markdown-alert-"] > :last-child { margin-bottom: 0; }
.docs-prose blockquote[class^="markdown-alert-"]::before { display: block; font: 700 12px var(--font-sans); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.markdown-alert-note { border-left-color: var(--accent-blue) !important; }
.markdown-alert-note::before { content: "Note"; color: var(--accent-blue); }
.markdown-alert-tip { border-left-color: var(--state-success) !important; }
.markdown-alert-tip::before { content: "Tip"; color: var(--state-success); }
.markdown-alert-important { border-left-color: var(--accent-violet) !important; }
.markdown-alert-important::before { content: "Important"; color: var(--accent-text); }
.markdown-alert-warning { border-left-color: var(--state-warning) !important; }
.markdown-alert-warning::before { content: "Warning"; color: var(--state-warning); }
.markdown-alert-caution { border-left-color: var(--state-danger) !important; }
.markdown-alert-caution::before { content: "Caution"; color: var(--state-danger); }

/* Alert headings in each site language (the English ones above are the fallback). */
:lang(de) .markdown-alert-note::before { content: "Hinweis"; }
:lang(de) .markdown-alert-tip::before { content: "Tipp"; }
:lang(de) .markdown-alert-important::before { content: "Wichtig"; }
:lang(de) .markdown-alert-warning::before { content: "Warnung"; }
:lang(de) .markdown-alert-caution::before { content: "Vorsicht"; }
:lang(fr) .markdown-alert-note::before { content: "Remarque"; }
:lang(fr) .markdown-alert-tip::before { content: "Conseil"; }
:lang(fr) .markdown-alert-important::before { content: "Important"; }
:lang(fr) .markdown-alert-warning::before { content: "Attention"; }
:lang(fr) .markdown-alert-caution::before { content: "Prudence"; }
:lang(es) .markdown-alert-note::before { content: "Nota"; }
:lang(es) .markdown-alert-tip::before { content: "Consejo"; }
:lang(es) .markdown-alert-important::before { content: "Importante"; }
:lang(es) .markdown-alert-warning::before { content: "Advertencia"; }
:lang(es) .markdown-alert-caution::before { content: "Precaución"; }
:lang(ja) .markdown-alert-note::before { content: "注"; }
:lang(ja) .markdown-alert-tip::before { content: "ヒント"; }
:lang(ja) .markdown-alert-important::before { content: "重要"; }
:lang(ja) .markdown-alert-warning::before { content: "警告"; }
:lang(ja) .markdown-alert-caution::before { content: "注意"; }
:lang(zh-Hans) .markdown-alert-note::before { content: "注"; }
:lang(zh-Hans) .markdown-alert-tip::before { content: "提示"; }
:lang(zh-Hans) .markdown-alert-important::before { content: "重要"; }
:lang(zh-Hans) .markdown-alert-warning::before { content: "警告"; }
:lang(zh-Hans) .markdown-alert-caution::before { content: "注意"; }
:lang(ja) .docs-prose blockquote[class^="markdown-alert-"]::before, :lang(zh-Hans) .docs-prose blockquote[class^="markdown-alert-"]::before { letter-spacing: 0.02em; }

/* Section landing cards */
.docs-cards { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.docs-cards a { display: block; height: 100%; padding: 16px 18px; border: 1px solid var(--border-subtle); border-radius: var(--radius-card); background: var(--bg-surface); color: var(--text-primary); }
.docs-cards a:hover { border-color: var(--border-strong); background: var(--bg-raised); text-decoration: none; }
.docs-cards strong { display: block; font-size: 16px; margin-bottom: 4px; }
.docs-cards span { display: block; font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* Prev / next */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 56px 0 24px; }
.docs-pager a { display: block; padding: 14px 18px; border: 1px solid var(--border-subtle); border-radius: var(--radius-card); color: var(--text-primary); }
.docs-pager a:hover { border-color: var(--accent-blue); text-decoration: none; }
.docs-pager span { display: block; font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.docs-pager-next { text-align: right; grid-column: 2; }
.docs-help { font-size: 14px; color: var(--text-tertiary); border-top: 1px solid var(--border-subtle); padding-top: 18px; }

/* Right "On this page" */
.docs-toc { position: sticky; top: 60px; align-self: start; max-height: calc(100vh - 60px); overflow-y: auto; padding: 40px 0; font-size: 13px; }
.docs-toc-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-tertiary); margin-bottom: 10px; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border-subtle); }
.docs-toc a { display: block; color: var(--text-secondary); padding: 4px 0 4px 12px; margin-left: -1px; border-left: 1px solid transparent; line-height: 1.4; }
.docs-toc a:hover { color: var(--text-primary); text-decoration: none; }
.docs-toc a.is-active { color: var(--text-primary); border-left-color: var(--accent-blue); }
.docs-toc .toc-l3 a { padding-left: 24px; }

/* An entry not translated into the page's language (it opens in English): a small "EN" tag after its title. */
.docs-en { display: inline-block; margin-left: 6px; padding: 1px 4px; vertical-align: 1px; border: 1px solid var(--border-subtle); border-radius: 4px;
  font: 500 10px/1.3 var(--font-mono); letter-spacing: 0.04em; color: var(--text-tertiary); }
.docs-search-results .r-lang { display: inline-block; margin-left: 8px; padding: 0 4px; border: 1px solid var(--border-subtle); border-radius: 4px; font: 500 10px/1.4 var(--font-mono); }
.docs-search-results [aria-selected="true"] .r-lang { border-color: rgba(4, 18, 22, 0.4); }

/* Search button (header) */
.docs-search-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
  font: 500 13px var(--font-sans); color: var(--text-tertiary); background: var(--bg-surface);
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px 8px 6px 10px; cursor: pointer; min-width: 200px;
}
.docs-search-btn[hidden] { display: none; }
.docs-search-btn:hover { color: var(--text-secondary); border-color: #46507a; }
.docs-search-btn kbd { margin-left: auto; }
.docs .header-cta { margin-left: 0; }

/* Search dialog */
.docs-search {
  width: min(640px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 120px)); margin: 12vh auto auto; padding: 0;
  background: var(--bg-raised); color: var(--text-primary); border: 1px solid var(--border-strong); border-radius: 14px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65); overflow: hidden;
}
.docs-search[open] { display: flex; flex-direction: column; }
.docs-search::backdrop { background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.docs-search-box { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-tertiary); }
.docs-search-box input { flex: 1; min-width: 0; font: 17px var(--font-sans); color: var(--text-primary); background: transparent; border: 0; outline: none; }
.docs-search-box input::-webkit-search-cancel-button { display: none; }
.docs-search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; }
.docs-search-results:empty { display: none; }
.docs-search-results a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text-primary); }
.docs-search-results a:hover { text-decoration: none; }
.docs-search-results [aria-selected="true"] a { background: var(--accent); color: var(--on-accent); }
.docs-search-results [aria-selected="true"] a .r-sec, .docs-search-results [aria-selected="true"] a .r-snip { color: rgba(4, 18, 22, 0.82); }
.docs-search-results .r-sec { display: block; font-size: 12px; color: var(--text-tertiary); margin-bottom: 2px; }
.docs-search-results .r-title { display: block; font-weight: 600; }
.docs-search-results .r-snip { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.docs-search-results mark { background: rgba(79, 216, 235, 0.25); color: inherit; border-radius: 3px; padding: 0 1px; }
.docs-search-results [aria-selected="true"] mark { background: rgba(4, 18, 22, 0.14); }
.docs-search-results .r-empty { padding: 18px 12px; color: var(--text-tertiary); font-size: 14px; }
.docs-search-hint { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border-subtle); font-size: 12px; color: var(--text-tertiary); }

/* Responsive */
@media (max-width: 1200px) {
  .docs-layout { grid-template-columns: var(--docs-sidebar) minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 16px; }
  .docs-sidebar { position: static; max-height: none; padding: 16px 0 0; overflow: visible; }
  .docs-nav-toggle { border: 1px solid var(--border-subtle); border-radius: var(--radius-card); background: var(--bg-surface); }
  .docs-nav-toggle > summary { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; }
  .docs-nav-toggle > summary::-webkit-details-marker { display: none; }
  .docs-nav-toggle > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--text-tertiary); border-bottom: 2px solid var(--text-tertiary); transform: rotate(45deg); }
  .docs-nav-toggle[open] > summary::after { transform: rotate(225deg); }
  .docs-nav { padding: 0 8px 12px; }
  .docs-content { padding-top: 24px; }
  .docs-cards { grid-template-columns: 1fr; }
  .docs-search-btn { min-width: 0; }
  .docs-search-label, .docs-search-btn kbd { display: none; }
}
