:root {
    color-scheme: light dark;
    --ink: #203038;
    --muted: #687a82;
    --line: #dbe8ea;
    --surface: #ffffff;
    --page-bg: #f6fafb;
    --header-bg: rgba(255, 255, 255, 0.94);
    --brand-ink: #17343e;
    --body-copy: #40515a;
    --soft-blue: #e9f5ff;
    --soft-green: #e8f7ef;
    --blue: #2f8ccf;
    --green: #239b72;
    --green-ink: #1f7a5b;
    --blue-ink: #286d9d;
    --coral: #e96f5a;
    --ad-bg: repeating-linear-gradient(135deg, #f3fbff, #f3fbff 12px, #eef8f1 12px, #eef8f1 24px);
    --ad-border: #a7c7cf;
    --shadow: 0 10px 24px rgba(28, 54, 62, 0.08);
}

:root[data-theme="light"] {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --ink: #eaf5f7;
        --muted: #9fb4bb;
        --line: #2d444b;
        --surface: #15252b;
        --page-bg: #0d181d;
        --header-bg: rgba(16, 29, 34, 0.94);
        --brand-ink: #eaf5f7;
        --body-copy: #c6d5d9;
        --soft-blue: #173245;
        --soft-green: #15382f;
        --blue: #78c7ff;
        --green: #79d7ae;
        --green-ink: #9de8c8;
        --blue-ink: #9ad9ff;
        --coral: #ff9b87;
        --ad-bg: repeating-linear-gradient(135deg, #122832, #122832 12px, #123027 12px, #123027 24px);
        --ad-border: #3b626b;
        --shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
    }
}

:root[data-theme="dark"] {
    --ink: #eaf5f7;
    --muted: #9fb4bb;
    --line: #2d444b;
    --surface: #15252b;
    --page-bg: #0d181d;
    --header-bg: rgba(16, 29, 34, 0.94);
    --brand-ink: #eaf5f7;
    --body-copy: #c6d5d9;
    --soft-blue: #173245;
    --soft-green: #15382f;
    --blue: #78c7ff;
    --green: #79d7ae;
    --green-ink: #9de8c8;
    --blue-ink: #9ad9ff;
    --coral: #ff9b87;
    --ad-bg: repeating-linear-gradient(135deg, #122832, #122832 12px, #123027 12px, #123027 24px);
    --ad-border: #3b626b;
    --shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page-bg);
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--header-bg);
    backdrop-filter: blur(14px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    font-weight: 800;
    color: var(--brand-ink);
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), var(--green));
    color: #ffffff;
}

.main-nav {
    display: flex;
    gap: 4px;
    flex: 1 1 auto;
    overflow-x: auto;
    padding-bottom: 2px;
}

.theme-switcher {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 4px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.theme-switcher button {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
    line-height: 1;
}

.theme-switcher button:hover,
.theme-switcher button:focus,
.theme-switcher button[aria-pressed="true"] {
    background: var(--soft-blue);
    color: var(--blue);
}

.main-nav a {
    flex: 0 0 auto;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 650;
}

.main-nav a:hover,
.main-nav a:focus {
    background: var(--soft-blue);
    color: var(--blue);
}

.page-shell {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 16px 12px 28px;
}

.section-head {
    display: flex;
    gap: 10px;
    align-items: end;
    justify-content: space-between;
    margin: 4px 0 14px;
}

.section-head h1,
.static-page h1 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.15;
}

.section-head span {
    color: var(--muted);
    font-weight: 650;
    white-space: nowrap;
}

.news-card {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.thumb {
    display: grid;
    width: 116px;
    aspect-ratio: 16 / 10;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--soft-blue), var(--soft-green));
    color: var(--green);
    font-size: 2rem;
    font-weight: 900;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.news-body {
    min-width: 0;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    color: var(--muted);
    font-size: 0.82rem;
}

.source-badge {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--soft-green);
    color: var(--green-ink);
    font-weight: 750;
}

.source-badge--niebezpiecznik {
    background: #ffe8ec;
    color: #b33a4a;
}

.source-badge--sekurak {
    background: #fff0d7;
    color: #a35b08;
}

.source-badge--telepolis {
    background: #e8ecff;
    color: #4457bd;
}

:root[data-theme="dark"] .source-badge--niebezpiecznik {
    background: #4a1c25;
    color: #ff9cac;
}

:root[data-theme="dark"] .source-badge--sekurak {
    background: #463015;
    color: #ffc978;
}

