/* ============================================================================
   Design tokens — ported from the reference site's CSS variables so light/
   dark mode and the primary color match exactly.
   ============================================================================ */

:root {
  --background: #ffffff;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --foreground: #14181f;
  --foreground-muted: #5b6472;
  --border: #e6e8ec;
  --primary: #1d4ed8;
  --primary-hover: #1a43bd;
  --primary-foreground: #ffffff;
  --accent-breaking: #dc2626;
  --accent-live: #2563eb;
  --radius-card: 0.875rem;
  --shadow-card: 0 1px 2px rgba(20, 24, 31, 0.04), 0 8px 24px -12px rgba(20, 24, 31, 0.12);
}

:root[data-theme="dark"] {
  --background: #0b0d12;
  --surface: #12151c;
  --surface-muted: #171b23;
  --foreground: #eef1f6;
  --foreground-muted: #9aa3b2;
  --border: #23272f;
  --primary: #4c7cf0;
  --primary-hover: #6690f2;
  --primary-foreground: #0b0d12;
  --accent-breaking: #f04b4b;
  --accent-live: #4c8ff0;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #0b0d12;
    --surface: #12151c;
    --surface-muted: #171b23;
    --foreground: #eef1f6;
    --foreground-muted: #9aa3b2;
    --border: #23272f;
    --primary: #4c7cf0;
    --primary-hover: #6690f2;
    --primary-foreground: #0b0d12;
    --accent-breaking: #f04b4b;
    --accent-live: #4c8ff0;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px -12px rgba(0, 0, 0, 0.5);
  }
}

/* ============================================================================
   Reset + base
   ============================================================================ */

* { box-sizing: border-box; }
* { border-color: var(--border); }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: 'Noto Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
::selection { background: var(--primary); color: var(--primary-foreground); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.container {
  width: 100%;
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; -ms-overflow-style: none; }

/* ============================================================================
   Buttons, badges, forms, alerts (shared with admin)
   ============================================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: .6rem; border: 1px solid transparent;
  font-weight: 600; font-size: .9rem; transition: background-color .15s, color .15s, border-color .15s;
  background: var(--surface-muted); color: var(--foreground);
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { background: var(--surface-muted); }
.btn-danger { background: transparent; border-color: var(--accent-breaking); color: var(--accent-breaking); }
.btn-danger:hover { background: var(--accent-breaking); color: #fff; }
.btn-sm { padding: .4rem .75rem; font-size: .8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .55rem;
  border-radius: .4rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
}
.badge-breaking { background: color-mix(in srgb, var(--accent-live) 12%, transparent); color: var(--accent-live); }
.badge-breaking .dot { width: .4rem; height: .4rem; border-radius: 50%; background: var(--accent-live); animation: pulse 1.6s ease-in-out infinite; }
.badge-category { color: #fff; }
.badge-status { text-transform: none; letter-spacing: 0; }
.badge-status-published { background: color-mix(in srgb, #16a34a 15%, transparent); color: #16a34a; }
.badge-status-draft { background: var(--surface-muted); color: var(--foreground-muted); }
.badge-status-scheduled { background: color-mix(in srgb, #d97706 15%, transparent); color: #d97706; }
.badge-status-archived { background: color-mix(in srgb, #6b7280 15%, transparent); color: #6b7280; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.alert { padding: .8rem 1rem; border-radius: .6rem; font-size: .9rem; margin-bottom: 1rem; border: 1px solid transparent; }
.alert-success { background: color-mix(in srgb, #16a34a 12%, transparent); color: #16a34a; border-color: color-mix(in srgb, #16a34a 30%, transparent); }
.alert-error { background: color-mix(in srgb, var(--accent-breaking) 12%, transparent); color: var(--accent-breaking); border-color: color-mix(in srgb, var(--accent-breaking) 30%, transparent); }
.alert-info { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }

.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .4rem; color: var(--foreground); }
.form-hint { font-size: .78rem; color: var(--foreground-muted); margin-top: .3rem; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .6rem .75rem; border-radius: .55rem; border: 1px solid var(--border);
  background: var(--surface); color: var(--foreground); font-size: .9rem;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.form-textarea { min-height: 7rem; resize: vertical; }
.form-check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }

/* ============================================================================
   Header / nav
   ============================================================================ */

.site-header {
  position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px);
}
.site-header__inner { display: flex; align-items: center; gap: .75rem; height: 3.5rem; }
.logo img { height: 2.25rem; width: auto; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}

