/*
 * Salesforce Docs MCP - Stylesheet (DSC / Salesforce Developers)
 * Semantic variables mapped to the DX design tokens defined in
 * css/dsc-tokens/ (the developer.salesforce.com design system).
 */

:root {
    /* Surfaces / text — mapped to DX (--dx-g-) tokens */
    --color-surface-1: var(--dx-g-background-color);         /* white */
    --color-surface-2: var(--dx-g-gray-95);                  /* #f3f3f3 */
    --color-on-surface-1: var(--dx-g-gray-40);               /* #5c5c5c secondary */
    --color-on-surface-2: var(--dx-g-text-body-color);       /* gray-10 body */
    --color-on-surface-3: var(--dx-g-text-heading-color);    /* blue-20 navy heading */
    --color-border-1: var(--dx-g-gray-80);                   /* #c9c9c9 */
    --color-brand-40: var(--dx-g-blue-vibrant-40);
    --color-brand-50: var(--dx-g-blue-vibrant-50);           /* prose link / primary */
    --color-brand-30: var(--dx-g-blue-vibrant-30);
    --color-brand-20: var(--dx-g-blue-vibrant-20);
    --color-brand-95: var(--dx-g-blue-vibrant-95);

    /* Spacing — DX px spacing scale */
    --spacing-1: var(--dx-g-spacing-xs);   /* 4px  */
    --spacing-2: var(--dx-g-spacing-sm);   /* 8px  */
    --spacing-3: var(--dx-g-spacing-smd);  /* 12px */
    --spacing-4: var(--dx-g-spacing-md);   /* 16px */
    --spacing-5: var(--dx-g-spacing-lg);   /* 24px */
    --spacing-6: var(--dx-g-spacing-xl);   /* 32px */
    --spacing-7: var(--dx-g-spacing-2xl);  /* 40px */
    --spacing-8: var(--dx-g-spacing-3xl);  /* 48px */

    /* Radius (DX has no radius token — keep literal values) */
    --radius-1: 0.25rem;
    --radius-2: 0.5rem;

    /* Typography — DX font families */
    --font-family-base: var(--dx-g-font-sans);        /* Salesforce Sans */
    --font-family-display: var(--dx-g-font-display);  /* ITC Avant Garde */
    --font-family-mono: var(--dx-g-font-mono);
    --font-size-base: var(--dx-g-text-base);          /* 16px */
    --font-weight-regular: var(--dx-g-font-normal);
    --font-weight-semibold: var(--dx-g-font-demi);
    --font-weight-bold: var(--dx-g-font-bold);
    --line-height-base: 1.5;

    /* Layout */
    --max-width: 880px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: var(--font-family-base);
    font-size: 100%;
    line-height: var(--line-height-base);
    background: var(--color-surface-2);
    color: var(--color-on-surface-2);
    -webkit-tap-highlight-color: transparent;
}

body {
    font-size: var(--font-size-base);
    background: var(--color-surface-1);
    margin: 0;
}

/* Header */
site-nav {                 /* custom element defaults to inline; make it block */
    display: block;
    min-height: 56px;      /* reserve the header's height so the page doesn't
                              jump before the <site-nav> element renders */
}

@media (min-width: 1400px) {
    site-nav { min-height: 72px; }   /* matches the taller desktop header */
}

header {
    border-bottom: 1px solid var(--color-border-1);
    background: var(--color-surface-1);
}

.top-nav {
    max-width: calc(var(--max-width) + 220px);
    margin: 0 auto;
    padding: var(--spacing-4) var(--spacing-5);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.top-nav .logo {
    font-weight: var(--font-weight-bold);
    font-size: 1.125rem;
    color: var(--color-on-surface-3);
    text-decoration: none;
}

.top-nav .logo:hover {
    text-decoration: none;
}

.top-nav-links a {
    color: var(--color-on-surface-1);
    text-decoration: none;
    margin-left: var(--spacing-5);
    font-size: var(--font-size-base);
    transition: color 0.1s linear;
}

.top-nav-links a:hover,
.top-nav-links a:focus-visible {
    color: var(--color-brand-40);
    text-decoration: underline;
}

.top-nav-links a.active {
    color: var(--color-brand-50);
    font-weight: var(--font-weight-semibold);
}

/* --- dx-global-header (contextnav): white bar, cloud logo + dx-tabs --- */
header {
    background: #fff;
    border-bottom: 1px solid var(--dx-g-gray-90);
    position: sticky;
    top: 0;
    z-index: 500;
}

.top-nav {
    max-width: none;   /* don't center the nav; span full width */
    margin: 0;
    padding: 0 24px;   /* L/R side padding, 0–1399px */
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--dx-g-spacing-lg);
    min-height: 56px;   /* header height, 0–1399px */
}

