/* ============================================================================
   Robomates Docs — Clean documentation theme
   ============================================================================ */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #f6f8fa;
    --sidebar-border: #d1d5db;
    --bg: #ffffff;
    --text: #1f2328;
    --text-secondary: #424a53;
    --text-muted: #656d76;
    --border: #d8dee4;
    --border-light: #e8ecf0;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --accent-bg: #ddf4ff;
    --code-bg: #f6f8fa;
    --table-stripe: #f6f8fa;
    --table-hover: #f3f4f6;
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c1c8cf; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a1a8af; }
* { scrollbar-width: thin; scrollbar-color: #c1c8cf transparent; }

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

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

.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================================
   Sidebar
   ============================================================================ */

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
}

.sidebar-logo-icon {
    width: 24px;
    height: 24px;
}

.sidebar-logo span {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    padding: 0.75rem 0;
    flex: 1;
}

.sidebar-link {
    display: block;
    padding: 0.35rem 1rem;
    font-size: 0.87rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
}

.sidebar-link.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--accent-bg);
    font-weight: 600;
}

.sidebar-group {
    margin-top: 0.15rem;
}

.sidebar-children {
    display: none;
    padding-bottom: 0.25rem;
}

.sidebar-group .sidebar-link.active + .sidebar-children {
    display: block;
}

.sidebar-children a {
    display: block;
    padding: 0.25rem 1rem 0.25rem 1.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.sidebar-children a:hover {
    color: var(--text);
}

.sidebar-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.sidebar-footer a:hover {
    color: var(--accent);
}

.sidebar-footer-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Mobile sidebar toggle (CSS-only) */
.sidebar-toggle-input { display: none; }
.sidebar-toggle-btn { display: none; }
.sidebar-overlay { display: none; }

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

.content {
    max-width: 860px;
    padding: 2.5rem 3rem 4rem;
    flex: 1;
}

/* ============================================================================
   Hero (Index)
   ============================================================================ */

.hero {
    display: flex;
    align-items: center;
    gap: 3rem;
    padding: 1rem 0 2rem;
}

.hero-content { flex: 1; }

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.15;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.hero-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 540px;
}

.hero-image {
    flex-shrink: 0;
    width: 220px;
    height: 220px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-placeholder {
    font-size: 5rem;
    opacity: 0.3;
}

/* ============================================================================
   Page Hero (Subpages)
   ============================================================================ */

.page-hero {
    padding: 0.5rem 0 1.5rem;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0.5rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 640px;
}

.hero-link {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.4rem 1rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.15s;
}

.hero-link:hover {
    background: var(--accent-hover);
    color: #fff;
}

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

.section {
    margin-top: 2.5rem;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-light);
    letter-spacing: -0.01em;
}

.section-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: -0.4rem;
    margin-bottom: 1rem;
}

.section-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.subsection-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 1.75rem;
    margin-bottom: 0.6rem;
}

/* ============================================================================
   Navigation Cards (Index)
   ============================================================================ */

.nav-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.nav-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}

.nav-card:hover {
    border-color: var(--accent);
}

.nav-card-icon {
    font-size: 1.4rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
    border-radius: 8px;
    flex-shrink: 0;
}

.nav-card-body { flex: 1; }

.nav-card-body h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.nav-card-body p {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.nav-card-arrow {
    font-size: 1rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color 0.15s;
}

.nav-card:hover .nav-card-arrow {
    color: var(--accent);
}

/* ============================================================================
   Kit Card
   ============================================================================ */

.kit-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}

.kit-card:hover {
    border-color: var(--accent);
}

