:root {
    color-scheme: dark;
    --bg: #061426;
    --bg-deep: #030d19;
    --surface: rgba(8, 29, 53, 0.82);
    --surface-strong: rgba(8, 30, 55, 0.96);
    --surface-soft: rgba(14, 43, 74, 0.58);
    --border: rgba(174, 205, 231, 0.17);
    --border-strong: rgba(136, 193, 232, 0.32);
    --text: #edf5fb;
    --text-soft: #bdcbd8;
    --text-muted: #8499ad;
    --cyan: #30b9f5;
    --cyan-strong: #0aa5ee;
    --cyan-soft: rgba(32, 175, 240, 0.13);
    --green: #7bde9b;
    --purple: #e590ff;
    --orange: #ffb16f;
    --danger: #ff7d87;
    --header-height: 88px;
    --sidebar-width: 374px;
    --content-max: 1100px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --shadow: 0 24px 70px rgba(0, 5, 14, 0.36);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg-deep);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    transform: translateY(-150%);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--cyan);
    color: #02101e;
    font-weight: 700;
    text-decoration: none;
}

.skip-link:focus {
    transform: none;
}

.topbar {
    position: fixed;
    z-index: 30;
    inset: 0 0 auto;
    height: var(--header-height);
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr auto;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(4, 18, 34, 0.88);
    box-shadow: 0 8px 35px rgba(0, 6, 18, 0.28);
    backdrop-filter: blur(18px);
}

.brand {
    height: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 30px;
    text-decoration: none;
}

.brand img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(42, 170, 238, 0.25));
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand-copy strong {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-copy small {
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.34em;
    text-transform: uppercase;
}

.page-identity {
    display: flex;
    align-items: center;
    min-width: 0;
    height: 100%;
}

.page-divider {
    width: 1px;
    height: 48px;
    margin-right: 26px;
    background: var(--border-strong);
}

.page-identity > div {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.page-identity strong {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-identity span:not(.page-divider) {
    overflow: hidden;
    color: var(--text-soft);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    padding-right: 30px;
}

.site-link {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--cyan);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 160ms ease, transform 160ms ease;
}

.site-link:hover {
    color: #8ad8ff;
    transform: translateX(-2px);
}

.site-link svg {
    width: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.menu-toggle {
    display: none;
    width: 42px;
    height: 42px;
    margin-left: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    border-radius: 2px;
    background: var(--text);
}

.app-shell {
    position: relative;
    height: 100vh;
    padding-top: var(--header-height);
    background:
        linear-gradient(90deg, rgba(4, 21, 40, 0.98) 0, rgba(4, 21, 40, 0.92) 16%, rgba(4, 20, 38, 0.97) 35%, rgba(3, 14, 28, 0.99) 100%),
        url("assets/bg-hero.jpg") center / cover fixed;
}

.sidebar {
    position: fixed;
    z-index: 20;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-strong);
    background: linear-gradient(180deg, rgba(4, 24, 45, 0.96), rgba(5, 22, 41, 0.98));
    box-shadow: 18px 0 50px rgba(0, 6, 18, 0.17);
}

.sidebar::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    opacity: 0.1;
    background: url("assets/bg-hero.jpg") 15% center / auto 100% no-repeat;
    mask-image: linear-gradient(to bottom, #000, transparent 75%);
}

.sidebar-scroll {
    min-height: 0;
    padding: 24px 24px 16px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(75, 170, 225, 0.38) transparent;
}

.version-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(5, 23, 43, 0.5);
}

.version-button {
    min-height: 58px;
    padding: 8px 12px;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease;
}

.version-button + .version-button {
    border-left: 1px solid var(--border-strong);
}

.version-button span,
.version-button small {
    display: block;
}

.version-button span {
    font-size: 15px;
    font-weight: 700;
}

.version-button small {
    margin-top: 4px;
    color: inherit;
    font-size: 10px;
}

.version-button.is-active {
    background: linear-gradient(135deg, #0b91df, #22b8f4);
    color: #fff;
    box-shadow: 0 8px 24px rgba(8, 151, 221, 0.22);
}

.version-button.is-reserved:hover {
    background: rgba(56, 155, 216, 0.08);
    color: var(--text);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    height: 50px;
    margin-bottom: 18px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(7, 25, 46, 0.74);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-box:focus-within {
    border-color: rgba(48, 185, 245, 0.75);
    box-shadow: 0 0 0 3px rgba(48, 185, 245, 0.1);
}

.search-box svg {
    flex: 0 0 auto;
    width: 20px;
    margin-left: 14px;
    fill: none;
    stroke: var(--text-soft);
    stroke-width: 1.8;
    stroke-linecap: round;
}

.search-box input {
    min-width: 0;
    width: 100%;
    height: 100%;
    padding: 0 10px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 13px;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box kbd {
    min-width: 27px;
    margin-right: 10px;
    padding: 3px 7px;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    color: var(--text-muted);
    font: 11px "JetBrains Mono", monospace;
    text-align: center;
}

.docs-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-group {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(6, 27, 49, 0.5);
}

.nav-group-toggle {
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 14px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
}

.nav-group-toggle svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-group-toggle .chevron {
    width: 15px;
    margin-left: auto;
    transition: transform 180ms ease;
}

.nav-group.is-open .chevron {
    transform: rotate(180deg);
}

.nav-group-items {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 200ms ease;
}

.nav-group.is-open .nav-group-items {
    grid-template-rows: 1fr;
}

.nav-group-items > div {
    min-height: 0;
    overflow: hidden;
}

.nav-link {
    position: relative;
    width: 100%;
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 8px 14px 8px 49px;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: background 150ms ease, color 150ms ease;
}

.nav-link::before {
    position: absolute;
    left: 28px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    content: "";
    opacity: 0.65;
}

.nav-link:hover {
    background: rgba(41, 156, 220, 0.08);
    color: var(--text);
}

.nav-link.is-active {
    background: linear-gradient(90deg, rgba(26, 150, 222, 0.24), rgba(26, 150, 222, 0.06));
    color: var(--cyan);
    font-weight: 600;
}

.nav-link.is-active::after {
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: var(--cyan);
    content: "";
}

.sidebar-note {
    margin: auto 24px 22px;
    display: flex;
    gap: 11px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(6, 25, 46, 0.74);
}

.sidebar-note svg {
    flex: 0 0 auto;
    width: 19px;
    fill: none;
    stroke: var(--text-soft);
    stroke-width: 1.7;
    stroke-linecap: round;
}

.sidebar-note p {
    margin: 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.65;
}

.content {
    height: calc(100vh - var(--header-height));
    margin-left: var(--sidebar-width);
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(75, 170, 225, 0.38) transparent;
}

.content-inner {
    width: min(var(--content-max), calc(100% - 80px));
    min-height: calc(100vh - var(--header-height) - 68px);
    margin: 0 auto;
    padding: 42px 0 70px;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.breadcrumbs strong {
    color: var(--cyan);
    font-weight: 600;
}

.breadcrumbs .dot {
    opacity: 0.55;
}

.doc-header {
    max-width: 850px;
    margin-bottom: 36px;
}

.doc-header h1 {
    margin: 0 0 15px;
    color: var(--text);
    font-size: clamp(34px, 4vw, 50px);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.06;
}

.doc-header p {
    margin: 0;
    color: var(--text-soft);
    font-size: 16px;
    line-height: 1.75;
}

.doc-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 19px;
    color: var(--text-muted);
    font-size: 12px;
}

.doc-summary span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--cyan);
}

.api-section {
    margin-top: 38px;
    scroll-margin-top: 120px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 15px;
}

.section-heading h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 750;
    letter-spacing: -0.025em;
}

.section-heading span {
    color: var(--text-muted);
    font-size: 11px;
}

.section-description {
    max-width: 830px;
    margin: -6px 0 18px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.7;
}

.api-table {
    overflow: hidden;
    border-top: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border-strong);
}

