@import url("../../../GuideIOS/assets/css/documentation.css");

/* =========================================================================
   Unified Android SDK Documentation Stylesheet
   Inherits iOS Design System and maps Android HTML selectors 1:1
   ========================================================================= */

:root, [data-theme="light"] {
    color-scheme: light;
    --bg: #f7f8fb;
    --surface: #ffffff;
    --text: #17202a;
    --muted: #667085;
    --border: #d8dee8;
    --accent: #0f6bff;
    --accent-soft: #e7f0ff;
    --hover-overlay: rgba(0, 0, 0, 0.05);
    --code-bg: #f8f8f8;
    --code-text: #1f2328;
    --code-keyword: #9b2393;
    --code-type: #703daa;
    --code-string: #c41a16;
    --code-number: #1c00cf;
    --code-comment: #536579;
    --code-member: #326d74;
    --code-symbol: #643820;
    --warning: #b45309;
    --important: #b42318;
    --tip: #047857;

    --ifm-background-color: var(--bg);
    --ifm-background-surface-color: var(--surface);
    --ifm-font-color-base: var(--text);
    --ifm-font-color-secondary: var(--muted);
    --ifm-heading-color: var(--text);
    --ifm-color-primary: var(--accent);
    --ifm-color-emphasis-100: color-mix(in srgb, var(--surface) 85%, var(--accent-soft));
    --ifm-color-emphasis-200: var(--border);
    --ifm-color-emphasis-300: var(--border);
    --ifm-color-emphasis-700: var(--text);
    --ifm-toc-border-color: var(--border);
    --ifm-hover-overlay: var(--hover-overlay);
    --prism-background-color: var(--code-bg);
    --prism-color: var(--code-text);
    --prism-bar: color-mix(in srgb, var(--surface) 86%, var(--code-bg));
    --prism-keyword: var(--code-keyword);
    --prism-string: var(--code-string);
    --prism-function: var(--code-type);
    --prism-comment: var(--code-comment);
    --prism-number: var(--code-number);
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #111318;
    --surface: #181c24;
    --text: #edf2f7;
    --muted: #a9b4c4;
    --border: #303846;
    --accent: #72a7ff;
    --accent-soft: #172a4a;
    --hover-overlay: rgba(255, 255, 255, 0.05);
    --code-bg: #1f1f24;
    --code-text: #f2f2f7;
    --code-keyword: #ff7ab2;
    --code-type: #dabaff;
    --code-string: #ff8170;
    --code-number: #d9c97c;
    --code-comment: #7f8c98;
    --code-member: #78c2b3;
    --code-symbol: #ffa14f;

    --ifm-background-color: var(--bg);
    --ifm-background-surface-color: var(--surface);
    --ifm-font-color-base: var(--text);
    --ifm-font-color-secondary: var(--muted);
    --ifm-heading-color: var(--text);
    --ifm-color-primary: var(--accent);
    --ifm-color-emphasis-100: color-mix(in srgb, var(--surface) 85%, var(--accent-soft));
    --ifm-color-emphasis-200: var(--border);
    --ifm-color-emphasis-300: var(--border);
    --ifm-color-emphasis-700: var(--text);
    --ifm-toc-border-color: var(--border);
    --ifm-hover-overlay: var(--hover-overlay);
    --prism-background-color: var(--code-bg);
    --prism-color: var(--code-text);
    --prism-bar: color-mix(in srgb, var(--surface) 86%, var(--code-bg));
    --prism-keyword: var(--code-keyword);
    --prism-string: var(--code-string);
    --prism-function: var(--code-type);
    --prism-comment: var(--code-comment);
    --prism-number: var(--code-number);
}

/* =========================================================================
   Language Display Rules (Multi-language toggle)
   ========================================================================= */
[data-lang="en"] [data-lang="vi"],
html[data-lang="en"] [data-lang="vi"] {
    display: none !important;
}

