:root {
    --color-bg: #f7f7f9;
    --color-surface: #ffffff;
    --color-text: #1e1e24;
    --color-muted: #6b6b76;
    --color-border: #e0e0e6;
    --color-primary: #2c5cf5;
    --color-primary-dark: #1d3fbf;
    --color-success-bg: #e6f6ec;
    --color-success-text: #1a7a3d;
    --color-error-bg: #fce8e8;
    --color-error-text: #a3241f;
    --radius: 8px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; }

/* Public layout (see the ".public-site" design system further below for
   the actual visual styling of the public-facing pages) */

/* Admin layout */
.admin-nav {
    background: #1e1e24;
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.admin-nav__brand { font-weight: 700; }
.admin-nav nav a { color: #d7d9e6; margin-left: 1rem; }
.admin-nav nav a:hover { color: #fff; }

.admin-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Cards / grid (admin dashboard) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}
.stat-card {
    display: block;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    color: inherit;
}
a.stat-card:hover { border-color: var(--color-primary); text-decoration: none; }
.stat-card__value { font-size: 2rem; font-weight: 700; }
.stat-card__label { color: var(--color-muted); }

/* Forms */
.form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin: 1rem 0;
}
.form label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; color: var(--color-muted); }
.form input, .form select, .form textarea {
    font: inherit;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
}
.form textarea { resize: vertical; min-height: 6rem; }
.form button, .btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1rem;
    font: inherit;
    cursor: pointer;
    align-self: flex-start;
}
.form button:hover, .btn:hover { background: var(--color-primary-dark); }
.btn--danger { background: var(--color-error-text); }
.btn--danger:hover { background: #7a1a17; }
.btn--secondary { background: var(--color-muted); }

.btn-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--color-muted);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.btn-x:hover { background: var(--color-error-bg); color: var(--color-error-text); }

.inline-form { display: inline; }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table th, .table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}
.table th { background: #fafafc; font-size: 0.85rem; text-transform: uppercase; color: var(--color-muted); }
.table tr:last-child td { border-bottom: none; }

.pagination { display: flex; align-items: center; gap: 1rem; color: var(--color-muted); }

.status-badge {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}
.status-badge--active { background: var(--color-success-bg); color: var(--color-success-text); }
.status-badge--disabled { background: var(--color-error-bg); color: var(--color-error-text); }

/* Flash messages */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin: 1rem 0;
}
.flash--success { background: var(--color-success-bg); color: var(--color-success-text); }
.flash--error { background: var(--color-error-bg); color: var(--color-error-text); }
.flash ul { margin: 0; padding-left: 1.2rem; }

/* Screenshots */
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin: 1rem 0;
}
.screenshot-grid img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.version-list { margin-top: 0.5rem; }
.version-list .current { font-weight: 600; }

/* ============================================================
   Public site — modern redesign (scoped to body.public-site so
   the admin area keeps its own simpler look untouched)
   ============================================================ */
.public-site {
    --pub-bg: #f6f7fb;
    --pub-surface: #ffffff;
    --pub-text: #14141f;
    --pub-muted: #62626f;
    --pub-border: #e7e8f0;
    --pub-accent: #4f46e5;
    --pub-accent-2: #06b6d4;
    --pub-accent-soft: #eef0fe;
    --pub-radius-lg: 20px;
    --pub-radius-md: 14px;
    --pub-radius-sm: 9px;
    --pub-shadow: 0 1px 2px rgba(20, 20, 31, 0.04), 0 12px 24px -12px rgba(20, 20, 31, 0.12);
    --pub-shadow-hover: 0 4px 10px rgba(20, 20, 31, 0.06), 0 20px 34px -14px rgba(20, 20, 31, 0.18);

    background: var(--pub-bg);
    color: var(--pub-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
    .public-site {
        --pub-bg: #0c0c13;
        --pub-surface: #15151f;
        --pub-text: #f2f2f7;
        --pub-muted: #9797ab;
        --pub-border: #26262f;
        --pub-accent: #818cf8;
        --pub-accent-2: #22d3ee;
        --pub-accent-soft: #1b1b2c;
        --pub-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 24px -12px rgba(0, 0, 0, 0.5);
        --pub-shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.35), 0 20px 34px -14px rgba(0, 0, 0, 0.6);
    }
}

