/* ============================================================
   OSArchive – main.css
   Theme: Terminal-meets-editorial | Dark base, green accents
   ============================================================ */

/* ── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Light theme (default) ─────────────────────────────────── */
:root, [data-theme="light"] {
    --bg:        #f5f7fa;
    --bg2:       #ffffff;
    --bg3:       #eef1f6;
    --border:    #dde2ea;
    --border2:   #c8cfd9;
    --text:      #1a2030;
    --text2:     #4a5568;
    --text3:     #8896aa;
    --green:     #1a7f37;
    --green2:    #dcfce7;
    --cyan:      #0369a1;
    --purple:    #6d28d9;
    --orange:    #c2410c;
    --red:       #dc2626;
    --yellow:    #d97706;
    --font-mono: 'Space Mono', 'Courier New', monospace;
    --font-sans: 'Inter', system-ui, sans-serif;
    --radius:    6px;
    --radius-lg: 12px;
    --shadow:    0 4px 24px rgba(0,0,0,0.10);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
    --transition: 0.18s ease;
    --heading:   #111827;
    color-scheme: light;
}

/* ── Dark theme ────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg:        #0d0f11;
    --bg2:       #13171b;
    --bg3:       #1a2028;
    --border:    #232b36;
    --border2:   #2e3a47;
    --text:      #c9d4df;
    --text2:     #8899a6;
    --text3:     #5a6875;
    --green:     #39d353;
    --green2:    #1a6b2e;
    --cyan:      #56d4dd;
    --purple:    #a78bfa;
    --orange:    #fb923c;
    --red:       #f87171;
    --yellow:    #fbbf24;
    --shadow:    0 4px 24px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --heading:   #e8f0f8;
    color-scheme: dark;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background var(--transition), color var(--transition);
}

/* Light-mode specific adjustments */
[data-theme="light"] .site-header { box-shadow: 0 1px 0 var(--border); }
[data-theme="light"] .distro-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.10); }
[data-theme="light"] .hero { background: linear-gradient(135deg, #eef6ff 0%, #f0fdf4 100%); }
[data-theme="light"] .hero::before { background: radial-gradient(ellipse 60% 80% at 70% 50%, rgba(26,127,55,0.07) 0%, transparent 70%); }
[data-theme="light"] .card-screenshot-placeholder { background: linear-gradient(135deg, #eef1f6, #e6f0fc); }
[data-theme="light"] .wiki-content p { color: var(--text2); }
[data-theme="light"] code { background: #eef1f6; color: #0369a1; }
[data-theme="light"] .news-home-card { background: #ffffff; }
[data-theme="light"] .news-home-card:hover { background: #f0fdf4; }
[data-theme="light"] .news-pinned .news-card-inner { background: #f0fdf4; }
[data-theme="light"] .admin-sidebar { background: #f8fafc; }
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group textarea,
[data-theme="light"] .form-group select { background: #fff; color: #1a2030; }
[data-theme="light"] .stat-card { background: #fff; }
[data-theme="light"] .sidebar-card { background: #fff; }
[data-theme="light"] .form-card  { background: #fff; }
[data-theme="light"] .comment    { background: #fff; }
[data-theme="light"] .release-card { background: #fff; }
[data-theme="light"] .search-result { background: #fff; }
[data-theme="light"] .timeline-content { background: #fff; }
[data-theme="light"] mark { background: #dcfce7; color: #166534; }
[data-theme="light"] .flash-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
[data-theme="light"] .flash-error   { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
[data-theme="light"] .flash-info    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
[data-theme="light"] .filter-btn.active { background: #dcfce7; border-color: #86efac; color: #166534; }
[data-theme="light"] .btn-primary { background: #dcfce7; color: #166534; border-color: #86efac; }
[data-theme="light"] .btn-primary:hover { background: #166534; color: #fff; }

/* ── Theme toggle button ───────────────────────────────────── */
.theme-toggle {
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 20px;
    width: 44px;
    height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all var(--transition);
    flex-shrink: 0;
    padding: 0;
    position: relative;
    overflow: hidden;
}
.theme-toggle:hover { border-color: var(--green); }
.theme-icon-light,
.theme-icon-dark  { position: absolute; transition: opacity 0.2s, transform 0.3s; }

/* Light theme: show sun, hide moon */
[data-theme="light"] .theme-icon-light { opacity: 1; transform: translateY(0); }
[data-theme="light"] .theme-icon-dark  { opacity: 0; transform: translateY(4px); }
/* Dark theme: show moon, hide sun */
[data-theme="dark"]  .theme-icon-dark  { opacity: 1; transform: translateY(0); }
[data-theme="dark"]  .theme-icon-light { opacity: 0; transform: translateY(-4px); }

a { color: var(--green); text-decoration: none; }
a:hover { color: var(--cyan); }
img { max-width: 100%; display: block; }

h1, h2, h3, h4, h5 {
    font-family: var(--font-mono);
    color: var(--heading);
    line-height: 1.3;
}

p { margin-bottom: 1rem; }

/* ── Layout ────────────────────────────────────────────────── */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.site-main  { flex: 1; padding-bottom: 80px; }

/* ── Header ────────────────────────────────────────────────── */
.site-header {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(8px);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    padding-top: 14px;
    padding-bottom: 14px;
}
.site-logo {
    display: flex; align-items: center; gap: 10px;
    color: var(--heading);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.site-logo:hover { color: var(--green); }
.logo-penguin { font-size: 1.4rem; }

.site-nav { display: flex; gap: 4px; align-items: center; }
.site-nav a {
    color: var(--text2);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition), background var(--transition);
}
.site-nav a:hover { color: var(--green); background: var(--bg3); }
.site-nav .admin-link { color: var(--orange); }

.header-search {
    margin-left: auto;
    display: flex;
    gap: 0;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    overflow: hidden;
}
.header-search input {
    background: transparent; border: none; outline: none;
    color: var(--text);
    padding: 8px 14px;
    font-size: 0.875rem;
    width: 220px;
    font-family: var(--font-sans);
}
.header-search button {
    background: transparent; border: none;
    color: var(--text2);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 1rem;
    transition: color var(--transition);
}
.header-search button:hover { color: var(--green); }

/* ── Flash messages ────────────────────────────────────────── */
.flash { padding: 12px 0; font-size: 0.875rem; font-weight: 500; }
.flash-success { background: #0d2918; color: var(--green); border-bottom: 1px solid var(--green2); }
.flash-error   { background: #2a1010; color: var(--red);   border-bottom: 1px solid #7f1d1d; }
.flash-info    { background: #0d1f2d; color: var(--cyan);  border-bottom: 1px solid #164e63; }

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
    padding: 72px 0 60px;
    background: linear-gradient(135deg, var(--bg2) 0%, #0a1520 100%);
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 60% 80% at 70% 50%, rgba(57,211,83,0.06) 0%, transparent 70%);
    pointer-events: none;
}
.hero-content { position: relative; z-index: 1; }
.hero-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--green);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 3rem); margin-bottom: 16px; color: var(--heading); }
.hero p   { color: var(--text2); font-size: 1.1rem; max-width: 600px; }

.hero-stats {
    display: flex; gap: 40px; margin-top: 40px;
}
.stat-item { text-align: center; }
.stat-num  { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; color: var(--green); display: block; }
.stat-label{ font-size: 0.8rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; }

/* ── Filters bar ───────────────────────────────────────────── */
.filters-bar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky; top: 57px; z-index: 90;
}
.filters-inner {
    display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.filter-label { font-size: 0.8rem; color: var(--text3); font-family: var(--font-mono); flex-shrink: 0; }

.filter-btn {
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text2);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    font-family: var(--font-sans);
}
.filter-btn:hover, .filter-btn.active {
    background: var(--green2);
    border-color: var(--green);
    color: var(--green);
}

/* ── Distro Grid ───────────────────────────────────────────── */
.section { padding: 48px 0; }
.section-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 28px; gap: 16px;
}
.section-title { font-size: 1.2rem; }
.section-title span { color: var(--green); }

.distro-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.distro-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    display: flex; flex-direction: column;
}
.distro-card:hover {
    border-color: var(--border2);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card-screenshot {
    aspect-ratio: 16/9;
    background: var(--bg3);
    overflow: hidden;
    position: relative;
}
.card-screenshot img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.3s ease;
}
.distro-card:hover .card-screenshot img { transform: scale(1.03); }
.card-screenshot-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
    color: var(--text3);
    background: linear-gradient(135deg, var(--bg3), #0d1520);
}

.card-body { padding: 18px 20px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-name { font-family: var(--font-mono); font-size: 1.05rem; color: var(--heading); }
.card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-desc { color: var(--text2); font-size: 0.875rem; line-height: 1.55; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-footer {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg3);
}
.card-footer-left { font-size: 0.78rem; color: var(--text3); font-family: var(--font-mono); }
.card-footer-right { display: flex; gap: 8px; align-items: center; }

/* ── Badges / Tags ─────────────────────────────────────────── */
.badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
}
.tag {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text2);
    transition: all var(--transition);
}
.tag:hover { color: var(--green); border-color: var(--green); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: var(--radius);
    font-size: 0.875rem; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: all var(--transition);
    border: 1px solid transparent;
    font-family: var(--font-sans);
}
.btn-primary   { background: var(--green2); color: var(--green); border-color: var(--green); }
.btn-primary:hover { background: #1d7a35; color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text2); border-color: var(--border2); }
.btn-secondary:hover { border-color: var(--green); color: var(--green); }
.btn-danger    { background: #2a0f0f; color: var(--red); border-color: #7f1d1d; }
.btn-danger:hover { background: #7f1d1d; color: #fff; }
.btn-sm        { padding: 5px 12px; font-size: 0.8rem; }

/* ── Distro Detail Page ────────────────────────────────────── */
.distro-hero {
    padding: 48px 0 0;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}
.distro-hero-inner { display: grid; grid-template-columns: 1fr 340px; gap: 48px; align-items: start; }
.distro-title-row  { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.distro-name { font-size: 2.4rem; }
.distro-subtitle { color: var(--text2); font-size: 1.05rem; margin-bottom: 20px; }
.distro-tags-row   { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.distro-meta-grid  {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    padding: 20px;
    background: var(--bg3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}
.meta-item .meta-key   { font-size: 0.75rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono); margin-bottom: 2px; }
.meta-item .meta-value { color: var(--text); font-size: 0.9rem; }

.distro-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Tab navigation ────────────────────────────────────────── */
.tab-nav {
    display: flex; gap: 0;
    border-bottom: 1px solid var(--border);
    margin-top: 40px;
}
.tab-nav a {
    padding: 12px 20px;
    color: var(--text2);
    font-size: 0.875rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    margin-bottom: -1px;
}
.tab-nav a:hover { color: var(--text); }
.tab-nav a.active { color: var(--green); border-bottom-color: var(--green); }

.tab-content { padding: 40px 0; }

/* ── Screenshots gallery ───────────────────────────────────── */
.screenshot-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.screenshot-item {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}
.screenshot-item:hover { border-color: var(--green); transform: scale(1.01); }
.screenshot-item img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.screenshot-caption { padding: 8px 12px; font-size: 0.8rem; color: var(--text2); background: var(--bg2); }

/* Lightbox */
.lightbox {
    display: none; position: fixed; inset: 0; z-index: 999;
    background: rgba(0,0,0,0.92);
    align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius); }
.lightbox-close {
    position: absolute; top: 20px; right: 24px;
    background: none; border: none; color: white; font-size: 2rem;
    cursor: pointer; line-height: 1;
}

/* ── Releases ──────────────────────────────────────────────── */
.releases-list { display: flex; flex-direction: column; gap: 20px; }
.release-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 24px;
}
.release-card.is-latest { border-color: var(--green2); }
.release-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.release-version { font-family: var(--font-mono); font-size: 1.1rem; color: var(--heading); }
.release-notes { color: var(--text2); font-size: 0.9rem; margin-bottom: 16px; }
.download-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.download-link {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--text2);
    transition: all var(--transition);
}
.download-link:hover { color: var(--green); border-color: var(--green); }
.download-link .dl-icon { font-size: 0.9rem; }
.download-link .dl-size { color: var(--text3); font-size: 0.75rem; }

/* ── Comments ──────────────────────────────────────────────── */
.comments-section { max-width: 760px; }
.comment {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px; margin-bottom: 16px;
}
.comment.is-reply { margin-left: 40px; border-left: 2px solid var(--green2); }
.comment-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.comment-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--green2); color: var(--green);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-family: var(--font-mono); font-size: 0.85rem;
    flex-shrink: 0;
}
.comment-author { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.comment-date   { font-size: 0.78rem; color: var(--text3); font-family: var(--font-mono); }
.comment-body   { color: var(--text2); font-size: 0.9rem; line-height: 1.65; }

/* ── Comment / Rating Form ─────────────────────────────────── */
.form-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px;
    max-width: 760px;
}
.form-card h3 { margin-bottom: 20px; }
.form-group   { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--text2); font-weight: 500; }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%; padding: 10px 14px;
    background: var(--bg3); border: 1px solid var(--border2);
    border-radius: var(--radius); color: var(--text);
    font-size: 0.9rem; font-family: var(--font-sans);
    outline: none; transition: border-color var(--transition);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--green); }
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Star rating widget */
.star-rating { display: flex; flex-direction: row-reverse; gap: 4px; }
.star-rating input { display: none; }
.star-rating label {
    font-size: 1.6rem; cursor: pointer; color: var(--text3);
    transition: color 0.1s;
}
.star-rating label:hover,
.star-rating label:hover ~ label,
.star-rating input:checked ~ label { color: var(--yellow); }

/* ── Sidebar ───────────────────────────────────────────────── */
.page-with-sidebar { display: grid; grid-template-columns: 1fr 280px; gap: 40px; align-items: start; }
.sidebar-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px;
}
.sidebar-card h4 { font-size: 0.85rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 14px; font-family: var(--font-mono); }

/* ── Rating display ────────────────────────────────────────── */
.rating-display { display: flex; align-items: center; gap: 8px; }
.rating-stars   { color: var(--yellow); font-size: 1.1rem; letter-spacing: 1px; }
.rating-score   { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; color: var(--yellow); }
.rating-count   { font-size: 0.8rem; color: var(--text3); }

/* ── Compare page ──────────────────────────────────────────── */
.compare-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.compare-table th, .compare-table td {
    padding: 14px 18px;
    border: 1px solid var(--border);
    text-align: left;
}
.compare-table th { background: var(--bg3); font-family: var(--font-mono); font-size: 0.8rem; color: var(--text3); text-transform: uppercase; }
.compare-table tr:hover td { background: var(--bg3); }

/* ── Timeline ──────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--border2); }
.timeline-item { position: relative; margin-bottom: 28px; }
.timeline-dot  { position: absolute; left: -29px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--green); border: 2px solid var(--bg); }
.timeline-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text3); margin-bottom: 4px; }
.timeline-content { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; }
.timeline-content h4 { font-size: 0.95rem; margin-bottom: 4px; }
.timeline-content p  { font-size: 0.85rem; color: var(--text2); margin: 0; }

/* ── Tags index ────────────────────────────────────────────── */
.tags-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.tag-pill  {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px;
    background: var(--bg2); border: 1px solid var(--border2);
    border-radius: 20px; font-size: 0.875rem; color: var(--text2);
    transition: all var(--transition);
}
.tag-pill:hover { border-color: var(--green); color: var(--green); }
.tag-pill .count { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text3); }

/* ── Search results ────────────────────────────────────────── */
.search-result {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 16px;
    transition: border-color var(--transition);
}
.search-result:hover { border-color: var(--border2); }
.search-result h3 a { color: var(--heading); font-size: 1.05rem; }
.search-result p { color: var(--text2); font-size: 0.875rem; margin: 8px 0 12px; }
mark { background: var(--green2); color: var(--green); padding: 0 2px; border-radius: 3px; }

/* ── Pagination ────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 40px; }
.page-link {
    padding: 7px 14px; border-radius: var(--radius);
    background: var(--bg2); border: 1px solid var(--border);
    color: var(--text2); font-size: 0.875rem; font-family: var(--font-mono);
    transition: all var(--transition);
}
.page-link:hover, .page-link.current {
    background: var(--green2); border-color: var(--green); color: var(--green);
}

/* ── Admin panel ───────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 57px); }
.admin-sidebar {
    background: var(--bg2); border-right: 1px solid var(--border);
    padding: 28px 0;
}
.admin-sidebar h3 {
    font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em;
    color: var(--text3); padding: 0 20px 10px; font-family: var(--font-mono);
}
.admin-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px; color: var(--text2); font-size: 0.875rem;
    transition: all var(--transition);
}
.admin-nav a:hover, .admin-nav a.active {
    background: var(--bg3); color: var(--green);
    border-left: 2px solid var(--green);
}
.admin-nav a span { font-size: 0.95rem; }
.admin-content { padding: 36px; overflow-x: auto; }
.admin-content h1 { font-size: 1.5rem; margin-bottom: 8px; }
.admin-content .subtitle { color: var(--text2); margin-bottom: 32px; font-size: 0.9rem; }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card {
    background: var(--bg2); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px;
}
.stat-card .num   { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; color: var(--green); }
.stat-card .label { font-size: 0.8rem; color: var(--text3); margin-top: 4px; }

/* Admin table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text3); text-transform: uppercase; background: var(--bg3); }
.data-table tr:hover td { background: var(--bg3); }
.data-table .actions { display: flex; gap: 6px; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer { background: var(--bg2); border-top: 1px solid var(--border); }
.footer-inner {
    display: grid; grid-template-columns: 280px 1fr;
    gap: 60px; padding: 56px 24px;
}
.footer-brand { display: flex; flex-direction: column; gap: 8px; }
.footer-brand .logo-penguin { font-size: 2rem; }
.footer-brand p { font-size: 0.85rem; color: var(--text3); line-height: 1.5; }
.footer-links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px; }
.footer-links h4 { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text3); margin-bottom: 12px; }
.footer-links a  { display: block; color: var(--text2); font-size: 0.875rem; margin-bottom: 8px; transition: color var(--transition); }
.footer-links a:hover { color: var(--green); }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 24px; }
.footer-bottom small { color: var(--text3); font-size: 0.8rem; }

/* ── Prose / wiki content ──────────────────────────────────── */
.wiki-content { color: var(--text); line-height: 1.75; font-size: 0.95rem; }
.wiki-content h2, .wiki-content h3 { margin: 28px 0 12px; color: var(--heading); }
.wiki-content p  { margin-bottom: 1rem; color: var(--text2); }
.wiki-content ul, .wiki-content ol { padding-left: 20px; margin-bottom: 1rem; color: var(--text2); }
.wiki-content li { margin-bottom: 4px; }
.wiki-content code {
    background: var(--bg3); padding: 2px 6px; border-radius: 4px;
    font-family: var(--font-mono); font-size: 0.85em; color: var(--cyan);
}
.wiki-content pre {
    background: var(--bg3); padding: 16px; border-radius: var(--radius);
    overflow-x: auto; margin-bottom: 1rem; border: 1px solid var(--border);
}
.wiki-content pre code { background: none; padding: 0; color: var(--text); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .distro-hero-inner   { grid-template-columns: 1fr; }
    .page-with-sidebar   { grid-template-columns: 1fr; }
    .footer-inner        { grid-template-columns: 1fr; gap: 32px; }
    .footer-links        { grid-template-columns: repeat(2, 1fr); }
    .admin-layout        { grid-template-columns: 1fr; }
    .admin-sidebar       { display: none; }
    .stats-row           { grid-template-columns: repeat(2, 1fr); }
    .hero-stats          { gap: 24px; }
    .form-row            { grid-template-columns: 1fr; }
    .distro-meta-grid    { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .site-nav { display: none; }
    .header-search input { width: 160px; }
    .distro-grid { grid-template-columns: 1fr; }
    .hero { padding: 40px 0 32px; }
}

/* ── Utility ───────────────────────────────────────────────── */
.text-muted   { color: var(--text3); }
.text-green   { color: var(--green); }
.text-mono    { font-family: var(--font-mono); }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-0  { margin-bottom: 0; }
.flex  { display: flex; }
.gap-8 { gap: 8px; }
.gap-12{ gap: 12px; }
.items-center{ align-items: center; }
.justify-between{ justify-content: space-between; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }

/* ── News system ───────────────────────────────────────────── */

/* Category badge (reused in cards and post header) */
.news-cat-badge {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 3px 9px;
    border-radius: 4px;
    white-space: nowrap;
    letter-spacing: 0.04em;
}

/* Full news card (feed page) */
.news-card {
    position: relative;
}
.news-card-inner {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.news-card-inner:hover {
    border-color: var(--border2);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.news-pinned .news-card-inner {
    border-color: var(--green2);
    background: linear-gradient(135deg, var(--bg2) 0%, #0a1a10 100%);
}
.news-pinned .news-card-inner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--green), transparent);
}
.news-pin-ribbon {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--green);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.news-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.news-card-title {
    font-size: 1.15rem;
    margin-bottom: 8px;
    line-height: 1.35;
}
.news-card-title a {
    color: var(--heading);
    transition: color var(--transition);
}
.news-card-title a:hover {
    color: var(--green);
}
.news-card-summary {
    color: var(--text2);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 16px;
}
.news-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* Homepage news strip cards */
.news-home-card {
    display: block;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    color: var(--text);
    text-decoration: none;
    transition: border-color var(--transition), transform var(--transition), background var(--transition);
    position: relative;
    overflow: hidden;
}
.news-home-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--green2), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}
.news-home-card:hover {
    border-color: var(--border2);
    background: #151c24;
    transform: translateY(-2px);
    color: var(--text);
}
.news-home-card:hover::after {
    opacity: 1;
}
.news-home-card h3 {
    font-family: var(--font-mono);
}

/* Single post body */
.news-body {
    max-width: 740px;
}
.news-body p {
    color: var(--text2);
    margin-bottom: 1.1rem;
}
/* Bold within news body via markdown-style **text** – rendered as-is in plain text mode */
.news-body strong {
    color: var(--text);
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .footer-links { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .news-card-title { font-size: 1rem; }
    .news-home-card  { padding: 14px 16px; }
}

/* ── Light-mode fixes for previously hardcoded dark colours ─── */

/* LTS badge (was hardcoded #0d1f2d background) */
.badge-lts {
    background: #0d1f2d22;
    color: var(--cyan);
    border: 1px solid #164e6344;
}
[data-theme="light"] .badge-lts {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

/* Latest release badge */
.badge-latest {
    background: var(--green2);
    color: var(--green);
    border: 1px solid var(--green2);
}

/* Reply comment avatar (was hardcoded #1a2540) */
.comment-avatar-reply {
    background: #1a254022;
    color: var(--purple);
}
[data-theme="light"] .comment-avatar-reply {
    background: #ede9fe;
    color: #6d28d9;
}

/* Success box (submit-news confirmation) */
.success-box {
    background: #0d291822;
    border: 1px solid var(--green2);
    border-radius: 12px;
    padding: 36px;
    text-align: center;
}
[data-theme="light"] .success-box {
    background: #f0fdf4;
}

/* Danger zone box (admin settings) */
.danger-zone {
    background: #1a0a0a;
    border: 1px solid #7f1d1d;
    border-radius: 12px;
    padding: 24px;
}
[data-theme="light"] .danger-zone {
    background: #fff1f2;
    border-color: #fecdd3;
}

/* Super-admin role badge */
.badge-super-admin {
    background: #2d1b4e;
    color: var(--purple);
    border: 1px solid #6d28d9;
}
[data-theme="light"] .badge-super-admin {
    background: #ede9fe;
    color: #6d28d9;
    border-color: #c4b5fd;
}

/* Ensure h1 inside news article uses --heading */
[data-theme="light"] article h1,
[data-theme="light"] .distro-hero h1 {
    color: var(--heading);
}

/* Prev/next nav cards on news page */
.prev-next-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    color: var(--text2);
    font-size: 0.875rem;
    transition: border-color var(--transition);
    display: block;
}
.prev-next-card:hover { border-color: var(--green); color: var(--text2); }
.prev-next-card .nav-label { font-size: 0.75rem; color: var(--text3); margin-bottom: 4px; }
.prev-next-card .nav-title { color: var(--heading); }

/* Data table primary cell text */
[data-theme="light"] .data-table td strong,
[data-theme="light"] .data-table td a { color: var(--heading); }

/* ── 404 suggestion cards ──────────────────────────────────── */
.suggestion-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    display: flex;
    gap: 14px;
    align-items: center;
    transition: border-color var(--transition);
    color: var(--text);
    text-decoration: none;
}
.suggestion-card:hover { border-color: var(--green); color: var(--text); }
.suggestion-card .suggestion-name  { font-weight: 600; color: var(--heading); }
.suggestion-card .suggestion-desc  { font-size: 0.82rem; color: var(--text2); }

/* ── News sidebar category links ───────────────────────────── */
.sidebar-category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text2);
    font-size: 0.875rem;
    transition: color var(--transition);
    text-decoration: none;
}
.sidebar-category-link:hover { color: var(--green); }
