/* ============================================================
   Unyform Docs theme.
   TOKENS COPIED from crates/dashboard-leptos/style/input.css
   (:root + .dark blocks). If you change tokens there, mirror here.
   ============================================================ */
:root {
  --color-base: #f5f0e8;
  --color-surface: rgba(236, 231, 222, 0.65);
  --color-surface-hover: rgba(0, 0, 0, 0.04);
  --color-border: rgba(0, 0, 0, 0.08);
  --color-text-primary: #1a1a17;
  --color-text-secondary: #5c5a52;
  --color-text-tertiary: #8a877d;
  --color-accent: #5450c8;
  --color-accent-hover: #4340a8;
  --color-accent-subtle: rgba(84, 80, 200, 0.08);
  --color-danger: #c23b3b;
  --color-danger-subtle: rgba(194, 59, 59, 0.08);
  --color-success: #22c55e;
  --color-success-subtle: rgba(34, 197, 94, 0.10);
  --color-warning: #a67c1a;
  --color-warning-subtle: rgba(166, 124, 26, 0.08);
  --m-border: #d4cfc5;
  --m-dark-bg: #12140f;
  --m-dark-elevated: #1a1c17;
  --m-dark-border: #2a2d24;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'DM Sans', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --nav-bg: rgba(245, 240, 232, 0.85);
}
.dark {
  --color-base: #12140f;
  --color-surface: rgba(30, 32, 26, 0.65);
  --color-surface-hover: rgba(255, 255, 255, 0.06);
  --color-border: rgba(255, 255, 255, 0.08);
  --color-text-primary: #f0ede6;
  --color-text-secondary: #a8a49a;
  --color-text-tertiary: #706d64;
  --color-accent: #7b78e8;
  --color-accent-hover: #9896f0;
  --color-accent-subtle: rgba(123, 120, 232, 0.15);
  --color-danger: #ef5555;
  --color-danger-subtle: rgba(239, 85, 85, 0.15);
  --color-success: #34d46e;
  --color-success-subtle: rgba(52, 212, 110, 0.15);
  --color-warning: #d4a832;
  --color-warning-subtle: rgba(212, 168, 50, 0.15);
  --m-border: #2a2d24;
  --nav-bg: rgba(18, 20, 15, 0.85);
}

* { box-sizing: border-box; }
html { scroll-padding-top: 5rem; }
body {
  margin: 0; background: var(--color-base); color: var(--color-text-primary);
  font-family: var(--font-sans); font-size: 16px; line-height: 1.65;
}
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

/* ── Topnav ── */
.topnav {
  position: fixed; top: 0; width: 100%; z-index: 50;
  backdrop-filter: blur(20px); background: var(--nav-bg);
  border-bottom: 1px solid var(--m-border);
}
.topnav-inner {
  max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; height: 4rem;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: .5rem; }
.brand-logo { height: 1.75rem; }
.brand-word {
  font-family: var(--font-serif); font-size: 1.25rem; font-weight: 700;
  letter-spacing: -0.02em; color: var(--color-accent);
}
.brand-docs {
  font-size: .8rem; color: var(--color-text-tertiary); border: 1px solid var(--m-border);
  border-radius: 999px; padding: .05rem .5rem; margin-left: .25rem;
}
.topnav-links { display: flex; align-items: center; gap: 1.5rem; }
.topnav-links a { font-size: .875rem; font-weight: 500; color: var(--color-text-secondary); }
.nav-btn {
  background: none; border: 1px solid var(--m-border); border-radius: .5rem;
  color: var(--color-text-secondary); cursor: pointer; padding: .3rem .6rem; font-size: .8rem;
}
.nav-btn kbd { font-family: var(--font-mono); font-size: .7rem; }

/* ── Shell: sidebar / content / toc ── */
.shell {
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: 2rem; max-width: 1400px; margin: 0 auto; padding: 5.5rem 1.5rem 3rem;
  min-height: calc(100vh - 10rem);
}
.sidebar { position: sticky; top: 5.5rem; align-self: start; max-height: calc(100vh - 6rem); overflow-y: auto; }
.toc-rail { position: sticky; top: 5.5rem; align-self: start; font-size: .82rem; }
@media (max-width: 1100px) { .shell { grid-template-columns: 260px minmax(0,1fr); } .toc-rail { display: none; } }
@media (max-width: 860px) { .shell { grid-template-columns: minmax(0,1fr); } .sidebar { display: none; } }

/* ── Sidebar nav ── */
.docs-nav { font-size: .875rem; }
.docs-nav .nav-section { margin-bottom: 1.25rem; }
.docs-nav .nav-section > a {
  font-family: var(--font-serif); font-size: 1rem; color: var(--color-text-primary);
}
.docs-nav ul { list-style: none; margin: .4rem 0 0; padding: 0 0 0 .25rem; border-left: 1px solid var(--m-border); }
.docs-nav li a {
  display: block; padding: .22rem .6rem; color: var(--color-text-secondary); border-radius: .35rem;
}
.docs-nav li a:hover { background: var(--color-surface-hover); }
.docs-nav li a.active { color: var(--color-accent); background: var(--color-accent-subtle); font-weight: 600; }

