:root {
    --bg: #0d0d0d;
    --surface: #161616;
    --surface-hover: #1c1c1c;
    --border: #2a2a2a;
    --border-hover: #464646;
    --text: #efefec;
    --text-muted: #8f8f8c;
    --text-dim: #56564f;

    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --radius: 3px;
    --gap: 1px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

a {
    color: inherit;
}

/* ---------- Header ---------- */

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px clamp(20px, 5vw, 64px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.brand-mark {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1em;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.brand-tag {
    font-family: var(--font-mono);
    font-size: 0.8em;
    color: var(--text-dim);
}

.site-nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    padding-bottom: 2px;
    transition: color 0.15s, border-color 0.15s;
}

.nav-link:hover {
    color: var(--text);
    border-color: var(--border-hover);
}

/* ---------- Main ---------- */

main {
    flex: 1;
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 56px clamp(20px, 5vw, 64px) 80px;
}

.lead {
    color: var(--text-muted);
    font-size: 1.05em;
    max-width: 46ch;
    margin-bottom: 40px;
}

/* ---------- Modular tile grid ---------- */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap);
    background: var(--border);
    border: 1px solid var(--border);
}

.tile {
    background: var(--surface);
    padding: 28px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 180px;
    transition: background 0.15s;
}

.tile:hover {
    background: var(--surface-hover);
}

.tile:focus-visible {
    outline: 1px solid var(--text);
    outline-offset: -1px;
}

.tile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tile-index {
    font-family: var(--font-mono);
    font-size: 0.8em;
    color: var(--text-dim);
}

.tile-arrow {
    color: var(--text-dim);
    transition: transform 0.15s, color 0.15s;
}

.tile:hover .tile-arrow {
    color: var(--text);
    transform: translateX(2px);
}

.tile h2, .tile h3 {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 1.15em;
}

.tile p {
    color: var(--text-muted);
    font-size: 0.92em;
}

.tile--wide {
    grid-column: 1 / -1;
}

/* List-style variant used on the downloads page */

.tile-grid--list .tile {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 0;
    padding: 22px 28px;
}

.tile-body h3 {
    margin-bottom: 4px;
}

/* ---------- Buttons ---------- */

.download-btn, .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border-hover);
    padding: 9px 16px;
    border-radius: var(--radius);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.download-btn:hover, .back-btn:hover {
    background: var(--text);
    color: var(--bg);
}

/* ---------- Footer ---------- */

footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px clamp(20px, 5vw, 64px);
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.85em;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
}

footer a:hover {
    color: var(--text);
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
    .site-header {
        padding: 20px;
    }

    main {
        padding: 40px 20px 60px;
    }

    .tile-grid--list .tile {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}
