/* Shared repairs for the REST and SOAP documentation pages.
   Loaded after home.css so the paper system stays, and the bits it
   flattens (endpoint bars, section padding, overflowing grids) get put back. */

.home.soap-docs,
.home.rest-docs {
    overflow-x: clip;
}

.home.soap-docs .soap-docs-shell,
.home.rest-docs .dev-guide-content {
    width: 100%;
    max-width: min(1280px, 100%);
    min-width: 0;
    margin: 0 auto;
    box-sizing: border-box;
}

.home.soap-docs .soap-docs-main,
.home.rest-docs .dev-guide-main,
.home.soap-docs .soap-section,
.home.rest-docs .dev-section,
.home.soap-docs .soap-callout,
.home.soap-docs .soap-steps,
.home.soap-docs .soap-facts,
.home.soap-docs .soap-ops,
.home.soap-docs .soap-code,
.home.rest-docs .endpoint-block,
.home.rest-docs .code-section,
.home.rest-docs .info-box,
.home.rest-docs .alert-box,
.home.rest-docs .warning-box {
    min-width: 0;
    max-width: 100%;
}

/* Beat .home section and .home main > section in home.css. Those rules
   paint every section the page paper and add a large vertical pad, and
   they outrank the shorter selectors above. */
.home.brand-page.rest-docs main.dev-guide-main > section.dev-section,
.home.brand-page.soap-docs main.soap-docs-main > section.soap-section {
    padding: 0 0 1.5rem !important;
    margin: 0 0 1.5rem !important;
    background: transparent !important;
    border-bottom: 1px solid var(--line) !important;
    scroll-margin-top: 140px;
}

.home.brand-page.rest-docs main.dev-guide-main > section.dev-section:last-child,
.home.brand-page.soap-docs main.soap-docs-main > section.soap-section:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: 0 !important;
}

.home.soap-docs .soap-section h2,
.home.rest-docs .dev-section h2,
.home.rest-docs .dev-section h3,
.home.rest-docs .dev-section h4 {
    overflow-wrap: anywhere;
}

.home.rest-docs .dev-section h2 i,
.home.rest-docs .dev-section h3 i {
    color: var(--pink);
    margin-right: 0.35rem;
}

.home.rest-docs .dev-guide-main a {
    color: var(--pink);
    font-weight: 650;
}

.home.rest-docs .dev-guide-main p,
.home.rest-docs .dev-section li {
    overflow-wrap: anywhere;
}

/* ----- REST hero, matching the SOAP paper hero ----- */
.home.rest-docs .api-docs-hero {
    margin-top: 0 !important;
    display: block !important;
    min-height: 0 !important;
    height: auto !important;
    padding: clamp(6.75rem, 10.5vw, 8rem) 0 1.5rem !important;
    text-align: left;
}

.home.rest-docs .api-docs-hero .container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.85rem;
    max-width: min(1200px, 100%);
}

.home.rest-docs .api-docs-hero .container > * {
    flex: 0 0 auto;
    max-width: 100%;
}

.home.rest-docs .api-docs-hero h1,
.home.rest-docs .api-docs-hero .lead,
.home.rest-docs .api-docs-hero-badge {
    margin-bottom: 0 !important;
}

.home.rest-docs .api-docs-hero h1 {
    max-width: min(22ch, 100%) !important;
}

.home.rest-docs .api-docs-hero .lead {
    max-width: min(40rem, 100%) !important;
}

.home.rest-docs .api-docs-hero-badge {
    display: block;
    width: fit-content;
    background: none !important;
    color: var(--ink-soft) !important;
    -webkit-text-fill-color: var(--ink-soft) !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: none !important;
}

.home.rest-docs .api-docs-hero-badge i {
    color: var(--ink-soft) !important;
    margin-right: 0.4rem;
}

.home.rest-docs .api-docs-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 0.15rem 0 0.25rem !important;
    width: 100%;
}

.home.rest-docs .api-docs-hero-actions .btn {
    border-radius: 4px !important;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    text-decoration: none;
}

.home.rest-docs .api-docs-meta,
.home.soap-docs .soap-docs-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 100%;
}

