/*
Theme Name: APN News
Theme URI: https://aipunjabnews.com/
Description: Complete custom mobile-first theme for AI Punjab News. Professional news-app design: app bar, breaking ticker, hero cards, horizontal news feed, bottom tab bar, premium article pages.
Author: AI Punjab News
Author URI: https://aipunjabnews.com/
Template: news-storm
Version: 3.1.0
Requires at least: 5.0
Requires PHP: 8.0
License: GNU General Public License v3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Text Domain: apn-news
*/

/* ================= 0. TOKENS ================= */
:root {
	--red: #C8102E;
	--red-dark: #9E0C24;
	--ink: #141414;
	--ink2: #1E1E1E;
	--paper: #fff;
	--wash: #F3F4F6;
	--line: #E7E8EB;
	--muted: #6B7280;
	--gold: #FFC531;
	--r: 14px;
	--rs: 10px;
	--tabh: 64px;
	--shadow: 0 1px 4px rgba(16,16,16,.07);
	--font: "Noto Sans Gurmukhi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ================= 1. RESET / BASE ================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: var(--font);
	background: var(--wash);
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
	line-height: 1.6;
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 12px; }
.skip-link { position: absolute; left: -9999px; }

/* ================= 2. APP BAR ================= */
.apn-topbar {
	position: sticky; top: 0; z-index: 600;
	background: var(--paper);
	border-bottom: 1px solid var(--line);
}
.apn-topbar-in {
	display: flex; align-items: center; justify-content: space-between;
	height: 56px; max-width: 1200px; margin: 0 auto; padding: 0 12px;
}
.apn-burger, .apn-searchbtn {
	background: none; border: none; padding: 8px; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
.apn-burger svg, .apn-searchbtn svg {
	width: 24px; height: 24px; stroke: var(--ink); fill: none;
	stroke-width: 2; stroke-linecap: round;
}
.apn-logo { display: flex; align-items: center; gap: 8px; }
.apn-logo-mark {
	background: var(--red); color: #fff; font-weight: 800; font-size: 15px;
	border-radius: 8px; padding: 4px 9px; letter-spacing: .02em;
}
.apn-logo-text { font-weight: 800; font-size: 15px; letter-spacing: .01em; }
.apn-logo-text span { color: var(--red); }
.apn-date {
	font-size: 11.5px; color: var(--muted); text-align: center;
	padding: 6px 12px 0; background: var(--paper);
}
.apn-date .live-dot {
	display: inline-block; width: 7px; height: 7px; border-radius: 50%;
	background: var(--red); margin-right: 5px;
	animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* slide-down menu */
.apn-drawer {
	display: none; background: var(--paper);
	border-bottom: 1px solid var(--line);
	max-height: 70vh; overflow-y: auto;
}
.apn-drawer.open { display: block; }
.apn-drawer ul { list-style: none; margin: 0; padding: 8px 0; }
.apn-drawer a {
	display: block; padding: 11px 16px; font-size: 15px; font-weight: 600;
	border-bottom: 1px solid var(--wash);
}
.apn-drawer a:hover { color: var(--red); }

/* ================= 3. CHIPS NAV ================= */
.apn-chips {
	display: flex; gap: 8px; overflow-x: auto;
	padding: 10px 12px; background: var(--paper);
	border-bottom: 1px solid var(--line);
	scrollbar-width: none;
	position: sticky; top: 56px; z-index: 590;
}
.apn-chips::-webkit-scrollbar { display: none; }
.apn-chips a {
	flex: 0 0 auto; font-size: 13px; font-weight: 600;
	background: var(--wash); border: 1px solid var(--line);
	border-radius: 999px; padding: 7px 14px; white-space: nowrap;
}
.apn-chips a.on { background: var(--red); border-color: var(--red); color: #fff; }

/* ================= 4. BREAKING TICKER ================= */
.apn-breaking {
	display: flex; align-items: stretch;
	background: var(--ink); color: #fff; overflow: hidden;
}
.apn-breaking-badge {
	flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
	background: var(--red); font-size: 11px; font-weight: 800;
	letter-spacing: .06em; padding: 0 12px; z-index: 2;
}
.apn-breaking-badge .live-dot {
	width: 7px; height: 7px; border-radius: 50%; background: #fff;
	animation: pulse 1.2s infinite;
}
.apn-breaking-track {
	flex: 1; overflow: hidden; display: flex; align-items: center;
}
.apn-breaking-track-inner {
	display: inline-flex; gap: 48px; padding-left: 16px;
	white-space: nowrap; font-size: 13px;
	animation: tick 40s linear infinite;
}
.apn-breaking-track-inner a:hover { color: var(--gold); }
@keyframes tick { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ================= 5. HERO (poster style — image carries the headline) ================= */
.apn-hero { padding: 12px 12px 0; max-width: 1200px; margin: 0 auto; }
.apn-hero-card {
	position: relative; border-radius: var(--r); overflow: hidden;
	box-shadow: var(--shadow); background: var(--ink); display: block;
}
.apn-hero-card img {
	width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; display: block;
}
.apn-kicker {
	display: inline-block; font-size: 10.5px; font-weight: 800;
	letter-spacing: .05em; text-transform: uppercase;
	background: var(--gold); color: var(--ink);
	border-radius: 6px; padding: 3px 9px; margin-bottom: 8px;
}
.apn-meta { font-size: 11.5px; color: rgba(255,255,255,.75); display: flex; gap: 8px; }
.apn-meta.dark { color: var(--muted); }
.apn-hero-card .apn-kicker {
	position: absolute; top: 12px; left: 12px; margin: 0;
	box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.apn-hero-card .apn-hero-meta {
	position: absolute; bottom: 10px; right: 12px;
	background: rgba(0,0,0,.65); color: #fff;
	font-size: 11px; font-weight: 600;
	padding: 4px 11px; border-radius: 999px;
	display: flex; gap: 6px; align-items: center;
}
.apn-hero-card h2.apn-sr {
	position: absolute; width: 1px; height: 1px; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
/* No-image fallback: show the headline as text */
.apn-hero-notext .apn-hero-fallback {
	display: flex; align-items: center; justify-content: center;
	aspect-ratio: 1200 / 630; background: linear-gradient(135deg, var(--ink2), var(--red-dark));
	padding: 24px; text-align: center;
}
.apn-hero-notext .apn-hero-fallback h2 {
	color: #fff; font-size: 20px; font-weight: 800; line-height: 1.5; margin: 0;
	position: static; width: auto; height: auto; clip: none;
}

/* ================= 6. SECTIONS ================= */
.apn-section { max-width: 1200px; margin: 0 auto; padding: 0 12px; }
.apn-sechead {
	display: flex; align-items: center; justify-content: space-between;
	margin: 22px 0 12px;
}
.apn-sechead h2 {
	font-size: 17px; font-weight: 800; margin: 0;
	padding-left: 10px; border-left: 4px solid var(--red); line-height: 1.3;
}
.apn-sechead a.more { font-size: 12.5px; font-weight: 700; color: var(--red); }

/* horizontal mini cards */
.apn-list { display: flex; flex-direction: column; gap: 10px; }
.apn-card {
	display: flex; gap: 12px; background: var(--paper);
	border: 1px solid var(--line); border-radius: var(--r);
	padding: 10px; box-shadow: var(--shadow);
}
.apn-card-img { flex: 0 0 108px; }
.apn-card-img img { width: 108px; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--rs); display: block; }
.apn-card-body { flex: 1; min-width: 0; }
.apn-card-cat { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--red); }
.apn-card-body h3 { font-size: 14.5px; font-weight: 700; line-height: 1.5; margin: 3px 0 6px;
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.apn-card-time { font-size: 11px; color: var(--muted); }

/* medium feature card */
.apn-feat {
	background: var(--paper); border: 1px solid var(--line); border-radius: var(--r);
	overflow: hidden; box-shadow: var(--shadow); margin-bottom: 10px; display: block;
}
.apn-feat img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.apn-feat-body { padding: 12px 14px 14px; }
.apn-feat-body h3 { font-size: 16px; font-weight: 800; line-height: 1.45; margin: 4px 0 6px; }

/* ================= 7. WEB STORIES RAIL ================= */
.apn-stories { display: flex; gap: 12px; overflow-x: auto; padding: 4px 12px 8px; scrollbar-width: none; }
.apn-stories::-webkit-scrollbar { display: none; }
.apn-story { flex: 0 0 auto; width: 76px; text-align: center; }
.apn-story img {
	width: 68px; height: 68px; border-radius: 50%; object-fit: cover;
	border: 3px solid var(--red); padding: 2px; background: #fff; display: block; margin: 0 auto;
}
.apn-story span { font-size: 10.5px; font-weight: 600; display: block; margin-top: 5px;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 992px) {
	.apn-stories { max-width: 1200px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
}

/* ================= 8. ARTICLE ================= */
.apn-article { background: var(--paper); }
.apn-article-in { max-width: 780px; margin: 0 auto; padding: 16px 16px 8px; }
.apn-article h1 { font-size: 23px; font-weight: 800; line-height: 1.42; margin: 8px 0 10px; }
.apn-byline {
	display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
	font-size: 12.5px; color: var(--muted);
	padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px;
}
.apn-byline .avatar {
	width: 30px; height: 30px; border-radius: 50%; background: var(--red);
	color: #fff; font-weight: 800; font-size: 13px;
	display: inline-flex; align-items: center; justify-content: center;
}
.apn-featured { margin: 14px 0 6px; }
.apn-featured img { border-radius: var(--r); width: 100%; }
.apn-content { font-size: 16.5px; line-height: 1.85; color: #262626; }
.apn-content p { margin-bottom: 1.1em; }
.apn-content h2 {
	font-size: 19px; font-weight: 800; margin: 1.5em 0 .6em;
	padding-left: 10px; border-left: 4px solid var(--red); color: var(--ink);
}
.apn-content img { border-radius: var(--rs); }
.apn-content blockquote {
	border-left: 4px solid var(--gold); background: var(--wash);
	border-radius: 0 var(--rs) var(--rs) 0;
	padding: 12px 14px; margin: 1.2em 0; font-size: 15.5px;
}
.apn-tags { margin: 16px 0; }
.apn-tags a {
	display: inline-block; font-size: 12px; font-weight: 600;
	background: var(--wash); border: 1px solid var(--line);
	border-radius: 999px; padding: 6px 12px; margin: 0 6px 8px 0;
}
.apn-share {
	display: flex; gap: 10px; align-items: center;
	padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
	margin: 8px 0 0;
}
.apn-share span { font-size: 13px; font-weight: 700; }
.apn-share button, .apn-share a {
	width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
	background: var(--paper); display: inline-flex; align-items: center; justify-content: center;
	cursor: pointer;
}
.apn-share svg { width: 19px; height: 19px; stroke: var(--ink); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.apn-share button.primary { background: var(--red); border-color: var(--red); }
.apn-share button.primary svg { stroke: #fff; }

/* related */
.apn-related { max-width: 1200px; margin: 0 auto; padding: 0 12px 8px; }
.apn-rel-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.apn-rel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.apn-rel img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.apn-rel h4 { font-size: 12.5px; line-height: 1.45; padding: 8px 10px 10px; margin: 0;
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 600px) { .apn-rel-grid { grid-template-columns: 1fr 1fr; } }

/* prev next */
.apn-pn { max-width: 780px; margin: 0 auto; padding: 0 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.apn-pn a { background: var(--wash); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font-size: 14px; font-weight: 600; display: block; }
.apn-pn small { display: block; font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* progress */
#apn-progress { display: none; }
@media (max-width: 991px) {
	#apn-progress { display: block; position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--red); z-index: 1001; }
}

/* ================= 9. ARCHIVE / SEARCH ================= */
.apn-arch-head { max-width: 1200px; margin: 0 auto; padding: 18px 12px 4px; }
.apn-arch-head h1 { font-size: 21px; font-weight: 800; margin: 0; padding-left: 10px; border-left: 4px solid var(--red); }
.apn-arch-head p { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.apn-pagination { display: flex; gap: 8px; justify-content: center; padding: 18px 12px 26px; }
.apn-pagination .page-numbers {
	min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
	background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
	font-size: 14px; font-weight: 700; padding: 0 10px;
}
.apn-pagination .page-numbers.current { background: var(--red); border-color: var(--red); color: #fff; }

/* ================= 10. TAB BAR ================= */
#apn-tabbar { display: none; }
@media (max-width: 991px) {
	#apn-tabbar {
		display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 999;
		height: calc(var(--tabh) + env(safe-area-inset-bottom, 0px));
		padding-bottom: env(safe-area-inset-bottom, 0px);
		background: rgba(255,255,255,.97);
		backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
		border-top: 1px solid var(--line);
		box-shadow: 0 -2px 16px rgba(0,0,0,.08);
	}
	#apn-tabbar a {
		flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
		gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 600; min-width: 0; position: relative;
	}
	#apn-tabbar a svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
	#apn-tabbar a.on { color: var(--red); }
	#apn-tabbar a.on::before {
		content: ""; position: absolute; top: 0; width: 26px; height: 3px;
		border-radius: 0 0 4px 4px; background: var(--red);
	}
	body { padding-bottom: calc(var(--tabh) + env(safe-area-inset-bottom, 0px)); }
}

/* search overlay — works on all screen sizes */
#apn-search-overlay { display: none; }
#apn-search-overlay.open {
	display: flex; position: fixed; inset: 0; z-index: 1000;
	background: rgba(10,10,10,.55); align-items: flex-start; justify-content: center;
	padding: 88px 16px 16px;
}
#apn-search-overlay form {
	width: 100%; max-width: 520px; display: flex; background: #fff;
	border-radius: 999px; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
#apn-search-overlay input[type="search"] {
	flex: 1; border: none; outline: none; font-size: 16px; padding: 14px 20px; background: transparent; min-width: 0;
}
#apn-search-overlay button { border: none; background: var(--red); color: #fff; font-weight: 700; font-size: 15px; padding: 0 26px; cursor: pointer; }

/* back to top */
#apn-top { display: none; }
@media (max-width: 991px) {
	#apn-top {
		display: flex; align-items: center; justify-content: center;
		position: fixed; right: 14px; bottom: calc(var(--tabh) + 16px + env(safe-area-inset-bottom, 0px));
		width: 44px; height: 44px; border-radius: 50%;
		background: var(--ink); color: #fff; border: none;
		box-shadow: 0 4px 14px rgba(0,0,0,.25); z-index: 998;
		opacity: 0; pointer-events: none; transition: opacity .25s; cursor: pointer;
	}
	#apn-top.show { opacity: 1; pointer-events: auto; }
	#apn-top svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }
}

/* ================= 11. FOOTER ================= */
.apn-footer { background: var(--ink); color: #c9cdd3; margin-top: 26px; }
.apn-footer-in { max-width: 1200px; margin: 0 auto; padding: 26px 12px 18px; }
.apn-footer-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.apn-footer p { font-size: 13px; }
.apn-footer nav ul { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.apn-footer nav a { font-size: 13px; color: #edeff2; }
.apn-copy { border-top: 1px solid #2a2a2a; margin-top: 16px; padding-top: 12px; font-size: 12px; color: #8a8f98; }

/* ================= 12. DESKTOP ================= */
.apn-hero-side { display: none; }
.apn-split { display: block; }
.apn-sidebar { display: none; }

@media (min-width: 992px) {
	.wrap { padding: 0 20px; }
	.apn-topbar-in { height: 64px; padding: 0 20px; }
	.apn-hero, .apn-arch-head, .apn-related { padding-left: 20px; padding-right: 20px; }
	.apn-section { padding-left: 20px; padding-right: 20px; }

	/* Hero: big story + 4 mini rail */
	.apn-hero-grid { display: grid; grid-template-columns: 1.9fr 1fr; gap: 14px; }
	.apn-hero-side { display: flex; flex-direction: column; gap: 10px; }
	.apn-mini {
		display: flex; gap: 10px; align-items: center;
		background: var(--paper); border: 1px solid var(--line);
		border-radius: var(--rs); padding: 8px;
		transition: border-color .2s ease;
	}
	.apn-mini:hover { border-color: var(--red); }
	.apn-mini-img { flex: 0 0 96px; }
	.apn-mini-img img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; display: block; }
	.apn-mini-body { flex: 1; min-width: 0; }
	.apn-mini-body h4 {
		font-size: 13px; line-height: 1.45; font-weight: 700; margin: 0 0 4px;
		display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
	}

	/* Content + sidebar split */
	.apn-split {
		max-width: 1200px; margin: 0 auto; padding: 0 20px;
		display: grid; grid-template-columns: minmax(0, 1fr) 320px;
		gap: 24px; align-items: start;
	}
	.apn-main { min-width: 0; }
	.apn-main .apn-section { max-width: none; margin: 0; padding: 0; }

	/* Sidebar */
	.apn-sidebar { display: block; position: sticky; top: 132px; }
	.apn-side-block {
		background: var(--paper); border: 1px solid var(--line);
		border-radius: var(--r); padding: 16px 18px; margin-bottom: 16px;
		box-shadow: var(--shadow);
	}
	.apn-side-block h3 {
		font-size: 15px; font-weight: 800; margin: 0 0 10px;
		padding-left: 10px; border-left: 4px solid var(--red);
	}
	.apn-side-block ol { list-style: none; margin: 0; padding: 0; counter-reset: trend; }
	.apn-side-block ol li {
		counter-increment: trend;
		display: flex; gap: 10px; align-items: flex-start;
		padding: 9px 0; border-bottom: 1px solid var(--wash);
		font-size: 13.5px; font-weight: 600; line-height: 1.5;
	}
	.apn-side-block ol li:last-child { border-bottom: none; padding-bottom: 0; }
	.apn-side-block ol li::before {
		content: counter(trend);
		flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
		background: var(--wash); color: var(--red);
		font-size: 12px; font-weight: 800;
		display: inline-flex; align-items: center; justify-content: center;
	}
	.apn-side-block ol li a:hover { color: var(--red); }
	.apn-sidebar .widget {
		background: var(--paper); border: 1px solid var(--line);
		border-radius: var(--r); padding: 18px; margin-bottom: 16px;
		box-shadow: var(--shadow);
	}
	.apn-sidebar .widget h2, .apn-sidebar .widget-title {
		font-size: 15px; font-weight: 800; margin: 0 0 10px;
	}
	.apn-sidebar .widget img { border-radius: var(--rs); }

	.apn-list-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
	.apn-article-in { padding: 26px 20px 10px; }
	.apn-article h1 { font-size: 30px; }
	.apn-chips { position: static; }
	#apn-tabbar, #apn-top { display: none !important; }
	body { padding-bottom: 0; }
}
