/* Custom styles for the Scalar API reference page (api/views/open-api/scalar.php). */

/* Assinafy design system (DESIGN.md): Mona Sans, blue primary, green success,
   light by default. The light tokens also sit on :root so the header renders
   before Scalar's bundle sets the mode class; body.*-mode beats Scalar's injected
   .light-mode/.dark-mode theme regardless of load order. */

/* Font files are immutable: ship a new filename to change one. scalar.php preloads the 400 face. */
@font-face { font-family: 'Mona Sans'; font-weight: 400; font-display: swap; src: url(fonts/MonaSans-Regular.woff2) format('woff2'); }
@font-face { font-family: 'Mona Sans'; font-weight: 600; font-display: swap; src: url(fonts/MonaSans-SemiBold.woff2) format('woff2'); }
@font-face { font-family: 'Mona Sans'; font-weight: 700; font-display: swap; src: url(fonts/MonaSans-Bold.woff2) format('woff2'); }

:root {
    --scalar-custom-header-height: 65px;
    --scalar-font: 'Mona Sans', ui-sans-serif, system-ui, sans-serif;
    --scalar-font-code: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --scalar-radius: 8px;
    --scalar-radius-lg: 12px;
    --scalar-radius-xl: 16px;
    --scalar-semibold: 600;
    --scalar-bold: 700;
    --scalar-sidebar-width: 256px;
}

@media (min-width: 721px) {
    :root {
        --scalar-heading-1: 36px; /* narrower screens keep Scalar's 24px */
    }
}

@media (min-width: 992px) {
    :root {
        --scalar-custom-header-height: 81px;
    }
}

:root,
body.light-mode {
    --scalar-color-1: #001122;
    --scalar-color-2: #384756;
    --scalar-color-3: #606c78; /* not in DESIGN.md: --muted-foreground lightened, 5:1 on --muted */
    --scalar-color-accent: #1452ff;
    --scalar-color-blue: #1452ff;
    --scalar-color-red: #b41a0d;
    /* Not in DESIGN.md: method/status hues darkened to at least 4.5:1 on white and on --accent. */
    --scalar-color-green: #087a4f;
    --scalar-color-orange: #a14a08;
    --scalar-color-yellow: #8a6100;
    --scalar-background-1: #fff;
    --scalar-background-2: #f5f7fb;
    --scalar-background-3: #ebf1ff;
    --scalar-background-accent: #ebf1ff;
    --scalar-border-color: #d5dfe8;
}

/* DESIGN.md has no dark palette: neutral grays, brand blue lightened to 6:1 on #0a0a0a.
   Scalar renders request cards as nested .dark-mode scopes in both modes. */
body.dark-mode,
body .dark-mode {
    --scalar-color-1: #ededed;
    --scalar-color-2: #a1a1a1;
    --scalar-color-3: #8f8f8f;
    --scalar-color-accent: #5b8cff;
    --scalar-color-blue: #5b8cff;
    --scalar-color-green: #1bd185;
    --scalar-color-red: #ff6166;
    --scalar-background-1: #0a0a0a;
    --scalar-background-2: #1a1a1a;
    --scalar-background-3: #292929;
    --scalar-background-accent: #1452ff26;
    --scalar-border-color: #ffffff24;
}

body.light-mode,
body.dark-mode,
body .dark-mode {
    --scalar-button-1: #1452ff;
    --scalar-button-1-color: #fff;
    --scalar-button-1-hover: #246bff;
    --scalar-sidebar-color-active: var(--scalar-color-accent);
    --scalar-sidebar-item-active-background: var(--scalar-background-accent);
    --scalar-sidebar-search-background: var(--scalar-background-2);
}

body {
    background: var(--scalar-background-1);
}

/* Scalar's full-width layout: a 1320px container left its two-column sections too
   narrow. The 20px gutter puts the logo over the sidebar's text. */
.docs-header {
    padding-inline: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
    height: var(--scalar-custom-header-height);
    border-bottom: 1px solid var(--scalar-border-color);
    background: var(--scalar-background-1);
}

.docs-header-logo {
    display: flex;
    align-items: center;
    min-height: 44px;
}

.docs-header-badge {
    padding: 2px 8px;
    border: 1px solid var(--scalar-border-color);
    border-radius: 999px;
    color: var(--scalar-color-2);
    font: 600 13px var(--scalar-font);
}

.docs-header .logo-dark,
body.dark-mode .docs-header .logo-light {
    display: none;
}

body.dark-mode .docs-header .logo-dark {
    display: block;
}

a[href*="/docs/markdown?"],
a[href*="/docs/internal/markdown?"],
a[href*="/docs/admin/markdown?"],
a[href^="https://chatgpt.com/?q="],
a[href^="https://claude.ai/new?q="] {
    display: inline-block;
    padding: 5px 10px;
    margin: 2px 4px 2px 0;
    border: 1px solid var(--scalar-border-color);
    border-radius: 6px;
    background: var(--scalar-background-2);
    color: var(--scalar-color-1) !important;
    font-size: 12px;
    line-height: 1;
    text-decoration: none !important;
}

.ai-actions {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
}

.ai-actions button {
    font: inherit;
    font-size: 12px;
    line-height: 1;
    padding: 6px 10px;
    border: 1px solid var(--scalar-border-color);
    background: var(--scalar-background-2);
    color: var(--scalar-color-1);
    cursor: pointer;
}

.ai-actions button:hover {
    background: var(--scalar-background-3);
}

.ai-actions .ai-actions-copy {
    border-radius: 6px 0 0 6px;
}

.ai-actions .ai-actions-toggle {
    border-radius: 0 6px 6px 0;
    border-left: 0;
    padding: 6px 7px;
}

.ai-actions-menu {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    min-width: 185px;
    padding: 4px;
    border: 1px solid var(--scalar-border-color);
    border-radius: 8px;
    background: var(--scalar-background-1);
    box-shadow: var(--scalar-shadow-2, 0 4px 16px rgba(0, 0, 0, .12));
    z-index: 100;
}

.ai-actions-menu.open {
    display: block;
}

.ai-actions-menu a {
    display: block;
    padding: 6px 10px;
    margin: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    font-size: 13px;
    color: var(--scalar-color-1) !important;
    text-decoration: none !important;
    white-space: nowrap;
}

.ai-actions-menu a:hover {
    background: var(--scalar-background-2);
}

/* A guide tag (no operations) leaves Scalar's right column empty: its text takes the whole row. */
.section-columns > .section-column:empty {
    display: none;
}

/* Scalar lets inline code break anywhere, so a table squeezed its code column into
   "DigitalCer tificate": keep a code value whole and let the text columns wrap.
   Phones keep the breaks, or a wide table would scroll the page sideways. */
@media (min-width: 721px) {
    .markdown td code {
        word-break: normal;
    }
}
