* {
    box-sizing: border-box;
}

:root {
    --bg: #f7f7f4;
    --surface: #ffffff;
    --surface-muted: #e8ece7;
    --text: #1e2428;
    --muted: #59636a;
    --soft-muted: #6b7378;
    --border: #d9ddd8;
    --card-border: #dde2dd;
    --radius: 8px;
    --font-body: Arial, Helvetica, sans-serif;
    --font-heading: Arial, Helvetica, sans-serif;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
}

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

a:hover {
    text-decoration: underline;
}

.site-header,
.site-main,
.site-footer {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 22px;
    padding: 34px 0 22px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: inline-block;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0;
    font-family: var(--font-heading);
}

.site-header p {
    max-width: 680px;
    margin: 8px 0 0;
    color: var(--muted);
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px 14px;
    font-size: 14px;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
}

.site-nav a:hover {
    color: var(--text);
    text-decoration: underline;
}

.site-main {
    padding: 28px 0 46px;
}

.ad-slot {
    width: 100%;
    margin: 18px auto;
    text-align: center;
    overflow: hidden;
}

.ad-slot-in-article {
    margin: 26px auto;
}

.ad-slot iframe,
.ad-slot img,
.ad-slot object,
.ad-slot embed {
    display: inline-block;
    max-width: 100%;
}

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

.post-card {
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.post-card .thumb {
    display: block;
    aspect-ratio: 16 / 10;
    background: var(--surface-muted);
}

.post-card img,
.hero-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.post-card div {
    padding: 18px;
}

.post-card h2 {
    margin: 4px 0 8px;
    font-size: 21px;
    line-height: 1.25;
    font-family: var(--font-heading);
}

.post-card p {
    margin: 0;
    color: var(--muted);
}

.meta {
    color: var(--soft-muted);
    font-size: 14px;
    margin: 0 0 8px;
}

.article {
    max-width: 780px;
    margin: 0 auto;
}

.article h1 {
    margin: 0 0 18px;
    font-size: 42px;
    line-height: 1.12;
    font-family: var(--font-heading);
}

.hero-image {
    max-height: 460px;
    border-radius: 8px;
    margin: 20px 0 28px;
}

.content {
    font-size: 18px;
}

.content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.content h2,
.content h3 {
    line-height: 1.25;
    margin-top: 30px;
    font-family: var(--font-heading);
}

.pagination {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
}

.pagination a {
    padding: 9px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.empty {
    max-width: 640px;
    margin: 60px auto;
    text-align: center;
}

.site-footer {
    position: relative;
    z-index: 20;
    padding: 22px 0 34px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.site-footer a {
    display: inline-block;
    padding: 8px 10px 8px 0;
    color: var(--text);
    text-decoration: underline;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
}

.legal-page ul {
    padding-left: 22px;
}

.legal-page li {
    margin: 8px 0;
}

.theme-classic {
    --bg: #f7f7f4;
    --surface: #ffffff;
    --surface-muted: #e8ece7;
    --text: #1e2428;
    --muted: #59636a;
    --soft-muted: #6b7378;
    --border: #d9ddd8;
    --card-border: #dde2dd;
    --radius: 8px;
}

.theme-magazine {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-muted: #eef1f4;
    --text: #171717;
    --muted: #51545a;
    --soft-muted: #777b82;
    --border: #202020;
    --card-border: #d7dbe0;
    --radius: 2px;
    --font-heading: Georgia, "Times New Roman", serif;
}

.theme-magazine .site-header {
    border-bottom-width: 3px;
}

.theme-signal {
    --bg: #f3f8f7;
    --surface: #ffffff;
    --surface-muted: #dfeeea;
    --text: #102421;
    --muted: #48615d;
    --soft-muted: #637b76;
    --border: #b9d5cf;
    --card-border: #c4ddd7;
    --radius: 8px;
}

.theme-signal .site-header {
    background: #e8f4f1;
    padding-left: 18px;
    padding-right: 18px;
    border-radius: 8px;
}

.theme-midnight {
    --bg: #101316;
    --surface: #181d22;
    --surface-muted: #252c33;
    --text: #eef2f3;
    --muted: #a5b0b8;
    --soft-muted: #8c98a2;
    --border: #2d343b;
    --card-border: #313942;
    --radius: 8px;
}

.theme-midnight .site-header {
    background: #181d22;
    padding-left: 18px;
    padding-right: 18px;
    border-radius: 8px;
}

.theme-coral {
    --bg: #fff2ed;
    --surface: #fffaf8;
    --surface-muted: #f3d6cc;
    --text: #2a2020;
    --muted: #704f45;
    --soft-muted: #9a6d60;
    --border: #de9b88;
    --card-border: #e5b3a5;
    --radius: 8px;
}

.theme-coral .site-header {
    background: #ffe3da;
    padding-left: 18px;
    padding-right: 18px;
    border-radius: 8px;
}

.theme-coral .post-card {
    box-shadow: 0 8px 24px rgba(139, 68, 45, 0.08);
}

.theme-terminal {
    --bg: #f5f5f5;
    --surface: #fbfbfb;
    --surface-muted: #e2e6e1;
    --text: #111816;
    --muted: #44514d;
    --soft-muted: #65716e;
    --border: #111816;
    --card-border: #111816;
    --radius: 0;
    --font-body: "Courier New", Courier, monospace;
    --font-heading: "Courier New", Courier, monospace;
}

.theme-terminal .post-card,
.theme-terminal .pagination a {
    border-width: 2px;
}

.theme-hero {
    --bg: #f6f8fa;
    --surface: #ffffff;
    --surface-muted: #e7edf2;
    --text: #18212a;
    --muted: #52616e;
    --soft-muted: #72808b;
    --border: #c9d5df;
    --card-border: #d8e0e7;
    --radius: 8px;
}

.theme-hero .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.theme-hero .post-card:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

.theme-hero .post-card:first-child h2 {
    font-size: 30px;
}

.theme-hero .post-card:first-child .thumb {
    aspect-ratio: 16 / 11;
}

.theme-hero .post-card:not(:first-child) h2 {
    font-size: 18px;
}

.theme-newspaper {
    --bg: #fbfaf7;
    --surface: transparent;
    --surface-muted: #e7e2d8;
    --text: #171411;
    --muted: #5a5148;
    --soft-muted: #7c7167;
    --border: #1c1712;
    --card-border: #d5cabd;
    --radius: 0;
    --font-heading: Georgia, "Times New Roman", serif;
}

.theme-newspaper .site-header {
    display: block;
    text-align: center;
    border-bottom: 4px double var(--border);
}

.theme-newspaper .site-nav {
    justify-content: center;
    margin-top: 12px;
}

.theme-newspaper .brand {
    font-size: 42px;
}

.theme-newspaper .grid {
    display: block;
    column-count: 2;
    column-gap: 34px;
}

.theme-newspaper .post-card {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 16px;
    break-inside: avoid;
    margin: 0 0 24px;
    padding-bottom: 20px;
    border-width: 0 0 1px;
    background: transparent;
}

.theme-newspaper .post-card .thumb {
    aspect-ratio: 4 / 3;
}

.theme-newspaper .post-card div {
    padding: 0;
}

.theme-newspaper .post-card h2 {
    font-size: 24px;
}

.theme-compact {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-muted: #e9edf1;
    --text: #17202a;
    --muted: #50606e;
    --soft-muted: #7b8791;
    --border: #ccd5dd;
    --card-border: #d8e0e7;
    --radius: 6px;
}

.theme-compact .site-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 0 16px;
}

.theme-compact .site-header p {
    text-align: right;
}

.theme-compact .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.theme-compact .post-card {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    min-height: 132px;
}

.theme-compact .post-card .thumb {
    aspect-ratio: auto;
    height: 100%;
}

.theme-compact .post-card div {
    padding: 12px 14px;
}

.theme-compact .post-card h2 {
    font-size: 17px;
}

.theme-compact .post-card p:not(.meta) {
    font-size: 14px;
}

.theme-imagewall {
    --bg: #111111;
    --surface: #191919;
    --surface-muted: #252525;
    --text: #f5f5f5;
    --muted: #d7d7d7;
    --soft-muted: #c1c1c1;
    --border: #303030;
    --card-border: #242424;
    --radius: 8px;
}

.theme-imagewall .site-header {
    border-bottom-color: #303030;
}

.theme-imagewall .grid {
    gap: 14px;
}

.theme-imagewall .post-card {
    position: relative;
    min-height: 360px;
    border: 0;
    background: #222222;
}

.theme-imagewall .post-card .thumb {
    height: 100%;
    aspect-ratio: auto;
}

.theme-imagewall .post-card .thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.08) 62%);
    pointer-events: none;
}