:root[data-theme="dark"] .source-badge--telepolis {
    background: #202a55;
    color: #aebaff;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .source-badge--niebezpiecznik {
        background: #4a1c25;
        color: #ff9cac;
    }

    :root:not([data-theme]) .source-badge--sekurak {
        background: #463015;
        color: #ffc978;
    }

    :root:not([data-theme]) .source-badge--telepolis {
        background: #202a55;
        color: #aebaff;
    }
}

.news-card h2 {
    margin: 6px 0;
    font-size: 1rem;
    line-height: 1.25;
}

.news-card h2 a:hover,
.read-more:hover,
.link-list a:hover {
    color: var(--blue);
}

.news-card p {
    margin: 0 0 9px;
    color: var(--body-copy);
    font-size: 0.94rem;
}

.tag-row,
.tag-cloud,
.source-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tag-pill,
.tag-cloud a {
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--soft-blue);
    color: var(--blue-ink);
    font-size: 0.8rem;
    font-weight: 650;
}

.read-more {
    display: inline-block;
    margin-top: 9px;
    color: var(--green);
    font-weight: 750;
}

.latest-sources {
    margin-bottom: 18px;
}

.source-cloud a {
    font-size: 0.82rem;
}

.side-column {
    display: grid;
    gap: 12px;
    align-content: start;
}

.side-box,
.static-page {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.side-box {
    padding: 14px;
}

.side-box h2 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.link-list {
    display: grid;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.link-list li {
    display: grid;
    gap: 3px;
}

.link-list a {
    font-weight: 700;
    line-height: 1.25;
}

.link-list span {
    color: var(--muted);
    font-size: 0.82rem;
}

.ad-box {
    display: grid;
    min-height: 210px;
    place-items: center;
    border: 1px dashed var(--ad-border);
    border-radius: 8px;
    background: var(--ad-bg);
    color: var(--muted);
    font-weight: 750;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 18px 0 0;
}

.pagination a {
    display: grid;
    min-width: 38px;
    min-height: 38px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    font-weight: 750;
}

.pagination a[aria-current="page"] {
    border-color: var(--green);
    background: var(--soft-green);
    color: var(--green);
}

.tag-directory {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.tag-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
}

.tag-shortcuts a {
    display: inline-grid;
    min-width: 30px;
    min-height: 30px;
    place-items: center;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 750;
}

.tag-group {
    display: grid;
    gap: 10px;
    margin-bottom: 22px;
}

.tag-group h2 {
    margin: 0;
    font-size: 1rem;
    color: var(--muted);
}

.tag-directory a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.tag-directory strong {
    color: var(--coral);
}

.pagination--compact a {
    min-width: 32px;
    min-height: 32px;
    font-size: 0.88rem;
}

.static-page {
    padding: 18px;
}

.static-page p {
    color: var(--body-copy);
}

.agent-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 18px;
}

.agent-card {
    display: grid;
    gap: 10px;
    justify-items: center;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(180deg, var(--soft-blue), var(--surface));
    text-align: center;
}

.agent-card img {
    width: min(180px, 70%);
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.agent-card h2 {
    margin: 0;
    font-size: 1.05rem;
}

.agent-card p {
    margin: 0;
}

.empty-state {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
}

.site-footer {
    display: grid;
    gap: 6px;
    padding: 20px 14px 28px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.site-footer strong {
    color: var(--ink);
}

.footer-meta {
    color: var(--muted);
    font-size: 0.88rem;
}

@media (max-width: 520px) {
    .site-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
    }

    .brand {
        grid-column: 1 / -1;
    }

    .brand span:last-child {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .main-nav {
        min-width: 0;
        padding-bottom: 0;
    }

    .main-nav a {
        padding: 7px 8px;
        font-size: 0.88rem;
    }

    .theme-switcher {
        justify-self: end;
        padding: 2px;
    }

    .theme-switcher button {
        width: 28px;
        height: 28px;
    }

    .news-card {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .thumb {
        width: 100%;
        aspect-ratio: 16 / 9;
    }

}

@media (min-width: 860px) {
    .site-header {
        padding: 10px 24px;
    }

    .page-shell {
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 26px;
        padding: 22px 18px 38px;
    }

    .news-card {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 16px;
        padding: 16px 0;
    }

    .thumb {
        width: 220px;
    }

    .news-card h2 {
        font-size: 1.24rem;
    }

    .agent-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tag-directory {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
    }

    .tag-directory a {
        min-height: 56px;
    }

    .tag-shortcuts {
        gap: 8px;
    }

    .tag-shortcuts a {
        min-width: 34px;
        min-height: 34px;
        font-size: 0.9rem;
    }
}
