:root[data-theme="dark"] {
    --bg: #181c23;
    --panel: #232a36;
    --text: #f0f4fa;
    --links: #4db3ff;
    --muted: #b3c2d6;
    --brand: #36a3f5;
    --button: #1a1f29;
    --border: #2a3240;
}

:root[data-theme="light"] {
    --bg: #fffdf8;
    --panel: #ffffff;
    --text: #1c1c1c;
    --links: #0d7bc7;
    --muted: #9e9e9e;
    --brand: #1c93e3;
    --button: #f3f3f3;
    --border: #e0dcdc;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}

a {
    color: var(--links);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
}

b {
    font-weight: 600;
}

p, ul, ol {
    margin-top: 0;
    margin-bottom: 8px;
}

p:last-child {
    margin-bottom: 0;
}

.menu {
    max-width: 916px;
}

.menu a {
    color: var(--text);
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-weight: 400;
}

.menu li.active a,
.menu a:hover {
    background: var(--button);
    border-color: var(--border);
    text-decoration: none;
}

.footer a {
    color: var(--muted);
    font-weight: 400;
}

.pagination a {
    font-weight: 400;
}

.layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.logo {
    border-radius: 16px;
}

:root[data-theme="light"] .logo-invert {
    filter: invert(0);
}

:root[data-theme="dark"] .logo-invert {
    filter: invert(1);
}

.logo-text {
    display: inline-block;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
}

.menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.content {
    padding: 16px 16px 120px 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 948px;
}

.content-body {
    flex: 1 1 auto;
    min-height: 0;
}

.footer {
    position: fixed;
    left: 220px;
    right: 0;
    bottom: 0;
    margin: 16px 16px 0px 16px;
    padding: 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    background: var(--bg);
    z-index: 10;
}

.hero .subtitle {
    margin: 0;
}

h1 {
    font-size: 20px;
}

h2 {
    font-size: 18px;
}

h3 {
    font-size: 17px;
}

h4 {
    font-size: 16px;
}

.publication h1 {
    margin: 0;
}

.channel__head h1 {
    margin: 0;
}

.gallery__head h1 {
    margin: 0;
}

.single h1 {
    margin: 0;
}

.grid, .cards, .gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 450px);
    grid-auto-rows: 1fr;
    justify-content: start;
    gap: 16px;
}

.grid {
    margin: 16px 0 0;
}

.cards, .gallery-grid {
    margin: 16px 0 16px;
}

.cards .card,
.cards .card--feature {
    width: 100%;
    box-sizing: border-box;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card__intro {
    margin: 8px 0 16px 0;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.card--feature {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.card h3 {
    margin: 0px;
    padding: 0px;
}

.card__icon img {
    display: block;
    border-radius: 12px;
}

.card__body h4 {
    margin: 0;
    padding: 0;
}

.card__body p {
    margin: 8px 0 0;
}

.card .button {
    margin-top: auto;
    align-self: flex-start;
}

.card__actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.gallery-image img {
    width: 100%;
    border-radius: 12px;
    display: block;
}

.gallery-image__caption {
    margin-top: 8px;
    font-size: 14px;
    color: var(--muted);
}

.intro {
    margin: 8px 0;
}

.cta-intro {
    margin: 0 0 16px 0;
}

.publication a:hover {
    text-decoration: underline;
}

.button {
    display: inline-block;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--button);
    color: var(--text);
    font-weight: 600;
    text-decoration: none;
}

:root[data-theme="light"] .button:hover {
    filter: brightness(0.95);
}

:root[data-theme="dark"] .button:hover {
    filter: brightness(1.15);
}

.button--primary {
    background: var(--brand);
    border-color: transparent;
    font-weight: 500;
    color: #fff;
}

:root[data-theme="light"] .button.button--primary:hover,
:root[data-theme="dark"] .button.button--primary:hover {
    filter: none;
    text-decoration: none;
}

.footer__inner {
    display: flex;
    gap: 24px;
    justify-content: flex-start;
    align-items: flex-start;
}

.small {
    font-size: 14px;
}

.theme-toggle {
    margin-top: auto;
    display: flex;
    justify-content: start;
    padding-top: 16px;
}

#theme-toggle-btn {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

#theme-toggle-btn:hover {
    background: var(--button);
}

.publications-list {
    display: grid;
    grid-template-columns: repeat(1, 932px);
    grid-auto-rows: 1fr;
    justify-content: start;
    margin: 0;
    gap: 16px;
}

.publication-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    gap: 8px;
    flex-direction: column;
    min-height: 120px;
}

.publication-card h3 {
    margin: 0;
}

.publication-card a {
    color: var(--text);
}

.publication-card p {
    margin: 0;
}

.publication-card a:hover {
    text-decoration: underline;
}

.publication {
    margin: 0;
}

.publication__img {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 16px;
}

.channel__img {
    width: 100%;
    border-radius: 12px;
}

.publication__intro {
    color: var(--muted);
    margin-bottom: 16px;
}

.publication__body {
    margin-top: 16px;
}

.pagination {
    margin: 24px 16px 0;
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 16px;
}

.pagination a {
    color: var(--text);
}

@media (max-width: 1200px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .brand {
        justify-content: flex-start;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .theme-toggle {
        position: absolute;
        top: 0px;
        right: 16px;
        margin-top: 0;
        z-index: 20;
    }

    .menu ul {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px 16px;
    }

    .grid, .cards, .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .publications-list {
        grid-template-columns: repeat(1, 1fr);
        grid-auto-rows: auto;
        margin: 0;
    }

    .content {
        padding-bottom: 24px;
    }

    .footer {
        position: static;
        margin: 24px 0 0;
        padding: 24px 0 0;
    }
}

@media (max-width: 740px) {

    .grid, .cards, .gallery-grid {
        grid-template-columns: 1fr;
    }

    .footer__inner {
        flex-direction: column;
        gap: 16px;
    }
}
