/* ==========================================================================
   TON DOCUMENTATION - STYLES
   ========================================================================== */

:root {
    --ton-blue: #0098EA;
    --ton-light-blue: #1AC9FF;
    --bg-primary: #0a0e1a;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --border-color: rgba(255, 255, 255, 0.1);
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --header-height: 56px;
    --sidebar-width: 280px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --touch-target: 44px;
}

@media (max-width: 768px) {
    :root {
        --header-height: 52px;
        --sidebar-width: 280px;
    }
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    line-height: 1.6;
    padding-top: var(--header-height);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   Header
   ========================================================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}

.header-content {
    max-width: 1800px;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    flex: 1;
}

.logo:hover {
    opacity: 0.8;
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.header-nav a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
}

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

.layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
}

.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    background: rgba(24, 24, 27, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    padding: var(--spacing-lg) 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.nav-resources {
    margin-top: auto;
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: var(--spacing-2xl);
    max-width: 1200px;
    overflow-x: hidden;
    min-width: 0;
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav-section {
    margin-bottom: var(--spacing-xl);
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 0 var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.nav-items {
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 6px var(--spacing-lg);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: var(--ton-blue);
    background: rgba(0, 152, 234, 0.1);
    border-left: 3px solid var(--ton-blue);
    padding-left: calc(var(--spacing-lg) - 3px);
}

/* ==========================================================================
   Dropdown Navigation
   ========================================================================== */

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px var(--spacing-lg);
    background: transparent;
    border: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.nav-dropdown-toggle .dropdown-arrow {
    transition: transform 0.2s;
}

.nav-dropdown-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown {
    display: none;
    padding-left: 0;
}

.nav-dropdown.open {
    display: block;
}

/* Sub-sections (projects) */
.nav-sub-section {
    margin: 0;
}

.nav-sub-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px var(--spacing-lg);
    padding-left: 28px;
    background: transparent;
    border: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.nav-sub-toggle:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-sub-toggle .dropdown-arrow {
    transition: transform 0.2s;
    opacity: 0.5;
}

.nav-sub-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-sub-toggle.active {
    color: var(--ton-blue);
}

.nav-sub-items {
    display: none;
    list-style: none;
    padding: 0;
}

.nav-sub-items.open {
    display: block;
}

.nav-sub-items .nav-link {
    padding-left: 44px;
    font-size: 13px;
}

.nav-sub-items .nav-link.active {
    padding-left: 41px;
}

/* ==========================================================================
   Sidebar Overlay (Mobile)
   ========================================================================== */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ==========================================================================
   Typography
   ========================================================================== */

h1 {
    font-size: clamp(1.75rem, 4vw + 1rem, 3rem);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.375rem, 3vw + 0.5rem, 2rem);
    font-weight: 600;
    margin: var(--spacing-2xl) 0 var(--spacing-lg);
    line-height: 1.3;
}

h3 {
    font-size: clamp(1.125rem, 2vw + 0.5rem, 1.5rem);
    font-weight: 600;
    margin: var(--spacing-xl) 0 var(--spacing-md);
    line-height: 1.4;
}

h4 {
    font-size: clamp(1rem, 1.5vw + 0.5rem, 1.125rem);
    font-weight: 600;
    margin: var(--spacing-lg) 0 var(--spacing-sm);
}

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    line-height: 1.8;
}

a {
    color: var(--ton-blue);
    text-decoration: none;
}

a:hover {
    opacity: 0.8;
}

ul, ol {
    margin-bottom: var(--spacing-lg);
    padding-left: var(--spacing-lg);
    color: var(--text-secondary);
}

li {
    margin-bottom: var(--spacing-xs);
    line-height: 1.7;
}

code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 14px;
    color: var(--ton-light-blue);
    word-break: break-word;
}

pre {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--ton-blue);
    padding: var(--spacing-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: var(--spacing-lg);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    position: relative;
    max-width: 100%;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
    word-break: normal;
    white-space: pre;
}

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

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: var(--spacing-lg) 0;
}

.docs-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-lg) 0;
}

.table-wrapper .docs-table {
    margin: 0;
}