.api-table-header,
.api-row {
    display: grid;
    grid-template-columns: minmax(285px, 1.25fr) minmax(105px, 0.42fr) minmax(300px, 1.45fr);
}

.api-table-header {
    color: var(--cyan);
    font-size: 12px;
    font-weight: 700;
}

.api-table-header > span {
    padding: 13px 15px;
}

.api-row {
    border-top: 1px solid var(--border);
    background: rgba(6, 24, 44, 0.24);
    transition: background 140ms ease;
}

.api-row:hover {
    background: rgba(22, 80, 118, 0.17);
}

.api-row > div {
    min-width: 0;
    padding: 15px;
}

.api-row > div + div {
    border-left: 1px solid var(--border);
}

.signature {
    color: #7bd7ff;
    font: 12px/1.6 "JetBrains Mono", Consolas, monospace;
    overflow-wrap: anywhere;
}

.return-type {
    color: var(--text);
    font: 12px/1.6 "JetBrains Mono", Consolas, monospace;
}

.api-description {
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.65;
}

mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(48, 185, 245, 0.22);
    color: inherit;
}

.example-block {
    margin-top: 28px;
}

.example-block h2 {
    margin: 0 0 8px;
    font-size: 22px;
    letter-spacing: -0.025em;
}

.example-block > p {
    margin: 0 0 15px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.7;
}

.code-card {
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(2, 15, 29, 0.84);
    box-shadow: var(--shadow);
}

.code-card-header {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 0 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(16, 47, 78, 0.45);
}

.code-card-header span {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.copy-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    font-size: 11px;
}

.copy-button:hover {
    background: var(--cyan-soft);
    color: var(--cyan);
}

.copy-button svg {
    width: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
}

.code-card pre {
    margin: 0;
    padding: 19px 20px 22px;
    overflow: auto;
    color: #d9e8f4;
    font: 12px/1.8 "JetBrains Mono", Consolas, monospace;
    tab-size: 4;
}

