@font-face {
    font-family: "Space Grotesk";
    src: url("fonts/Space_Grotesk.ttf") format("truetype");
    font-weight: 300 700;
    font-display: swap;
}

/* Palette shared with the Publisium dashboard */
:root {
    color-scheme: light;
    --bg: #f7f7f9;
    --panel: #ffffff;
    --panel-alt: #f1f1f4;
    --panel-hover: #e9e9ee;
    --border: #e4e4ea;
    --border-strong: #d3d3dc;
    --text: #17171b;
    --muted: #6a6a76;
    --muted-dim: #9a9aa5;
    --accent: #6c5ce7;
    --accent-hover: #5c4bd6;
    --accent-dim: rgba(108, 92, 231, 0.1);
    --danger: #d93a52;
    --danger-dim: rgba(240, 84, 106, 0.1);
    --success: #1f9d6c;
    --success-dim: rgba(52, 196, 140, 0.14);
    --on-accent: #ffffff;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-card: 0 1px 2px rgba(20, 20, 30, 0.04), 0 6px 16px rgba(20, 20, 30, 0.05);
    --shadow-md: 0 2px 6px rgba(20, 20, 30, 0.05), 0 16px 40px rgba(20, 20, 30, 0.08);
    --inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    --glow: rgba(108, 92, 231, 0.12);
    --focus: 0 0 0 3px rgba(108, 92, 231, 0.3);
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #0a0a0c;
        --panel: #131316;
        --panel-alt: #1a1a1f;
        --panel-hover: #202027;
        --border: #26262d;
        --border-strong: #34343d;
        --text: #f2f2f4;
        --muted: #8f8f9a;
        --muted-dim: #6a6a74;
        --accent: #7c6df2;
        --accent-hover: #9186f6;
        --accent-dim: rgba(124, 109, 242, 0.14);
        --danger: #f0546a;
        --danger-dim: rgba(240, 84, 106, 0.12);
        --success: #34c48c;
        --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 6px 16px rgba(0, 0, 0, 0.22);
        --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.28), 0 16px 40px rgba(0, 0, 0, 0.34);
        --inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
        --glow: rgba(124, 109, 242, 0.16);
        --focus: 0 0 0 3px rgba(124, 109, 242, 0.4);
    }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(900px 420px at 50% -120px, var(--glow), transparent 70%),
        var(--bg);
    background-repeat: no-repeat;
    color: var(--text);
    font: 15px/1.55 "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

main { flex: 1; padding-bottom: 72px; }
a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); }
img { display: block; }
.wrap { width: 100%; max-width: 980px; margin: 0 auto; padding: 0 24px; }

:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--radius-sm); }

/* ---------- Top bar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 10;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--border);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; object-fit: contain; }
nav { display: flex; gap: 2px; }
nav a { padding: 8px 14px; border-radius: var(--radius-sm); color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
nav a:hover { background: var(--panel-alt); color: var(--text); }
nav a[aria-current="page"] { background: var(--accent-dim); color: var(--accent); }

/* ---------- Typography ---------- */
.hero { padding: 56px 0 28px; }
.eyebrow {
    display: inline-flex; align-items: center; gap: 8px;
    margin: 0 0 14px; padding: 5px 12px; border-radius: 999px;
    background: var(--accent-dim); color: var(--accent);
    font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
h1 { margin: 0 0 12px; font-size: clamp(30px, 6vw, 42px); line-height: 1.1; letter-spacing: -.025em; font-weight: 700; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; font-weight: 600; }
h3 { margin: 28px 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.lead { margin: 0; max-width: 58ch; color: var(--muted); font-size: 17px; line-height: 1.6; }
.muted { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

/* ---------- Panels ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow-card), var(--inset);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.badge {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 3px 10px; border-radius: 999px;
    background: var(--success-dim); color: var(--success);
    font-size: 12px; font-weight: 600;
}
.badge-accent { background: var(--accent-dim); color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 20px; }
.stat { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-alt); }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat strong { display: block; margin-top: 2px; font-size: 17px; font-weight: 600; }

.changelog { margin: 0; padding: 0; list-style: none; }
.changelog li { position: relative; padding: 5px 0 5px 20px; color: var(--muted); }
.changelog li::before { content: ""; position: absolute; left: 3px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- Buttons ----------
   Colors are set explicitly for every link state so the global a:hover rule can never hide the label. */
.btn, .btn:link, .btn:visited, .btn:hover, .btn:active {
    color: var(--on-accent);
    text-decoration: none;
}
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 0 22px;
    border: 1px solid transparent; border-radius: var(--radius-sm);
    background: var(--accent);
    font: inherit; font-weight: 600; line-height: 1; cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .18);
    transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 4px 14px var(--accent-dim), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 18px; height: 18px; }

.btn-ghost, .btn-ghost:link, .btn-ghost:visited, .btn-ghost:hover, .btn-ghost:active { color: var(--text); }
.btn-ghost { background: var(--panel); border-color: var(--border-strong); box-shadow: var(--inset); }
.btn-ghost:hover:not(:disabled) { background: var(--panel-alt); box-shadow: var(--inset); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- License form ---------- */
.license-form { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); display: grid; gap: 10px; }
.check {
    display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
    padding: 13px 15px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: var(--panel-alt); transition: border-color .15s, background .15s;
}
.check:hover { border-color: var(--border-strong); }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.license-form .btn { justify-self: start; margin-top: 8px; }

.checksum { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; word-break: break-all; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }

.alert {
    margin-bottom: 16px; padding: 13px 16px; border-radius: var(--radius-sm);
    background: var(--danger-dim); color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

/* ---------- Lists & grids ---------- */
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 13px 2px; border-bottom: 1px solid var(--border); }
.file-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.file-list-inline { margin-top: 8px; }
.file-name { font-weight: 600; color: var(--text); word-break: break-all; }
.file-name:hover { color: var(--accent); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.product {
    display: flex; flex-direction: column; gap: 8px; padding: 22px;
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-card), var(--inset); color: var(--text);
}
a.product { transition: border-color .15s, transform .15s, box-shadow .15s; }
a.product:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md), var(--inset); color: var(--text); }
.product h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.product p { margin: 0; color: var(--muted); font-size: 14px; }
.product .muted { margin-top: auto; padding-top: 10px; }

