/* ICA API Demo playground styles
   Reuses site brand vars from sectors.css (--navy-deepest, --teal, etc.).
   Page-local layout only. */

.apidemo-hero {
    background: var(--navy-deepest);
    padding: 5rem 0 3rem;
    text-align: center;
}
.apidemo-eyebrow {
    font-family: var(--font-mono);
    font-size: .75rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 1rem;
}
.apidemo-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--text-heading);
    margin: 0 0 1rem;
}
.apidemo-sub {
    color: var(--text-body);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

.apidemo-main {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    /* Use top/bottom only so the inherited .container padding (0 24px) survives. */
    padding-top: 3rem;
    padding-bottom: 3rem;
    align-items: start;
}

.apidemo-sidebar-title {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin: 0 0 1rem;
}
.apidemo-endpoint-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.apidemo-endpoint-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--navy-card);
    border: 1px solid var(--navy-border);
    color: var(--text-body);
    border-radius: 8px;
    padding: .75rem 1rem;
    cursor: pointer;
    font: inherit;
}
.apidemo-endpoint-btn:hover { border-color: var(--teal); }
.apidemo-endpoint-btn.active { border-color: var(--teal); background: rgba(0,198,167,.08); }
.apidemo-method {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: .5rem;
}
.apidemo-method.get  { background: #0e4f47; color: #7bd5c4; }
.apidemo-method.post { background: #3a3a6c; color: #b0b0ff; }
.apidemo-endpoint-label { font-weight: 600; }
.apidemo-endpoint-desc { font-size: .8rem; color: var(--text-muted); margin-top: .25rem; }

.apidemo-workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Grid items default to min-width: auto (intrinsic content width), so long
       <pre> lines in Response/Code cards would push this column past the 1fr
       allocation and spill past the container's right edge. min-width: 0 lets
       the column honor its track size and forces overflow into the child
       scrollers (.apidemo-response-body / .apidemo-snippet). */
    min-width: 0;
}
.apidemo-card {
    background: var(--navy-card);
    border: 1px solid var(--navy-border);
    border-radius: 12px;
    padding: 1.5rem;
}
.apidemo-card-title {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

.apidemo-request-url {
    font-family: var(--font-mono);
    font-size: .95rem;
    background: var(--navy-deepest);
    padding: .75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    color: var(--text-heading);
    word-break: break-all;
}

.apidemo-param-form {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 1rem;
}
.apidemo-param-form label {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    font-size: .85rem;
    color: var(--text-body);
}
.apidemo-param-form input,
.apidemo-param-form select {
    background: var(--navy-deepest);
    border: 1px solid var(--navy-border);
    color: var(--text-heading);
    padding: .5rem .75rem;
    border-radius: 6px;
    font: inherit;
}

.apidemo-response-meta {
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: .75rem;
}
.apidemo-response-meta .status-ok { color: #7bd5c4; }
.apidemo-response-meta .status-err { color: #ff7b7b; }
.apidemo-response-body,
.apidemo-snippet {
    max-height: 420px;
    overflow: auto;
    font-size: .85rem;
    border-radius: 6px;
    margin: 0;
}

.apidemo-tabs {
    display: flex;
    gap: .5rem;
    margin-bottom: .75rem;
    border-bottom: 1px solid var(--navy-border);
}
.apidemo-tab {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    padding: .5rem 1rem;
    cursor: pointer;
    font: inherit;
    border-bottom: 2px solid transparent;
}
.apidemo-tab.active { color: var(--teal); border-bottom-color: var(--teal); }

#copy-btn { margin-top: .75rem; }

/* Soft-gate modal */
.apidemo-gate {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 24, .85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.apidemo-gate[hidden] { display: none; }
.apidemo-gate-panel {
    background: var(--navy-card);
    border: 1px solid var(--navy-border);
    border-radius: 12px;
    padding: 2rem;
    max-width: 420px;
    width: calc(100% - 2rem);
}
.apidemo-gate-panel form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}
.apidemo-gate-panel label {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    color: var(--text-body);
}
.apidemo-gate-panel input {
    background: var(--navy-deepest);
    border: 1px solid var(--navy-border);
    color: var(--text-heading);
    padding: .6rem .75rem;
    border-radius: 6px;
    font: inherit;
}
.apidemo-gate-err { color: #ff7b7b; font-size: .85rem; margin: 0; }

.apidemo-footer {
    /* Top/bottom only so the inherited .container padding (0 24px) survives. */
    padding-top: 3rem;
    padding-bottom: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
}

/* Focus indicators — sectors.css resets `outline: none` globally, so we
   re-establish keyboard-visible focus styling per WCAG 2.4.7. */
.apidemo-endpoint-btn:focus-visible,
.apidemo-tab:focus-visible,
#copy-btn:focus-visible,
#send-btn:focus-visible,
.apidemo-param-form input:focus-visible,
.apidemo-param-form select:focus-visible,
.apidemo-gate-panel input:focus-visible,
.apidemo-gate-panel button:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

/* Mobile */
@media (max-width: 768px) {
    .apidemo-hero { padding: 3rem 0 2rem; }
    .apidemo-main {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
    .apidemo-sidebar { order: -1; }
    .apidemo-endpoint-list {
        flex-direction: row;
        overflow-x: auto;
        gap: .5rem;
        /* Prevent focus-visible outlines from being clipped by overflow. */
        padding: 2px;
        /* Give horizontal scroll some room without hugging the viewport edge. */
        -webkit-overflow-scrolling: touch;
    }
    .apidemo-endpoint-btn { min-width: 180px; flex: 0 0 auto; }
    .apidemo-card { padding: 1.25rem; }
    .apidemo-request-url { font-size: .85rem; }
    .apidemo-tabs { overflow-x: auto; }
    .apidemo-tab { white-space: nowrap; }
}
