/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Reserves scrollbar gutter so layout doesn't shift between short/tall pages */
    scrollbar-gutter: stable;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: #fff;
    color: #333;
    padding: 1rem 0;
    border-bottom: 1px solid #eaeaea;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0;
}

.header-nav a {
    color: #000;
    text-decoration: none;
    margin-left: 2rem;
    font-weight: 500;
    transition: color 0.2s;
}

.header-nav a:hover {
    color: #ff9500;
}

/* Language selector dropdown */
.language-selector {
    position: relative;
    display: none; /* hidden — EN only for now; restore to inline-block when multilingual */
    margin-left: 1.5rem;
}

.lang-current {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #000;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: #000;
    font-family: inherit;
    transition: all 0.2s;
}

.lang-current:hover {
    background: #f0f0f0;
}

.lang-current svg {
    transition: transform 0.2s;
}

.language-selector.open .lang-current svg {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 132px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.language-selector.open .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-dropdown .lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
    margin-left: 0;
    font-weight: 500;
}

.lang-dropdown .lang-option:hover {
    background: #f0f0f0;
    text-decoration: none;
}

.lang-check {
    margin-left: 8px;
    color: #000;
}

.lang-option-current {
    font-weight: 600;
}

/* Home Page */
.home-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    width: 100%;
}

.welcome {
    text-align: center;
    margin-bottom: 4rem;
}

.welcome-title {
    font-size: 2.5rem;
    color: #333;
    font-weight: 800;
    margin-bottom: 1rem;
}

.welcome-text {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 2rem;
}

.search-box {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 1.25rem;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem 1rem 3rem;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: #ff9500;
}

.search-results {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    z-index: 100;
    overflow: hidden;
    text-align: left;
}

