:root {
    color-scheme: light;
    --paper: #f4f5f7;
    --card: #ffffff;
    --ink: #161616;
    --muted: #667085;
    --line: #e6e8ee;
    --accent: #c0392b;
    --accent-ink: #ffffff;
    --footer: #141414;
    --footer-ink: #f5f5f5;
    --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
    --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body.portal[data-theme="gazette"] {
    color-scheme: light;
    --paper: #f6f1e8;
    --card: #fffdf9;
    --ink: #241c14;
    --muted: #7a6a58;
    --line: #e6dccb;
    --accent: #9a6414;
    --accent-ink: #fffdf9;
    --footer: #3a2e22;
    --footer-ink: #f6f1e8;
}

* { box-sizing: border-box; }

body.portal {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }

.sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.site-header {
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.site-bar,
.portal-wrap,
.site-footer-inner {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
}

.site-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 22px 0 14px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    max-width: 100%;
    font-family: var(--serif);
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    text-align: left;
}

.logo img {
    display: block;
    flex: none;
    max-height: 72px;
    width: auto;
}

.logo-name {
    min-width: 0;
    line-height: 1.05;
}

.tagline {
    max-width: 36rem;
    margin: -8px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: left;
}

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(22, 22, 22, 0.46);
}

.search-modal[hidden] { display: none; }

.search-dialog {
    position: relative;
    width: min(560px, 100%);
    padding: 28px;
    background: var(--card);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(22, 22, 22, 0.22);
}

.search-dialog h2 {
    margin: 0 36px 16px 0;
    font-family: var(--serif);
    font-size: 1.6rem;
}

.search-dialog form { display: flex; gap: 8px; }

.search-dialog input {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
}

.search-dialog button[type="submit"] {
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 700;
    padding: 12px 18px;
    cursor: pointer;
}

.search-close {
    position: absolute;
    top: 16px;
    right: 16px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.search-close:hover { color: var(--ink); }

body.search-open { overflow: hidden; }

.share button,
.share a,
.pager a,
.pager span {
    border: 0;
    border-radius: 999px;
    background: var(--ink);
    color: var(--card);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 16px;
    cursor: pointer;
}

.kanal {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 18px;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.kanal a,
.kanal .search-toggle {
    flex: none;
    padding-bottom: 8px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.kanal .search-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.kanal .search-toggle svg { width: 15px; height: 15px; }

.kanal a.is-current,
.kanal a:hover,
.kanal .search-toggle:hover {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.portal-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 36px;
    padding: 28px 0 56px;
}

.block + .block { margin-top: 36px; }

.block > h2,
.sidebar h2,
.share h2 {
    margin: 0 0 16px;
    font-family: var(--serif);
    font-size: 1.35rem;
    line-height: 1.2;
}

.block > h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.block > h2::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--accent);
}

.latest,
.latest-rows,
.section-grid,
.archive-list {
    display: grid;
    gap: 18px;
}

.latest > .latest-rows {
    grid-template-columns: 1fr 1fr;
}

.latest > .latest-rows .story-row {
    grid-template-columns: 108px minmax(0, 1fr);
}

.latest-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

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

.index-button {
    display: inline-flex;
    margin-top: 18px;
    border: 1px solid var(--ink);
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 700;
}

.index-button:hover {
    background: var(--ink);
    color: var(--card);
}

.portal-wrap > .home-categories {
    grid-column: 1 / -1;
}

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

.home-category > h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    font-family: var(--serif);
    font-size: 1.2rem;
    line-height: 1.2;
}

.home-category > h2::before {
    content: "";
    width: 8px;
    height: 8px;
    flex: none;
    background: var(--accent);
}

.home-categories .latest-rows { gap: 12px; }

.home-categories .story-row { grid-template-columns: 120px minmax(0, 1fr); }

.home-categories .story-copy { padding: 10px 12px 12px; }

.home-categories .story h3 { font-size: 0.95rem; }