.icon-tile {
    display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 6px;
    border-radius: 11px; background: var(--accent-dim); color: var(--accent);
}
.icon-tile svg { width: 20px; height: 20px; }

/* ---------- Landing ---------- */
.hero-landing { padding: 88px 0 48px; text-align: center; }
.hero-landing h1 { font-size: clamp(34px, 8vw, 56px); }
.hero-landing .lead { margin-left: auto; margin-right: auto; }
.hero-landing .actions { justify-content: center; margin-top: 34px; }
.features { margin-top: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

/* ---------- Footer ---------- */
.footer {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    padding-top: 22px; padding-bottom: 30px; border-top: 1px solid var(--border);
    color: var(--muted); font-size: 13px;
}
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }

@media (max-width: 560px) {
    .wrap { padding: 0 18px; }
    .hero { padding: 36px 0 20px; }
    .hero-landing { padding: 56px 0 32px; }
    .card { padding: 20px; }
    .actions .btn, .license-form .btn { width: 100%; justify-self: stretch; }
    .lead { font-size: 16px; }
}

/* ---------- Download progress ---------- */
[hidden] { display: none !important; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; }

.dl { margin-top: 6px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel-alt); }
.dl-top { display: flex; align-items: center; gap: 14px; }
.dl-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-text strong { font-weight: 600; }
.dl-icon { display: none; width: 38px; height: 38px; border-radius: 10px; place-items: center; flex: none; }
.dl-icon svg { width: 20px; height: 20px; }
.dl[data-state="busy"] .dl-icon-busy { display: grid; background: var(--accent-dim); color: var(--accent); }
.dl[data-state="done"] .dl-icon-done { display: grid; background: var(--success-dim); color: var(--success); }
.dl[data-state="error"] .dl-icon-error { display: grid; background: var(--danger-dim); color: var(--danger); }
.dl[data-state="done"] { border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.dl[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.dl[data-state="busy"] .dl-icon-busy svg { animation: dl-bob 1.2s ease-in-out infinite; }

.dl-bar { position: relative; height: 8px; margin-top: 14px; overflow: hidden; border-radius: 999px; background: var(--border); }
.dl-bar span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #4fb2e8); transition: width .15s linear; }
.dl[data-state="done"] .dl-bar span { background: var(--success); }
.dl[data-state="error"] .dl-bar span { background: var(--danger); }
.dl-bar.indeterminate span { width: 35%; animation: dl-slide 1.1s ease-in-out infinite; transition: none; }

@keyframes dl-bob { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(2px); } }
@keyframes dl-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@media (prefers-reduced-motion: reduce) {
    .dl-icon svg, .dl-bar span { animation: none !important; }
}
@media (max-width: 560px) {
    .dl-top { flex-wrap: wrap; }
    .license-form .btn-sm { width: auto; }
}

.license-form .dl .btn { margin-top: 0; }