.docs-table th,
.docs-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.docs-table th {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.docs-table td {
    color: var(--text-secondary);
    font-size: 14px;
}

.docs-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

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

.content-section {
    margin-bottom: var(--spacing-2xl);
}

.content-section:first-child {
    margin-top: 0;
}

.lead {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
}

/* ==========================================================================
   Code Blocks
   ========================================================================== */

.code-block {
    position: relative;
    margin: var(--spacing-lg) 0;
}

.code-block pre {
    margin: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 15px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(180deg, #0098EA 0%, #0088CC 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 152, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 152, 234, 0.4);
    opacity: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid rgba(0, 152, 234, 0.4);
}

.btn-secondary:hover {
    background: rgba(0, 152, 234, 0.1);
    border-color: var(--ton-blue);
    opacity: 1;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    transition: all 0.3s;
}

.card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 152, 234, 0.3);
    transform: translateY(-4px);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.docs-footer {
    margin-top: var(--spacing-2xl);
    margin-left: var(--sidebar-width);
    border-top: 1px solid var(--border-color);
    padding: 12px var(--spacing-lg);
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-separator {
    opacity: 0.4;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.footer-link:hover {
    color: var(--text-primary);
}

.footer-link svg {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
    color: var(--text-secondary);
}

pre:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--ton-blue);
}

.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--ton-blue);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

#back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: var(--ton-blue);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 152, 234, 0.3);
    transition: all 0.3s;
    z-index: 999;
    opacity: 0;
}

#back-to-top.visible {
    display: flex;
    opacity: 1;
}

#back-to-top:hover {
    transform: translateY(-2px);
}

#back-to-top svg {
    color: white;
    width: 24px;
    height: 24px;
}

/* ==========================================================================
   Mobile (768px)
   ========================================================================== */

@media (max-width: 768px) {
    /* Sidebar - slide in from left */
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        top: var(--header-height);
        bottom: 0;
        width: var(--sidebar-width);
        background: rgba(10, 14, 26, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-right: 1px solid var(--border-color);
        z-index: 999;
        transition: left 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* Touch targets - minimum 44px */
    .nav-link {
        padding: 12px var(--spacing-lg);
        min-height: var(--touch-target);
        display: flex;
        align-items: center;
    }

    .nav-link.active {
        padding-left: calc(var(--spacing-lg) - 3px);
    }

    .nav-dropdown-toggle {
        padding: 12px var(--spacing-lg);
        min-height: var(--touch-target);
    }

    .nav-sub-toggle {
        min-height: var(--touch-target);
        padding: 10px var(--spacing-lg) 10px 32px;
    }

    .nav-sub-items .nav-link {
        padding: 10px var(--spacing-lg) 10px 44px;
        min-height: 40px;
    }

    /* Layout */
    .main-content {
        margin-left: 0;
        padding: var(--spacing-md);
    }

    .docs-footer {
        margin-left: 0;
        padding: 12px var(--spacing-md);
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: var(--touch-target);
        height: var(--touch-target);
    }

    /* Content section */
    .content-section {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Tables - horizontal scroll wrapper */
    .docs-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .docs-table th,
    .docs-table td {
        padding: 10px 12px;
        font-size: 13px;
    }

    /* Code blocks */
    pre {
        font-size: 13px;
        padding: var(--spacing-sm);
        max-width: calc(100vw - var(--spacing-md) * 2);
        border-radius: var(--radius-sm);
    }

    code {
        font-size: 12px;
    }

    /* Links - break long URLs */
    a {
        word-break: break-word;
    }

    /* Typography adjustments */
    .lead {
        font-size: 16px;
    }

    p {
        font-size: 15px;
        line-height: 1.7;
    }

    li {
        font-size: 15px;
    }

    /* Buttons */
    .btn-primary,
    .btn-secondary {
        padding: 14px 24px;
        min-height: var(--touch-target);
        font-size: 15px;
    }

    /* Share buttons */
    .share-btn {
        width: var(--touch-target);
        height: var(--touch-target);
    }

    /* Content sections */
    .content-section {
        margin-bottom: var(--spacing-xl);
    }
}

/* ==========================================================================
   Small Mobile (480px)
   ========================================================================== */

@media (max-width: 480px) {
    .main-content {
        padding: var(--spacing-sm);
        padding-bottom: calc(var(--spacing-sm) + env(safe-area-inset-bottom, 0));
    }

    .header-content {
        padding: 0 var(--spacing-sm);
        padding-left: calc(var(--spacing-sm) + env(safe-area-inset-left, 0));
        padding-right: calc(var(--spacing-sm) + env(safe-area-inset-right, 0));
    }

    .logo {
        font-size: 13px;
    }

    .header-nav {
        display: none;
    }

    .docs-table th,
    .docs-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .breadcrumbs {
        font-size: 11px;
        margin-bottom: var(--spacing-sm);
    }

    .prev-next-link {
        padding: var(--spacing-sm);
    }

    .footer-content {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */

.breadcrumbs {
    margin-bottom: var(--spacing-lg);
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.breadcrumbs li:not(:last-child)::after {
    content: '>';
    color: var(--text-muted);
}

.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--ton-blue);
}

.breadcrumbs span[aria-current="page"] {
    color: var(--text-secondary);
}

/* ==========================================================================
   Anchor Links
   ========================================================================== */

h2, h3 {
    position: relative;
}

.anchor-link {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    vertical-align: middle;
}

h2:hover .anchor-link,
h3:hover .anchor-link,
.anchor-link:focus {
    opacity: 1;
}

.anchor-link:hover {
    color: var(--ton-blue);
}

.anchor-link svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Previous/Next Navigation
   ========================================================================== */

.prev-next-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border-color);
}

.prev-next-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all 0.2s;
    flex: 1;
    max-width: 280px;
}

