/* Diode Docs — Alto-inspired theme (from docs.diode.io theme.yml) */
:root {
  --text: #000000;
  --text-main: #363636;
  --text-muted: #70777f;
  --links: #f15c2e;
  --highlight: #de935f;
  --body-bg: #fff;
  --bg: #efefef;
  --bg-alt: #f7f7f7;
  --border: #dbdbdb;
  --code-bg: #f7f7f7;
  --header-h: 64px;
  --footer-h: 52px;
  --font: "TT Norms Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --text: #e6edf3;
  --text-main: #e6edf3;
  --text-muted: #c8c8c8;
  --links: #f15c2e;
  --body-bg: #121516;
  --bg: #1d1f21;
  --bg-alt: #080808;
  --border: #333;
  --code-bg: #1d1f21;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  color-scheme: light;
  background: var(--body-bg);
}
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--body-bg);
  line-height: 1.55;
  padding-bottom: var(--footer-h);
}
a { color: var(--links); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
code, pre { font-family: var(--mono); font-size: 0.92em; }
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
}
code {
  background: var(--bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
pre code { background: transparent; padding: 0; }
table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
th, td { border: 1px solid var(--border); padding: 0.5rem 0.75rem; text-align: left; }
blockquote {
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--links);
  color: var(--text-muted);
}
.muted { color: var(--text-muted); }
.btn {
  display: inline-block;
  background: var(--links);
  color: #fff !important;
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none !important;
  font: inherit;
}
.btn:hover { filter: brightness(1.05); }
.btn-outline {
  background: transparent;
  color: var(--links) !important;
  border: 1px solid var(--links);
}
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.9rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--body-bg);
  border-bottom: 1px solid var(--border);
}
.top-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  min-height: var(--header-h);
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text);
  text-decoration: none !important;
  flex-shrink: 0;
}
.logo { height: 28px; width: auto; display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: inline; }
.logo-heading {
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--text-main);
  letter-spacing: 0.01em;
  line-height: 1;
  /* Optical vertical balance next to the lowercase diode wordmark */
  transform: translateY(1px);
}
.nav-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.product-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 0.15rem;
}
.product-nav a {
  display: block;
  padding: 0.35rem 0.65rem;
  color: var(--text-main);
  border-radius: 4px;
  text-decoration: none !important;
}
.product-nav a:hover,
.product-nav a.focus {
  background: var(--bg);
  color: var(--links);
}
.nav-search input {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-main);
  border-radius: 4px;
  padding: 0.35rem 0.6rem;
  width: 10rem;
}
.theme-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-main);
  border-radius: 4px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}