[data-lang="vi"] [data-lang="en"],
html[data-lang="vi"] [data-lang="en"] {
    display: none !important;
}

/* =========================================================================
   Page Article Visibility (Critical for Single Page Navigation)
   ========================================================================= */
.page {
    display: none;
}

.page.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Navbar / Topbar Mapping
   ========================================================================= */
.navbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 64px;
    padding: 10px 20px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    box-shadow: none;
}

.navbar__brand {
    display: flex;
    align-items: center;
    min-width: 0;
    color: var(--muted);
    text-decoration: none;
}

.navbar__title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar__items {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.navbar__items--right {
    margin-left: auto;
}

.ds-button {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    font-size: 0.92rem;
    min-width: 180px;
}

.ds-button:hover {
    border-color: var(--accent);
    color: var(--text);
}

.ds-button kbd {
    background: color-mix(in srgb, var(--surface) 86%, var(--bg));
    border: 1px solid var(--border);
    box-shadow: none;
    color: var(--muted);
}

.navbar__toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.navbar__scrim {
    display: none;
    position: fixed;
    inset: 64px 0 0 0;
    z-index: 180;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s, visibility 0.18s;
}

.navbar__scrim.on {
    opacity: 1;
    visibility: visible;
}

/* =========================================================================
   Locale Switcher — inherited verbatim from the iOS stylesheet
   (.locale / .locale__button / .locale__icon / .locale__label /
    .locale__caret / .locale__menu / .locale__item). Do not re-declare here.
   ========================================================================= */

/* =========================================================================
   Layout & Sidebar Mapping
   ========================================================================= */
.docPage {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 0;
    min-height: calc(100vh - 64px);
    background: var(--bg);
}

.docSidebarContainer {
    width: 300px;
    flex: 0 0 300px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.docSidebar {
    position: sticky;
    top: 64px;
    height: calc(100vh - 64px);
    display: flex;
    flex-direction: column;
}

.docSidebar__scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 32px;
    scrollbar-width: thin;
}

.menu {
    font-size: 0.9375rem;
}

.menu__section {
    margin-bottom: 6px;
}

.menu__section + .menu__section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.menu__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu__list .menu__list {
    width: calc(100% - 18px);
    margin: 0 0 4px 18px;
    padding-left: 10px;
    border-left: 1px solid var(--border);
}

.menu__group {
    margin: 0;
}

/* Nested group header = navigable link + separate collapse caret
   (parity with iOS .menu-group__row / .menu-group__link / .menu-group__toggle). */
.menu__group > summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 2px;
    min-width: 0;
    padding: 0;
    border-radius: 4px;
    user-select: none;
}

.menu__group > summary::-webkit-details-marker {
    display: none;
}

.menu__group.active-parent > summary {
    background: var(--hover-overlay);
}

.menu__grouplink {
    flex: 1 1 auto;
    overflow: hidden;
    padding: 6px 12px;
    border-radius: 4px;
    color: var(--muted);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu__grouplink:hover {
    color: var(--text);
    background: var(--hover-overlay);
    text-decoration: none;
}

.menu__caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    color: var(--muted);
    transition: color 0.18s ease, background 0.18s ease;
}

.menu__caret::before {
    content: "";
    width: 7px;
    height: 7px;
    border-right: 1.6px solid currentColor;
    border-bottom: 1.6px solid currentColor;
    transform: rotate(45deg) translate(-1px, -1px);
    transform-origin: center;
    transition: transform 0.18s ease;
}

.menu__group > summary:hover .menu__caret {
    color: var(--text);
    background: var(--hover-overlay);
}

.menu__group:not([open]) > summary .menu__caret::before {
    transform: rotate(-45deg) translate(-1px, -1px);
}

