:root{--accent-on-light:#4D7EA8;--accent-on-dark:#6F9CC4;--bg-light:#FFFFFF;--bg-dark:#090B10;}
/* Euphoric Software docs. Layout and components modelled on Mintlify's
   "maple" theme. Theme tokens from docs.json are prepended at build time. */

:root {
  --sidebar-width: 288px;
  --toc-width: 232px;
  --content-width: 720px;
  --content-wide: 980px;
  --font: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 14px;
}

:root, [data-theme="light"] {
  --bg: var(--bg-light, #ffffff);
  --surface: #f7f8fa;
  --surface-hover: #f0f2f5;
  --code-bg: #f7f8fa;
  --border: #e5e7ec;
  --border-strong: #d5d9e1;
  --text: #171a21;
  --text-body: #3b4150;
  --muted: #5b6475;
  --subtle: #858d9e;
  --accent: var(--accent-on-light);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --shadow: 0 12px 32px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .06);
  --overlay: rgba(15, 18, 25, .35);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: var(--bg-dark, #090b10);
  --surface: #11141c;
  --surface-hover: #161a24;
  --code-bg: #0d1017;
  --border: #1f2430;
  --border-strong: #2b3140;
  --text: #e9ebf2;
  --text-body: #c3c8d4;
  --muted: #9da5b6;
  --subtle: #788296;
  --accent: var(--accent-on-dark);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --shadow: 0 16px 40px rgba(0, 0, 0, .5);
  --overlay: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 32px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--accent-soft); }
.icon { width: 1em; height: 1em; flex-shrink: 0; display: inline-block; vertical-align: -0.125em; }
.icon-img { object-fit: contain; }
kbd { font: 500 11px/1 var(--font); color: var(--subtle); border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; background: var(--bg); }

.skip-link { position: fixed; top: -100px; left: 16px; z-index: 100; padding: 10px 16px; border-radius: 8px; background: var(--accent); color: #fff; }
.skip-link:focus { top: 16px; }

/* Logo: show the variant for the current theme. */
.logo { display: block; line-height: 0; }
.logo img { height: 26px; width: auto; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); z-index: 40;
  display: flex; flex-direction: column; gap: 14px;
  padding: 22px 16px 0 20px; background: var(--bg); border-right: 1px solid var(--border);
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 4px 6px; }
.theme-toggle { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; }
.theme-toggle button { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 999px; color: var(--subtle); font-size: 11px; }
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button[aria-pressed="true"] { background: var(--surface-hover); color: var(--text); }

.product-switcher { position: relative; }
.product-current { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; font-weight: 600; text-align: left; }
.product-current:hover { background: var(--surface-hover); }
.product-current span { flex: 1; }
.product-current .icon:first-child { color: var(--muted); }
.product-current .icon:last-child { color: var(--subtle); font-size: 11px; transition: transform .15s; }
.product-current[aria-expanded="true"] .icon:last-child { transform: rotate(180deg); }
.product-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 5; padding: 6px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); box-shadow: var(--shadow); }
.product-option { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; }
.product-option:hover { background: var(--surface-hover); }
.product-option-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); color: var(--muted); font-size: 14px; flex-shrink: 0; }
.product-option.active .product-option-icon { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.product-option-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.product-option-name { font-size: 14px; font-weight: 600; }
.product-option-description { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.product-option > .icon { color: var(--accent); font-size: 12px; }

.search-trigger { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--subtle); font-size: 14px; transition: border-color .15s; }
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger span { flex: 1; text-align: left; }

.sidebar-nav { flex: 1; overflow-y: auto; margin: 0 -8px 0 -4px; padding: 4px 8px 24px 4px; scrollbar-width: thin; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.anchors { margin-bottom: 18px !important; }
.anchors a { display: flex; align-items: center; gap: 12px; padding: 5px 4px; font-size: 14px; color: var(--muted); }
.anchors a:hover { color: var(--text); }
.anchor-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; font-size: 12px; border: 1px solid var(--border); }
.anchors a:hover .anchor-icon { border-color: var(--border-strong); }
.nav-group { margin-bottom: 22px; }
.nav-group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 0 4px; font-size: 13.5px; font-weight: 600; color: var(--text); }
/* Admin-only groups, shown only on admin-only pages. */
.nav-lock { margin-left: auto; color: var(--subtle); font-size: 11px; line-height: 0; }
.nav-group ul { border-left: 1px solid var(--border); margin-left: 4px !important; }
.nav-link { display: flex; align-items: center; gap: 8px; margin-left: -1px; padding: 5px 12px 5px 13px; border-left: 1px solid transparent; font-size: 14px; color: var(--muted); line-height: 1.45; }
.nav-link:hover { color: var(--text); border-left-color: var(--border-strong); }
.nav-link.active { color: var(--accent); border-left-color: var(--accent); font-weight: 500; }
.nav-subgroup-title { margin: 8px 0 4px 13px; font-size: 13px; font-weight: 600; color: var(--text); }
.nav-subgroup ul { margin-left: 13px !important; }

