/* ==========================================================================
   PBN Base — shared design system for the Portal Berita Nusantara network.
   Token-driven: child themes override --c-* / --font-* to express brand.
   Mobile-first. System fonts only (zero web-font downloads). No frameworks.
   ========================================================================== */

/* ---- Design tokens (defaults = light "broadsheet"; children override) ---- */
:root {
  /* Brand (child overrides these three families) */
  --c-primary: #1a3a5c;
  --c-primary-700: #142d48;
  --c-primary-100: #e7edf3;
  --c-accent: #c41e3a;
  --c-accent-100: #fbe7eb;
  --c-on-primary: #ffffff;
  --c-on-accent: #ffffff;

  /* Surfaces & text */
  --c-bg: #ffffff;
  --c-surface: #ffffff;
  --c-surface-2: #f6f7f9;
  --c-text: #16202c;
  --c-text-muted: #5b6573;
  --c-border: #e3e7ec;
  --c-link: var(--c-primary);

  /* Chrome */
  --c-header-bg: var(--c-primary);
  --c-header-text: #ffffff;
  --c-header-muted: rgba(255,255,255,.72);
  --c-footer-bg: var(--c-primary-700);
  --c-footer-text: rgba(255,255,255,.82);
  --c-topbar-bg: var(--c-primary-700);
  --c-topbar-text: rgba(255,255,255,.85);

  /* Chips / kicker */
  --c-chip-bg: var(--c-accent);
  --c-chip-text: var(--c-on-accent);

  /* Typography (children may override --font-display) */
  --font-display: var(--font-body);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-ui: var(--font-body);

  /* Type scale (mobile baseline) */
  --fs-hero: clamp(1.55rem, 4.8vw, 2.6rem);
  --fs-h2: clamp(1.2rem, 3vw, 1.6rem);
  --fs-card: 1.02rem;
  --fs-body: 1.05rem;
  --fs-meta: .8rem;
  --lh-tight: 1.16;
  --lh-body: 1.7;

  /* Space & shape */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px;
  --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16,32,48,.06), 0 8px 24px rgba(16,32,48,.06);
  --wrap: 1200px;
  --header-h: 60px;
}

/* ---- Reset (lean) ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--c-bg); color: var(--c-text);
  font-family: var(--font-body); font-size: var(--fs-body); line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: var(--lh-tight); margin: 0 0 var(--sp-3); color: var(--c-text); letter-spacing: -.01em; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; border-radius: 3px; }

/* ---- Skip link / a11y helpers ---- */
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--c-accent); color: var(--c-on-accent); padding: var(--sp-2) var(--sp-4); z-index: 200; }
.skip-link:focus { left: var(--sp-3); top: var(--sp-3); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Layout wrapper ---- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--sp-4); }

/* ==========================================================================
   Top utility bar (date + optional live ticker slot)
   ========================================================================== */
.topbar { background: var(--c-topbar-bg); color: var(--c-topbar-text); font-size: var(--fs-meta); }
.topbar .wrap { display: flex; align-items: center; gap: var(--sp-4); min-height: 34px; }
.topbar__date { white-space: nowrap; font-weight: 600; letter-spacing: .02em; }

/* ==========================================================================
   Header / navigation
   ========================================================================== */
.site-header { background: var(--c-header-bg); color: var(--c-header-text); position: sticky; top: 0; z-index: 100; }
.site-header__inner { display: flex; align-items: center; gap: var(--sp-3); min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: var(--sp-3); margin-right: auto; min-width: 0; }
.brand .custom-logo-link { flex: none; display: inline-flex; align-items: center; }
.brand img, .brand .custom-logo { height: 38px; width: auto; flex: none; }
.brand__name { min-width: 0; }
.brand__name { color: var(--c-header-text); font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; line-height: 1.05; }
.brand__tag { display: block; color: var(--c-header-muted); font-size: .66rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }

/* primary nav (desktop hidden under hamburger on mobile) */
.nav { display: none; }
.nav__list { display: flex; align-items: center; gap: var(--sp-1); }
.nav__list a { color: var(--c-header-text); font-family: var(--font-ui); font-weight: 600; font-size: .92rem; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm); display: inline-block; }
.nav__list a:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.nav__list a[aria-current="page"] { color: var(--c-on-accent); background: var(--c-accent); }

.header-actions { display: flex; align-items: center; gap: var(--sp-1); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; background: transparent; border: 0; color: var(--c-header-text); border-radius: var(--radius-sm); }
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn svg { width: 22px; height: 22px; }

/* search slide-down */
.search-panel { display: none; background: var(--c-surface); border-top: 1px solid var(--c-border); }
.search-panel.is-open { display: block; }
.search-form { display: flex; gap: var(--sp-2); padding: var(--sp-3) 0; }
.search-form input[type="search"] { flex: 1; min-height: 46px; padding: 0 var(--sp-4); font-size: 1rem; border: 1px solid var(--c-border); border-radius: var(--radius-sm); background: var(--c-surface); color: var(--c-text); }
.search-form button { min-height: 46px; padding: 0 var(--sp-5); background: var(--c-accent); color: var(--c-on-accent); border: 0; border-radius: var(--radius-sm); font-weight: 700; }

/* mobile menu — caps height & scrolls so a long category list stays tidy */
.mobile-menu { display: none; background: var(--c-header-bg); border-top: 1px solid rgba(255,255,255,.14); max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.mobile-menu.is-open { display: block; }
.mobile-menu a { display: block; color: var(--c-header-text); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid rgba(255,255,255,.10); font-weight: 600; min-height: 48px; }
.mobile-menu a:hover, .mobile-menu a[aria-current="page"] { background: rgba(255,255,255,.10); text-decoration: none; }

/* ==========================================================================
   Breaking-news ticker (opt-in per child; transform-only, no layout shift)
   ========================================================================== */
.ticker { background: var(--c-surface); border-bottom: 1px solid var(--c-border); overflow: hidden; }
.ticker__inner { display: flex; align-items: stretch; }
.ticker__label { flex: none; display: inline-flex; align-items: center; gap: var(--sp-2); background: var(--c-accent); color: var(--c-on-accent); font-weight: 800; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; padding: var(--sp-2) var(--sp-4); }
.ticker__viewport { overflow: hidden; flex: 1; align-self: center; }
.ticker__track { display: inline-flex; gap: var(--sp-6); white-space: nowrap; animation: ticker-scroll 38s linear infinite; }
.ticker:hover .ticker__track, .ticker:focus-within .ticker__track { animation-play-state: paused; }
.ticker__track a { color: var(--c-text); font-weight: 600; font-size: .86rem; padding-block: var(--sp-2); }
.ticker__track a::before { content: "•"; color: var(--c-accent); margin-right: var(--sp-3); }
@keyframes ticker-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker__track { animation: none; white-space: normal; flex-wrap: wrap; }
  .card a:hover .card__media img { transform: none; }
}

/* ==========================================================================
   Section headings
   ========================================================================== */
.section { padding-block: var(--sp-6); }
.section__head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.section__title { font-size: 1.05rem; text-transform: uppercase; letter-spacing: .06em; margin: 0; position: relative; padding-left: var(--sp-3); }
.section__title::before { content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 5px; height: 1.05em; background: var(--c-accent); border-radius: 2px; }
.section__rule { flex: 1; height: 1px; background: var(--c-border); }

/* ==========================================================================
   Article cards
   ========================================================================== */
.kicker { display: inline-block; font-family: var(--font-ui); font-weight: 800; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c-on-accent); background: var(--c-chip-bg); padding: 3px 8px; border-radius: 3px; }
.kicker--ghost { background: transparent; color: var(--c-accent); padding-inline: 0; }