.story {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.story-media {
    display: block;
    aspect-ratio: 16 / 10;
    background: var(--line);
}

.story-media img,
.story-fallback { width: 100%; height: 100%; object-fit: cover; }

.story-fallback { display: block; background: linear-gradient(160deg, var(--line), var(--paper)); }

.story-copy { padding: 14px 16px 16px; }

.kicker {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.story h3 {
    margin: 0;
    font-family: var(--serif);
    font-size: 1.05rem;
    line-height: 1.3;
}

.story-lead .story-media { aspect-ratio: 16 / 9; }
.story-lead h3 { font-size: 1.85rem; }

.story-row {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr);
    align-items: stretch;
}

.story-row .story-media {
    min-width: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    aspect-ratio: 1;
}

.story-row .story-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.story-copy p { margin: 10px 0 0; color: var(--muted); }
.story time,
.popular time,
.reading > time {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.8rem;
}

.sidebar section {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.sidebar section + section { margin-top: 18px; }

.popular {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: popular;
}

.popular li {
    counter-increment: popular;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 12px;
    align-items: start;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.popular li::before {
    content: counter(popular);
    color: var(--accent);
    font-family: var(--serif);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.popular a { font-weight: 600; line-height: 1.35; }
.popular time { margin-top: 6px; line-height: 1.4; }

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tags a {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.reading h1 {
    margin: 8px 0 0;
    font-family: var(--serif);
    font-size: clamp(2rem, 4vw, 2.8rem);
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.reading figure { margin: 20px 0; }
.reading img { width: 100%; border-radius: 8px; }
.reading figcaption { margin-top: 8px; color: var(--muted); font-size: 0.85rem; }
.reading .deck { font-size: 1.15rem; color: var(--muted); }
.article-body { font-size: 1.05rem; }
.article-body p { margin: 0 0 1em; }

.share { margin-top: 28px; }
.share div { display: flex; flex-wrap: wrap; gap: 8px; }
.share a,
.share button { background: var(--card); color: var(--ink); border: 1px solid var(--line); }

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 22px;
}

.pager span[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.pager .is-disabled { opacity: 0.4; }

.empty { color: var(--muted); }

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

.site-footer a:hover { color: var(--accent); }

.site-footer-inner {
    display: grid;
    gap: 14px;
    padding: 28px 0;
}

.site-footer nav { display: flex; flex-wrap: wrap; gap: 14px; }
.site-footer p { margin: 0; color: var(--muted); }

@media (max-width: 900px) {
    .portal-wrap,
    .latest > .latest-rows,
    .latest-pair,
    .home-categories,
    .section-grid,
    .archive-list { grid-template-columns: 1fr; }
    .portal-wrap > main { order: 1; }
    .portal-wrap > .home-categories { order: 2; }
    .portal-wrap > .sidebar { order: 3; }
    .story-row,
    .home-categories .story-row { grid-template-columns: 112px minmax(0, 1fr); }
}

body.portal[data-theme="gazette"] .site-bar {
    align-items: center;
}

body.portal[data-theme="gazette"] .logo,
body.portal[data-theme="gazette"] .tagline {
    text-align: center;
}

body.portal[data-theme="gazette"] .kanal {
    justify-content: safe center;
    gap: 8px;
    font-size: 0.85rem;
    letter-spacing: 0;
    text-transform: none;
}

body.portal[data-theme="gazette"] .kanal a,
body.portal[data-theme="gazette"] .kanal .search-toggle {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 14px;
    color: var(--ink);
}

body.portal[data-theme="gazette"] .kanal a.is-current,
body.portal[data-theme="gazette"] .kanal a:hover,
body.portal[data-theme="gazette"] .kanal .search-toggle:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

body.portal[data-theme="gazette"][data-page="home"] .portal-wrap {
    grid-template-columns: 1fr;
}

body.portal[data-theme="gazette"][data-page="home"] .sidebar {
    display: none;
}

body.portal[data-theme="gazette"] .story-lead {
    display: grid;
    border: 0;
    background: #000;
}

body.portal[data-theme="gazette"] .story-lead .story-media,
body.portal[data-theme="gazette"] .story-lead .story-copy {
    grid-area: 1 / 1;
}

body.portal[data-theme="gazette"] .story-lead .story-media { aspect-ratio: 16 / 8; }

body.portal[data-theme="gazette"] .story-lead .story-copy {
    align-self: end;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.82));
    color: #fff;
    padding: 64px 28px 24px;
}

body.portal[data-theme="gazette"] .story-lead h3 {
    font-size: clamp(2rem, 4vw, 3.1rem);
}

body.portal[data-theme="gazette"] .story-lead .kicker { color: #e0b15a; }

body.portal[data-theme="gazette"] .story-lead .story-copy p,
body.portal[data-theme="gazette"] .story-lead time {
    color: rgba(255, 255, 255, 0.84);
}

body.portal[data-theme="gazette"] .site-footer p { color: #d9cbb8; }
body.portal[data-theme="gazette"] .site-footer a:hover { color: #e0b15a; }

body.portal[data-theme="gazette"] .latest > .latest-rows .story {
    background: transparent;
    border: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
}

body.portal[data-theme="gazette"] .latest-pair {
    grid-template-columns: 1.35fr 0.85fr;
    align-items: stretch;
}

body.portal[data-theme="gazette"] .latest-pair .story:first-child .story-media { aspect-ratio: 4 / 5; }
body.portal[data-theme="gazette"] .latest-pair .story:last-child .story-media { aspect-ratio: 16 / 10; }

.gazette-strip {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(220px, 0.7fr);
    gap: 32px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.gazette-strip h2 {
    margin: 0 0 12px;
    font-family: var(--serif);
    font-size: 1.15rem;
}

.gazette-strip .popular {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 22px;
}

.gazette-strip .popular li { border-top: 0; padding: 8px 0; }

body.portal[data-theme="gazette"] .home-categories {
    grid-template-columns: 1fr;
    gap: 0;
}

body.portal[data-theme="gazette"] .home-category {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    padding: 22px 0;
    border-top: 1px solid var(--line);
}

body.portal[data-theme="gazette"] .home-category .latest-rows {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.portal[data-theme="gazette"] .home-category .story {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
}

body.portal[data-theme="gazette"] .site-footer-inner { justify-items: center; text-align: center; }
body.portal[data-theme="gazette"] .site-footer nav { justify-content: center; }

@media (max-width: 900px) {
    body.portal[data-theme="gazette"] .latest > .latest-rows,
    body.portal[data-theme="gazette"] .latest-pair,
    body.portal[data-theme="gazette"] .gazette-strip,
    body.portal[data-theme="gazette"] .gazette-strip .popular,
    body.portal[data-theme="gazette"] .home-category,
    body.portal[data-theme="gazette"] .home-category .latest-rows {
        grid-template-columns: 1fr;
    }
}