@media (min-width: 1400px) {
    .top-nav {
        padding: 0 40px;    /* L/R side padding, 1400px and up */
        min-height: 72px;   /* header height, 1400px and up */
    }
}

/* dx-logo: 28px cloud + brand label (blue-vibrant-20, display font) */
.top-nav .logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    font-family: var(--dx-g-font-display);
    font-weight: 700;
    font-size: 16px;         /* site name, 0–1399px */
    line-height: 24px;
    letter-spacing: normal;
    color: var(--dx-g-blue-vibrant-20);
}

@media (min-width: 1400px) {
    .top-nav .logo {
        font-size: 24px;    /* site name, 1400px and up */
        line-height: 32px;
    }
}

.top-nav .logo img {
    width: 45px;                           /* proportional cloud */
    height: auto;
    margin-right: var(--dx-g-spacing-md);  /* 16px between cloud and name */
}

.top-nav .logo:hover {
    color: var(--dx-g-blue-vibrant-40);
}

/* C360 context-nav items (contextnav__ cl1-button): bold navy, hover/current blue */
.top-nav-links {
    display: flex;
    align-items: center;
    gap: 0;   /* per-item 0 16px padding controls spacing (--sds-g-spacing-4) */
}

.top-nav-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 var(--dx-g-spacing-md);     /* 0 16px */
    font-family: var(--dx-g-font-sans);
    font-size: var(--dx-g-text-base);      /* 16px */
    font-weight: var(--dx-g-font-bold);    /* 700 */
    line-height: 24px;
    color: var(--dx-g-blue-vibrant-20);    /* #032d60 navy */
    text-decoration: none;
    background: transparent;
}

.top-nav-links a:hover,
.top-nav-links a:focus-visible {
    background: transparent;
    color: var(--dx-g-blue-vibrant-50);    /* #0176d3 blue */
    text-decoration: none;
}

.top-nav-links a.active {
    color: var(--dx-g-blue-vibrant-50);    /* current page uses C360 active blue */
    font-weight: var(--dx-g-font-bold);    /* keep all items 700 */
}

.top-nav-links a.active:hover,
.top-nav-links a.active:focus-visible {
    background: transparent;
    color: var(--dx-g-blue-vibrant-50);
}

@media (min-width: 1400px) {
    .top-nav-links a {
        line-height: 28px;   /* desktop context nav */
    }
}

/* --- Mobile menu drawer (0-799px), C360 context-nav reference ------- */
.nav-menu-toggle {
    display: none;                          /* hidden at >=800px */
    align-self: center;                     /* center vertically in header */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--dx-g-blue-vibrant-20);     /* navy, C360 hamburger-blue */
    cursor: pointer;
}

.nav-menu-toggle:hover,
.nav-menu-toggle:focus-visible {
    color: var(--dx-g-blue-vibrant-50);     /* blue */
}

.nav-menu-toggle .icon-close { display: none; }
.nav-menu-toggle[aria-expanded="true"] .icon-hamburger { display: none; }
.nav-menu-toggle[aria-expanded="true"] .icon-close { display: inline-block; }

.nav-overlay { display: none; }

/* suppress the drawer animation while the viewport is being resized,
   so crossing the 799px breakpoint doesn't flash the panel open */
.top-nav-links.no-anim { transition: none; }

@media (max-width: 799px) {
    .nav-menu-toggle { display: inline-flex; }

    /* only the trigger + logo are in flow here (nav is a fixed drawer),
       so this 16px gap sits between the trigger and the logo only */
    .top-nav { gap: var(--dx-g-spacing-md); }   /* 16px */

    /* the nav becomes a drop-down drawer panel below the header */
    .top-nav-links {
        position: fixed;
        top: 56px;                          /* below the 56px header */
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: #fff;
        padding: var(--dx-g-spacing-sm) 0;  /* 8px */
        border-top: 1px solid var(--dx-g-gray-90);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
        z-index: 499;
    }

    .top-nav-links.open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .top-nav-links a {
        justify-content: flex-start;
        padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-lg);   /* 12px 24px tap target */
        line-height: 24px;
    }

    .nav-overlay.open {
        display: block;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.2);
        z-index: 498;
    }
}