.home.rest-docs .api-docs-chip,
.home.soap-docs .soap-chip {
    display: inline-flex !important;
    align-items: center;
    gap: 0.4rem;
    background: var(--card) !important;
    border: 1px solid var(--line) !important;
    border-radius: 4px !important;
    padding: 0.4rem 0.7rem !important;
    color: var(--ink-soft) !important;
    font-weight: 600;
    font-size: 0.82rem;
    line-height: 1.3;
}

.home.rest-docs .api-docs-chip i,
.home.soap-docs .soap-chip i {
    color: var(--pink) !important;
}

/* ----- REST shell ----- */
.home.rest-docs .dev-guide-content {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
    padding: 1.25rem var(--page-gutter, clamp(16px, 3vw, 28px)) 3rem;
}

.home.rest-docs .dev-guide-sidebar {
    position: sticky;
    top: 96px;
    padding: 1.1rem 1rem 1.15rem !important;
}

.home.rest-docs .dev-guide-sidebar h3 {
    font-size: 0.95rem;
    margin: 0 0 0.85rem;
    padding: 0 0.35rem 0.85rem;
    border-bottom: 2px solid rgba(236, 46, 94, 0.35);
}

.home.rest-docs .dev-guide-sidebar h3 i {
    color: var(--pink);
    margin-right: 0.4rem;
}

.home.rest-docs .dev-guide-sidebar ul li a {
    border-radius: 4px !important;
    font-weight: 600;
}

.home.rest-docs .dev-guide-sidebar ul li a.active {
    background: #fff5f7 !important;
    color: #8B1538 !important;
    border-left-color: var(--pink) !important;
}

.home.rest-docs .dev-guide-sidebar > div {
    margin-top: 1rem !important;
    padding-top: 1rem !important;
    border-top: 1px solid var(--line) !important;
    display: grid;
    gap: 0.45rem;
}

.home.rest-docs .dev-guide-sidebar > div a {
    display: flex !important;
    align-items: center;
    gap: 0.45rem;
    margin: 0 !important;
    padding: 0.55rem 0.7rem;
    border-radius: 4px;
    background: var(--paper);
    color: var(--ink) !important;
    text-decoration: none !important;
    font-size: 0.86rem;
    font-weight: 650;
}

.home.rest-docs .dev-guide-sidebar > div a:hover {
    color: var(--pink) !important;
    background: #fff5f7;
}

.home.rest-docs .dev-guide-main {
    padding: clamp(1.15rem, 2.5vw, 2rem) !important;
}

.home.rest-docs .dev-section > ul {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.45rem;
}

.home.rest-docs .dev-section > ul > li {
    padding: 0.7rem 0.85rem;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 4px;
    color: var(--ink);
    line-height: 1.5;
}

.home.rest-docs .endpoint-block {
    background: var(--card) !important;
    border: 1px solid var(--line) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    padding: 1.15rem 1.15rem 0.4rem;
    margin: 1rem 0 1.25rem;
}

.home.rest-docs .endpoint-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--line);
}

.home.rest-docs .endpoint-header .http-method {
    margin: 0;
    border-radius: 4px;
    background: var(--pink);
}

