:root {
    --bg-color: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --border: #e2e8f0;
}

body.dark-theme {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
    --border: #334155;
}


/* ================================
   Global
   ================================ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;

    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

main {
    flex: 1;
}


/* ================================
   Main Container
   ================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}


/* ================================
   Header
   ================================ */

.site-header {
    padding: 50px 0 0;
    border-bottom: 1px solid var(--border);
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
}

.site-header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.site-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}


/* ================================
   Dark Mode Toggle
   ================================ */

.theme-toggle {
    flex-shrink: 0;

    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);

    padding: 8px 16px;
    border-radius: 6px;

    cursor: pointer;
    font-weight: 500;

    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--primary);
}


/* ================================
   Main Site Navigation
   ================================ */

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;

    margin-top: 26px;
    padding-bottom: 0;
}

.nav-link {
    position: relative;

    display: inline-flex;
    align-items: center;

    color: var(--text-muted);
    text-decoration: none;

    font-size: 0.92rem;
    font-weight: 600;

    padding: 9px 14px 11px;
    border-radius: 7px 7px 0 0;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}

.nav-link:hover {
    color: var(--text-main);
    background: var(--bg-color);
}

.nav-link.active {
    color: var(--primary);
    background: var(--card-bg);
}

.nav-link.active::after {
    content: "";

    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 0;

    height: 2px;

    background: var(--primary);
    border-radius: 2px 2px 0 0;
}


/* ================================
   Repository Layout
   ================================ */

.content-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 38px;
    align-items: start;

    padding-top: 40px;
    padding-bottom: 60px;
}


/* ================================
   Repository Sidebar
   ================================ */

.repository-sidebar {
    min-width: 0;
}

.sidebar-search {
    margin-bottom: 30px;
}

.sidebar-label {
    display: block;

    margin-bottom: 8px;

    color: var(--text-muted);

    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-box {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;

    transform: translateY(-50%);

    font-size: 0.85rem;
    opacity: 0.75;

    pointer-events: none;
}

.search-box input {
    width: 100%;

    padding: 9px 10px 9px 32px;

    border: 1px solid var(--border);
    border-radius: 7px;

    background: var(--card-bg);
    color: var(--text-main);

    font-family: inherit;
    font-size: 0.88rem;

    outline: none;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.08);
}


/* ================================
   Sidebar Sections
   ================================ */

.sidebar-section {
    margin-bottom: 32px;
}

.sidebar-heading {
    margin-bottom: 12px;

    color: var(--text-muted);

    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-item {
    display: block;

    padding: 7px 10px;

    border-radius: 6px;

    color: var(--text-muted);
    text-decoration: none;

    font-size: 0.88rem;
    line-height: 1.45;

    transition:
        color 0.2s ease,
        background-color 0.2s ease;
}

.sidebar-item:hover {
    color: var(--text-main);
    background: var(--card-bg);
}

.sidebar-empty {
    padding: 5px 10px;

    color: var(--text-muted);

    font-size: 0.82rem;
    font-style: italic;
}


/* ================================
   Main Repository Content
   ================================ */

.repository-content {
    min-width: 0;
}


/* ================================
   Application / Article Grid
   ================================ */

.app-grid {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    gap: 24px;

    padding-top: 0;
    padding-bottom: 0;
}


/* ================================
   Application Cards
   ================================ */

.app-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;

    padding: 24px;

    min-height: 300px;

    display: flex;
    flex-direction: column;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.app-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;

    gap: 14px;

    margin-bottom: 12px;
}

.app-header h2 {
    font-size: 1.1rem;
    line-height: 1.45;

    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}


/* ================================
   Version Badge
   ================================ */

.badge {
    font-size: 0.75rem;

    background: var(--bg-color);

    padding: 2px 8px;
    border-radius: 99px;

    border: 1px solid var(--border);
    color: var(--text-muted);
}


/* ================================
   Operating System Tag
   ================================ */

.os-tag {
    flex-shrink: 0;

    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);

    line-height: 1.4;
}


/* ================================
   Application Description
   ================================ */

.app-desc {
    color: var(--text-muted);
    margin-bottom: 24px;

    flex-grow: 1;

    font-size: 0.92rem;
    line-height: 1.65;
}


/* ================================
   Application Card Footer
   ================================ */

.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 12px;

    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.app-footer small {
    color: var(--text-main);
    font-size: 0.78rem;
}


/* ================================
   Application Actions
   ================================ */

.app-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ================================
   Download Button
   ================================ */

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: var(--primary);
    color: white;

    text-decoration: none;

    padding: 8px 16px;
    border-radius: 6px;

    font-weight: 500;
    font-size: 0.88rem;

    white-space: nowrap;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.btn-download:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}


/* ================================
   Read Button
   ================================ */