/* Main content */
main.page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--spacing-6) var(--spacing-5) var(--spacing-8);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    padding: 0;
    color: var(--color-on-surface-3);
}

h1 {
    font-family: var(--font-family-display);
    font-size: 2.5rem;
    font-weight: var(--font-weight-demi, 600);
    line-height: 1.2;
    letter-spacing: -0.32px;
    margin-top: var(--spacing-2);
    margin-bottom: var(--spacing-3);
}

h2 {
    font-size: 1.25rem;
    font-weight: var(--font-weight-bold);
    line-height: 1.25;
    margin-top: var(--spacing-7);
    margin-bottom: var(--spacing-3);
    padding-bottom: var(--spacing-2);
    border-bottom: 1px solid var(--color-border-1);
}

h3 {
    font-size: 1rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-on-surface-2);
    letter-spacing: 0.02em;
    margin-top: var(--spacing-5);
    margin-bottom: var(--spacing-2);
}

p {
    margin: 0 0 var(--spacing-4);
}

/* Links */
a {
    color: var(--color-brand-40);
    text-decoration: none;
    transition: color 0.1s linear;
}

a:hover,
a:focus-visible {
    text-decoration: underline;
    color: var(--color-brand-30);
}

a:active {
    color: var(--color-brand-20);
}

/* Lists */
ul, ol {
    margin: 0 0 var(--spacing-4);
    padding-left: var(--spacing-5);
}

li {
    margin-bottom: var(--spacing-2);
}

/* Code */
code {
    font-family: var(--font-family-mono);
    font-size: 0.85em;
    background: var(--color-surface-2);
    padding: 1px 5px;
    border-radius: var(--radius-1);
}

pre {
    background: var(--color-surface-2);
    border: 1px solid var(--color-border-1);
    border-radius: var(--radius-2);
    padding: var(--spacing-4);
    overflow-x: auto;
    margin: 0 0 var(--spacing-4);
}

pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 var(--spacing-4);
    font-size: var(--font-size-base);
}

th, td {
    text-align: left;
    padding: var(--spacing-3) var(--spacing-3);
    border-bottom: 1px solid var(--color-border-1);
    vertical-align: top;
}

th {
    background: var(--color-surface-2);
    font-weight: var(--font-weight-semibold);
    color: var(--color-on-surface-3);
}

/* Hero */
.hero {
    margin-top: var(--spacing-4);
    margin-bottom: var(--spacing-5);
}

.lede {
    font-size: 1.125rem;
    color: var(--color-on-surface-1);
    line-height: 1.5;
}

/* Page toolbar */
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-2);
    margin-bottom: var(--spacing-5);
}

.page-toolbar button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    background: none;
    border: 1px solid var(--color-border-1);
    border-radius: 2rem;
    padding: var(--spacing-2) var(--spacing-4);
    font-family: var(--font-family-base);
    font-size: 0.875rem;
    color: var(--color-on-surface-1);
    cursor: pointer;
    transition: color 0.1s linear, border-color 0.1s linear, background 0.1s linear;
}

.page-toolbar button:hover,
.page-toolbar .toolbar-link:hover {
    color: var(--color-on-surface-2);
    border-color: var(--color-on-surface-2);
    background: var(--color-surface-2);
    text-decoration: none;
}

.page-toolbar .toolbar-link {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-2);
    background: none;
    border: 1px solid var(--color-border-1);
    border-radius: 2rem;
    padding: var(--spacing-2) var(--spacing-4);
    font-family: var(--font-family-base);
    font-size: 0.875rem;
    color: var(--color-on-surface-1);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.1s linear, border-color 0.1s linear, background 0.1s linear;
}


/* Sections */
section {
    margin-bottom: var(--spacing-2);
}

/* Strong */
strong, b {
    font-weight: var(--font-weight-bold);
}

/* Tabs */
.tabs {
    margin: var(--spacing-4) 0 var(--spacing-5);
    border: 1px solid var(--color-border-1);
    border-radius: var(--radius-2);
    overflow: hidden;
}

.tab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background: var(--color-surface-2);
    border-bottom: 1px solid var(--color-border-1);
    padding: var(--spacing-2) var(--spacing-2) 0;
}