.theme-imagewall .post-card div {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 20px;
}

.theme-imagewall .post-card h2 {
    font-size: 22px;
}

.theme-imagewall .post-card p:not(.meta) {
    display: none;
}

.theme-darknews {
    --bg: #0b0f14;
    --surface: #121923;
    --surface-muted: #1d2632;
    --text: #f0f4f8;
    --muted: #aab6c2;
    --soft-muted: #7f8b96;
    --border: #283440;
    --card-border: #263341;
    --radius: 4px;
    --font-heading: Arial, Helvetica, sans-serif;
}

.theme-darknews .site-header {
    background: #121923;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px;
}

.theme-darknews .post-card {
    border-top: 3px solid #4da3ff;
}

.theme-darknews .post-card:first-child {
    border-top-color: #ffcc4d;
}

.theme-tabloid {
    --bg: #ffffff;
    --surface: #ffffff;
    --surface-muted: #f1f1f1;
    --text: #101010;
    --muted: #4d4d4d;
    --soft-muted: #777777;
    --border: #101010;
    --card-border: #101010;
    --radius: 0;
}

.theme-tabloid .site-header {
    background: #101010;
    color: #ffffff;
    padding: 24px;
    border: 0;
}

.theme-tabloid .brand,
.theme-tabloid .site-header p,
.theme-tabloid .site-nav a {
    color: #ffffff;
}

.theme-tabloid .grid {
    gap: 18px;
}

.theme-tabloid .post-card {
    border-width: 3px;
}

.theme-tabloid .post-card h2 {
    font-size: 24px;
    text-transform: uppercase;
}

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

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

    .theme-hero .post-card:first-child {
        grid-column: span 2;
    }

    .theme-newspaper .grid {
        column-count: 1;
    }

    .article h1 {
        font-size: 34px;
    }
}

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

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

    .theme-hero .post-card:first-child {
        grid-column: span 1;
    }

    .theme-newspaper .post-card,
    .theme-compact .post-card {
        display: block;
    }

    .theme-compact .site-header {
        display: block;
    }

    .theme-compact .site-header p {
        text-align: left;
    }

    .site-header {
        display: block;
    }

    .site-nav {
        justify-content: flex-start;
        margin-top: 14px;
    }

    .theme-compact .post-card .thumb {
        aspect-ratio: 16 / 10;
        height: auto;
    }

    .site-header,
    .site-main,
    .site-footer {
        width: min(100% - 22px, 1120px);
    }

    .brand {
        font-size: 24px;
    }

    .article h1 {
        font-size: 29px;
    }
}