.public-site a { color: var(--pub-accent); }
.public-site h1, .public-site h2, .public-site h3 { letter-spacing: -0.02em; }

/* Nav */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--pub-surface);
    background: color-mix(in srgb, var(--pub-surface) 82%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--pub-border);
}
.site-nav__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.site-nav__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--pub-text) !important;
}
.site-nav__mark {
    display: inline-flex;
    width: 26px;
    height: 26px;
    color: var(--pub-accent);
}
.site-nav__mark svg { width: 100%; height: 100%; }
.site-nav__links a {
    margin-left: 1.5rem;
    color: var(--pub-muted) !important;
    font-size: 0.92rem;
    font-weight: 500;
}
.site-nav__links a:hover { color: var(--pub-text) !important; }

/* Hero */
.hero {
    padding: 4.5rem 1.5rem 3.5rem;
    background: var(--pub-accent-soft);
    background:
        radial-gradient(60% 100% at 15% 0%, color-mix(in srgb, var(--pub-accent) 14%, transparent), transparent 60%),
        radial-gradient(50% 80% at 100% 0%, color-mix(in srgb, var(--pub-accent-2) 12%, transparent), transparent 60%);
}
.hero__inner { max-width: 1120px; margin: 0 auto; }
.hero h1 {
    font-size: clamp(2rem, 4vw, 3.1rem);
    margin: 0.6rem 0 1rem;
    max-width: 18ch;
}
.hero__lede {
    color: var(--pub-muted);
    font-size: 1.1rem;
    max-width: 60ch;
    margin: 0;
}

.eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pub-accent);
}

