:root
{
    --resource-prose-width: var(--prose, 58rem);
    --resource-sidebar-width: 15rem;
    --resource-gap: clamp(1.5rem, 4vw, 3.5rem);

    --resource-space-xs: 0.45rem;
    --resource-space-sm: 0.75rem;
    --resource-space-md: 1.25rem;
    --resource-space-lg: 2rem;
    --resource-space-xl: clamp(2.75rem, 6vw, 5rem);

    --resource-radius-sm: var(--radius-control, 0.6rem);
    --resource-radius: var(--radius, 0.82rem);
    --resource-radius-lg: var(--radius-hero, 1.25rem);

    --resource-surface: var(--surface, #ffffff);
    --resource-surface-soft: var(--surface-soft, #f5f7fb);
    --resource-surface-subtle: var(--surface-subtle, #f8fafc);
    --resource-text: var(--text, #172033);
    --resource-text-strong: var(--text-strong, #101828);
    --resource-muted: var(--muted, #667085);
    --resource-line: var(--line, #d8dee8);
    --resource-line-strong: var(--line-strong, #b7c1cf);
    --resource-accent: var(--accent, #3157d5);
    --resource-accent-strong: var(--accent-strong, #2446b4);
    --resource-accent-soft: var(--accent-soft, #e9eeff);
    --resource-code-bg: var(--code-bg, #111827);
    --resource-code-text: var(--code-text, #edf2f7);
    --resource-good: var(--good, #166534);
    --resource-warning: var(--warn, #92400e);
    --resource-danger: var(--danger, #991b1b);

    --resource-shadow: 0 1.2rem 3rem rgba(31, 48, 80, 0.08);
    --resource-shadow-soft: 0 0.65rem 1.8rem rgba(31, 48, 80, 0.06);
}


/* ============================================================================================= */
/* Page shell */
/* ============================================================================================= */

.resource-page
{
    position: relative;
    color: var(--resource-text);
}

/* #viewport owns the public page width and horizontal gutter. */
.resource-shell
{
    width: 100%;
}

.resource-progress
{
    position: fixed;
    inset: 0 0 auto;
    z-index: 60;
    height: 0.22rem;
    pointer-events: none;
}

.resource-progress__bar
{
    width: 100%;
    height: 100%;
    background: var(--resource-accent);
    transform: scaleX(0);
    transform-origin: left center;
}


/* ============================================================================================= */
/* Hero */
/* ============================================================================================= */

.resource-hero
{
    margin-bottom: var(--resource-space-xl);
    border-block: var(--border-width, 0.0625rem) solid var(--resource-line);
    background:
        radial-gradient(circle at 88% 16%, rgba(49, 87, 213, 0.13), transparent 28rem),
        linear-gradient(135deg, var(--resource-surface) 0%, var(--hero-end, #f7f9ff) 100%);
}

.resource-hero__inner
{
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 0.55fr);
    gap: var(--resource-gap);
    align-items: center;
    padding-block: clamp(2.5rem, 7vw, 6rem);
    padding-left: 2rem;
    padding-right: 2rem;
}

.resource-hero__copy
{
    min-width: 0;
}

.resource-eyebrow,
.resource-section__eyebrow,
.resource-hero__summary-label,
.resource-sidebar__title
{
    margin: 0;
    color: var(--resource-accent);
    font-size: 0.73rem;
    font-weight: 850;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

.resource-slot--hero h1
{
    max-width: 18ch;
    margin: var(--resource-space-sm) 0 0;
    font-size: clamp(2.6rem, 6vw, 5rem);
    line-height: 1.02;
}

.resource-slot--hero > p
{
    max-width: 50rem;
    margin: 1.25rem 0 0;
    color: var(--resource-muted);
    font-size: clamp(1rem, 2vw, 1.18rem);
    line-height: 1.75;
}

.resource-hero__summary
{
    padding: clamp(1.25rem, 3vw, 1.8rem);
    border: var(--border-width, 0.0625rem) solid var(--resource-line);
    border-radius: var(--resource-radius-lg);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--resource-shadow-soft);
    backdrop-filter: blur(0.75rem);
}

.resource-hero__summary-label
{
    margin-bottom: var(--resource-space-md);
}

.resource-slot--summary > :first-child
{
    margin-top: 0;
}

.resource-slot--summary > :last-child
{
    margin-bottom: 0;
}

.resource-slot--summary ul
{
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.resource-slot--summary li
{
    position: relative;
    padding-left: 1.45rem;
    color: var(--resource-text-strong);
}

.resource-slot--summary li::before
{
    content: "";
    position: absolute;
    top: 0.7em;
    left: 0.1rem;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--resource-accent);
    transform: translateY(-50%);
}


/* ============================================================================================= */
/* Layout / navigation */
/* ============================================================================================= */

.resource-layout
{
    display: grid;
    grid-template-columns: var(--resource-sidebar-width) minmax(0, 1fr);
    gap: var(--resource-gap);
    align-items: start;
}

.resource-sidebar
{
    position: sticky;
    top: 5rem;
}

.resource-sidebar__panel
{
    padding: 1rem;
    border: var(--border-width, 0.0625rem) solid var(--resource-line);
    border-radius: var(--resource-radius);
    background: var(--resource-surface);
}

.resource-sidebar__title
{
    margin-bottom: 0.75rem;
}

.resource-toc
{
    display: grid;
    gap: 0.12rem;
}

.resource-toc:empty::after
{
    content: "Sections will appear here.";
    color: var(--resource-muted);
    font-size: 0.84rem;
}

.resource-toc a
{
    display: block;
    padding: 0.5rem 0.6rem;
    border-radius: var(--resource-radius-sm);
    color: var(--resource-muted);
    font-size: 0.86rem;
    font-weight: 650;
    line-height: 1.35;
    text-decoration: none;
}

.resource-toc a:hover,
.resource-toc a:focus-visible,
.resource-toc a.is-active
{
    background: var(--resource-accent-soft);
    color: var(--resource-accent);
}

.resource-main
{
    min-width: 0;
}


/* ============================================================================================= */
/* Sections */
/* ============================================================================================= */

.resource-section
{
    margin-bottom: clamp(2.5rem, 6vw, 5rem);
    scroll-margin-top: 6rem;
}

.resource-section:not(.resource-section--article)
{
    padding: clamp(1.25rem, 3vw, 2rem);
    border: var(--border-width, 0.0625rem) solid var(--resource-line);
    border-radius: var(--resource-radius-lg);
    background: var(--resource-surface);
    box-shadow: var(--resource-shadow-soft);
}

.resource-section__heading
{
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
    padding-bottom: 1rem;
    border-bottom: var(--border-width, 0.0625rem) solid var(--resource-line);
}

.resource-section__heading h2
{
    margin: 0.25rem 0 0;
    font-size: clamp(1.5rem, 3vw, 2.15rem);
}

.resource-section--simulation
{
    overflow: hidden;
    background:
        linear-gradient(180deg, var(--resource-surface) 0%, var(--resource-surface-subtle) 100%);
}

.resource-section--closing
{
    background: linear-gradient(135deg, var(--resource-accent-soft), var(--resource-surface));
}


/* ============================================================================================= */
/* Markdown / prose */
/* ============================================================================================= */

.resource-prose
{
/*     max-width: var(--resource-prose-width); */
    font-size: 1rem;
    line-height: 1.78;
}

.resource-section:not(.resource-section--article) .resource-prose
{
    max-width: none;
}

.resource-prose > :first-child
{
    margin-top: 0;
}

.resource-prose > :last-child
{
    margin-bottom: 0;
}

.resource-prose h2,
.resource-prose h3,
.resource-prose h4
{
    color: var(--resource-text-strong);
    scroll-margin-top: 6rem;
}

.resource-prose h2
{
    margin-top: 3rem;
}

.resource-prose h3
{
    margin-top: 2.2rem;
}

.resource-prose p,
.resource-prose li
{
/*     max-width: 74ch; */
}

.resource-prose ul,
.resource-prose ol
{
    padding-left: 1.4rem;
}

.resource-prose li + li
{
    margin-top: 0.45rem;
}

.resource-prose a
{
    font-weight: 650;
}

.resource-prose blockquote
{
    margin: 1.5rem 0;
    padding: 1rem 1.2rem;
    border-left: 0.25rem solid var(--resource-accent);
    border-radius: 0 var(--resource-radius-sm) var(--resource-radius-sm) 0;
    background: var(--resource-accent-soft);
    color: var(--resource-text-strong);
}

.resource-prose blockquote > :first-child
{
    margin-top: 0;
}

.resource-prose blockquote > :last-child
{
    margin-bottom: 0;
}

.resource-prose img,
.resource-media-content img
{
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.5rem auto;
    border: var(--border-width, 0.0625rem) solid var(--resource-line);
    border-radius: var(--resource-radius);
    background: var(--resource-surface);
}

.resource-prose figure
{
    margin: 1.6rem 0;
}

.resource-prose figcaption
{
    margin-top: 0.6rem;
    color: var(--resource-muted);
    font-size: 0.84rem;
    text-align: center;
}

.resource-prose code
{
    overflow-wrap: anywhere;
}

.resource-prose pre
{
    position: relative;
    overflow-x: auto;
    margin: 1.5rem 0;
    padding: 1.15rem;
    border-radius: var(--resource-radius);
    background: var(--resource-code-bg);
    color: var(--resource-code-text);
    line-height: 1.6;
}

.resource-prose pre code
{
    padding: 0;
    background: transparent;
    color: inherit;
}

.resource-code-copy
{
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    padding: 0.38rem 0.6rem;
    border: var(--border-width, 0.0625rem) solid rgba(255, 255, 255, 0.2);
    border-radius: var(--resource-radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--resource-code-text);
    font: inherit;
    font-size: 0.76rem;
    cursor: pointer;
}

.resource-code-copy:hover,
.resource-code-copy:focus-visible
{
    background: rgba(255, 255, 255, 0.16);
}


/* ============================================================================================= */
/* Tables */
/* ============================================================================================= */

.resource-table-wrap
{
    overflow-x: auto;
    margin: 1.5rem 0;
    border: var(--border-width, 0.0625rem) solid var(--resource-line);
    border-radius: var(--resource-radius);
    background: var(--resource-surface);
}

.resource-table-wrap table
{
    width: 100%;
    min-width: 36rem;
    margin: 0;
    border: 0;
    border-collapse: collapse;
}

.resource-table-wrap th,
.resource-table-wrap td
{
    padding: 0.8rem 0.9rem;
    border-bottom: var(--border-width, 0.0625rem) solid var(--resource-line);
    text-align: left;
    vertical-align: middle;
}

.resource-table-wrap th
{
    background: var(--resource-surface-subtle);
    color: var(--resource-text-strong);
    font-size: 0.8rem;
    font-weight: 800;
}

.resource-table-wrap tr:last-child td
{
    border-bottom: 0;
}

.resource-table-wrap tbody tr:hover
{
    background: var(--resource-accent-soft);
}

.resource-table-wrap img
{
    width: 4.5rem;
    max-height: 4.5rem;
    margin: 0;
    object-fit: contain;
}


/* ============================================================================================= */
/* Simulation / embeds */
/* ============================================================================================= */

.resource-simulation
{
    overflow: hidden;
    border: var(--border-width, 0.0625rem) solid var(--resource-line);
    border-radius: var(--resource-radius);
    background: var(--resource-surface-soft);
}

.resource-simulation__frame,
.resource-embed__content
{
    min-height: 24rem;
}

.resource-simulation__frame iframe,
.resource-embed__content iframe,
.resource-embed iframe
{
    display: block;
    width: 100%;
    min-height: 34rem;
    border: 0;
    background: var(--resource-surface);
}

.resource-simulation__controls
{
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.resource-control
{
    min-height: 2.45rem;
    padding: 0.5rem 0.8rem;
    border: var(--border-width, 0.0625rem) solid var(--resource-line-strong);
    border-radius: var(--resource-radius-sm);
    background: var(--resource-surface);
    color: var(--resource-text-strong);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 750;
    cursor: pointer;
}

.resource-control:hover,
.resource-control:focus-visible
{
    border-color: var(--resource-accent);
    color: var(--resource-accent);
}

.resource-simulation-overlay
{
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    background: var(--resource-code-bg);
}

.resource-simulation-overlay[hidden]
{
    display: none;
}

.resource-simulation-overlay__header
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.8rem 1rem;
    color: var(--resource-code-text);
}

.resource-simulation-overlay__body
{
    min-height: 0;
    padding: 0 1rem 1rem;
}

.resource-simulation-overlay__body .resource-simulation__frame
{
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border-radius: var(--resource-radius);
}

.resource-simulation-overlay__body iframe
{
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.resource-control--inverse
{
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.08);
    color: var(--resource-code-text);
}

.resource-control--inverse:hover,
.resource-control--inverse:focus-visible
{
    border-color: rgba(255, 255, 255, 0.7);
    color: #ffffff;
}

body.resource-simulation-open
{
    overflow: hidden;
}


/* ============================================================================================= */
/* Downloads / useful links */
/* ============================================================================================= */

.resource-downloads ul
{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 0.8rem;
    padding: 0;
    list-style: none;
}

.resource-downloads li
{
    max-width: none;
    margin: 0;
}

.resource-downloads li a
{
    display: block;
    min-height: 100%;
    padding: 1rem;
    border: var(--border-width, 0.0625rem) solid var(--resource-line);
    border-radius: var(--resource-radius);
    background: var(--resource-surface-subtle);
    color: var(--resource-text-strong);
    text-decoration: none;
}

.resource-downloads li a:hover,
.resource-downloads li a:focus-visible
{
    border-color: var(--resource-accent);
    background: var(--resource-accent-soft);
    color: var(--resource-accent);
}


/* ============================================================================================= */
/* Responsive */
/* ============================================================================================= */

@media (max-width: 68rem)
{
    .resource-sidebar
    {
        display: none;
    }

    .resource-desktop-only
    {
        display: none !important;
    }

    .resource-mobile-only
    {
        display: flex;
    }


    .resource-hero__inner
    {
        grid-template-columns: minmax(0, 1.3fr) minmax(14rem, 0.7fr);
    }

    .resource-layout
    {
        grid-template-columns: 12rem minmax(0, 1fr);
    }
}

@media (max-width: 56rem)
{
    .resource-hero__inner,
    .resource-layout
    {
        grid-template-columns: 1fr;
    }

    .resource-sidebar
    {
        position: static;
    }

    .resource-sidebar__panel
    {
        padding: 0.8rem;
    }

    .resource-toc
    {
        display: flex;
        gap: 0.35rem;
        overflow-x: auto;
        padding-bottom: 0.15rem;
        scrollbar-width: thin;
    }

    .resource-toc a
    {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

@media (max-width: 40rem)
{
    .resource-section:not(.resource-section--article)
    {
        padding: 1rem;
        border-radius: var(--resource-radius);
    }

    .resource-section__heading
    {
        align-items: flex-start;
        flex-direction: column;
    }

    .resource-simulation__controls
    {
        width: 100%;
    }

    .resource-control
    {
        flex: 1 1 auto;
    }

    .resource-simulation__frame iframe,
    .resource-embed__content iframe,
    .resource-embed iframe
    {
        min-height: 27rem;
    }
}


/* ============================================================================================= */
/* ProductEngine resource output */
/* ============================================================================================= */

.resource-component-table__quantity
{
    width: 8rem;
    text-align: center;
    white-space: nowrap;
}

.resource-component-table__reference
{
    width: 12rem;
    white-space: nowrap;
}

.resource-product-embed
{
    display: block;
    width: 100%;
    border: 0;
}


/* ============================================================================================= */
/* Resource availability                                                                         */
/* ============================================================================================= */

.resource-mobile-only
{
    display: none;
}

.resource-mobile-unavailable
{
    align-items: center;
    justify-content: center;

    width: 100%;
    min-height: 8rem;

    padding: 2rem;

    border: var(--border-width, 0.0625rem) solid var(--resource-line);
    border-radius: var(--resource-radius);

    background: var(--resource-surface-subtle);
    text-align: center;
}

.resource-mobile-unavailable p
{
    margin: 0;
    color: var(--resource-muted);
    font-weight: 600;
}

@media (max-width: 48rem)
{
    .resource-desktop-only
    {
        display: none !important;
    }

    .resource-mobile-only
    {
        display: flex;
    }
}