/* Top-level section header (Guides / Examples) — parity with iOS .menu-section__toggle. */
.menu__group--top > summary {
    gap: 6px;
    min-height: 32px;
    margin: 12px 0 2px;
    padding: 6px 12px;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.menu__section:first-child .menu__group--top > summary {
    margin-top: 0;
}

.menu__group--top > summary:hover {
    color: var(--text);
    background: var(--hover-overlay);
}

.menu__group--top > summary .menu__caret {
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    margin-left: auto;
    border-radius: 0;
}

.menu__group--top > summary .menu__caret::before {
    border-right-width: 1.4px;
    border-bottom-width: 1.4px;
}

.menu__group--top > summary:hover .menu__caret {
    background: transparent;
}

.menu__link {
    display: block;
    min-width: 0;
    padding: 6px 12px;
    border-radius: 4px;
    color: var(--muted);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.25;
    text-decoration: none;
}

.menu__link:hover {
    color: var(--text);
    background: var(--hover-overlay);
    text-decoration: none;
}

.menu__link--active, .menu__link.active {
    color: var(--accent);
    background: var(--hover-overlay);
    font-weight: 600;
}


/* =========================================================================
   Breadcrumbs Mapping
   ========================================================================= */
.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    font-size: 0.88rem;
}

.breadcrumbs__item {
    display: inline-flex;
    align-items: center;
}

.breadcrumbs__link {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    text-decoration: none;
    gap: 4px;
}

.breadcrumbs__link:hover {
    color: var(--text);
    background: transparent;
}

.breadcrumbs__link svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.breadcrumbs__sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    opacity: 0.6;
    width: 12px;
    height: 12px;
}

.breadcrumbs__sep svg {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
}

.breadcrumbs__item--active .breadcrumbs__link {
    color: var(--text);
    font-weight: 600;
}

/* =========================================================================
   Content & Headings Mapping
   ========================================================================= */
.docMainContainer {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    justify-content: center;
}

.docRow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    column-gap: 24px;
    max-width: none;
    padding: 24px 32px 48px;
    width: 100%;
}

main.docItemCol {
    min-width: 0;
    padding: 0 0 36px;
}

h1.t {
    font-size: 42px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--text);
    margin: 14px 0 12px;
}

h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 28px 0 12px;
    scroll-margin-top: 88px;
}

h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 24px 0 8px;
    scroll-margin-top: 88px;
}

h2 .hh, h3 .hh {
    opacity: 0;
    padding: 0 0.25rem;
    color: var(--muted);
    font-weight: 400;
    transition: opacity 0.1s;
    text-decoration: none;
}

h2:hover .hh, h3:hover .hh {
    opacity: 1;
}

h2 .hh:hover, h3 .hh:hover {
    color: var(--accent);
    text-decoration: none;
}

.tag {
    font-size: 1.15rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

.muted {
    color: var(--muted);
    font-size: 0.9375rem;
}

/* Callouts / Admonitions (.cal -> .callout) */
.cal {
    display: flex;
    gap: 12px;
    border-left: 4px solid var(--accent);
    background: var(--surface);
    border-radius: 8px;
    padding: 14px 16px;
    margin: 16px 0;
    box-shadow: none;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
}

.cal .ic {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.cal p {
    margin: 0;
}

.cal p + p {
    margin-top: 6px;
}

.cal.tip { border-left-color: var(--tip); }
.cal.warn { border-left-color: var(--warning); }
.cal.danger { border-left-color: var(--important); }

/* Tables & Wrappers */
.tw {
    overflow-x: auto;
    margin: 16px 0;
}

.grid4 td {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
}

/* Code Blocks & Prism Syntax Highlighting */
.codeblock {
    position: relative;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--code-bg);
    color: var(--code-text);
    box-shadow: none;
    margin: 16px 0;
    overflow: hidden;
}

.codeblock .cbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: color-mix(in srgb, var(--surface) 86%, var(--code-bg));
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: ui-monospace, SFMono-Regular, monospace;
}

.codeblock .cbar .lang {
    font-weight: 600;
    color: var(--text);
}