.code-keyword { color: var(--purple); }
.code-function { color: #74d4ff; }
.code-string { color: #9eea76; }
.code-number { color: var(--orange); }
.code-comment { color: #71889c; font-style: italic; }
.code-boolean { color: #ff8e8e; }

.search-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.search-title h1 {
    margin: 0;
    font-size: clamp(30px, 4vw, 44px);
    letter-spacing: -0.04em;
}

.search-title button {
    padding: 9px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--text-soft);
    cursor: pointer;
    font-size: 12px;
}

.search-result-group {
    margin-top: 32px;
}

.search-result-label {
    margin-bottom: 12px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.empty-state,
.reserved-state {
    min-height: 58vh;
    display: grid;
    place-items: center;
    text-align: center;
}

.empty-state > div,
.reserved-state > div {
    max-width: 560px;
}

.state-icon {
    width: 68px;
    height: 68px;
    display: grid;
    place-items: center;
    margin: 0 auto 22px;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: var(--cyan-soft);
    color: var(--cyan);
}

.state-icon svg {
    width: 30px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.empty-state h1,
.reserved-state h1 {
    margin: 0 0 12px;
    font-size: clamp(30px, 4vw, 46px);
    letter-spacing: -0.04em;
}

.empty-state p,
.reserved-state p {
    margin: 0;
    color: var(--text-soft);
    line-height: 1.75;
}

.reserved-state button {
    margin-top: 24px;
    padding: 11px 17px;
    border: 0;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #0b91df, #22b8f4);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.docs-footer {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 max(40px, calc((100% - var(--content-max)) / 2));
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
}

.docs-footer a {
    color: var(--text-soft);
    text-decoration: none;
}

.docs-footer a:hover {
    color: var(--cyan);
}

.toast {
    position: fixed;
    z-index: 60;
    right: 22px;
    bottom: 22px;
    transform: translateY(18px);
    padding: 11px 15px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(5, 29, 51, 0.96);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
    transform: none;
    opacity: 1;
}

.mobile-backdrop {
    position: fixed;
    z-index: 18;
    inset: var(--header-height) 0 0;
    background: rgba(0, 5, 14, 0.68);
    backdrop-filter: blur(4px);
}

@media (max-width: 1100px) {
    :root {
        --sidebar-width: 330px;
    }

    .page-identity span:not(.page-divider) {
        display: none;
    }

    .content-inner {
        width: min(var(--content-max), calc(100% - 48px));
    }

    .api-table-header,
    .api-row {
        grid-template-columns: minmax(235px, 1fr) 100px minmax(235px, 1.2fr);
    }
}

@media (max-width: 860px) {
    :root {
        --header-height: 76px;
    }

    body {
        overflow: auto;
    }

    .topbar {
        grid-template-columns: auto 1fr auto;
    }

    .brand {
        padding: 0 16px;
    }

    .brand img {
        width: 39px;
        height: 39px;
    }

    .brand-copy {
        display: none;
    }

    .page-divider {
        display: none;
    }

    .page-identity strong {
        font-size: 17px;
    }

    .site-link {
        display: none;
    }

    .topbar-actions {
        padding-right: 15px;
    }

    .menu-toggle {
        display: block;
    }

    .app-shell {
        min-height: 100vh;
        height: auto;
    }

    .sidebar {
        width: min(88vw, 360px);
        transform: translateX(-105%);
        transition: transform 220ms ease;
    }

    .sidebar.is-open {
        transform: none;
    }

    .content {
        height: auto;
        min-height: calc(100vh - var(--header-height));
        margin-left: 0;
        overflow: visible;
    }

    .content-inner {
        width: min(100% - 32px, 760px);
        padding-top: 30px;
    }

    .api-table {
        border: 0;
    }

    .api-table-header {
        display: none;
    }

    .api-row {
        display: block;
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        background: rgba(6, 28, 50, 0.68);
    }

    .api-row > div {
        padding: 11px 13px;
    }

    .api-row > div + div {
        border-top: 1px solid var(--border);
        border-left: 0;
    }

    .api-row > div::before {
        display: block;
        margin-bottom: 5px;
        color: var(--text-muted);
        font: 9px "Inter", sans-serif;
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }

    .api-row > div:nth-child(1)::before { content: "Função"; }
    .api-row > div:nth-child(2)::before { content: "Retorno"; }
    .api-row > div:nth-child(3)::before { content: "O que faz"; }

    .docs-footer {
        padding: 18px 16px;
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
}

@media (max-width: 520px) {
    .page-identity strong {
        font-size: 15px;
    }

    .content-inner {
        width: min(100% - 24px, 760px);
    }

    .doc-header h1 {
        font-size: 34px;
    }

    .doc-header p {
        font-size: 14px;
    }

    .section-heading {
        align-items: start;
        flex-direction: column;
        gap: 5px;
    }

    .code-card pre {
        padding: 16px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