.prev-next-link:hover {
    background: rgba(0, 152, 234, 0.1);
    border-color: rgba(0, 152, 234, 0.3);
}

.prev-next-link.prev {
    justify-content: flex-start;
}

.prev-next-link.next {
    justify-content: flex-end;
    margin-left: auto;
    text-align: right;
}

.prev-next-link svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.prev-next-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.prev-next-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prev-next-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.prev-next-spacer {
    flex: 1;
    max-width: 280px;
}

@media (max-width: 768px) {
    .prev-next-nav {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .prev-next-link {
        max-width: 100%;
    }

    .prev-next-link.next {
        margin-left: 0;
    }

    .breadcrumbs ol {
        font-size: 12px;
    }
}

/* ==========================================================================
   Share Buttons
   ========================================================================== */

.share-buttons {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-2xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.share-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-right: var(--spacing-xs);
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.share-btn svg {
    width: 18px;
    height: 18px;
}

.share-twitter:hover {
    background: rgba(29, 155, 240, 0.15);
    border-color: rgba(29, 155, 240, 0.4);
    color: #1d9bf0;
}

.share-telegram:hover {
    background: rgba(0, 136, 204, 0.15);
    border-color: rgba(0, 136, 204, 0.4);
    color: #0088cc;
}

.share-copy:hover {
    background: rgba(0, 152, 234, 0.15);
    border-color: rgba(0, 152, 234, 0.4);
    color: var(--ton-blue);
}

@media (max-width: 768px) {
    .share-buttons {
        justify-content: center;
    }
}

/* ==========================================================================
   GitHub Source Code Link
   ========================================================================== */

.github-source-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    flex-shrink: 0;
}

.github-source-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.github-source-link svg {
    flex-shrink: 0;
}

.github-source-link span {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .github-source-link span {
        display: none;
    }
    .github-source-link {
        padding: 8px;
    }
}

@media print {
    .github-source-link {
        display: none !important;
    }
}

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

.hero-title {
    font-size: clamp(2rem, 6vw + 1rem, 3.5rem);
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    background: linear-gradient(135deg, #ffffff 0%, var(--ton-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw + 0.5rem, 1.25rem);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    margin-top: var(--spacing-lg);
}

@media (max-width: 480px) {
    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions .btn-primary,
    .hero-actions .btn-secondary {
        width: 100%;
    }
}

/* ==========================================================================
   On This Page (Table of Contents)
   ========================================================================== */

.on-this-page {
    --otp-width: 220px;
    position: fixed;
    top: calc(var(--header-height) + var(--spacing-2xl));
    right: var(--spacing-xl);
    width: var(--otp-width);
    max-height: calc(100vh - var(--header-height) - var(--spacing-2xl) * 2);
    overflow-y: auto;
    z-index: 50;
}

.on-this-page:empty,
.on-this-page.hidden {
    display: none;
}

.on-this-page-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
    padding-left: var(--spacing-sm);
}

.on-this-page-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: 1px solid var(--border-color);
}

.on-this-page-item {
    margin: 0;
    line-height: 1.4;
}

.on-this-page-item a {
    display: block;
    padding: 6px var(--spacing-sm);
    padding-left: var(--spacing-md);
    margin-left: -1px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.on-this-page-item a:hover {
    color: var(--text-secondary);
}

.on-this-page-item.active a {
    color: var(--ton-blue);
    font-weight: 500;
    border-left-color: var(--ton-blue);
}

.on-this-page-item.nested a {
    padding-left: calc(var(--spacing-md) + var(--spacing-sm));
    font-size: 12px;
}

.on-this-page::-webkit-scrollbar {
    width: 4px;
}

.on-this-page::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

@media (max-width: 1199px) {
    .on-this-page {
        display: none;
    }
}

@media (min-width: 1200px) {
    .main-content {
        margin-right: calc(var(--otp-width, 220px) + var(--spacing-xl) * 2);
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .header, .sidebar, .floating-nav, .docs-footer, #back-to-top, .on-this-page, .share-buttons {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    body {
        background: white;
        color: black;
        padding: 0;
    }
}