.sidebar-bottom { margin: 0 -16px 0 -20px; border-top: 1px solid var(--border); }
.sidebar-cta { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; font-size: 14px; font-weight: 500; color: var(--muted); }
.sidebar-cta:hover { color: var(--accent); }
.sidebar-cta .icon { font-size: 11px; }

/* ---------- Page ---------- */
.page { margin-left: var(--sidebar-width); display: flex; justify-content: center; gap: 56px; padding: 40px 48px 0; min-height: 100vh; }
.content { width: 100%; max-width: var(--content-width); min-width: 0; display: flex; flex-direction: column; }
.wide .content { max-width: var(--content-wide); }
.page-header { margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; font-size: 13.5px; font-weight: 600; color: var(--accent); }
h1 { margin: 0; font-size: 30px; line-height: 1.25; font-weight: 700; letter-spacing: -0.02em; }
.lead { margin: 10px 0 0; font-size: 17px; line-height: 1.6; color: var(--muted); }

.toc { position: sticky; top: 40px; align-self: flex-start; width: var(--toc-width); flex-shrink: 0; max-height: calc(100vh - 80px); overflow-y: auto; font-size: 13.5px; }
.toc-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-weight: 600; color: var(--text); }
.toc-title .icon { color: var(--subtle); }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a { display: block; padding: 4px 0; color: var(--muted); line-height: 1.45; transition: color .12s; }
.toc a:hover { color: var(--text); }
.toc a.active { color: var(--accent); font-weight: 500; }
.toc-depth-3 a { padding-left: 14px; }

/* ---------- Prose ---------- */
.prose { color: var(--text-body); font-size: 15.5px; line-height: 1.75; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 18px; }
.prose a:not(.card):not(.heading-anchor) { color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:not(.card):not(.heading-anchor):hover { text-decoration-thickness: 2px; }
.prose strong { color: var(--text); font-weight: 600; }
.prose h2, .prose h3, .prose h4 { position: relative; color: var(--text); letter-spacing: -0.01em; }
.prose h2 { margin: 42px 0 14px; font-size: 23px; line-height: 1.35; font-weight: 650; }
.prose h3 { margin: 32px 0 10px; font-size: 18px; line-height: 1.4; font-weight: 600; }
.prose h4 { margin: 24px 0 8px; font-size: 16px; font-weight: 600; }
.heading-anchor { position: absolute; left: -28px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: 11px; color: var(--subtle); opacity: 0; border: 1px solid var(--border); background: var(--bg); transition: opacity .12s; }
:is(h2, h3, h4):hover > .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.prose ul, .prose ol { margin: 0 0 18px; padding-left: 22px; }
.prose li { margin: 6px 0; padding-left: 4px; }
.prose li::marker { color: var(--subtle); }
.prose li > p { margin: 0; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
.prose blockquote { margin: 0 0 18px; padding: 2px 0 2px 18px; border-left: 3px solid var(--border-strong); color: var(--muted); }
.prose img { max-width: 100%; height: auto; border-radius: 12px; }
.prose :not(pre) > code { font: 0.875em/1 var(--mono); padding: 3px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text); overflow-wrap: break-word; }
.prose td > code:only-child, .prose td:first-child code { white-space: nowrap; }
.prose kbd { font-size: 12px; }

.table-wrap { overflow-x: auto; margin: 0 0 22px; border: 1px solid var(--border); border-radius: 12px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.6; }
.prose th { text-align: left; font-weight: 600; color: var(--text); background: var(--surface); }
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }

/* Code blocks (Shiki, dual theme). */
.code-block { position: relative; margin: 0 0 22px; }
.prose pre.shiki { margin: 0 0 22px; padding: 16px 18px; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--code-bg) !important; font: 13.5px/1.7 var(--mono); tab-size: 2; }
.code-block pre.shiki { margin: 0; }
.shiki, .shiki span { color: var(--shiki-light); }
[data-theme="dark"] .shiki, [data-theme="dark"] .shiki span { color: var(--shiki-dark); }
.copy-button { position: absolute; top: 9px; right: 9px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--subtle); background: var(--code-bg); border: 1px solid var(--border); opacity: 0; transition: opacity .12s, color .12s; font-size: 13px; }
.code-block:hover .copy-button, .copy-button:focus-visible { opacity: 1; }
.copy-button:hover { color: var(--text); }
.copy-button.copied { color: var(--accent); opacity: 1; }

/* ---------- Components ---------- */
.card-group { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 16px; margin: 0 0 22px; }
.card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); transition: border-color .15s, background .15s; margin: 0 0 16px; }
.card-group > .card { margin: 0; }
.card-link:hover { border-color: var(--accent); }
.card-inner { padding: 20px 22px; }
.card-horizontal .card-inner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.card-icon { display: block; color: var(--accent); font-size: 20px; line-height: 0; margin-bottom: 14px; }
.card-horizontal .card-icon { margin: 0; }
.card-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 0 !important; }
.card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px !important; font-size: 15px; font-weight: 600; color: var(--text); line-height: 1.4; }
.card-external { color: var(--subtle); font-size: 11px; line-height: 0; }
.card-body { font-size: 14.5px; line-height: 1.6; color: var(--muted); }
.card-body > :last-child { margin-bottom: 0; }
.card-cta { display: flex; align-items: center; gap: 6px; margin: 12px 0 0 !important; font-size: 14px; font-weight: 500; color: var(--accent); }

.steps { margin: 6px 0 22px; }
.step { position: relative; display: flex; gap: 18px; padding-bottom: 26px; }
.steps { counter-reset: step; }
.step-marker { counter-increment: step; position: relative; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 999px; background: var(--surface-hover); color: var(--text); font-size: 13px; font-weight: 600; }
.step-marker:empty::before { content: counter(step); }
.step::before { content: ""; position: absolute; left: 13.5px; top: 34px; bottom: 6px; width: 1px; background: var(--border); }
.step:last-child { padding-bottom: 4px; }
.step:last-child::before { display: none; }
.step-content { flex: 1; min-width: 0; padding-top: 2px; }
.step-title { margin: 0 0 6px !important; font-weight: 600; color: var(--text); }
.step-body > :last-child { margin-bottom: 0; }