.search-result-item {
    display: block;
    padding: 0.875rem 1.25rem;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #fff8f4;
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-result-title {
    font-weight: 500;
}

.search-result-section {
    font-size: 0.8rem;
    color: #999;
    flex-shrink: 0;
    margin-left: 1rem;
}

.search-result-excerpt {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.3rem;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.search-no-results {
    padding: 1rem 1.25rem;
    color: #999;
    margin: 0;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.category-card {
    display: block;
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    cursor: pointer;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.category-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.category-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.category-stats {
    font-size: 0.9rem;
    color: #999;
}

/* Breadcrumbs */
.breadcrumbs {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 1rem 0;
}

.breadcrumbs-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    color: #666;
}

.breadcrumbs a {
    color: #ff9500;
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs span {
    margin: 0 0.5rem;
}

/* Layout */
.layout {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 3rem;
    width: 100%;
}

/* Material Icons — section icons in sidebar and cards */
.sidebar-section-icon {
    font-size: 18px;
    vertical-align: middle;
    color: #999;
    margin-right: 2px;
}

.card-icon {
    font-size: 2rem;
    vertical-align: middle;
    color: #999;
    display: block;
    margin-bottom: 0.5rem;
}

.section-page-icon {
    font-size: 2rem;
    vertical-align: middle;
    color: #999;
    margin-right: 4px;
}

/* Sidebar */
.sidebar {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    height: fit-content;
    position: sticky;
    top: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar details {
    margin-bottom: 0.25rem;
}

.sidebar details summary {
    list-style: none;
    cursor: pointer;
    padding: 0.5rem 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
    border-bottom: 1px solid #f0f0f0;
}

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

.sidebar details summary a {
    color: #555;
    text-decoration: none;
}

.sidebar details[open] > summary a {
    color: #ff9500;
}

.sidebar details ul {
    list-style: none;
    padding: 0.4rem 0 0.4rem 0.75rem;
    border-left: 2px solid #f0f0f0;
    margin: 0.25rem 0 0.5rem 0.25rem;
}

.sidebar details li {
    margin-bottom: 0.4rem;
}

.sidebar details a {
    color: #555;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
    display: block;
    padding: 0.1rem 0;
}

.sidebar details a:hover {
    color: #ff9500;
}

.sidebar a.sidebar-active {
    color: #ff9500;
    font-weight: 600;
}

.sidebar a.sidebar-section-active {
    color: #ff9500;
    font-weight: 700;
}

/* Main Content */
.main-content {
    background: white;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-height: 500px;
}

.main-content h1 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 800;
}

.main-content h2 {
    color: #333;
    margin: 2rem 0 1rem;
    font-size: 1.5rem;
    clear: both;
}

.main-content h3 {
    color: #555;
    margin: 1.5rem 0 1rem;
    font-size: 1.2rem;
    clear: both;
}

.main-content hr {
    clear: both;
}

.main-content h4 {
    color: #666;
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
}

.main-content p {
    margin-bottom: 1rem;
}

.main-content ul, .main-content ol {
    margin: 1rem 0 1rem 2rem;
}

.main-content li {
    margin-bottom: 0.5rem;
}

.main-content a {
    color: #ff9500;
    text-decoration: none;
}

.main-content a:hover {
    text-decoration: underline;
}

.main-content code {
    background: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    word-break: break-all;
    overflow-wrap: break-word;
}

.main-content pre {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1rem 0;
}

/* Article Tiles (section index pages) */
.article-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.article-tile {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.25rem;
    background: #f8f9fa;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid #ff9500;
}

.article-tile:hover {
    background: white;
    box-shadow: 0 3px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.article-tile-title {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.article-tile-desc {
    color: #777;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Callout Boxes */
.callout {
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    margin: 1.25rem 0;
    overflow: hidden;
    font-size: 0.95rem;
    line-height: 1.5;
}

.callout-note {
    background: #e3f2fd;
    border-left: 4px solid #1976d2;
    color: #0d47a1;
}

.callout-warning {
    background: #fff3e0;
    border-left: 4px solid #f57c00;
    color: #bf360c;
}

.callout-tip {
    background: #e8f5e9;
    border-left: 4px solid #388e3c;
    color: #1b5e20;
}

/* Tab Material Icons */
.tab-icon {
    font-size: 18px;
    vertical-align: middle;
    margin-right: 2px;
}

/* Tab Group wrapper — multiple independent tab groups per article */
.tab-group {
    margin: 0;
}

/* Platform Tabs */
.platform-tabs {
    display: flex;
    gap: 0.5rem;
    margin: 1.5rem 0;
    border-bottom: 2px solid #e0e0e0;
}

.platform-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.2s;
}

.platform-tab:hover {
    color: #ff9500;
}

.platform-tab.active {
    border-bottom-color: #ff9500;
    color: #ff9500;
    font-weight: 600;
}

.platform-content {
    display: none;
}

.platform-content.active {
    display: block;
}

/* Screenshot Placeholders */
.screenshot-placeholder {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    padding: 0.875rem 1.25rem;
    background: #f0f4f8;
    border: 1.5px dashed #b0bec5;
    border-radius: 8px;
    color: #546e7a;
    font-size: 0.9rem;
}

.screenshot-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.screenshot-label {
    font-style: italic;
}

/* Float screenshot — narrow (mobile portrait screenshots, ~220px) */
.screenshot-float {
    float: right;
    margin: 0.25rem 0 1.5rem 2rem;
    max-width: 220px;
    clear: right;
    text-align: center;
}

.screenshot-float img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    display: block;
}

.screenshot-float .screenshot-caption {
    margin-top: 0.5rem;
    color: #999;
    font-size: 0.78rem;
    font-style: italic;
}

/* Float screenshot — wide (desktop/landscape screenshots) */
.screenshot-float-wide {
    float: right;
    margin: 0.25rem 0 1.5rem 2rem;
    max-width: 32%;
    clear: right;
    text-align: center;
}

.screenshot-float-wide img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    display: block;
}

.screenshot-float-wide .screenshot-caption {
    margin-top: 0.5rem;
    color: #999;
    font-size: 0.78rem;
    font-style: italic;
}

/* Block screenshot — full-width centered (wide desktop screenshots) */
.screenshot-block {
    display: block;
    margin: 1rem auto 1.5rem;
    max-width: 75%;
    text-align: center;
    clear: both;
}

.screenshot-block img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    display: block;
    margin: 0 auto;
}

.screenshot-block .screenshot-caption {
    margin-top: 0.5rem;
    color: #999;
    font-size: 0.78rem;
    font-style: italic;
}

.screenshot-caption {
    margin-top: 0.5rem;
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

/* Clearfix for sections containing floated screenshots */
.clearfix::after {
    content: '';
    display: table;
    clear: both;
}

/* Article List */
.article-list {
    list-style: none;
    margin: 0;
}

.article-list li {
    background: #f8f9fa;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    border-left: 4px solid #ff9500;
}

.article-list h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
}

.article-list h4 a {
    color: #333;
    text-decoration: none;
}

.article-list h4 a:hover {
    color: #ff9500;
}

.article-list .description {
    color: #666;
    margin-bottom: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge.ready {
    background: #4caf50;
    color: white;
}

.badge.todo {
    background: #ff9800;
    color: white;
}

/* Footer */
.footer {
    background: #2d2d2d;
    color: white;
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer a {
    color: #fcb23b;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .sidebar {
        position: static;
    }

    .main-content {
        padding: 1.5rem;
    }

    .welcome-title {
        font-size: 2rem;
    }

    .categories-grid {
        grid-template-columns: 1fr;
    }

    /* Screenshots: no float on mobile, center as block */
    .screenshot-float {
        float: none;
        max-width: 260px;
        margin: 1rem auto 1.5rem;
        display: block;
    }

    /* Header: compact on small screens */
    .header-logo {
        font-size: 1rem;
    }

    .header-nav a {
        margin-left: 1rem;
        font-size: 0.85rem;
    }

    .language-selector {
        margin-left: 0.75rem;
    }
}