.btn-read {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    background: transparent;
    color: var(--primary);

    border: 1px solid var(--primary);

    text-decoration: none;

    padding: 8px 16px;
    border-radius: 6px;

    font-weight: 500;
    font-size: 0.88rem;

    white-space: nowrap;

    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.btn-read:hover {
    background: var(--primary);
    color: white;
}


/* ================================
   Disabled Button
   ================================ */

.btn-disabled {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-style: italic;
}


/* ================================
   Empty State
   ================================ */

.no-apps {
    grid-column: 1 / -1;

    padding: 40px;

    text-align: center;

    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;

    color: var(--text-muted);
}


/* ================================
   Toast Notification
   ================================ */

.toast {
    position: fixed;

    bottom: 20px;
    right: 20px;

    background: #10b981;
    color: white;

    padding: 12px 24px;
    border-radius: 8px;

    font-size: 0.9rem;

    opacity: 0;
    transform: translateY(20px);

    transition:
        opacity 0.3s ease,
        transform 0.3s ease;

    pointer-events: none;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}


/* ================================
   Pagination
   ================================ */

.pagination {
    display: flex;
    gap: 8px;

    justify-content: center;

    margin: 40px 0;
}

.page-num {
    padding: 8px 14px;

    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-main);

    text-decoration: none;

    border-radius: 6px;

    transition:
        color 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease;
}

.page-num:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.page-num.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}


/* ================================
   Footer
   ================================ */

.site-footer {
    margin-top: 40px;
    padding: 28px 0;

    background: var(--card-bg);
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 24px;
}

.site-footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.footer-nav a {
    color: var(--text-muted);
    text-decoration: none;

    font-size: 0.85rem;
    font-weight: 600;

    padding: 5px 0;

    transition:
        color 0.2s ease;
}

.footer-nav a:hover {
    color: var(--primary);
}

.footer-separator {
    color: var(--border);
    font-size: 0.8rem;
}


/* ================================
   Reading / Detail Pages
   ================================ */

.article-content,
.application-content {
    max-width: 760px;
    margin: 0 auto;
    padding: 56px 20px 80px;
}


/* ================================
   Article Header
   ================================ */

.article-header {
    margin-bottom: 42px;
}

.article-header h2,
.application-header h2 {
    font-size: 2.2rem;
    line-height: 1.25;
    letter-spacing: -0.025em;
    margin-bottom: 14px;
}

.article-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
}


/* ================================
   Article Body
   ================================ */

.article-body,
.application-body {
    color: var(--text-main);

    font-size: 1.08rem;
    line-height: 1.85;
}


/* Paragraphs */

.article-body p,
.application-body p {
    margin-bottom: 1.5rem;
}


/* Headings */

.article-body h2,
.application-body h2 {
    font-size: 1.65rem;
    line-height: 1.35;

    margin-top: 3rem;
    margin-bottom: 1rem;
}

.article-body h3,
.application-body h3 {
    font-size: 1.35rem;
    line-height: 1.4;

    margin-top: 2.5rem;
    margin-bottom: 0.9rem;
}

.article-body h4,
.application-body h4 {
    font-size: 1.15rem;

    margin-top: 2rem;
    margin-bottom: 0.75rem;
}


/* Lists */

.article-body ul,
.article-body ol,
.application-body ul,
.application-body ol {
    margin: 0 0 1.5rem 1.5rem;
}

.article-body li,
.application-body li {
    margin-bottom: 0.6rem;
}


/* Links inside content */

.article-body a,
.application-body a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.article-body a:hover,
.application-body a:hover {
    color: var(--primary-hover);
}


/* Blockquotes */

.article-body blockquote,
.application-body blockquote {
    margin: 2rem 0;
    padding: 1rem 1.5rem;

    border-left: 4px solid var(--primary);

    background: var(--card-bg);
    color: var(--text-muted);
}


/* Images */

.article-body img,
.application-body img {
    display: block;

    max-width: 100%;
    height: auto;

    margin: 2rem auto;

    border-radius: 10px;
}


/* ================================
   Application Header
   ================================ */

.application-header {
    margin-bottom: 28px;
}

.application-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.application-description {
    color: var(--text-muted);

    font-size: 1.05rem;
    line-height: 1.7;

    margin-bottom: 32px;
}


/* ================================
   Application Detail Actions
   ================================ */

.application-actions {
    display: flex;
    align-items: center;

    gap: 10px;

    margin-top: 40px;
    padding-top: 24px;

    border-top: 1px solid var(--border);
}


/* ================================
   CMS Pages
   ================================ */

.page-content {
    max-width: 760px;
    margin: 0 auto;
    padding: 20px 0 80px;
}

.page-header {
    margin-bottom: 36px;
}

.page-header h2 {
    font-size: 2.2rem;
    line-height: 1.25;
    letter-spacing: -0.025em;
    color: var(--text-main);
}


/* ================================
   CMS Page Body
   ================================ */

.page-body {
    color: var(--text-main);
    font-size: 1.08rem;
    line-height: 1.85;
}