.main-nav { display: none; flex: 1; align-items: center; gap: .2rem; overflow-x: auto; }
.main-nav a {
  white-space: nowrap; padding: .4rem .6rem; border-radius: .4rem; font-size: .875rem;
  font-weight: 500; color: var(--foreground-muted); transition: background-color .15s, color .15s;
}
.main-nav a:hover, .main-nav a.is-active { background: var(--surface-muted); color: var(--foreground); }

.header-actions { display: flex; align-items: center; gap: .1rem; margin-left: auto; }
.header-date { display: none; font-size: .75rem; color: var(--foreground-muted); font-variant-numeric: tabular-nums; margin-right: .4rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem;
  border-radius: .5rem; color: var(--foreground-muted); background: transparent; border: none;
}
.icon-btn:hover { background: var(--surface-muted); color: var(--foreground); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }

.mobile-menu-btn { display: inline-flex; }

@media (min-width: 1024px) {
  .main-nav { display: flex; }
  .header-date { display: inline; }
  .mobile-menu-btn { display: none; }
}

/* Mobile drawer */
.mobile-menu-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.mobile-menu-overlay.is-open { opacity: 1; pointer-events: auto; }
.mobile-menu {
  position: fixed; top: 0; left: 0; bottom: 0; width: 17rem; max-width: 85vw; background: var(--surface);
  z-index: 51; transform: translateX(-100%); transition: transform .25s ease; padding: 1rem; overflow-y: auto;
  border-right: 1px solid var(--border);
}
.mobile-menu.is-open { transform: translateX(0); }
.mobile-menu a { display: block; padding: .6rem .5rem; border-radius: .5rem; color: var(--foreground); font-weight: 500; }
.mobile-menu a:hover { background: var(--surface-muted); }
.mobile-menu__close { margin-bottom: .5rem; }

/* Breaking bar */
.breaking-bar { background: var(--accent-live); color: #fff; }
.breaking-bar__inner { display: flex; align-items: center; gap: .75rem; height: 2.25rem; }
.breaking-bar__label { flex-shrink: 0; font-size: .72rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.breaking-bar__viewport { flex: 1; overflow: hidden; }
.breaking-bar__track { display: inline-flex; white-space: nowrap; animation: marquee 26s linear infinite; }
.breaking-bar__track:hover { animation-play-state: paused; }
.breaking-bar__track a { color: #fff; font-size: .82rem; font-weight: 600; padding: 0 1.5rem; opacity: .95; }
.breaking-bar__track a:hover { text-decoration: underline; }

@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ============================================================================
   Sections / headings
   ============================================================================ */

.section { padding: 2rem 0; }
.section__header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.1rem; gap: 1rem; }
.section-title { font-size: 1.15rem; font-weight: 800; display: flex; align-items: center; gap: .5rem; }
.section-title .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--primary); }
.section__link { font-size: .82rem; font-weight: 600; color: var(--primary); white-space: nowrap; }
.section__link:hover { text-decoration: underline; }

/* ============================================================================
   Image wrapper + fallback
   ============================================================================ */

.img-wrap { position: relative; overflow: hidden; border-radius: var(--radius-card); background: var(--surface-muted); }
.img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.img-wrap.is-hoverable:hover img { transform: scale(1.05); }
.ratio-16-10 { aspect-ratio: 16 / 10; }
.ratio-16-9 { aspect-ratio: 16 / 9; }
.ratio-4-3 { aspect-ratio: 4 / 3; }
.ratio-square { aspect-ratio: 1 / 1; }