.admin-link {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Docs layout */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
}
.docnav {
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem 2rem;
  background: var(--bg-alt);
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h) - var(--footer-h));
  position: sticky;
  top: var(--header-h);
}
.docnav-title {
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--text);
}
.docnav-pinned {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}
.docnav-pinned a {
  display: block;
  padding: 0.4rem 0.45rem;
  border-radius: 3px;
  color: var(--text);
  text-decoration: none !important;
  font-size: 0.98rem;
  font-weight: 600;
}
.docnav-pinned a:hover,
.docnav-pinned a.active {
  background: var(--bg);
  color: var(--links);
}
.docnav-group { margin-bottom: 0.35rem; }
.docnav-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  margin: 0;
  padding: 0.35rem 0.25rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: left;
  border-radius: 3px;
}
.docnav-toggle:hover {
  color: var(--text);
  background: var(--bg);
}
.docnav-chevron {
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-left: 0.15rem;
}
.docnav-group.is-open .docnav-chevron {
  transform: rotate(45deg);
  margin-top: -0.15rem;
}
.docnav-group-label { flex: 1; }
.docnav-list {
  list-style: none;
  margin: 0 0 0.5rem;
  padding: 0 0 0 1rem;
}
.docnav-list[hidden] { display: none; }
.docnav-group a {
  display: block;
  padding: 0.25rem 0.4rem;
  border-radius: 3px;
  color: var(--text-main);
  text-decoration: none !important;
  font-size: 0.95rem;
}
.docnav-group a:hover,
.docnav-group a.active {
  background: var(--bg);
  color: var(--links);
}
.docnav-group a.active {
  font-weight: 600;
}
.docs-main { padding: 1.5rem 2rem 3rem; }
.docs-article { max-width: 820px; }
.docs-article h1 {
  margin-top: 0;
  color: var(--text);
  font-size: 2rem;
  line-height: 1.2;
}
.docs-article h2 { margin-top: 1.75rem; color: var(--text); }
.docs-article h3 { margin-top: 1.35rem; }
.docs-article p, .docs-article li { color: var(--text-main); }
.docs-article img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.75rem 0;
}
.video-embed {
  position: relative;
  width: 100%;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  margin: 1.25rem 0;
  background: #000;
  border-radius: 6px;
  overflow: hidden;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.welcome, .search-page {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.25rem 3rem;
}
.welcome-links { font-size: 1.1rem; line-height: 1.9; }
.search-form { display: flex; gap: 0.5rem; margin: 1rem 0; }
.search-form input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text-main);
}
.search-results { list-style: none; padding: 0; }
.search-results li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.search-results .badge {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  background: var(--bg);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  color: var(--text-muted);
}
.search-results mark {
  background: #fffece;
  color: inherit;
  padding: 0 0.1em;
}
[data-theme="dark"] .search-results mark { background: #5a4a10; }
.snip { margin: 0.35rem 0 0; color: var(--text-muted); font-size: 0.95rem; }

/* Fixed thin footer (viewport bottom) */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  height: var(--footer-h);
  background: var(--body-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.site-footer-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.25rem;
  flex-wrap: wrap;
  text-align: center;
}
.site-footer-tagline,
.site-footer-legal {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1;
}
.site-footer-tagline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}
.site-footer-brand {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none !important;
}
.site-footer-logo {
  height: 20px;
  width: auto;
  display: block;
  /* Wordmark sits optically low in its viewBox; lift to match adjacent text */
  transform: translateY(-2.5px);
}
.site-footer .logo-dark { display: none; }
[data-theme="dark"] .site-footer .logo-light { display: none; }
[data-theme="dark"] .site-footer .logo-dark { display: block; }

