/* ===== News site theme ===== */
:root {
  --accent: #c8102e;
  --bg: #ffffff;
  --bg-soft: #f4f5f7;
  --text: #16181d;
  --text-2: #4a4f59;
  --muted: #6b717c;
  --line: #e4e6ea;
  --card: #ffffff;
  --radius: 10px;
  --wrap: 1180px;
  --font: "Kantumruy Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --bg-soft: #1a1d23;
    --text: #eceef2;
    --text-2: #c3c7cf;
    --muted: #8d939e;
    --line: #2a2e36;
    --card: #16191e;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.35; margin: 0; font-weight: 700; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 10; }

/* ----- Header ----- */
.topbar { background: var(--text); color: var(--bg); font-size: .8rem; }
.topbar-in { display: flex; justify-content: space-between; gap: 12px; padding-top: 6px; padding-bottom: 6px; }
.top-social { display: flex; gap: 14px; }
.top-social a:hover { color: var(--bg); text-decoration: underline; }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 18px; }
.logo { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--text); }
.logo::first-letter { color: var(--accent); }
.search { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.search input { border: 0; background: transparent; color: var(--text); font: inherit; font-size: .9rem; padding: 8px 14px; width: 220px; outline: none; }
.search button { border: 0; background: transparent; color: var(--muted); padding: 8px 12px; cursor: pointer; }
.search button:hover { color: var(--accent); }
.catnav { border-top: 1px solid var(--line); border-bottom: 3px solid var(--accent); position: sticky; top: 0; z-index: 5; background: var(--bg); }
.catnav-in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.catnav-in::-webkit-scrollbar { display: none; }
.catnav a { white-space: nowrap; padding: 11px 12px; font-weight: 600; font-size: .95rem; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.catnav a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* ----- Layout ----- */
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 36px; align-items: start; }
.section-title {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 1.2rem; padding-bottom: 8px; margin: 0 0 18px; border-bottom: 2px solid var(--text);
}
.section-title .more { font-size: .85rem; color: var(--accent); font-weight: 600; }
.page-title { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin-bottom: 20px; }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }

/* ----- Cards ----- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card-img { display: block; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .card-img img { transform: scale(1.03); }
.noimg { display: grid; place-items: center; width: 100%; height: 100%; font-size: 2.4rem; font-weight: 700; color: var(--accent); opacity: .5; }
.kicker { color: var(--accent); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.card-title { font-size: 1.08rem; }
.card-excerpt { margin: 0; color: var(--text-2); font-size: .93rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { font-size: .8rem; color: var(--muted); }
.card-body { display: flex; flex-direction: column; gap: 6px; }

/* Top stories */
.top { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; margin-bottom: 40px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.card.lead .card-title { font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.25; }
.card.lead .card-excerpt { font-size: 1rem; -webkit-line-clamp: 4; }
.card.lead.wide { margin-bottom: 32px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.top-side { display: flex; flex-direction: column; gap: 18px; }
.top-side .card { flex-direction: row; gap: 14px; }
.top-side .card-img { flex: 0 0 130px; aspect-ratio: 4 / 3; }
.top-side .card-title { font-size: .98rem; }
.card.mini .card-title { font-size: .98rem; }
.cat-block { margin-top: 44px; }

/* ----- Sidebar ----- */
.sidebar { display: flex; flex-direction: column; gap: 28px; position: sticky; top: 64px; }
.box-title { font-size: 1.05rem; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 2px solid var(--text); }
.ranked { list-style: none; margin: 0; padding: 0; }
.ranked li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-weight: 600; font-size: .95rem; line-height: 1.45; }
.ranked li:last-child { border-bottom: 0; }
.rank { flex: 0 0 auto; font-size: 1.6rem; line-height: 1; font-weight: 700; color: var(--accent); min-width: 22px; }
.follow p { margin: 0 0 12px; font-size: .9rem; }
.follow-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fbtn { text-align: center; padding: 9px 10px; border-radius: 8px; color: #fff; font-weight: 600; font-size: .9rem; background: #444; }
.fbtn:hover { color: #fff; opacity: .9; }
.fbtn-facebook { background: #1877f2; }
.fbtn-telegram { background: #229ed9; }
.fbtn-youtube { background: #e62117; }
.fbtn-tiktok { background: #111; }

/* ----- Article ----- */
.article { min-width: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a:hover { text-decoration: underline; }
.article-title { font-size: clamp(1.6rem, 4.2vw, 2.5rem); line-height: 1.25; letter-spacing: -.01em; }
.lede { font-size: 1.15rem; color: var(--text-2); margin: 14px 0 0; }
.article-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .88rem; color: var(--muted); margin: 18px 0 14px; }
.article-img { margin: 22px 0; }
.article-img img { width: 100%; border-radius: var(--radius); }
.prose { font-size: 1.1rem; line-height: 1.8; overflow-wrap: break-word; }
:lang(km) .prose { line-height: 1.95; }
.prose p { margin: 0 0 1.2em; }
.prose h2 { font-size: 1.45rem; margin: 1.6em 0 .6em; }
.prose h3 { font-size: 1.2rem; margin: 1.4em 0 .5em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose img { border-radius: var(--radius); margin: 1.2em auto; }
.prose blockquote { margin: 1.4em 0; padding: .4em 0 .4em 1.2em; border-left: 4px solid var(--accent); color: var(--text-2); font-style: italic; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; border-radius: var(--radius); }
.prose .ql-align-center { text-align: center; }
.prose .ql-align-right { text-align: right; }
.source { font-size: .9rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.related { margin-top: 40px; }
.preview-bar { background: #fff3cd; color: #664d03; border: 1px solid #ffe69c; border-radius: 8px; padding: 10px 14px; margin-bottom: 18px; }

/* Share buttons */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; }
.share-label { font-size: .85rem; font-weight: 600; color: var(--muted); margin-right: 4px; }
.sh { font: inherit; font-size: .85rem; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 0; cursor: pointer; color: #fff; }
.sh:hover { color: #fff; opacity: .88; }
.sh-fb { background: #1877f2; }
.sh-tg { background: #229ed9; }
.sh-x { background: #111; }
.sh-copy { background: var(--bg-soft); color: var(--text); border: 1px solid var(--line); }
.sh-copy:hover { color: var(--text); }

/* Ads */
.ad { margin: 28px 0; text-align: center; overflow: hidden; }
.ad-header { margin-top: 16px; margin-bottom: 0; }
.ad-side { margin: 0; }

/* Pager */
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line); }
.pager a { font-weight: 600; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; }
.pager a:hover { border-color: var(--accent); }
.pager-num { color: var(--muted); font-size: .9rem; }

.search-big { margin-bottom: 28px; border-radius: 10px; }
.search-big input { width: 100%; font-size: 1rem; padding: 12px 16px; }
.search-big button { background: var(--accent); color: #fff; font: inherit; font-weight: 600; padding: 12px 20px; }
.search-big button:hover { color: #fff; }

.notfound { text-align: center; padding: 40px 0 56px; }
.big404 { font-size: 5rem; font-weight: 700; color: var(--accent); margin: 0; line-height: 1; }
.notfound h1 { margin: 10px 0; }
.btn { display: inline-block; background: var(--accent); color: #fff; padding: 10px 20px; border-radius: 999px; font-weight: 600; }
.btn:hover { color: #fff; opacity: .9; }

/* ----- Footer ----- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--line); padding-top: 40px; font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.logo-footer { font-size: 1.6rem; }
.site-footer h4 { font-size: .95rem; margin-bottom: 12px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--text-2); }
.footer-social { display: flex; flex-wrap: wrap; gap: 14px; font-weight: 600; }
.copyright { border-top: 1px solid var(--line); margin-top: 32px; padding-top: 16px; padding-bottom: 24px; color: var(--muted); font-size: .85rem; }

/* ----- Responsive ----- */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .top { grid-template-columns: 1fr; }
  .brand { flex-wrap: wrap; }
  .brand .search { width: 100%; }
  .brand .search input { width: 100%; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 560px) {
  .grid, .grid-2 { grid-template-columns: 1fr; gap: 22px; }
  .grid .card:not(.lead), .grid-2 .card { flex-direction: row; gap: 14px; }
  .grid .card:not(.lead) .card-img, .grid-2 .card .card-img { flex: 0 0 120px; aspect-ratio: 4 / 3; }
  .grid .card-excerpt { display: none; }
  .grid-4 { gap: 16px; }
  .top-side .card-img { flex-basis: 110px; }
  .prose { font-size: 1.05rem; }
}

/* Khmer: letter-spacing and ::first-letter break Khmer character shaping */
:lang(km) .logo, :lang(km) .kicker, :lang(km) .article-title { letter-spacing: 0; text-transform: none; }
:lang(km) .logo::first-letter { color: inherit; }
:lang(km) .card-title, :lang(km) .article-title { line-height: 1.55; }