.tab-button {
    background: none;
    border: 1px solid transparent;
    border-bottom: none;
    padding: var(--spacing-2) var(--spacing-4);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--color-on-surface-1);
    cursor: pointer;
    border-radius: var(--radius-1) var(--radius-1) 0 0;
    margin-bottom: -1px;
    transition: background 0.1s linear, color 0.1s linear;
}

.tab-button:hover {
    color: var(--color-brand-40);
    background: var(--color-surface-1);
    border-bottom-color: var(--dx-g-blue-vibrant-40);
}

.tab-button.active {
    color: var(--color-brand-50);
    background: var(--color-surface-1);
    border-color: var(--color-border-1);
    border-bottom-color: var(--color-surface-1);
}

.tab-content {
    display: none;
    padding: var(--spacing-4) var(--spacing-5);
    background: var(--color-surface-1);
}

.tab-content.active {
    display: block;
}

/* Code block with copy button */
.code-block {
    position: relative;
    margin-bottom: var(--spacing-3);
}

.code-block pre {
    margin: 0;
}

.copy-button {
    position: absolute;
    top: var(--spacing-2);
    right: var(--spacing-2);
    background: var(--color-surface-1);
    border: 1px solid var(--color-border-1);
    border-radius: var(--radius-1);
    padding: var(--spacing-1);
    color: var(--color-on-surface-1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s linear, color 0.1s linear;
}

.copy-button:hover {
    background: var(--color-surface-2);
    color: var(--color-on-surface-2);
}


/* Right nav (table of contents) */
.page-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    max-width: calc(var(--max-width) + 220px);
    margin: 0 auto;
    padding: 0 var(--spacing-5);
}

@media (min-width: 1100px) {
    .page-wrapper {
        grid-template-columns: 1fr 200px;
        gap: var(--spacing-6);
    }
}

.page-wrapper main.page {
    max-width: var(--max-width);
    /* Size the content column from its grid track, NOT from its widest child.
       Without this, a non-wrapping code line / long URL / tab row sets the
       column's min-content width and the whole page overflows on narrow
       screens (min-width:0 alone can't break that circular sizing because the
       code block's overflow:auto doesn't scroll until its width is pinned).
       `contain: inline-size` makes the inline size independent of contents;
       `width: 100%` then pins it to the track so wide children scroll/wrap. */
    min-width: 0;
    contain: inline-size;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.right-nav {
    display: none;
}

@media (min-width: 1100px) {
    .right-nav {
        display: block;
        position: sticky;
        top: 48px;                 /* match heading anchor offset when pinned */
        align-self: start;
        margin-top: 78px;          /* align "Contents" baseline with the H1 baseline */
        padding-top: 0;
        max-height: calc(100vh - 72px);
        overflow-y: auto;
    }
}

@media (min-width: 1400px) {
    .right-nav {
        top: 64px;                 /* match heading anchor offset when pinned */
        max-height: calc(100vh - 88px);
    }
}

.right-nav-title {
    font-size: 0.6875rem;
    font-weight: var(--font-weight-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-on-surface-1);
    margin-bottom: var(--spacing-3);
}

.right-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.right-nav li {
    margin-bottom: var(--spacing-2);
}

.right-nav a {
    font-size: 0.8125rem;
    color: var(--color-on-surface-1);
    text-decoration: none;
    line-height: 1.4;
    display: block;
    padding: 2px 0;
    border-left: 2px solid transparent;
    padding-left: var(--spacing-3);
    transition: color 0.1s linear, border-color 0.1s linear;
}

.right-nav a:hover {
    color: var(--color-brand-40);
    text-decoration: none;
}

.right-nav a.active {
    color: var(--color-brand-50);
    border-left-color: var(--color-brand-50);
    font-weight: var(--font-weight-semibold);
}

/* Markdown overlay */
.markdown-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    padding: var(--spacing-5);
}

.markdown-overlay.active {
    display: flex;
}

.markdown-overlay-panel {
    background: var(--color-surface-1);
    border: 1px solid var(--color-border-1);
    border-radius: var(--radius-2);
    width: 100%;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.markdown-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-3) var(--spacing-4);
    border-bottom: 1px solid var(--color-border-1);
}

.markdown-overlay-header span {
    font-weight: var(--font-weight-semibold);
    font-size: 0.875rem;
    color: var(--color-on-surface-3);
}