.card { display: flex; flex-direction: column; gap: var(--sp-2); background: var(--c-surface); }
.card__media { position: relative; overflow: hidden; border-radius: var(--radius-sm); aspect-ratio: 16 / 9; background: var(--c-surface-2); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card a:hover .card__media img { transform: scale(1.04); }
.card__kicker { position: absolute; left: var(--sp-2); top: var(--sp-2); }
.card__title { font-size: var(--fs-card); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card--row .card__title { -webkit-line-clamp: 3; }
.card__title a { color: var(--c-text); }
.card__title a:hover { color: var(--c-primary); text-decoration: none; }
.card__meta { font-size: var(--fs-meta); color: var(--c-text-muted); display: flex; gap: var(--sp-2); align-items: center; }
.card__excerpt { color: var(--c-text-muted); font-size: .95rem; line-height: 1.6; margin: 0; }

/* horizontal card (list / right-rail) */
.card--row { flex-direction: row; gap: var(--sp-3); align-items: flex-start; }
.card--row .card__media { flex: none; width: 116px; aspect-ratio: 16 / 9; }
.card--row .card__body { min-width: 0; }
.card--row .card__title { font-size: .98rem; }

/* Guard against long unbroken words / pasted URLs overflowing on mobile. */
.prose, .card__title, .lead__title, .rank__title, .article__title, .brand__name { overflow-wrap: anywhere; }

/* numbered popular list */
.rank { counter-reset: rank; display: flex; flex-direction: column; gap: var(--sp-4); }
.rank__item { display: flex; gap: var(--sp-3); align-items: baseline; counter-increment: rank; }
.rank__item::before { content: counter(rank); flex: none; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; line-height: 1; color: var(--c-accent); min-width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; }
.rank__title { font-size: .95rem; font-weight: 600; }
.rank__title a { color: var(--c-text); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { background: var(--c-footer-bg); color: var(--c-footer-text); margin-top: var(--sp-7); border-top: 3px solid var(--c-accent); }
.site-footer a { color: var(--c-footer-text); }
.site-footer a:hover { color: #fff; }
.footer-top { display: grid; grid-template-columns: 1fr; gap: var(--sp-6); padding-block: var(--sp-7); }
.footer-brand img, .footer-brand .custom-logo { height: 40px; width: auto; margin-bottom: var(--sp-3); }
.footer-brand p { font-size: .9rem; max-width: 42ch; margin: 0 0 var(--sp-3); }
.footer-social { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.footer-social a { font-size: .82rem; font-weight: 600; }
.footer-col h3 { color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: var(--sp-3); position: relative; padding-bottom: var(--sp-2); }
.footer-col h3::after { content: ""; position: absolute; left: 0; bottom: 0; width: 28px; height: 2px; background: var(--c-accent); }
.footer-col li { margin-bottom: var(--sp-2); }
.footer-col a { font-size: .92rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); padding-block: var(--sp-4); font-size: .82rem; display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); justify-content: space-between; align-items: center; }
.footer-legal { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
.footer-legal li { position: relative; }
.footer-legal li + li::before { content: "·"; position: absolute; left: calc(var(--sp-2) * -1 - 2px); opacity: .5; }

/* Empty / no-result / 404 notice */
.notice { text-align: center; padding: var(--sp-7) var(--sp-4); }
.notice__code { font-family: var(--font-display); font-size: clamp(2.6rem, 9vw, 4.5rem); line-height: 1; color: var(--c-accent); margin: 0; }
.notice h1 { font-size: var(--fs-h2); margin: var(--sp-3) 0; }
.notice p { color: var(--c-text-muted); max-width: 52ch; margin: 0 auto var(--sp-5); }
.notice .search-form { max-width: 460px; margin: 0 auto; }

/* ==========================================================================
   Article (single) & archive shared
   ========================================================================== */
.breadcrumb { font-size: var(--fs-meta); color: var(--c-text-muted); padding-block: var(--sp-4) 0; display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.breadcrumb a { color: var(--c-text-muted); }
.breadcrumb [aria-current] { color: var(--c-text); }

.article { padding-block: var(--sp-5); }
.article__header { margin-bottom: var(--sp-4); }
.article__title { font-size: var(--fs-hero); margin: var(--sp-3) 0; }
.article__meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); align-items: center; color: var(--c-text-muted); font-size: var(--fs-meta); border-block: 1px solid var(--c-border); padding-block: var(--sp-3); }
.article__author { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; color: var(--c-text); }
.article__author .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--c-primary-100); }
.article__hero { margin: var(--sp-4) 0; }
.article__hero img { width: 100%; border-radius: var(--radius); }
.article__hero figcaption { font-size: var(--fs-meta); color: var(--c-text-muted); margin-top: var(--sp-2); }

.prose { max-width: 70ch; }
.prose p { margin: 0 0 var(--sp-5); font-size: var(--fs-body); line-height: var(--lh-body); }
.prose h2 { font-size: var(--fs-h2); margin-top: var(--sp-6); }
.prose blockquote { margin: var(--sp-5) 0; padding: var(--sp-2) var(--sp-5); border-left: 4px solid var(--c-accent); color: var(--c-text); font-style: italic; }

/* share */
.share { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-5) 0; flex-wrap: wrap; }
.share__label { font-size: var(--fs-meta); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--c-text-muted); }
.share a, .share button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-border); cursor: pointer; padding: 0; font: inherit; }
.share a:hover, .share button:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.share .is-copied { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.share svg { width: 18px; height: 18px; }

/* related */
.related-grid { display: grid; grid-template-columns: 1fr; gap: var(--sp-5); }

/* archive list */
.archive-head { padding-block: var(--sp-5) 0; }
.archive-head h1 { font-size: var(--fs-h2); }
.archive-head h1 span { color: var(--c-accent); }

/* pagination */
.pagination { display: flex; gap: var(--sp-2); flex-wrap: wrap; padding-block: var(--sp-6); justify-content: center; }
.pagination a, .pagination span { min-width: 44px; min-height: 44px; display: grid; place-items: center; padding-inline: var(--sp-3); border: 1px solid var(--c-border); border-radius: var(--radius-sm); color: var(--c-text); font-weight: 600; }
.pagination .is-current { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.pagination a:hover { border-color: var(--c-primary); text-decoration: none; }

/* sidebar widgets */
.widget { margin-bottom: var(--sp-6); }
.widget__title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; padding-bottom: var(--sp-2); border-bottom: 2px solid var(--c-accent); margin-bottom: var(--sp-4); }

/* ==========================================================================
   Responsive — tablet/desktop
   ========================================================================== */
@media (min-width: 600px) {
  .related-grid { grid-template-columns: 1fr 1fr; }
  .footer-top { grid-template-columns: repeat(2, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (min-width: 880px) {
  :root { --fs-body: 1.08rem; --header-h: 68px; }
  .nav { display: block; }
  /* Desktop shows the first 7 channels inline; the rest stay reachable via the
     "Semua Kanal" trigger (same offcanvas as mobile). Hidden only on .nav__list —
     .mobile-menu__list keeps all 10 channels. */
  .nav__list > li:nth-child(n+8) { display: none; }
  .hamburger { display: inline-flex; align-items: center; gap: .45em; width: auto; padding: var(--sp-2) var(--sp-3); }
  .hamburger::after { content: "Semua Kanal"; font-family: var(--font-ui); font-weight: 600; font-size: .92rem; }
  /* No !important so .mobile-menu.is-open (higher specificity) opens the
     full-channel offcanvas on desktop too. */
  .mobile-menu { display: none; }
  .footer-top { grid-template-columns: 2fr 1fr 1fr 1fr; }
  .footer-brand { grid-column: auto; }
}
@media (min-width: 1024px) {
  .brand img { height: 42px; }
}