.home.rest-docs .endpoint-header .endpoint-url {
    display: inline !important;
    width: auto !important;
    max-width: 100%;
    margin: 0;
    padding: 0 !important;
    background: transparent !important;
    color: var(--ink) !important;
    -webkit-text-fill-color: var(--ink) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.home.rest-docs .info-box,
.home.rest-docs .alert-box,
.home.rest-docs .warning-box {
    overflow-wrap: anywhere;
}

.home.rest-docs .info-box code,
.home.rest-docs .dev-guide-main code {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.home.rest-docs .code-section {
    max-width: 100%;
}

.home.rest-docs .code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.home.rest-docs .code-section pre {
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.home.rest-docs .code-section pre code {
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
}

.home.rest-docs .param-required,
.home.rest-docs .param-optional {
    display: inline-block;
    line-height: 1.35;
    white-space: nowrap;
}

.home.rest-docs .param-table {
    width: 100%;
}

/* ----- SOAP overflow: grids were growing past the phone ----- */
.home.soap-docs .soap-callout,
.home.soap-docs .soap-steps li,
.home.soap-docs .soap-feature-list li {
    grid-template-columns: auto minmax(0, 1fr);
    max-width: 100%;
}

.home.soap-docs .soap-callout > div,
.home.soap-docs .soap-steps li > span,
.home.soap-docs .soap-feature-list li > span,
.home.soap-docs .soap-fact,
.home.soap-docs .soap-fact .value,
.home.soap-docs .soap-op {
    min-width: 0;
    max-width: 100%;
}

.home.soap-docs .soap-callout p,
.home.soap-docs .soap-callout a,
.home.soap-docs .soap-steps li,
.home.soap-docs .soap-fact code,
.home.soap-docs .soap-docs-main code,
.home.soap-docs .soap-op p {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.home.soap-docs .soap-fact code,
.home.soap-docs .soap-steps code {
    display: inline-block;
    max-width: 100%;
    box-sizing: border-box;
    vertical-align: baseline;
}

.home.soap-docs .soap-code,
.home.soap-docs .soap-code pre {
    max-width: 100%;
    min-width: 0;
}

.home.soap-docs .soap-code pre {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.home.soap-docs .soap-code pre code {
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
}

.home.soap-docs .soap-docs-mobile-toc,
.home.rest-docs .api-docs-mobile-toc {
    display: none;
    position: sticky;
    top: 81px;
    z-index: 40;
    max-width: 100%;
    background: rgba(243, 240, 234, 0.96);
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0;
}

.home.soap-docs .soap-docs-mobile-toc .container,
.home.rest-docs .api-docs-mobile-toc .container {
    display: flex;
    gap: 0.45rem;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.15rem;
}

.home.rest-docs .api-docs-mobile-toc a {
    flex: 0 0 auto;
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 650;
    color: var(--ink);
    text-decoration: none;
    background: var(--card);
    border: 1px solid var(--line);
}

.home.rest-docs .api-docs-mobile-toc a.active,
.home.soap-docs .soap-docs-mobile-toc a.active {
    background: #fff5f7 !important;
    color: var(--pink) !important;
    border-color: rgba(236, 46, 94, 0.35);
}

@media (max-width: 1024px) {
    .home.rest-docs .dev-guide-content {
        grid-template-columns: 220px minmax(0, 1fr);
    }
}

@media (max-width: 860px) {
    .home.soap-docs .soap-docs-mobile-toc,
    .home.rest-docs .api-docs-mobile-toc {
        display: block;
    }

    .home.rest-docs .dev-guide-sidebar {
        display: none;
    }

    .home.rest-docs .dev-guide-content {
        grid-template-columns: 1fr;
        padding: 1rem var(--page-gutter, 16px) 2.5rem;
        gap: 0;
    }

    .home.rest-docs .dev-guide-main,
    .home.soap-docs .soap-docs-main {
        padding: 1rem !important;
    }

    .home.soap-docs .soap-docs-hero-actions .btn,
    .home.rest-docs .api-docs-hero-actions .btn {
        width: 100%;
    }

    .home.rest-docs .param-table {
        display: block;
        border: 0;
    }

    .home.rest-docs .param-table thead {
        display: none;
    }

    .home.rest-docs .param-table tbody {
        display: block;
    }

    .home.rest-docs .param-table tr {
        display: block;
        width: 100%;
        background: var(--paper);
        border: 1px solid var(--line) !important;
        border-radius: 4px;
        padding: 0.75rem 0.85rem 0.35rem;
        margin: 0 0 0.65rem;
    }

    .home.rest-docs .param-table td {
        display: block;
        width: 100%;
        border: 0 !important;
        background: transparent !important;
        padding: 0 0 0.65rem;
        color: var(--ink);
    }

    .home.rest-docs .param-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.15rem;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--ink-soft);
    }

    .home.rest-docs .param-required,
    .home.rest-docs .param-optional {
        white-space: normal;
    }

    .home.soap-docs .soap-facts,
    .home.soap-docs .soap-ops {
        grid-template-columns: 1fr;
    }
}