.markdown-overlay-header button {
    background: none;
    border: none;
    color: var(--color-on-surface-1);
    cursor: pointer;
    padding: var(--spacing-1);
    display: flex;
    align-items: center;
}

.markdown-overlay-header button:hover {
    color: var(--color-on-surface-2);
}

.markdown-overlay-body {
    overflow-y: auto;
    padding: var(--spacing-4);
}

.markdown-overlay-body pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.8125rem;
    line-height: 1.6;
    background: none;
    border: none;
    padding: 0;
}

/* Footer */
footer {
    border-top: 1px solid var(--color-border-1);
    color: var(--color-on-surface-1);
    font-size: 0.8125rem;
    text-align: center;
    padding: var(--spacing-5) var(--spacing-5);
}

/* =====================================================================
   DSC COMPONENT LAYER
   Replicates the visual styling of the real DSC (dx-*) components so the
   page's existing markup matches Salesforce Developers components.
   Rules come last so they override the base rules above.
   ===================================================================== */

/* --- Headings: DSC display type specs -------------------------------- */
main.page h1,
main.page h2,
main.page h3,
main.page h4 {
    font-family: var(--font-family-display);   /* ITC Avant Garde */
    font-weight: var(--dx-g-font-demi, 600);
    color: var(--dx-g-text-heading-color);     /* blue-vibrant-20 */
}

/* Heading 1 — display-4 (top margin handled by page padding for 56px gap) */
main.page h1 {
    font-size: var(--dx-g-text-3xl);       /* 40px */
    line-height: 48px;
    letter-spacing: -0.8px;
    margin-top: 0;
    margin-bottom: var(--dx-g-spacing-md); /* 16px */
}

/* Offset anchor jumps so headings clear the sticky header */
main.page h2,
main.page h3,
main.page h4,
main.page [id] {
    scroll-margin-top: 48px;   /* clears the sticky header on anchor jumps */
}

@media (min-width: 1400px) {
    main.page h2,
    main.page h3,
    main.page h4,
    main.page [id] {
        scroll-margin-top: 64px;
    }
}

/* Heading 2 — display-5 (no underline) */
main.page h2 {
    font-size: var(--dx-g-text-2xl);       /* 32px */
    line-height: 40px;
    letter-spacing: -0.4px;
    margin-top: var(--dx-g-spacing-2xl);   /* 40px */
    margin-bottom: var(--dx-g-spacing-md); /* 16px */
    padding-bottom: 0;
    border-bottom: none;
}

/* --- Reference page only: dx-hr divider above each H2 -------------- */
main.page.reference-page h2 {
    border-top: 2px solid var(--dx-g-gray-90);
    padding-top: var(--dx-g-spacing-2xl);  /* 40px gap between line and heading */
}

/* Heading 3 — display-6 */
main.page h3 {
    font-size: var(--dx-g-text-xl);        /* 24px */
    line-height: 32px;
    letter-spacing: -0.4px;
    margin-top: var(--dx-g-spacing-xl);    /* 32px */
    margin-bottom: var(--dx-g-spacing-md); /* 16px */
}

/* Heading 4 — display-8 */
main.page h4 {
    font-size: var(--dx-g-text-base);      /* 16px */
    line-height: 24px;
    letter-spacing: -0.5px;
    margin-top: var(--dx-g-spacing-lg);    /* 24px */
    margin-bottom: var(--dx-g-spacing-sm); /* 8px */
}

/* --- Prose links: dx prose-link (blue-vibrant-50, hover blue-40) ----- */
main.page p a,
main.page li a,
main.page td a {
    color: var(--dx-g-blue-vibrant-50);
    text-decoration: none;
}

main.page p a:hover,
main.page li a:hover,
main.page td a:hover {
    color: var(--dx-g-blue-vibrant-40);
    text-decoration: none;
}

/* --- dx-button label type (dx-text-button-*): display font, 14px ----- */
#btn-copy-llm,
.page-toolbar .toolbar-link {
    font-family: var(--dx-g-font-display);   /* ITC Avant Garde */
    font-size: var(--dx-g-text-sm);          /* 14px */
    font-weight: var(--dx-g-font-normal);
    line-height: 20px;
    letter-spacing: 0;
}

