:root {
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --bg: #ffffff;
    --soft: #f3f4f6;
    --accent: #c8102e;
    --accent-dark: #9d0d24;
    --wrap: 1180px;
    --radius: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--ink);
    background: var(--soft);
    line-height: 1.55;
}

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

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }
.main { padding-top: 1.25rem; padding-bottom: 1rem; }

/* Top bar */
.topbar { background: #111; color: #d1d5db; font-size: .78rem; }
.topbar .wrap { display: flex; justify-content: space-between; gap: 1rem; padding-top: .45rem; padding-bottom: .45rem; }
.topbar a:hover { color: #fff; }

/* Masthead */
.masthead { background: var(--bg); }
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 1rem; padding-bottom: 1rem; }
.brand { font-size: 1.9rem; font-weight: 900; letter-spacing: -.03em; line-height: 1; border-left: 7px solid var(--accent); padding-left: .65rem; }
.brand:hover { color: var(--ink); }

.search { display: flex; }
.search input { width: 240px; padding: .5rem .8rem; border: 1px solid var(--line); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); font: inherit; font-size: .9rem; background: var(--bg); color: var(--ink); }
.search button { padding: .5rem .9rem; border: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--accent); color: #fff; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
.search button:hover { background: var(--accent-dark); }

/* Main navigation */
.mainnav { position: sticky; top: 0; z-index: 50; background: var(--bg); border-top: 1px solid var(--line); border-bottom: 3px solid var(--accent); }
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.menu > li { position: relative; }
.mainnav .menu a { display: block; padding: .8rem .95rem; font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); }
.mainnav .menu a:hover, .mainnav .menu a.active { color: var(--accent); }

.submenu { display: none; position: absolute; top: 100%; left: 0; z-index: 60; min-width: 200px; margin: 0; padding: .35rem 0; list-style: none; background: var(--bg); border: 1px solid var(--line); border-top: 3px solid var(--accent); box-shadow: 0 10px 28px rgba(0, 0, 0, .12); }
.has-children:hover > .submenu, .has-children:focus-within > .submenu { display: block; }
.mainnav .submenu a { padding: .55rem 1rem; text-transform: none; font-size: .88rem; font-weight: 600; letter-spacing: 0; white-space: nowrap; }

/* Section headings and panels */
.panel { background: var(--bg); padding: 1rem 1.15rem; border-radius: var(--radius); margin-bottom: 1.25rem; }
.section-title { display: flex; align-items: center; gap: .55rem; margin: 0 0 .3rem; padding-bottom: .5rem; font-size: 1rem; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--ink); }
.section-title::before { content: ""; width: .6rem; height: 1.05rem; background: var(--accent); }