.img-fallback {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  padding: .5rem; text-align: center; color: #fff; font-weight: 700; font-size: .95rem;
  background: linear-gradient(135deg, var(--fallback-color, var(--primary)), color-mix(in srgb, var(--fallback-color, var(--primary)) 60%, #000));
}

/* ============================================================================
   Article cards
   ============================================================================ */

.hero-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .hero-grid { grid-template-columns: 3fr 2fr; } }

.card-hero-main { display: block; position: relative; border-radius: var(--radius-card); overflow: hidden; height: 100%; }
.card-hero-main .img-wrap { height: 100%; }
.card-hero-main__overlay {
  position: absolute; inset-inline: 0; bottom: 0; padding: .75rem 1rem;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
}
.card-hero-main__title { color: #fff; font-weight: 700; font-size: 1.05rem; line-height: 1.35; }
@media (min-width: 640px) { .card-hero-main__title { font-size: 1.2rem; } }

.hero-sub-list { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) and (max-width: 1023px) { .hero-sub-list { grid-template-columns: 1fr 1fr; } }
.card-hero-sub { display: flex; gap: .75rem; align-items: flex-start; }
.card-hero-sub .img-wrap { width: 5.5rem; height: 5.5rem; flex-shrink: 0; border-radius: .6rem; }
.card-hero-sub__title { font-size: .92rem; font-weight: 600; line-height: 1.35; }
.card-hero-sub:hover .card-hero-sub__title { color: var(--primary); }

.card-horizontal {
  display: flex; gap: 1rem; border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-card); padding: .85rem; transition: box-shadow .15s;
}
.card-horizontal:hover { box-shadow: var(--shadow-card); }
.card-horizontal .img-wrap { width: 8rem; flex-shrink: 0; border-radius: .6rem; aspect-ratio: 4/3; }
.card-horizontal__title { font-size: 1.02rem; font-weight: 700; line-height: 1.35; }
.card-horizontal:hover .card-horizontal__title { color: var(--primary); }
.card-horizontal__excerpt { margin-top: .3rem; font-size: .85rem; color: var(--foreground-muted); }

.card-grid-item__title { font-size: 1rem; font-weight: 700; line-height: 1.35; margin-top: .7rem; }
.card-grid-item:hover .card-grid-item__title { color: var(--primary); }

.card-compact { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; }
.card-compact__rank { width: 1.5rem; flex-shrink: 0; text-align: center; font-size: 1.05rem; font-weight: 800; color: color-mix(in srgb, var(--foreground-muted) 55%, transparent); }
.card-compact__rank.is-top { color: var(--primary); }
.card-compact__title { font-size: .88rem; font-weight: 600; line-height: 1.35; }
.card-compact:hover .card-compact__title { color: var(--primary); }

.meta { display: flex; align-items: center; gap: .4rem; font-size: .74rem; color: var(--foreground-muted); flex-wrap: wrap; }
.meta .sep { opacity: .6; }

.grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 768px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

.stack { display: flex; flex-direction: column; gap: .9rem; }

/* ============================================================================
   Sidebar layout (homepage + category page): main content column plus a
   sticky side rail for ad banners, falling back to recommended articles.
   ============================================================================ */

.layout-with-sidebar { display: grid; gap: 2.25rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1024px) { .layout-with-sidebar { grid-template-columns: minmax(0, 1fr) 300px; } }
@media (min-width: 1024px) { .layout-with-sidebar.no-sidebar { grid-template-columns: 1fr; } }

.layout-main { min-width: 0; }
.layout-main > .section-block + .section-block { margin-top: 2.5rem; }

.side-rail { display: flex; flex-direction: column; gap: 1.75rem; }
@media (min-width: 1024px) { .side-rail { position: sticky; top: 5rem; } }

.ad-stack { display: flex; flex-direction: column; gap: 1.25rem; }
.ad-banner {
  display: block; border-radius: var(--radius-card); overflow: hidden;
  background: var(--surface-muted); border: 1px solid var(--border);
}
.ad-banner img { width: 100%; height: auto; }

.side-widget {
  border-radius: var(--radius-card); overflow: hidden; border: 1px solid var(--border); background: var(--surface);
}
.side-widget__header {
  background: var(--primary); color: var(--primary-foreground); font-weight: 800; font-size: .85rem;
  padding: .7rem 1rem; letter-spacing: .01em;
}
.side-widget__body { padding: 0 1rem; }
.side-news-item { display: block; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.side-news-item:last-child { border-bottom: none; }
.side-news-item__title { display: block; font-size: .85rem; font-weight: 600; line-height: 1.35; }
.side-news-item:hover .side-news-item__title { color: var(--primary); }
.side-news-item__date { display: block; margin-top: .35rem; font-size: .72rem; color: var(--foreground-muted); }

/* Homepage category previews: show only the first article on phones/tablets
   (single-column breakpoints), the category header's "Бүгдийг үзэх" link is
   the "more" action. Desktop (>=1024px) keeps the 4-up grid. */
@media (max-width: 1023px) {
  .home-cat-grid > div:nth-child(n+2) { display: none; }
}

/* ============================================================================
   Most read / tabs
   ============================================================================ */

.tabs { display: inline-flex; gap: .2rem; background: var(--surface-muted); padding: .2rem; border-radius: .6rem; }
.tab-btn { padding: .35rem .7rem; border-radius: .45rem; font-size: .78rem; font-weight: 600; color: var(--foreground-muted); background: transparent; border: none; }
.tab-btn.is-active { background: var(--surface); color: var(--foreground); box-shadow: var(--shadow-card); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ============================================================================
   Video section
   ============================================================================ */

.video-card__frame { aspect-ratio: 16/9; border-radius: var(--radius-card); overflow: hidden; background: #000; }
.video-card__frame iframe { width: 100%; height: 100%; border: 0; }
.video-card__title { margin-top: .6rem; font-weight: 700; font-size: .95rem; }

/* ============================================================================
   Newsletter
   ============================================================================ */

.newsletter-box {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 55%, #7c3aed));
  border-radius: var(--radius-card); padding: 1.75rem; color: #fff; text-align: center;
}
.newsletter-box h3 { font-size: 1.15rem; font-weight: 800; }
.newsletter-box p { margin-top: .4rem; font-size: .88rem; opacity: .9; max-width: 32rem; margin-inline: auto; }
.newsletter-form { display: flex; gap: .5rem; max-width: 26rem; margin: 1.1rem auto 0; flex-wrap: wrap; justify-content: center; }
.newsletter-form input[type="email"] {
  flex: 1; min-width: 12rem; padding: .65rem .9rem; border-radius: .55rem; border: 1px solid transparent; font-size: .88rem;
}
.newsletter-form button { flex-shrink: 0; }
.newsletter-form small { display: block; margin-top: .6rem; opacity: .8; font-size: .72rem; }

/* ============================================================================
   Footer
   ============================================================================ */

.site-footer { border-top: 1px solid var(--border); background: var(--surface-muted); margin-top: 2rem; }
.footer-grid { display: grid; gap: 2rem; padding: 2.5rem 0; grid-template-columns: 1fr; }
@media (min-width: 768px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-col h4 { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; margin-bottom: .8rem; color: var(--foreground-muted); }
.footer-col p { font-size: .85rem; color: var(--foreground-muted); line-height: 1.6; }
.footer-col ul { display: flex; flex-direction: column; gap: .5rem; }
.footer-col a { font-size: .85rem; color: var(--foreground-muted); }
.footer-col a:hover { color: var(--primary); }
.social-links { display: flex; gap: .5rem; margin-top: .9rem; }
.social-links a {
  width: 2.1rem; height: 2.1rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border);
}
.social-links a:hover { border-color: var(--primary); color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); padding: 1.1rem 0; font-size: .78rem; color: var(--foreground-muted); text-align: center; }

/* ============================================================================
   Article page
   ============================================================================ */

.reading-progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--primary); z-index: 60; width: 0%; transition: width .1s linear; }

.breadcrumb { font-size: .8rem; color: var(--foreground-muted); display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.breadcrumb a:hover { color: var(--primary); }

.article-header { max-width: 46rem; margin: 0 auto 1.5rem; text-align: left; }
.article-header__title { font-size: 1.6rem; font-weight: 800; line-height: 1.3; margin-bottom: .9rem; }
@media (min-width: 768px) { .article-header__title { font-size: 2rem; } }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .82rem; color: var(--foreground-muted); }

.article-featured-image { max-width: 56rem; margin: 0 auto 1.5rem; }
.article-featured-image img { width: 100%; border-radius: var(--radius-card); }
.article-featured-image figcaption { font-size: .78rem; color: var(--foreground-muted); margin-top: .5rem; text-align: center; }

.article-body-wrap { max-width: 46rem; margin: 0 auto; }

.article-body { font-size: 1.08rem; line-height: 1.85; color: var(--foreground); }
.article-body > * + * { margin-top: 1.25em; }
.article-body h2 { font-size: 1.4em; font-weight: 700; line-height: 1.3; margin-top: 1.8em; }
.article-body h3 { font-size: 1.2em; font-weight: 700; line-height: 1.3; margin-top: 1.6em; }
.article-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.article-body blockquote { border-left: 3px solid var(--primary); padding-left: 1.25rem; font-style: italic; color: var(--foreground-muted); }
.article-body ul, .article-body ol { padding-left: 1.5rem; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body img { border-radius: var(--radius-card); width: 100%; height: auto; }
.article-body table { width: 100%; border-collapse: collapse; }
.article-body th, .article-body td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.article-body iframe { width: 100%; aspect-ratio: 16/9; border-radius: var(--radius-card); border: 0; }

.share-buttons { display: flex; align-items: center; gap: .5rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.share-buttons span { font-size: .82rem; font-weight: 600; color: var(--foreground-muted); margin-right: .3rem; }
.share-btn {
  position: relative;
  width: 2.2rem; height: 2.2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); color: var(--foreground-muted); background: var(--surface);
}
.share-btn:hover { border-color: var(--primary); color: var(--primary); }
.share-btn.is-copied::after {
  content: 'Хуулагдлаа ✓'; position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: var(--foreground); color: var(--background); font-size: .7rem; font-weight: 600;
  padding: .25rem .55rem; border-radius: .35rem; white-space: nowrap;
}

.tags-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1.5rem; }
.tag-chip { font-size: .78rem; padding: .3rem .65rem; border-radius: .5rem; background: var(--surface-muted); color: var(--foreground-muted); }
.tag-chip:hover { color: var(--primary); }

.prev-next-nav { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-top: 2rem; }
@media (min-width: 640px) { .prev-next-nav { grid-template-columns: 1fr 1fr; } }
.prev-next-nav a { display: block; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius-card); }
.prev-next-nav a:hover { border-color: var(--primary); }
.prev-next-nav .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--foreground-muted); font-weight: 700; }
.prev-next-nav .title { margin-top: .35rem; font-weight: 700; font-size: .92rem; line-height: 1.35; }
.prev-next-nav.next-col { text-align: right; }