/* --- dx-button: secondary (both toolbar buttons) -------------------- */
#btn-copy-llm,
.page-toolbar .toolbar-link {
    background: transparent;
    border: 2px solid var(--dx-g-button-secondary-color);  /* blue-vibrant-50 */
    border-radius: var(--dx-g-spacing-xs);                 /* 4px */
    color: var(--dx-g-button-secondary-color);             /* dx-text-button-brand */
    padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-md);/* 8px 16px */
}

#btn-copy-llm:hover,
.page-toolbar .toolbar-link:hover {
    background: transparent;
    border-color: var(--dx-g-blue-vibrant-40);
    color: var(--dx-g-blue-vibrant-40);
}

/* icon sits to the right of the label */
.page-toolbar #btn-view-md svg,
.page-toolbar #btn-copy-llm svg {
    order: 2;
}

/* --- dx-code-block: toolbar + content ------------------------------- */
.cb-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    background: var(--dx-g-gray-90);
    border-radius: 0.3em 0.3em 0 0;
    padding-right: var(--dx-g-spacing-xs);
}

.cb-header {
    display: flex;
    align-items: center;
    margin-left: var(--dx-g-spacing-md);
    color: var(--dx-g-blue-vibrant-20);
    font-family: var(--dx-g-font-display);
    font-size: var(--dx-g-text-sm);
    font-weight: var(--dx-g-font-demi);
    line-height: var(--dx-g-text-lg);
}

.cb-header-icon {
    margin-right: var(--dx-g-spacing-sm);
    background: #fff;
    border-radius: 50%;
    height: 24px;
    width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--dx-g-blue-vibrant-50);
}

/* copy button sits in the toolbar (dx-button tertiary icon) */
.code-block .copy-button {
    position: static;
    top: auto;
    right: auto;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--dx-g-spacing-xs);
    color: var(--dx-g-blue-vibrant-20);
}

.code-block .copy-button:hover {
    background: var(--dx-g-cloud-blue-vibrant-95);
    color: var(--dx-g-blue-vibrant-40);
}

.code-block-content {
    border-radius: 0 0 0.3em 0.3em;
    overflow-x: auto;
}

.code-block .code-block-content pre {
    background: var(--dx-g-gray-95);
    border: none;
    border-radius: 0 0 0.3em 0.3em;
    margin: 0;
}

/* --- dx-tab-panel: underline tabs ----------------------------------- */
.tabs {
    border: none;
    border-radius: 0;
    overflow: visible;
}

.tab-buttons {
    background: none;
    padding: 0;
    border-bottom: 1px solid var(--dx-g-gray-80);
    gap: var(--dx-g-spacing-md);
    flex-wrap: nowrap;   /* single row; overflow folds into the "More" menu (dx-tab-panel-list) */
}

.tab-button {
    background: none;
    background-clip: padding-box;   /* keep hover fill off the 4px bottom border / underline */
    border: none;
    border-bottom: var(--dx-g-spacing-xs) solid transparent;  /* 4px */
    border-radius: var(--dx-g-spacing-sm) var(--dx-g-spacing-sm) 0 0;
    margin-bottom: -1px;
    padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-lg);   /* 8px 24px */
    font-family: var(--dx-g-font-sans);
    font-size: var(--dx-g-text-base);                          /* 16px */
    font-weight: var(--dx-g-font-normal);
    color: var(--dx-g-blue-vibrant-20);
    flex-shrink: 0;        /* keep natural width so the row truly overflows */
    white-space: nowrap;   /* never wrap a label; overflow folds into "More" */
}

.tab-button:hover {
    background: var(--dx-g-blue-vibrant-95);
    color: var(--dx-g-blue-vibrant-20);
}

.tab-button.active {
    background: none;
    border: none;
    border-bottom: var(--dx-g-spacing-xs) solid var(--dx-g-blue-vibrant-50);
    color: var(--dx-g-blue-vibrant-50);
    font-weight: var(--dx-g-font-bold);
}

.tab-content {
    background: none;
    padding: var(--dx-g-spacing-lg) 0 0;
}

/* --- dx-tab-panel-list overflow: fold extra tabs into a "More" menu -- */
/* tabs that don't fit are hidden (JS measures on load + resize) */
.tab-button.is-hidden {
    display: none;
}

/* the "More" trigger sits inline at the end of the row; menu anchors to it */
.tab-more {
    position: relative;
    display: flex;
    align-items: stretch;
}

.tab-more[hidden] {
    display: none;
}