.label { display: inline-block; padding: .15rem .5rem; border-radius: 3px; background: var(--accent); color: #fff; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; line-height: 1.4; }
a.label:hover { background: var(--accent-dark); color: #fff; }

/* Layout grid */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }

/* Hero */
.hero { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 4px; margin-bottom: 1.5rem; border-radius: var(--radius); overflow: hidden; background: #000; }
.hero-item { position: relative; display: block; min-height: 210px; overflow: hidden; color: #fff; background: linear-gradient(135deg, #1f2937, #0b0f19); }
.hero-item:hover { color: #fff; }
.hero-main { grid-row: 1 / span 2; min-height: 430px; }
.hero-item img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.hero-item:hover img { transform: scale(1.04); }
.hero-item::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .88), rgba(0, 0, 0, .05) 65%); }
.hero-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 1rem 1.15rem; }
.hero h2 { margin: .45rem 0 .3rem; font-size: 1.05rem; line-height: 1.25; font-weight: 800; }
.hero-main h2 { font-size: clamp(1.4rem, 3vw, 2.15rem); }
.hero-meta { font-size: .75rem; color: #d1d5db; }

/* Story rows */
.story { display: grid; grid-template-columns: 260px 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.story:last-of-type { border-bottom: 0; }
.story-thumb { display: block; aspect-ratio: 2 / 1; overflow: hidden; border-radius: 4px; background: var(--soft); }
.story-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ph { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 2.4rem; font-weight: 900; color: #9ca3af; background: linear-gradient(135deg, #e5e7eb, #f3f4f6); }
.story-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .65rem; margin-bottom: .35rem; font-size: .76rem; color: var(--muted); }
.story h3 { margin: 0 0 .35rem; font-size: 1.15rem; line-height: 1.3; font-weight: 800; }
.story p { margin: 0; font-size: .93rem; color: #374151; }
.empty { color: var(--muted); padding: 1rem 0; }

/* Sidebar */
.popular { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.popular li { counter-increment: rank; display: flex; gap: .7rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.popular li:last-child { border-bottom: 0; }
.popular li::before { content: counter(rank); flex: 0 0 1.5rem; font-size: 1.45rem; font-weight: 900; line-height: 1.1; color: var(--accent); }
.popular a { font-size: .92rem; font-weight: 700; line-height: 1.35; }

.timeline { list-style: none; margin: .8rem 0 0; padding: 0 0 0 .9rem; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 .95rem .8rem; }
.timeline li::before { content: ""; position: absolute; left: calc(-.9rem - 5px); top: .3rem; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline time { display: block; font-size: .72rem; font-weight: 800; color: var(--accent); }
.timeline a { font-size: .9rem; font-weight: 600; line-height: 1.35; }

.catlist { list-style: none; margin: 0; padding: 0; }
.catlist a { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; font-weight: 700; }
.catlist li:last-child a { border-bottom: 0; }
.catlist .count { color: var(--muted); font-weight: 500; }

/* Pager */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 1rem; font-size: .88rem; color: var(--muted); }
.pager .btn { padding: .5rem 1rem; border-radius: 4px; background: var(--ink); color: #fff; font-weight: 700; }
.pager a.btn:hover { background: var(--accent); color: #fff; }
.pager .btn.disabled { background: var(--line); color: #9ca3af; }

/* Article and page */
.article { padding: 1.4rem 1.5rem; border-radius: var(--radius); background: var(--bg); }
.crumbs { margin-bottom: .6rem; font-size: .8rem; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.article h1 { margin: .5rem 0 .65rem; font-size: clamp(1.65rem, 4vw, 2.45rem); line-height: 1.17; font-weight: 900; letter-spacing: -.015em; }
.byline { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-bottom: 1rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.byline strong { color: var(--ink); }
.article-figure { margin: 0 0 1.1rem; }
.article-figure img { display: block; width: 100%; border-radius: 4px; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 1.2rem; font-size: .8rem; }
.share a { padding: .35rem .8rem; border-radius: 999px; color: #fff; font-weight: 700; }
.share a:hover { color: #fff; opacity: .88; }
.share .wa { background: #25d366; }
.share .fb { background: #1877f2; }
.share .x { background: #111; }

.prose { font-size: 1.08rem; line-height: 1.78; color: #1f2937; overflow-wrap: anywhere; }
.prose h2 { margin: 1.8rem 0 .6rem; font-size: 1.5rem; line-height: 1.25; }
.prose h3 { margin: 1.5rem 0 .5rem; font-size: 1.25rem; line-height: 1.3; }
.prose p { margin: 0 0 1.1rem; }
.prose a { color: var(--accent); text-decoration: underline; }
.prose img { display: block; margin: 1.2rem auto; border-radius: 4px; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1.1rem; }
.prose blockquote { margin: 1.3rem 0; padding: .5rem 1rem; border-left: 4px solid var(--accent); background: var(--soft); color: #374151; }
.prose pre { overflow-x: auto; padding: 1rem; border-radius: 6px; background: #111827; color: #f9fafb; font-size: .9rem; }
.prose code { font-size: .92em; }
.prose .ql-align-center { text-align: center; }
.prose .ql-align-right { text-align: right; }
.prose .ql-align-justify { text-align: justify; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: 1.6rem; }
.gallery img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 4px; }

.tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.6rem; font-size: .85rem; }
.tags a { padding: .25rem .7rem; border-radius: 999px; background: var(--soft); font-weight: 600; }
.tags a:hover { background: var(--accent); color: #fff; }

.related-title { margin-top: 2rem; }
.related { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: .8rem; }
.mini { display: block; }
.mini-thumb { display: block; aspect-ratio: 3 / 2; margin-bottom: .45rem; overflow: hidden; border-radius: 4px; background: var(--soft); }
.mini-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mini-title { font-size: .9rem; font-weight: 700; line-height: 1.3; }

.draft-notice { padding: .5rem .75rem; border: 1px solid #fcd34d; border-radius: 6px; background: #fef3c7; font-size: .85rem; }

/* Footer */
.footer { margin-top: 2rem; background: #111; color: #9ca3af; font-size: .88rem; }
.footer .wrap { padding-top: 1.6rem; padding-bottom: 1.6rem; }
.footer .menu { gap: .5rem 1.3rem; }
.footer .menu a { color: #d1d5db; font-size: .88rem; }
.footer .menu a:hover { color: #fff; }
.footer .copy { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #1f2937; }

/* Tablet and phone */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .hero { grid-template-columns: 1fr; grid-template-rows: auto; }
    .hero-main { grid-row: auto; min-height: 300px; }
}

@media (max-width: 760px) {
    .masthead .wrap { flex-wrap: wrap; }
    .search { width: 100%; }
    .search input { flex: 1; width: auto; }
    .mainnav .menu { flex-wrap: nowrap; overflow-x: auto; }
    .mainnav .menu a { white-space: nowrap; }
    .submenu { display: none !important; }
}

@media (max-width: 640px) {
    .story { grid-template-columns: 112px 1fr; gap: .75rem; }
    .story p { display: none; }
    .story h3 { font-size: 1rem; }
    .related { grid-template-columns: 1fr; }
    .article { padding: 1.1rem; }
}

.brand-block { display: flex; flex-direction: column; gap: .3rem; }
.brand.has-logo { border-left: 0; padding-left: 0; }
.brand img { display: block; height: 46px; width: auto; max-width: 280px; }
.tagline { font-size: .78rem; color: var(--muted); }