.callout { display: flex; gap: 12px; margin: 0 0 22px; padding: 14px 18px; border-radius: var(--radius); border: 1px solid var(--callout-border); background: var(--callout-bg); font-size: 14.5px; line-height: 1.65; }
.callout-icon { line-height: 0; padding-top: 5px; color: var(--callout-fg); font-size: 15px; }
.callout-body { flex: 1; min-width: 0; color: var(--text-body); }
.callout-body > :last-child { margin-bottom: 0; }
.callout-body p { margin-bottom: 10px; }
.callout-title { font-weight: 600; color: var(--text); }
.callout-note { --callout-fg: #3b82f6; }
.callout-info { --callout-fg: var(--muted); }
.callout-tip { --callout-fg: #10b981; }
.callout-check { --callout-fg: #16a34a; }
.callout-warning { --callout-fg: #d97706; }
.callout-danger { --callout-fg: #ef4444; }
.callout { --callout-bg: color-mix(in srgb, var(--callout-fg) 7%, var(--bg)); --callout-border: color-mix(in srgb, var(--callout-fg) 25%, var(--border)); }
[data-theme="dark"] .callout { --callout-bg: color-mix(in srgb, var(--callout-fg) 9%, var(--bg)); --callout-border: color-mix(in srgb, var(--callout-fg) 28%, var(--bg)); }
[data-theme="dark"] .callout-note { --callout-fg: #60a5fa; }
[data-theme="dark"] .callout-warning { --callout-fg: #fbbf24; }

.accordion-group { margin: 0 0 22px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.accordion { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 12px; }
.accordion-group .accordion { border: 0; border-radius: 0; margin: 0; border-bottom: 1px solid var(--border); }
.accordion-group .accordion:last-child { border-bottom: 0; }
.accordion summary { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 500; color: var(--text); }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary:hover { background: var(--surface); }
.accordion-chevron { color: var(--subtle); font-size: 11px; line-height: 0; transition: transform .15s; }
.accordion[open] .accordion-chevron { transform: rotate(90deg); }
.accordion-title { display: flex; flex-direction: column; }
.accordion-description { font-size: 13.5px; font-weight: 400; color: var(--muted); }
.accordion-body { padding: 2px 18px 6px 42px; font-size: 15px; }

.tabs { margin: 0 0 22px; }
.tab-list { display: flex; gap: 22px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 8px 0 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; font-size: 14.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.frame { margin: 0 0 22px; }
.frame-inner { padding: 8px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); line-height: 0; }
.frame-inner img { border-radius: 12px; }
.frame figcaption { margin-top: 8px; text-align: center; font-size: 13.5px; color: var(--muted); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--accent-soft); color: var(--accent); }

/* ---------- Pager and footer ---------- */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 40px; }
.pager a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s; }
.pager a:hover { border-color: var(--accent); }
.pager-next { text-align: right; align-items: flex-end; }
.pager-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--subtle); }
.pager-label .icon { font-size: 10px; }
.pager-title { font-weight: 600; color: var(--text); }
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: auto; padding: 40px 0 32px; font-size: 13px; color: var(--subtle); }
.pager + .page-footer { margin-top: 48px; border-top: 1px solid var(--border); padding-top: 24px; }
.page-footer p { margin: 0; }
.socials { display: flex; gap: 14px; font-size: 16px; }
.socials a:hover { color: var(--text); }

/* ---------- Search ---------- */
.search-dialog { width: min(640px, calc(100% - 32px)); max-height: min(560px, calc(100vh - 120px)); margin: 12vh auto 0; padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); color: var(--text); box-shadow: var(--shadow); overflow: hidden; }
.search-dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.search-box { display: flex; flex-direction: column; max-height: inherit; }
.search-input-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); color: var(--subtle); }
.search-input-row input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: 16px var(--font); }
.search-input-row input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.search-results:empty { display: none; }
.search-result a { display: block; padding: 10px 12px; border-radius: 10px; }
.search-result[aria-selected="true"] a { background: var(--surface-hover); }
.search-result-path { display: block; font-size: 12px; color: var(--subtle); }
.search-result-title { display: block; font-weight: 600; font-size: 14.5px; }
.search-result[aria-selected="true"] .search-result-title { color: var(--accent); }
.search-result-snippet { display: block; margin-top: 2px; font-size: 13.5px; color: var(--muted); line-height: 1.5; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.search-result mark { background: none; color: var(--text); font-weight: 600; }
.search-empty { padding: 28px 12px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Mobile ---------- */
.mobile-bar, .nav-overlay { display: none; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; color: var(--muted); font-size: 16px; }
.icon-button:hover { color: var(--text); background: var(--surface); }

@media (max-width: 1279px) {
  .toc { display: none; }
}

@media (max-width: 1023px) {
  .mobile-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; padding: 0 8px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
  .mobile-bar .logo img { height: 22px; }
  .sidebar { width: min(320px, 86vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  .nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .nav-open .nav-overlay { display: block; position: fixed; inset: 0; z-index: 35; background: var(--overlay); }
  .nav-open { overflow: hidden; }
  .page { margin-left: 0; padding: 28px 16px 0; }
  .heading-anchor { display: none; }
  html { scroll-padding-top: 72px; }
}

@media (hover: none) {
  .search-trigger kbd, .search-input-row kbd { display: none; }
}

@media (max-width: 639px) {
  .card-group { grid-template-columns: minmax(0, 1fr); }
  h1 { font-size: 26px; }
  .lead { font-size: 16px; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .page-footer { flex-direction: column-reverse; align-items: flex-start; }
  .accordion-body { padding-left: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