.tab-more-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--dx-g-spacing-sm);
    background: none;
    background-clip: padding-box;
    border: none;
    border-bottom: var(--dx-g-spacing-xs) solid transparent;   /* align with tab underline */
    border-radius: var(--dx-g-spacing-sm) var(--dx-g-spacing-sm) 0 0;
    margin-bottom: -1px;
    padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-lg);    /* match .tab-button */
    font-family: var(--dx-g-font-sans);
    font-size: var(--dx-g-text-base);
    color: var(--dx-g-blue-vibrant-20);
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
}

.tab-more-btn:hover {
    background: var(--dx-g-blue-vibrant-95);
}

/* highlight the trigger when the current tab lives inside the menu */
.tab-more-btn.active {
    color: var(--dx-g-blue-vibrant-50);
    border-bottom-color: var(--dx-g-blue-vibrant-50);
    font-weight: var(--dx-g-font-bold);
}

.tab-more-icon {
    flex-shrink: 0;
}

/* dropdown panel (dx-popover) */
.tab-more-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 50;
    min-width: 160px;
    margin-top: var(--dx-g-spacing-xs);
    padding: var(--dx-g-spacing-xs) 0;
    background: #fff;
    border: 1px solid var(--dx-g-gray-90);
    border-radius: var(--dx-g-spacing-xs);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.tab-more-menu[hidden] {
    display: none;
}

.tab-more-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: var(--dx-g-spacing-sm) var(--dx-g-spacing-md);
    font-family: var(--dx-g-font-sans);
    font-size: var(--dx-g-text-base);
    color: var(--dx-g-blue-vibrant-20);
    white-space: nowrap;
    cursor: pointer;
}

.tab-more-item:hover {
    background: var(--dx-g-blue-vibrant-95);
    font-weight: var(--dx-g-font-bold);
}

.tab-more-item.active {
    color: var(--dx-g-blue-vibrant-50);
    font-weight: var(--dx-g-font-bold);
}

/* --- overflow safety: long words/URLs wrap instead of pushing width --- */
/* `anywhere` (not `break-word`) so an unbreakable URL can't set a large
   min-content width; it breaks to fit the column on narrow screens. */
main.page p,
main.page li,
main.page a,
main.page dd {
    overflow-wrap: anywhere;
}

/* 200px of breathing room after content, before the footer */
.page-wrapper main.page {
    padding-top: 56px;      /* total space between header and h1 */
    padding-bottom: 200px;
}

/* tighten the header-to-h1 gap by 24px on the smallest breakpoint */
@media (max-width: 799px) {
    .page-wrapper main.page {
        padding-top: 32px;   /* 56 - 24 */
    }

    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .page-toolbar button,
    .page-toolbar .toolbar-link {
        width: 100%;
        justify-content: center;
    }

    main.page h1,
    main.page h2,
    main.page h3,
    main.page h4 {
        overflow-wrap: anywhere;
    }
}

/* zero the hero/title top margins so the 56px comes only from padding */
.hero {
    margin-top: 0;
}

/* --- dx-toc "Contents" label ---------------------------------------- */
.right-nav-title {
    font-family: var(--font-family-display);   /* Avant Garde For Salesforce */
    font-weight: var(--dx-g-font-demi);        /* Demi (600) */
    font-size: 18px;
    line-height: 24px;
    letter-spacing: 0.09px;                    /* 0.5% of 18px */
    text-transform: none;
    color: var(--dx-g-text-heading-color);
}

.right-nav a {
    font-family: var(--dx-g-font-sans);
    font-size: var(--dx-g-text-sm);
    color: var(--dx-g-blue-vibrant-20);
    border-left: 3px solid transparent;
    padding-left: 11px;
}

.right-nav a:hover {
    color: var(--dx-g-blue-vibrant-40);
    border-left-color: var(--dx-g-blue-vibrant-40);
}

.right-nav a.active {
    color: var(--dx-g-blue-vibrant-50);
    border-left-color: var(--dx-g-blue-vibrant-50);
    font-weight: var(--dx-g-font-bold);
}

/* --- dx-footer: prose-link terms styling ---------------------------- */
footer {
    font-family: var(--dx-g-font-sans);
    font-size: var(--dx-g-text-xs);       /* 12px */
}

footer a {
    color: var(--dx-g-blue-vibrant-50);
    text-decoration: underline;
}

footer a:hover {
    color: var(--dx-g-blue-vibrant-40);
}