.login-wrap {
  min-height: calc(100vh - var(--header-h) - var(--footer-h));
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  width: min(360px, 100%);
  text-align: center;
}
.login-card .tagline { color: var(--text-muted); }
.login-card .hint { font-size: 0.9rem; color: var(--text-muted); }
.login-card .error { color: #c0392b; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ask-fab {
  position: fixed;
  right: 1.25rem;
  bottom: calc(var(--footer-h) + 1rem);
  z-index: 40;
  background: var(--links);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.ask-fab:hover { filter: brightness(1.05); }
.ask-panel {
  position: fixed;
  right: 1.25rem;
  bottom: calc(var(--footer-h) + 3.6rem);
  z-index: 40;
  width: min(400px, calc(100vw - 2rem));
  height: min(520px, calc(100vh - var(--header-h) - var(--footer-h) - 5rem));
  background: var(--body-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ask-panel:has(.ask-log:empty),
.ask-panel:has(.ask-log:not(:has(.ask-msg))) {
  height: auto;
  max-height: min(520px, calc(100vh - var(--header-h) - var(--footer-h) - 5rem));
}
.ask-panel:has(.ask-captcha:not([hidden])):has(.ask-log:empty),
.ask-panel:has(.ask-captcha:not([hidden])):has(.ask-log:not(:has(.ask-msg))) {
  height: min(520px, calc(100vh - var(--header-h) - var(--footer-h) - 5rem));
}
.ask-panel[hidden],
.ask-captcha[hidden],
.ask-stop-gen[hidden],
.ask-new-conv[hidden],
.ask-panel-welcome[hidden],
#ask-captcha-error[hidden] {
  display: none !important;
}
.ask-panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "welcome welcome";
  align-items: start;
  column-gap: 0.5rem;
  row-gap: 0.2rem;
  padding: 0.85rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}
.ask-panel-head-actions {
  grid-area: actions;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.ask-new-conv {
  border: 0;
  background: none;
  color: var(--links);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.3;
  cursor: pointer;
  padding: 0.35rem 0.15rem 0;
  white-space: nowrap;
}
.ask-new-conv:hover,
.ask-new-conv:focus-visible {
  text-decoration: underline;
}
.ask-panel-title {
  grid-area: title;
  margin: 0;
  font-size: 1rem;
  color: var(--text);
  min-width: 0;
}
.ask-panel-welcome {
  grid-area: welcome;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.ask-panel:has(.ask-msg) .ask-panel-welcome {
  display: none;
}
.ask-panel:has(.ask-msg) .ask-panel-head {
  grid-template-areas: "title actions";
}
.ask-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0.15rem 0.35rem;
  z-index: 1;
}
.ask-log {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
}
.ask-log-spacer {
  flex: 1 1 auto;
  min-height: 0;
}
.ask-log:empty,
.ask-log:not(:has(.ask-msg)) {
  flex: 0 0 0;
  padding: 0;
  overflow: hidden;
}
.ask-msg-who { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.2rem; }
.ask-msg--user .ask-msg-body {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
}
.ask-msg-body { font-size: 0.95rem; color: var(--text-main); word-break: break-word; }
.ask-msg-body a { color: var(--links); }
.ask-msg-body p { margin: 0 0 0.65em; }
.ask-msg-body p:last-child { margin-bottom: 0; }
.ask-msg-body h1,
.ask-msg-body h2,
.ask-msg-body h3,
.ask-msg-body h4 {
  margin: 0.15em 0 0.4em;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--text);
}
.ask-msg-body ul,
.ask-msg-body ol {
  margin: 0.3em 0 0.65em;
  padding-left: 1.2em;
}
.ask-msg-body li { margin: 0.15em 0; }
.ask-msg-body pre {
  margin: 0.4em 0 0.65em;
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
}
.ask-msg-body code { font-size: 0.88em; }
.ask-activity { color: var(--text-muted); font-style: italic; }
.ask-stop-gen {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--links);
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  flex: 0 0 auto;
}
.ask-stop-gen:hover,
.ask-stop-gen:focus-visible {
  text-decoration: underline;
}
.ask-stop-gen-icon {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  background: currentColor;
  border-radius: 1px;
  flex: 0 0 auto;
}
.ask-error { color: #c0392b; }
.ask-captcha {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0.85rem 0.65rem;
  background: var(--bg-alt);
  overflow: hidden;
  flex: 0 1 auto;
  max-height: 42%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ask-captcha-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
}
.ask-panel:has(.ask-captcha:not([hidden])) .ask-captcha {
  max-height: none;
  flex: 1 1 auto;
}
.ask-compose {
  border-top: 1px solid var(--border);
  padding: 0.55rem 0.75rem 0.65rem;
  background: var(--bg-alt);
  flex: 0 0 auto;
}
.ask-captcha-title { margin: 0; font-size: 0.92rem; font-weight: 600; color: var(--text); }
.ask-captcha-prompt { margin: 0.35rem 0 0.65rem; font-size: 0.9rem; color: var(--text-main); }
.ask-captcha-grid {
  display: grid;
  grid-template-columns: repeat(3, 3.6rem);
  gap: 0.3rem;
  justify-content: start;
}
.ask-captcha-tile {
  width: 3.6rem;
  height: 3.6rem;
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--body-bg);
  cursor: pointer;
  padding: 0.18rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ask-captcha-tile svg { width: 100%; height: 100%; }
.ask-captcha-tile.is-on {
  border-color: var(--links);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--links) 35%, transparent);
}
.ask-captcha-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.55rem;
  flex: 0 0 auto;
}
.ask-compose-field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--body-bg);
}
.ask-compose-field:focus-within {
  border-color: var(--links);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--links) 35%, transparent);
}
.ask-compose textarea {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  resize: none;
  overflow-y: auto;
  border: 0;
  background: transparent;
  color: var(--text-main);
  border-radius: 0;
  padding: 0.42rem 0.7rem;
  font: inherit;
  line-height: 1.35;
  height: 2.35rem;
  min-height: 2.35rem;
  max-height: 7rem;
  box-sizing: border-box;
}
.ask-compose textarea:focus {
  outline: none;
}
.ask-send {
  flex: 0 0 2.35rem;
  width: 2.35rem;
  min-height: 100%;
  align-self: stretch;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--links);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ask-send svg {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
}
.ask-send:hover { filter: brightness(1.08); }
.ask-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}
.page-login .ask-root { display: none; }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docnav {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .product-nav { gap: 0; }
  .nav-search input { width: 7rem; }
  .logo-heading { display: none; }
  .ask-fab { right: 0.85rem; bottom: calc(var(--footer-h) + 0.75rem); }
  .ask-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: calc(var(--footer-h) + 3.4rem);
  }
}