.codeblock pre {
    margin: 0;
    padding: 16px;
    background: transparent;
    overflow-x: auto;
}

.codeblock pre code {
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    line-height: 1.6;
    white-space: pre;
    color: var(--code-text);
    background: none;
    border: 0;
    padding: 0;
}

.k { color: var(--code-keyword); }
.f { color: var(--code-type); }
.s { color: var(--code-string); }
.c { color: var(--code-comment); font-style: italic; }
.n { color: var(--code-number); }

.copyBtn {
    position: absolute;
    top: 6px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 86%, var(--code-bg));
    color: var(--text);
    cursor: pointer;
}

.copyBtn .i-check { display: none; }
.copyBtn.done { color: #047857; border-color: #047857; }
.copyBtn.done .i-check { display: block; }
.copyBtn.done .i-copy { display: none; }

/* Cards & Grids */
.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 118px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: none;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.card:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--surface) 90%, var(--accent-soft));
    box-shadow: none;
}

.card .h {
    font-weight: 600;
    color: var(--text);
    font-size: 1rem;
}

.card .d {
    font-size: 0.92rem;
    color: var(--muted);
    line-height: 1.45;
}

.facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 18px;
}

.fact {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.88rem;
}

.fact b {
    margin-right: 5px;
    color: var(--text);
}

.shots {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 0 0 1.5rem;
}

.shots figure {
    margin: 0;
}

.shots figcaption {
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
    margin-top: 0.5rem;
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 1.5rem;
    align-items: start;
}

.phone {
    aspect-ratio: var(--phone, 1344 / 2992);
    border-radius: 14px;
    background-size: cover;
    background-position: top center;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.phone:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.phone.m { background-image: var(--img-map); }
.phone.s { background-image: var(--img-style); }
.phone.n { background-image: var(--img-nearby); }
.phone.t { background-image: var(--img-toolbox); }

/* ==========================================================================
   Image Lightbox & Zoom Viewer
   ========================================================================== */
.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 20, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    user-select: none;
    overflow: hidden;
}

.image-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.image-lightbox__header {
    position: absolute;
    top: 18px;
    right: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    z-index: 20;
    pointer-events: none;
}

.image-lightbox__controls {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: rgba(26, 32, 44, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: auto;
}

.image-lightbox__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #e2e8f0;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.image-lightbox__btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    transform: scale(1.06);
}

.image-lightbox__btn:active {
    transform: scale(0.94);
}

.image-lightbox__scale {
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    min-width: 52px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.image-lightbox__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    background: rgba(26, 32, 44, 0.85);
    color: #e2e8f0;
    cursor: pointer;
    font-size: 20px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease, border-color 0.15s ease;
}

.image-lightbox__close:hover {
    background: rgba(239, 68, 68, 0.85);
    color: #ffffff;
    border-color: rgba(239, 68, 68, 0.9);
    transform: scale(1.06);
}

.image-lightbox__close:active {
    transform: scale(0.94);
}

.image-lightbox__stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
    cursor: zoom-out;
}

.image-lightbox__img {
    max-width: 88vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    transform-origin: center center;
    transition: transform 0.12s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: grab;
    will-change: transform;
    pointer-events: auto;
}

.image-lightbox__img.is-zoomed {
    cursor: grab;
}

.image-lightbox__img.is-dragging {
    cursor: grabbing;
    transition: none;
}

.image-lightbox__caption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80vw;
    padding: 10px 22px;
    background: rgba(20, 24, 33, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 30px;
    color: #f1f5f9;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    line-height: 1.45;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: none;
    z-index: 20;
    transition: opacity 0.2s ease;
}

/* Table of Contents */
.tocContainer {
    grid-column: 2;
}

.tableOfContents {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    border-left: 1px solid var(--border);
    padding: 0 0 0 16px;
    font-size: 0.88rem;
}

.toc__title {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 8px;
}