.related-section { max-width: 56rem; margin: 2.5rem auto 0; }

/* ============================================================================
   Category / search pages
   ============================================================================ */

.page-header { padding: 1.75rem 0 1.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.75rem; }
.page-header__title { font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; gap: .6rem; }
.page-header__badge { width: .8rem; height: .8rem; border-radius: 50%; }
.page-header__desc { margin-top: .4rem; color: var(--foreground-muted); font-size: .92rem; max-width: 40rem; }

.search-form { display: flex; gap: .5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.search-form input[type="search"] { flex: 1; min-width: 14rem; }
.filter-bar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.filter-chip {
  padding: .35rem .8rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--border); color: var(--foreground-muted);
}
.filter-chip.is-active { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.filter-chip:hover:not(.is-active) { border-color: var(--primary); color: var(--primary); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--foreground-muted); }
.empty-state h3 { font-size: 1.05rem; color: var(--foreground); margin-bottom: .4rem; }

.pagination { display: flex; justify-content: center; gap: .35rem; margin-top: 2rem; flex-wrap: wrap; }
.page-btn {
  min-width: 2.2rem; height: 2.2rem; padding: 0 .6rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: .5rem; border: 1px solid var(--border); font-size: .85rem; font-weight: 600; color: var(--foreground);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.is-active { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.page-btn.is-disabled { opacity: .4; pointer-events: none; }

/* ============================================================================
   Misc: theme toggle icon swap, load-more, skip link
   ============================================================================ */

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--primary); color: var(--primary-foreground);
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 .4rem 0;
}
.skip-link:focus { left: 0; }

.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.load-more-wrap { display: flex; justify-content: center; margin-top: 1.75rem; }

.center-text { text-align: center; }
.mt-lg { margin-top: 2rem; }