.kit-image {
    width: 140px;
    height: 140px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--sidebar-bg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kit-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kit-placeholder {
    font-size: 3rem;
    opacity: 0.25;
}

.kit-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.kit-info p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.kit-cta {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.82rem;
}

/* ============================================================================
   BOM Grid
   ============================================================================ */

.bom-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.bom-card {
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.bom-image {
    width: 100px;
    height: 100px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--sidebar-bg);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bom-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bom-info {
    margin-bottom: 0.35rem;
}

.bom-name {
    font-size: 0.82rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.1rem;
}

.bom-qty {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.bom-link {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.bom-link:hover {
    text-decoration: underline;
}

/* ============================================================================
   Specs Grid
   ============================================================================ */

.specs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.5rem;
}

.specs-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
}

.spec-item {
    background: var(--sidebar-bg);
    border-radius: 6px;
    border: 1px solid var(--border-light);
    padding: 0.6rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.spec-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 500;
}

.spec-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ============================================================================
   Feature Grid
   ============================================================================ */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.75rem;
}

.feature-grid.small {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.feature-card {
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 1rem;
}

.feature-icon {
    font-size: 1.3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.feature-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.feature-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ============================================================================
   Repo Grid
   ============================================================================ */

.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.repo-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s;
}

.repo-card:hover {
    border-color: var(--accent);
}

.repo-icon { font-size: 1.25rem; }

.repo-body h4 {
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.repo-body p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================================
   Diagram Panel
   ============================================================================ */

.diagram-panel {
    background: var(--sidebar-bg);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    padding: 1.5rem;
}

.system-diagram {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.diagram-steps {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.step-num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--text);
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.table-panel {
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

thead th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
    white-space: nowrap;
}

tbody td {
    padding: 0.5rem 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

tbody tr:hover {
    background: var(--table-hover);
}

.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.35rem;
    vertical-align: middle;
    border: 1px solid var(--border);
}

/* ============================================================================
   Panels, Info Boxes, Code Blocks
   ============================================================================ */

.panel {
    background: var(--sidebar-bg);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    padding: 1.25rem;
}

.panel h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.panel-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
}

.info-box {
    background: var(--accent-bg);
    border-radius: 6px;
    border: 1px solid #b6d6f8;
    border-left: 3px solid var(--accent);
    padding: 0.85rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0.75rem 0;
}

code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.85em;
    background: var(--code-bg);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.code-block {
    background: var(--code-bg);
    border-radius: 6px;
    border: 1px solid var(--border-light);
    padding: 0.85rem 1rem;
    overflow-x: auto;
}

.code-block code {
    display: block;
    background: none;
    padding: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.steps-list {
    padding-left: 1.25rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.steps-list li {
    margin-bottom: 0.4rem;
    line-height: 1.5;
}

.styled-list {
    padding-left: 1.25rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.styled-list li {
    margin-bottom: 0.35rem;
    line-height: 1.5;
}

/* ============================================================================
   Screenshot Panels
   ============================================================================ */

.screenshot-panel {
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 1rem;
}

.screenshot-panel img {
    width: 100%;
    display: block;
}

/* ============================================================================
   Game Sections
   ============================================================================ */

.game-section {
    margin-bottom: 2rem;
}

.game-header {
    margin-bottom: 0.75rem;
}

.game-badge {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    color: var(--text);
}

/* ============================================================================
   Download Button
   ============================================================================ */

.btn-download {
    display: inline-block;
    padding: 0.45rem 1rem;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: background 0.15s;
    margin-bottom: 1rem;
}

.btn-download:hover {
    background: var(--accent-hover);
    color: #fff;
}

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

.footer {
    margin-top: auto;
    padding: 1.5rem 3rem;
    border-top: 1px solid var(--border-light);
}

.footer-inner {
    max-width: 860px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--accent);
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 1024px) {
    .content { padding: 2rem 2rem 3rem; }
    .footer { padding: 1.5rem 2rem; }
}

@media (max-width: 768px) {
    body { display: block; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 200;
    }

    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 0.75rem;
        left: 0.75rem;
        z-index: 300;
        width: 36px;
        height: 36px;
        background: var(--bg);
        border: 1px solid var(--border);
        border-radius: 6px;
        font-size: 1.1rem;
        color: var(--text);
        cursor: pointer;
    }

    .sidebar-toggle-input:checked ~ .sidebar {
        transform: translateX(0);
    }

    .sidebar-toggle-input:checked ~ .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.25);
        z-index: 150;
    }

    .main { margin-left: 0; }
    .content { padding: 3.5rem 1.25rem 3rem; }
    .footer { padding: 1.25rem; }

    .hero {
        flex-direction: column;
        gap: 1.5rem;
    }
    .hero-title { font-size: 2rem; }
    .hero-description { max-width: 100%; }
    .hero-image { width: 180px; height: 180px; }

    .nav-cards { grid-template-columns: 1fr; }

    .kit-card { flex-direction: column; gap: 1rem; text-align: center; }
    .kit-image { width: 120px; height: 120px; }

    .bom-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

    .two-col { grid-template-columns: 1fr; }

    .page-title { font-size: 1.75rem; }
    .feature-grid { grid-template-columns: 1fr; }

    .table-panel { overflow-x: auto; }

    .footer-inner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .bom-grid { grid-template-columns: repeat(2, 1fr); }
    .specs-grid { grid-template-columns: 1fr; }
    .repo-grid { grid-template-columns: 1fr; }
}