/* Sections */
.section { max-width: 1120px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.section__head { margin-bottom: 1.5rem; }
.section__head h2 { margin: 0.25rem 0 0; font-size: 1.6rem; }

.page-head { max-width: 1120px; margin: 0 auto; padding: 2.5rem 1.5rem 0; }
.page-head__meta { color: var(--pub-muted); margin: 0.5rem 0 0; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.detail-head h1 { margin: 0.5rem 0 0; font-size: clamp(1.6rem, 3vw, 2.2rem); }

.public-site .breadcrumb { color: var(--pub-muted); font-size: 0.85rem; }
.public-site .breadcrumb a { color: var(--pub-muted); }
.public-site .breadcrumb a:hover { color: var(--pub-accent); }
.public-site .breadcrumb span { margin: 0 0.35rem; }

.empty-note { color: var(--pub-muted); }

/* Category cards */
.cats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.cat-card {
    position: relative;
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--pub-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    color: var(--pub-text) !important;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--pub-shadow-hover); }
.cat-card__icon {
    display: inline-flex;
    width: 42px;
    height: 42px;
    align-items: center;
    justify-content: center;
    border-radius: var(--pub-radius-sm);
    background: var(--pub-accent-soft);
    color: var(--pub-accent);
    margin-bottom: 0.9rem;
}
.cat-card__icon svg { width: 22px; height: 22px; }
.cat-card h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.cat-card p { margin: 0; color: var(--pub-muted); font-size: 0.88rem; }
.cat-card__arrow {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--pub-muted);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.cat-card:hover .cat-card__arrow { opacity: 1; transform: translateX(0); }

/* Software cards */
.sw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}
.sw-card {
    display: block;
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius-lg);
    overflow: hidden;
    box-shadow: var(--pub-shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    color: var(--pub-text) !important;
}
.sw-card:hover { transform: translateY(-3px); box-shadow: var(--pub-shadow-hover); }
.sw-card__thumb {
    position: relative;
    aspect-ratio: 16/10;
    background: var(--pub-accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 0.6rem;
}
.sw-card__thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.sw-card__placeholder { color: var(--pub-accent); opacity: 0.5; width: 46px; height: 46px; }
.sw-card__placeholder svg { width: 100%; height: 100%; }
.sw-card__body { padding: 1rem 1.1rem 1.15rem; }
.sw-card__body h3 { margin: 0 0 0.65rem; font-size: 1.02rem; }
.sw-card__meta { margin: 0; color: var(--pub-muted); font-size: 0.85rem; }

.tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    background: var(--pub-accent-soft);
    color: var(--pub-accent);
}
.tag + .tag { margin-left: 0.35rem; }
.sw-card__thumb .tag {
    position: relative;
    z-index: 1;
    background: var(--pub-surface);
    background: color-mix(in srgb, var(--pub-surface) 88%, transparent);
    backdrop-filter: blur(4px);
}
.tag--windows { background: #e0f2fe; color: #0369a1; }
.tag--linux { background: #fef3c7; color: #92400e; }
.tag--macos { background: #ede9fe; color: #6d28d9; }
.tag--other { background: var(--pub-border); color: var(--pub-muted); }
@media (prefers-color-scheme: dark) {
    .tag--windows { background: #0c2f45; color: #7dd3fc; }
    .tag--linux { background: #3a2a06; color: #fbbf24; }
    .tag--macos { background: #2a1f45; color: #c4b5fd; }
    .tag--other { background: var(--pub-border); color: var(--pub-muted); }
}

/* CTA buttons (public) */
.public-site .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    padding: 0.7rem 1.3rem;
    color: #fff !important;
    background: var(--pub-accent);
    text-decoration: none !important;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    border: none;
    cursor: pointer;
    font: inherit;
}
.public-site .btn svg { width: 18px; height: 18px; }
.public-site .btn--cta {
    background: linear-gradient(135deg, var(--pub-accent), var(--pub-accent-2));
    box-shadow: var(--pub-shadow);
}
.public-site .btn--cta:hover { transform: translateY(-1px); box-shadow: var(--pub-shadow-hover); }
.public-site .btn--ghost {
    background: transparent;
    color: var(--pub-accent) !important;
    border: 1px solid var(--pub-border);
    padding: 0.45rem 0.9rem;
    font-size: 0.88rem;
}
.public-site .btn--ghost:hover { border-color: var(--pub-accent); }

.download-options { display: flex; gap: 0.7rem; flex-wrap: wrap; }

/* Gallery */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.9rem;
}
.gallery__item {
    display: block;
    width: 100%;
    border-radius: var(--pub-radius-md);
    overflow: hidden;
    border: 1px solid var(--pub-border);
    box-shadow: var(--pub-shadow);
    padding: 0;
    background: none;
    font: inherit;
    cursor: zoom-in;
}
.gallery__item img { width: 100%; height: 170px; object-fit: cover; display: block; transition: transform 0.2s ease; }
.gallery__item:hover img { transform: scale(1.03); }

/* Screenshot lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    z-index: 100;
}
.lightbox[hidden] { display: none; }
.lightbox__image {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--pub-radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox__close {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s ease;
}
.lightbox__close:hover { background: rgba(255, 255, 255, 0.25); }

/* Prose */
.prose { color: var(--pub-text); font-size: 1.02rem; line-height: 1.75; max-width: 72ch; }

/* Version list */
.version-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.version-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--pub-surface);
    border: 1px solid var(--pub-border);
    border-radius: var(--pub-radius-md);
    padding: 0.9rem 1.1rem;
    flex-wrap: wrap;
}
.version-list__label { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.version-list__date { display: block; color: var(--pub-muted); font-size: 0.85rem; margin-top: 0.15rem; }

/* Footer */
.public-site .site-footer { border-top: 1px solid var(--pub-border); margin-top: 2rem; }
.site-footer__inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--pub-muted);
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .hero { padding: 3rem 1.25rem 2.5rem; }
    .detail-head { flex-direction: column; }
}