/* ── Prose ── */
.prose { max-width: 46rem; }
.prose h1 { font-family: var(--font-serif); font-size: 2.3rem; font-weight: 400; letter-spacing: -0.02em; margin: 0 0 1rem; }
.prose h2 { font-family: var(--font-serif); font-size: 1.6rem; font-weight: 400; margin: 2.2rem 0 .7rem; }
.prose h3 { font-size: 1.12rem; margin: 1.8rem 0 .5rem; }
.prose p, .prose li { color: var(--color-text-secondary); }
.prose strong { color: var(--color-text-primary); }
.prose code {
  font-family: var(--font-mono); font-size: .85em; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: .3rem; padding: .1rem .35rem;
}
/* Code blocks: always dark, both modes (Stripe-style) */
.prose pre {
  background: var(--m-dark-elevated); border: 1px solid var(--m-dark-border);
  border-radius: .6rem; padding: 1rem 1.2rem; overflow-x: auto; line-height: 1.5;
}
.prose pre code { background: none; border: none; padding: 0; font-size: .82rem; }
.prose img { max-width: 100%; border-radius: .6rem; border: 1px solid var(--m-border); }
.prose table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.prose th, .prose td { border: 1px solid var(--m-border); padding: .45rem .7rem; text-align: left; }
.prose blockquote { border-left: 3px solid var(--color-accent); margin: 1rem 0; padding: .2rem 1rem; color: var(--color-text-tertiary); }

/* ── Landing cards ── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-top: 2rem; }
.card {
  display: block; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: .8rem; padding: 1.1rem 1.25rem; transition: border-color .15s;
}
.card:hover { border-color: var(--color-accent); }
.card h3 { margin: 0 0 .3rem; font-family: var(--font-serif); font-weight: 400; color: var(--color-text-primary); }
.card p { margin: 0; font-size: .85rem; color: var(--color-text-tertiary); }

/* ── TOC ── */
.toc-rail .toc-title { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; color: var(--color-text-tertiary); margin-bottom: .5rem; }
.toc-rail ul { list-style: none; margin: 0; padding: 0; }
.toc-rail ul ul { padding-left: .8rem; }
.toc-rail a { display: block; padding: .18rem 0; color: var(--color-text-tertiary); }
.toc-rail a:hover { color: var(--color-accent); }

/* ── Page footer nav / edit link ── */
.page-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; border-top: 1px solid var(--m-border); padding-top: 1.2rem; font-size: .875rem; }
.edit-link { display: inline-block; margin-top: 1.2rem; font-size: .8rem; color: var(--color-text-tertiary); }

/* ── Footer ── */
.footer { border-top: 1px solid var(--m-border); margin-top: 2rem; }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 1.4rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.footer-copy { font-size: .8rem; color: var(--color-text-tertiary); }

/* ── Search modal ── */
.search-modal {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.35);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh;
}
.search-modal[hidden] { display: none; }
.search-box {
  width: min(640px, 92vw); background: var(--color-base); border: 1px solid var(--m-border);
  border-radius: .9rem; box-shadow: 0 8px 32px rgba(0,0,0,.18); overflow: hidden;
}
#search-input { width: 100%; border: none; outline: none; background: none; padding: 1rem 1.2rem; font-size: 1rem; color: var(--color-text-primary); font-family: var(--font-sans); }
#search-results { list-style: none; margin: 0; padding: 0 0 .4rem; max-height: 50vh; overflow-y: auto; border-top: 1px solid var(--m-border); }
#search-results li a { display: block; padding: .6rem 1.2rem; }
#search-results li a:hover, #search-results li a.selected { background: var(--color-accent-subtle); }
#search-results .result-path { display: block; font-size: .72rem; color: var(--color-text-tertiary); }

/* ── Admonitions ── */
.admonition { border: 1px solid var(--color-border); border-left-width: 3px; border-radius: .5rem; padding: .8rem 1rem; margin: 1.2rem 0; }
.admonition .admonition-title { font-weight: 600; margin: 0 0 .3rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.admonition.note { border-left-color: var(--color-accent); background: var(--color-accent-subtle); }
.admonition.tip { border-left-color: var(--color-success); background: var(--color-success-subtle); }
.admonition.warning { border-left-color: var(--color-warning); background: var(--color-warning-subtle); }

/* ── Endpoint chip ── */
.endpoint { display: flex; align-items: center; gap: .6rem; margin: 1.2rem 0 .8rem; }
.endpoint-method { font-family: var(--font-mono); font-size: .72rem; font-weight: 600; padding: .15rem .5rem; border-radius: .35rem; color: #fff; }
.endpoint-post { background: var(--color-accent); }
.endpoint-get { background: var(--color-success); }
.endpoint-delete { background: var(--color-danger); }
.endpoint code { font-size: .95rem; }

/* ── Tabs ── */
.tabs { margin: 1.2rem 0; }
.tab-buttons { display: flex; gap: .25rem; border-bottom: 1px solid var(--m-border); }
.tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer;
  padding: .45rem .9rem; font-size: .85rem; color: var(--color-text-secondary); font-family: var(--font-sans);
}
.tab-btn.active { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Figure / video / embed ── */
figure { margin: 1.4rem 0; }
figcaption { font-size: .8rem; color: var(--color-text-tertiary); text-align: center; margin-top: .4rem; }
.docs-video, .docs-embed { width: 100%; border-radius: .6rem; border: 1px solid var(--m-border); }