.table-of-contents__link {
    display: block;
    padding: 4px 0;
    color: var(--muted);
    line-height: 1.35;
    text-decoration: none;
}

.table-of-contents__link:hover {
    color: var(--accent);
    text-decoration: none;
}

.table-of-contents__link--h3 {
    padding-left: 12px;
    font-size: 0.85rem;
}

.table-of-contents__link--active {
    color: var(--accent);
    font-weight: 600;
}

/* Search Modal */
.ds-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    padding: max(8vh, 3rem) 1rem 1rem;
}

.ds-modal.on {
    display: block;
}

.ds-panel {
    max-width: 36rem;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    border: 1px solid var(--border);
}

.ds-form {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.ds-form svg {
    flex: 0 0 auto;
    color: var(--accent);
}

.ds-input {
    flex: 1;
    border: 0;
    outline: 0;
    background: none;
    font-size: 1.05rem;
    color: var(--text);
    font-family: inherit;
}

.ds-esc {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.72rem;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
}

.ds-keys {
    display: flex;
    gap: 3px;
}

.ds-results {
    max-height: min(60vh, 26rem);
    overflow-y: auto;
    padding: 8px;
}

.ds-group {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    padding: 8px 10px 4px;
}

.ds-hit {
    display: block;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.ds-hit:hover, .ds-hit.sel {
    background: var(--accent);
    color: #ffffff;
    text-decoration: none;
}

.ds-hit:hover .ds-path, .ds-hit.sel .ds-path {
    color: rgba(255, 255, 255, 0.85);
}

.ds-hit .ds-title {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.35;
}

.ds-hit .ds-path {
    display: block;
    font-size: 0.8rem;
    line-height: 1.35;
    color: var(--muted);
}

.ds-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.ds-foot {
    display: flex;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted);
}

/* Pagination */
.pagination-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.pagination-nav__link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 12px 14px;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, background 0.2s;
}

.pagination-nav__link:hover {
    border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
    background: var(--accent-soft);
    text-decoration: none;
}

.pagination-nav__link--next {
    align-items: flex-end;
    text-align: right;
}

.pagination-nav__sublabel {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pagination-nav__label {
    font-size: 0.96rem;
    font-weight: 600;
    line-height: 1.35;
}

/* Footer (Site Footer) */
.footer {
    background: #1b1c22;
    color: #cfd8e3;
    padding: 2rem 1.5rem;
    margin-top: 3rem;
}

.footer__inner {
    max-width: 1240px;
    margin: 0 auto;
}

.footer__links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
}

.footer__title {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    margin: 0 0 0.75rem;
}

.footer__items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer__item {
    margin: 0.35rem 0;
    font-size: 0.9rem;
}

.footer__link {
    color: #cfd8e3;
    text-decoration: none;
}

.footer__link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.footer__bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: #9fadbd;
}

footer.foot {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.85rem;
}

/* Responsive Media Queries */
@media (max-width: 1100px) {
    .docPage {
        grid-template-columns: 300px minmax(0, 1fr);
    }
    .docRow {
        grid-template-columns: minmax(0, 1fr);
    }
    .tocContainer {
        display: none;
    }
    .cards, .shots {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    /* The .ds-button override above outranks the iOS rule that hides search on
       narrow screens (same specificity, later source order) — restore it here. */
    .ds-button, .ds-keys {
        display: none;
    }

    .navbar__toggle {
        display: inline-flex;
    }
    .navbar__scrim {
        display: block;
    }
    .docPage {
        grid-template-columns: 1fr;
    }
    .docSidebarContainer {
        position: fixed;
        top: 64px;
        left: 0;
        z-index: 190;
        width: min(320px, calc(100vw - 24px));
        height: calc(100vh - 64px);
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        visibility: hidden;
        pointer-events: none;
    }
    .docSidebarContainer.open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }
    .cards, .shots, .split {
        grid-template-columns: 1fr;
    }
    h1.t {
        font-size: 32px;
    }
}
