:root {
    color-scheme: dark;
    --bg: #090d12;
    --surface: #101720;
    --surface2: #151e29;
    --text: #f1f5f9;
    --muted: #a9b7c6;
    --line: #243143;
    --blue: #78aefe;
    --red: #e45a52;
    --shadow:
        0 16px 34px
        rgba(0, 0, 0, .18);
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f7fa;
    --surface: #ffffff;
    --surface2: #f8fafc;
    --text: #101721;
    --muted: #5c6c7f;
    --line: #dce4ed;
    --blue: #1852ad;
    --red: #c53a32;
    --shadow:
        0 12px 30px
        rgba(30, 44, 64, .08);
}

* {
    box-sizing: border-box;
}

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

body::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    height: 4px;
    background:
        linear-gradient(
            90deg,
            #fff 0 33.333%,
            #1f5fd1 33.333% 66.666%,
            #d52b1e 66.666%
        );
    z-index: 20;
}

.wrap {
    width:
        min(
            1220px,
            calc(100% - 32px)
        );
    margin: 0 auto;
    padding: 38px 0 52px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content:
        space-between;
    gap: 16px;
    margin-bottom: 48px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand-mark {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--blue);
    box-shadow:
        18px 0 0
        var(--red);
}

.theme-btn,
.filter-btn {
    border:
        1px solid
        var(--line);
    background:
        var(--surface);
    color:
        var(--text);
    font: inherit;
    cursor: pointer;
}

.theme-btn {
    min-height: 40px;
    padding: 0 14px;
    border-radius: 12px;
}

.theme-btn:hover,
.theme-btn:focus-visible,
.filter-btn:hover,
.filter-btn:focus-visible {
    border-color:
        var(--blue);
    outline: none;
}

.hero {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        auto;
    gap: 28px;
    align-items: end;
    margin-bottom: 26px;
}

h1 {
    margin: 0;
    font-size:
        clamp(
            48px,
            7vw,
            84px
        );
    line-height: .94;
    letter-spacing: -.06em;
}

.subtitle {
    max-width: 720px;
    margin: 15px 0 0;
    color: var(--muted);
    font-size: 17px;
    line-height: 1.55;
}

.updated {
    color: var(--muted);
    font-size: 13px;
    padding-bottom: 6px;
    white-space: nowrap;
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.filter-btn {
    border-radius: 999px;
    padding: 8px 12px;
    color: var(--muted);
    font-size: 12px;
}

.filter-btn.active {
    color: var(--text);
    border-color: var(--blue);
    background: var(--surface2);
}

.grid {
    display: grid;
    grid-template-columns:
        repeat(
            3,
            minmax(0, 1fr)
        );
    gap: 18px;
}

.card {
    --accent: var(--blue);

    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 310px;
    padding: 22px;
    border:
        1px solid
        var(--line);
    border-radius: 18px;
    background:
        linear-gradient(
            180deg,
            var(--surface2),
            var(--surface) 34%
        );
    color: inherit;
    text-decoration: none;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition:
        transform .16s ease,
        border-color .16s ease;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background:
        var(--accent);
}

.card:hover,
.card:focus-visible {
    transform:
        translateY(-3px);
    border-color:
        var(--accent);
    outline: none;
}

.card[hidden] {
    display: none;
}

.card[data-category="ИИ"] {
    --accent: #8b7dff;
}

.card[data-category="Роботы"] {
    --accent: #42bda7;
}

.card[data-category="Космос"] {
    --accent: #6c91ff;
}

.card[data-category="Природа"] {
    --accent: #63b76a;
}

.card[data-category="ИТ"] {
    --accent: #4fa3ff;
}

.meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 11px;
}

.category {
    color: var(--accent);
    font-weight: 800;
}

.sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: .55;
}

h2 {
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
    letter-spacing: -.025em;
}

.summary {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.read {
    margin-top: auto;
    padding-top: 20px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
}

.empty {
    grid-column: 1 / -1;
    padding: 32px;
    border:
        1px solid
        var(--line);
    border-radius: 18px;
    background: var(--surface);
    color: var(--muted);
}

footer {
    display: flex;
    justify-content:
        space-between;
    gap: 20px;
    margin-top: 34px;
    padding-top: 20px;
    border-top:
        1px solid
        var(--line);
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );
    }

    .hero {
        grid-template-columns: 1fr;
    }

    .updated {
        padding-bottom: 0;
    }
}

@media (max-width: 620px) {
    .wrap {
        width:
            min(
                calc(100% - 22px),
                1220px
            );
        padding-top: 28px;
    }

    .topbar {
        margin-bottom: 36px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .card {
        min-height: 260px;
    }

    h1 {
        font-size: 54px;
    }

    .subtitle {
        font-size: 15px;
    }

    footer {
        flex-direction: column;
    }
}