/* --- dx-modal: markdown overlay panel ------------------------------- */
.markdown-overlay-panel {
    border-radius: var(--dx-g-spacing-md);   /* 16px */
}

.markdown-overlay-header span {
    font-family: var(--font-family-display);
    color: var(--dx-g-blue-vibrant-20);
}

/* --- dx docs table (dxHelpers/table): indigo header, rounded, bordered */
main.page table {
    display: table;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: var(--dx-g-spacing-lg);
    margin-bottom: var(--dx-g-spacing-sm);
    font-size: var(--dx-g-text-sm);
}

/* --- table scroll shadows (added by js/table-scroll.js) ------------- */
/* Structure built by the script:
     .table-scroll  (relative; hosts the edge shadows)
       .table-scroll__viewport  (the horizontal scroller)
         table
       .table-scroll-shadow--left / --right
   The shadows sit on .table-scroll (not the viewport) so they stay pinned to
   the edges while the table scrolls inside the viewport. */
.table-scroll {
    position: relative;
    margin-top: var(--dx-g-spacing-lg);
    margin-bottom: var(--dx-g-spacing-sm);
}

.table-scroll__viewport {
    overflow-x: auto;   /* harmless when the table wraps; scrolls when it can't */
}

/* Zero the table's own vertical margins once it's inside the scroll viewport
   (the spacing lives on .table-scroll instead). Scoped through main.page so it
   outweighs the margin set on `main.page table`; otherwise those margins get
   trapped inside the viewport and make the container taller than the table. */
main.page .table-scroll table {
    margin-top: 0;
    margin-bottom: 0;
}

.table-scroll-shadow {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 24px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 1;
}

.table-scroll-shadow--left {
    left: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
}

.table-scroll-shadow--right {
    right: 0;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0));
}

.table-scroll.has-left .table-scroll-shadow--left { opacity: 1; }
.table-scroll.has-right .table-scroll-shadow--right { opacity: 1; }

main.page table tr {
    height: 50px;
}

main.page th,
main.page td {
    padding: var(--dx-g-spacing-md);
    font-size: var(--dx-g-text-sm);
    line-height: var(--dx-g-text-lg);
    text-align: left;
    vertical-align: top;
}

/* --- Table behavior classes ----------------------------------------- */
/* .table--wrap: cells wrap so the table always fits the content column and
   never scrolls. Applied to every table by default.
   `break-word` (not `anywhere`) keeps each column at least as wide as its
   longest word, so ordinary words like "collection" or "Required?" stay on a
   single line; only a token too long for its column on its own (e.g. a URL)
   is broken. */
main.page table.table--wrap th,
main.page table.table--wrap td {
    white-space: normal;
    overflow-wrap: break-word;
}

/* .table--scroll: table keeps a 760px minimum width and scrolls horizontally
   instead of wrapping. Only applied on the Reference page, and only takes
   effect at 0-799px (below). Above 799px the table falls back to .table--wrap. */
@media (max-width: 799px) {
    main.page table.table--scroll {
        min-width: 760px;
    }
    main.page table.table--scroll th,
    main.page table.table--scroll td {
        white-space: nowrap;
        overflow-wrap: normal;
    }
}

main.page th {
    background-color: var(--dx-g-indigo-vibrant-95);
    color: var(--dx-g-text-body-color);
    font-weight: var(--dx-g-font-bold);
    border-bottom: 3px solid var(--dx-g-indigo-vibrant-30);
}

main.page tbody tr td {
    border-bottom: 1px solid var(--dx-g-gray-90);
}

main.page tr th:first-of-type,
main.page td:first-of-type {
    min-width: 110px;
}

main.page tr td:first-of-type {
    border-left: 1px solid var(--dx-g-gray-90);
}

main.page tr td:last-of-type {
    border-right: 1px solid var(--dx-g-gray-90);
}

main.page tr:first-of-type th:first-of-type {
    border-top-left-radius: 4px;
}

main.page tr:first-of-type th:last-of-type {
    border-top-right-radius: 4px;
}

main.page tr:last-of-type td:first-of-type {
    border-bottom-left-radius: 4px;
    border-bottom: 1px solid var(--dx-g-gray-90);
    border-left: 1px solid var(--dx-g-gray-90);
}

main.page tr:last-of-type td:last-of-type {
    border-bottom-right-radius: 4px;
    border-bottom: 1px solid var(--dx-g-gray-90);
    border-right: 1px solid var(--dx-g-gray-90);
}