.page-body p {
    margin-bottom: 1.5rem;
}

.page-body h2 {
    font-size: 1.65rem;
    line-height: 1.35;
    margin-top: 3rem;
    margin-bottom: 1rem;
}

.page-body h3 {
    font-size: 1.35rem;
    line-height: 1.4;
    margin-top: 2.5rem;
    margin-bottom: 0.9rem;
}

.page-body h4 {
    font-size: 1.15rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}


/* Lists */

.page-body ul,
.page-body ol {
    margin: 0 0 1.5rem 1.5rem;
}

.page-body li {
    margin-bottom: 0.6rem;
}


/* Links */

.page-body a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.page-body a:hover {
    color: var(--primary-hover);
}


/* Images */

.page-body img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 2rem auto;
    border-radius: 10px;
}


/* Blockquotes */

.page-body blockquote {
    margin: 2rem 0;
    padding: 1rem 1.5rem;

    border-left: 4px solid var(--primary);

    background: var(--card-bg);
    color: var(--text-muted);
}


/* ================================
   CMS Page Footer
   ================================ */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    margin-top: 40px;
}

.footer-inner {
    min-height: 90px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}

.footer-copy {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 0.9rem;
}

.footer-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
}

.footer-nav a:hover {
    color: var(--primary);
}


/* ================================
   Welcome / Home Page
   ================================ */

.welcome-section {
    max-width: 850px;
    margin: 0 auto;
    padding: 100px 20px;

    text-align: center;
}

.welcome-section h2 {
    margin-bottom: 18px;
    font-size: 2rem;
    line-height: 1.3;
}

.welcome-section p {
    color: var(--text-muted);
    font-size: 1.08rem;
    line-height: 1.7;
}


/* ================================
   Tablet Layout
   ================================ */

@media (max-width: 1050px) {

    .container {
        max-width: 100%;
    }

    .content-layout {
        grid-template-columns: 190px minmax(0, 1fr);
        gap: 28px;
    }

    .app-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


/* ================================
   Mobile / Small Tablet
   ================================ */

@media (max-width: 760px) {

    .site-header {
        padding-top: 32px;
    }

    .header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .theme-toggle {
        align-self: flex-start;
    }

    .site-header h1 {
        font-size: 1.7rem;
    }


    .main-nav {
        gap: 4px;
        flex-wrap: wrap;

        margin-top: 22px;
    }

    .nav-link {
        padding: 8px 11px 10px;
        font-size: 0.9rem;
    }


    /* Sidebar moves above repository content */

    .content-layout {
        grid-template-columns: 1fr;
        gap: 30px;

        padding-top: 28px;
    }


    .repository-sidebar {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 24px;
    }

    .sidebar-search {
        grid-column: 1 / -1;
        margin-bottom: 0;
    }

    .sidebar-section {
        margin-bottom: 0;
    }


    .app-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .app-card {
        min-height: 0;
        padding: 20px;
    }


    .welcome-section {
        padding: 70px 20px;
    }

    .welcome-section h2 {
        font-size: 1.7rem;
    }


    .footer-content,
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;

        gap: 12px;
    }

    .footer-nav {
        gap: 12px;
    }

}


/* ================================
   Reading Page Responsive Layout
   ================================ */

@media (max-width: 640px) {

    .article-content,
    .application-content {
        padding: 40px 20px 60px;
    }

    .article-header h2,
    .application-header h2 {
        font-size: 1.8rem;
    }

    .article-body,
    .application-body {
        font-size: 1rem;
        line-height: 1.75;
    }

    .article-body h2,
    .application-body h2 {
        font-size: 1.4rem;
    }

    .article-body h3,
    .application-body h3 {
        font-size: 1.2rem;
    }

}


/* ================================
   Very Small Screens
   ================================ */

@media (max-width: 480px) {

    .container {
        padding: 0 16px;
    }

    .repository-sidebar {
        display: block;
    }

    .sidebar-search {
        margin-bottom: 28px;
    }

    .sidebar-section {
        margin-bottom: 28px;
    }

    .app-footer {
        align-items: flex-start;
    }

    .app-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .btn-read,
    .btn-download {
        padding: 7px 12px;
        font-size: 0.82rem;
    }

}

/* ================================
   Homepage Profile Image
   ================================ */

.profile-image {
    width: 80px;
    height: 80px;

    display: block;
    margin: 0 auto 22px;

    object-fit: cover;

    border-radius: 50%;
    border: 1px solid var(--border);

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ================================
   Search Results
   ================================ */

.search-heading {
    margin-bottom: 24px;
}

.search-heading h2 {
    font-size: 1.35rem;
    line-height: 1.4;
    color: var(--text-main);
}

.sidebar-links a {
    display: block;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    transition: color 0.2s ease;
}

.sidebar-links a:hover {
    color: var(--accent);
    text-decoration: none;
}



