/*
Theme Name: PilarNews
Theme URI: https://pilarnegara.com/
Author: Pilar Media Grup
Description: Tema portal berita yang ringan dan aman: headline, Berita Terkini, Terpopuler, blok per kategori, slot iklan, share WhatsApp, dan schema NewsArticle. Warna dan logo diatur lewat Customizer.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: pilarnews
*/

/* ---------- Tokens ---------- */
:root {
	--pn-accent: #c62828;
	--pn-text: #1c1c1c;
	--pn-muted: #6b6b6b;
	--pn-line: #e6e6e6;
	--pn-bg: #ffffff;
	--pn-soft: #f5f5f5;
	--pn-dark: #161616;
	--pn-radius: 6px;
	--pn-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--pn-serif: Georgia, "Times New Roman", serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--pn-font); color: var(--pn-text); background: var(--pn-bg); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--pn-accent); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
button, input { font: inherit; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
.skip-link:focus { position: fixed !important; top: 8px; left: 8px; width: auto; height: auto; clip: auto; z-index: 1000; padding: 8px 12px; background: #fff; border: 2px solid var(--pn-accent); }
:focus-visible { outline: 2px solid var(--pn-accent); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar { background: var(--pn-dark); color: #cfcfcf; font-size: 12px; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 32px; gap: 12px; }
.social-links { display: flex; gap: 14px; flex-wrap: wrap; }
.social-links a:hover { color: #fff; }

/* ---------- Header ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--pn-line); position: sticky; top: 0; z-index: 50; }
.admin-bar .site-header { top: 32px; }
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 68px; position: relative; }
.site-branding { flex: 0 0 auto; }
.site-branding img { max-height: 48px; width: auto; }
.site-title { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; color: var(--pn-accent); }
.header-search { margin-left: auto; width: 320px; }
.search-form { display: flex; border: 1px solid var(--pn-line); border-radius: 999px; overflow: hidden; background: var(--pn-soft); }
.search-field { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 14px; outline: 0; }
.search-submit { border: 0; background: var(--pn-accent); color: #fff; padding: 0 16px; cursor: pointer; font-weight: 600; }
.icon-btn { display: none; background: none; border: 0; width: 40px; height: 40px; cursor: pointer; padding: 0; color: var(--pn-text); }
.icon-bars, .icon-bars::before, .icon-bars::after { display: block; width: 22px; height: 2px; background: currentColor; position: relative; margin: 0 auto; }
.icon-bars::before, .icon-bars::after { content: ""; position: absolute; left: 0; }
.icon-bars::before { top: -7px; }
.icon-bars::after { top: 7px; }
.icon-search { display: block; width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; position: relative; margin: 0 auto; }
.icon-search::after { content: ""; position: absolute; width: 2px; height: 7px; background: currentColor; right: -4px; bottom: -6px; transform: rotate(-45deg); }

/* Channel menu */
.main-nav { background: var(--pn-accent); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; overflow-x: auto; scrollbar-width: none; }
.main-nav ul::-webkit-scrollbar { display: none; }
.main-nav a { display: block; padding: 11px 14px; color: #fff; font-weight: 600; font-size: 14px; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.3px; }
.main-nav a:hover, .main-nav .current-menu-item > a, .main-nav .current-cat > a { background: rgba(0, 0, 0, 0.18); color: #fff; }

/* ---------- Layout ---------- */
.site-main { padding: 20px 0 40px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; margin-top: 24px; }
.section-title { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--pn-line); margin-bottom: 16px; font-size: 18px; }
.section-title span { display: inline-block; padding-bottom: 8px; margin-bottom: -2px; border-bottom: 2px solid var(--pn-accent); font-weight: 800; text-transform: uppercase; }
.section-more { font-size: 13px; font-weight: 600; color: var(--pn-accent); }
.more-link { display: inline-block; margin-top: 12px; font-weight: 700; color: var(--pn-accent); }

/* ---------- Cards ---------- */
.thumb { display: block; position: relative; overflow: hidden; border-radius: var(--pn-radius); background: var(--pn-soft); aspect-ratio: 16 / 9; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
a.thumb:hover img { transform: scale(1.04); }
.thumb-placeholder { position: absolute; inset: 0; background: linear-gradient(135deg, #ececec, #dcdcdc); }
.cat-label { display: inline-block; color: var(--pn-accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.card-title { font-size: 17px; font-weight: 700; }
.card-time { display: block; margin-top: 6px; font-size: 12px; color: var(--pn-muted); }

.card-list { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--pn-line); }
.card-list:first-child { padding-top: 0; }
.card-list .thumb { aspect-ratio: 8 / 5; }

.card-grid .thumb { margin-bottom: 10px; }
.card-grid .card-title { font-size: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

/* ---------- Headline ---------- */
.headline { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 24px; }
.headline-main { position: relative; border-radius: var(--pn-radius); overflow: hidden; }
.headline-main .thumb { border-radius: 0; height: 100%; aspect-ratio: 16 / 10; }
.headline-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 22px 20px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85)); color: #fff; pointer-events: none; }
.headline-caption a { pointer-events: auto; }
.headline-caption .cat-label { background: var(--pn-accent); color: #fff; padding: 2px 8px; border-radius: 3px; }
.headline-title { font-size: 28px; font-weight: 800; margin: 6px 0; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.headline-title a:hover { color: #fff; text-decoration: underline; }
.headline-caption time { font-size: 13px; color: #ddd; }
.headline-side .card-list { grid-template-columns: 120px minmax(0, 1fr); padding: 12px 0; }
.headline-side .card-list:first-child { padding-top: 0; }
.headline-side .card-title { font-size: 15px; }

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

/* ---------- Sidebar ---------- */
.col-side .widget { margin-bottom: 28px; }
.popular-list { list-style: none; counter-reset: pop; margin: 0; padding: 0; }
.popular-list li { counter-increment: pop; position: relative; padding: 12px 0 12px 46px; border-bottom: 1px solid var(--pn-line); }
.popular-list li::before { content: counter(pop); position: absolute; left: 0; top: 8px; font-size: 30px; font-weight: 800; line-height: 1; color: var(--pn-accent); opacity: 0.85; width: 36px; text-align: center; }
.popular-list a { font-weight: 700; font-size: 15px; line-height: 1.35; }
.popular-list time { display: block; font-size: 12px; color: var(--pn-muted); margin-top: 4px; }
.col-side .widget ul { padding-left: 18px; }

/* ---------- Ads ---------- */
.ad { margin: 20px auto; text-align: center; overflow: hidden; }
.ad-label { display: block; font-size: 10px; color: var(--pn-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.ad img { margin: 0 auto; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: 13px; color: var(--pn-muted); margin-top: 4px; }
.breadcrumb a { color: var(--pn-accent); font-weight: 600; }

/* ---------- Article ---------- */
.article-header { margin-bottom: 18px; }
.article-title { font-size: 34px; font-weight: 800; letter-spacing: -0.3px; margin: 4px 0 12px; }
.article-meta { font-size: 14px; color: var(--pn-muted); display: flex; gap: 8px; flex-wrap: wrap; }
.article-meta .author { font-weight: 700; color: var(--pn-text); }
.article-image { margin: 0 0 20px; }
.article-image img { width: 100%; border-radius: var(--pn-radius); }
.article-image figcaption { font-size: 13px; color: var(--pn-muted); margin-top: 8px; }
.article-content { font-family: var(--pn-serif); font-size: 19px; line-height: 1.75; }
.article-content p { margin: 0 0 1.2em; }
.article-content a { color: var(--pn-accent); text-decoration: underline; }
.article-content h2, .article-content h3 { font-family: var(--pn-font); margin: 1.4em 0 0.6em; }
.article-content blockquote { margin: 1.5em 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--pn-accent); font-style: italic; color: #333; }
.article-content figure { margin: 1.5em 0; }
.article-content figcaption, .wp-caption-text { font-family: var(--pn-font); font-size: 13px; color: var(--pn-muted); }
.article-content iframe { max-width: 100%; }
.article-content .ad { font-family: var(--pn-font); }
.alignleft { float: left; margin: 0 20px 12px 0; }
.alignright { float: right; margin: 0 0 12px 20px; }
.aligncenter { margin-left: auto; margin-right: auto; }
.article-footer { margin: 28px 0; padding-top: 16px; border-top: 1px solid var(--pn-line); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.tags-label { font-weight: 700; margin-right: 4px; }
.tags a { background: var(--pn-soft); border: 1px solid var(--pn-line); border-radius: 999px; padding: 3px 12px; font-size: 13px; }

.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.share-label { font-size: 13px; font-weight: 700; color: var(--pn-muted); margin-right: 4px; }
.share-btn { display: inline-block; border: 0; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; color: #fff; cursor: pointer; }
.share-btn:hover { color: #fff; opacity: 0.88; }
.share-btn--whatsapp { background: #1fa855; }
.share-btn--facebook { background: #1877f2; }
.share-btn--x { background: #111; }
.share-btn--telegram { background: #229ed9; }
.share-btn--copy { background: var(--pn-soft); color: var(--pn-text); border: 1px solid var(--pn-line); }
.share-btn--copy:hover { color: var(--pn-text); }

.related { margin-top: 32px; }

/* ---------- Archive / search / 404 ---------- */
.archive-header { margin-bottom: 18px; }
.archive-title { font-size: 26px; font-weight: 800; }
.archive-title span { color: var(--pn-accent); }
.archive-desc { color: var(--pn-muted); margin-top: 6px; }
.navigation.pagination { margin-top: 24px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.page-numbers { display: inline-block; min-width: 38px; text-align: center; padding: 7px 10px; border: 1px solid var(--pn-line); border-radius: var(--pn-radius); font-weight: 600; }
.page-numbers.current { background: var(--pn-accent); border-color: var(--pn-accent); color: #fff; }
.not-found { max-width: 560px; margin: 40px auto; text-align: center; }
.not-found-code { font-size: 80px; font-weight: 800; color: var(--pn-accent); margin: 0; line-height: 1; }
.not-found .search-form { margin: 20px 0; }
.empty { color: var(--pn-muted); }

/* ---------- Comments ---------- */
.comments { margin-top: 32px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment { padding: 14px 0; border-bottom: 1px solid var(--pn-line); }
.comment-list .children { list-style: none; padding-left: 28px; }
.comment-author img { float: left; margin-right: 10px; border-radius: 50%; }
.comment-meta { font-size: 13px; color: var(--pn-muted); }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea { width: 100%; padding: 10px; border: 1px solid var(--pn-line); border-radius: var(--pn-radius); }
.comment-form .submit { background: var(--pn-accent); color: #fff; border: 0; border-radius: var(--pn-radius); padding: 10px 20px; font-weight: 700; cursor: pointer; }

/* ---------- Footer ---------- */
.site-footer { background: var(--pn-dark); color: #bdbdbd; margin-top: 20px; font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 32px; padding: 36px 16px; }
.footer-title { font-size: 24px; font-weight: 800; color: #fff; }
.footer-text { margin: 10px 0 14px; }
.site-footer a:hover { color: #fff; }
.widget-title { color: #fff; font-size: 15px; margin-bottom: 10px; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; }
.footer-widgets ul { list-style: none; padding: 0; margin: 0; }
.footer-widgets li { margin-bottom: 6px; }
.footer-bottom { border-top: 1px solid #2c2c2c; }
.footer-bottom-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.footer-menu { list-style: none; display: flex; flex-wrap: wrap; gap: 16px; margin: 0; padding: 0; }
.copyright { margin: 0; font-size: 13px; }

.to-top { position: fixed; right: 16px; bottom: 16px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--pn-accent); color: #fff; font-size: 18px; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.2s; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.to-top.is-visible { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.layout { grid-template-columns: minmax(0, 1fr); }
	.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 782px) {
	.admin-bar .site-header { top: 0; }
	.icon-btn { display: block; }
	.header-inner { min-height: 56px; gap: 8px; }
	.site-branding { flex: 1; text-align: center; }
	.site-branding img { max-height: 36px; margin: 0 auto; }
	.site-title { font-size: 22px; }
	.header-search { display: none; position: absolute; left: 0; right: 0; top: 100%; width: auto; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--pn-line); }
	.header-search.is-open { display: block; }
	.main-nav { display: none; }
	.main-nav.is-open { display: block; }
	.main-nav ul { flex-direction: column; }
	.main-nav a { border-top: 1px solid rgba(255, 255, 255, 0.15); }
	.headline { grid-template-columns: minmax(0, 1fr); }
	.headline-title { font-size: 21px; }
	.headline-caption { padding: 40px 14px 14px; }
	.article-title { font-size: 25px; }
	.article-content { font-size: 17px; }
	.footer-grid { grid-template-columns: minmax(0, 1fr); }
	.grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.alignleft, .alignright { float: none; margin: 0 0 12px; }
}

@media (max-width: 480px) {
	.card-list, .headline-side .card-list { grid-template-columns: 110px minmax(0, 1fr); gap: 12px; }
	.card-title { font-size: 15px; }
	.grid-4, .grid-3 { grid-template-columns: minmax(0, 1fr); }
	.topbar .social-links { display: none; }
}
