/*
Theme Name: FP News
Theme URI: https://example.com
Author: FP News
Description: Fully custom bilingual (Bangla/English) newspaper theme — regular WordPress posts and categories, infinite-scroll archives, view-based Most Read, and same-category recommendations.
Version: 1.0.0
Requires at least: 6.0
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: fp-news
*/

/* ==================================================================
   1. Tokens
   ================================================================== */
:root {
	--maroon: #6e1f2a;
	--maroon-dark: #4c141c;
	--maroon-tint: #f7e9ea;
	--cream: #fbf3e4;
	--ink: #221512;
	--ink-soft: #5b4a44;
	--ink-faint: #8d7c75;
	--paper: #faf7f0;
	--surface: #ffffff;
	--line: rgba(34, 21, 18, 0.12);
	--line-strong: rgba(34, 21, 18, 0.24);
	--live: #b23a2e;
	--gold: #b4790a;
	--focus: var(--maroon);

	/* The masthead/footer are a deliberately constant dark bar in both
	   light and dark site themes — intentionally NOT redefined inside
	   the dark-mode block below, unlike --ink/--cream which flip. */
	--masthead-bg: #221512;
	--masthead-fg: #fbf3e4;
	--masthead-fg-rgb: 251, 243, 228;

	--font-serif: "Bitter", Georgia, "Times New Roman", serif;
	--font-serif-bn: "Noto Serif Bengali", var(--font-serif);
	--font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--font-sans-bn: "Noto Sans Bengali", var(--font-sans);

	--container: 1240px;
	--radius: 4px;
	--shadow-card: 0 1px 2px rgba(34, 21, 18, 0.06);

	/* This is a fixed light-mode design — deliberately not adapting to
	   the visitor's OS/browser dark-mode preference. color-scheme
	   tells the browser itself (scrollbars, form controls) to stay
	   light too, instead of guessing from the system setting. */
	color-scheme: light;
}

/* ==================================================================
   2. Reset & base
   ================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: 16px;
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}
body.lang-bn { font-family: var(--font-sans-bn); }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; }
input, textarea { font: inherit; }

a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 2px;
}

.container { max-width: var(--container); margin: 0 auto; padding: 0 1.4rem; }

.sr-only {
	position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
	position: absolute; left: -9999px; top: 0; z-index: 999;
	background: var(--maroon); color: #fff; padding: 0.7rem 1.2rem;
}
.skip-link:focus { left: 0.6rem; top: 0.6rem; }

h1, h2, h3, h4 {
	font-family: var(--font-serif);
	font-weight: 700;
	line-height: 1.18;
	margin: 0;
	text-wrap: balance;
}
body.lang-bn h1, body.lang-bn h2, body.lang-bn h3, body.lang-bn h4 { font-family: var(--font-serif-bn); }

/* ==================================================================
   3. Header / masthead
   ================================================================== */
.site-header {
	background: var(--ink);
	color: var(--cream);
	position: sticky;
	top: 0;
	z-index: 60;
}
.masthead-bar {
	display: flex;
	align-items: center;
	gap: 1.5rem;
	padding: 0.9rem 1.4rem;
	max-width: var(--container);
	margin: 0 auto;
}
.site-branding { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
.site-branding img { height: 40px; width: auto; }
.site-branding .site-title {
	font-family: var(--font-serif);
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--cream);
}
.site-dateline {
	font-size: 0.78rem;
	color: rgba(251, 243, 228, 0.68);
	white-space: nowrap;
	border-left: 1px solid rgba(251,243,228,0.2);
	padding-left: 1rem;
	display: none;
}
@media (min-width: 900px) { .site-dateline { display: block; } }

.main-nav { flex: 1; overflow: hidden; }
.main-nav > ul { display: none; align-items: center; gap: 1.5rem; flex-wrap: nowrap; }
@media (min-width: 1080px) { .main-nav > ul { display: flex; } }

.main-nav > ul > li { position: relative; }
.main-nav > ul > li > a {
	display: block;
	padding: 0.5rem 0;
	font-size: 0.9rem;
	font-weight: 500;
	color: rgba(251, 243, 228, 0.86);
	white-space: nowrap;
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li.current-menu-item > a { color: var(--gold); }

.main-nav .menu-item-has-children > a::after { content: "▾"; font-size: 0.6em; margin-left: 0.35em; opacity: 0.7; }
.main-nav .sub-menu {
	position: absolute;
	top: 100%; left: 0;
	background: var(--ink);
	border: 1px solid rgba(251,243,228,0.14);
	min-width: 210px;
	padding: 0.5rem 0;
	box-shadow: 0 12px 24px rgba(0,0,0,0.35);
	opacity: 0;
	visibility: hidden;
	transform: translateY(4px);
	transition: opacity 0.15s ease, transform 0.15s ease;
}
.main-nav .menu-item-has-children:hover > .sub-menu,
.main-nav .menu-item-has-children:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.main-nav .sub-menu a { padding: 0.55rem 1.1rem; font-size: 0.86rem; color: rgba(251,243,228,0.86); }
.main-nav .sub-menu a:hover { color: var(--gold); background: rgba(251,243,228,0.06); }

.masthead-actions { display: flex; align-items: center; gap: 0.9rem; flex-shrink: 0; }
.lang-switch {
	font-size: 0.82rem;
	font-weight: 600;
	border: 1px solid rgba(251,243,228,0.3);
	border-radius: 3px;
	padding: 0.32rem 0.65rem;
}
.lang-switch:hover { border-color: var(--gold); color: var(--gold); }

.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; color: var(--cream); border-radius: 50%; }
.icon-btn:hover { background: rgba(251,243,228,0.1); }
.nav-toggle { display: grid; }
@media (min-width: 1080px) { .nav-toggle { display: none; } }

/* Mobile nav */
.mobile-nav {
	display: none;
	flex-direction: column;
	background: var(--ink);
	border-top: 1px solid rgba(251,243,228,0.12);
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.25s ease;
}
.mobile-nav.is-open { display: flex; max-height: 80vh; overflow-y: auto; }
.mobile-nav ul { padding: 0.4rem 0; }
.mobile-nav a { display: block; padding: 0.75rem 1.4rem; font-size: 0.94rem; color: rgba(251,243,228,0.88); border-bottom: 1px solid rgba(251,243,228,0.06); }
.mobile-nav .sub-menu a { padding-left: 2.4rem; font-size: 0.88rem; opacity: 0.85; }

/* Search overlay */
.search-overlay {
	position: fixed; inset: 0; z-index: 90;
	background: rgba(20, 12, 10, 0.72);
	display: none;
	align-items: flex-start;
	justify-content: center;
	padding-top: 12vh;
}
.search-overlay.is-open { display: flex; }
.search-overlay form {
	width: min(560px, 92vw);
	background: var(--surface);
	border-radius: var(--radius);
	display: flex;
	align-items: center;
	padding: 0.4rem 0.4rem 0.4rem 1.1rem;
	box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
.search-overlay input[type="search"] {
	flex: 1; border: 0; background: none; padding: 0.75rem 0.5rem; font-size: 1.05rem; color: var(--ink);
}
.search-overlay input[type="search"]:focus { outline: none; }
.search-overlay button[type="submit"] { background: var(--maroon); color: #fff; padding: 0.65rem 1.1rem; border-radius: 3px; font-size: 0.86rem; font-weight: 600; }
.search-overlay-close { position: absolute; top: 1.4rem; right: 1.4rem; color: #fff; }

/* ==================================================================
   4. Breaking strip
   ================================================================== */
.breaking-strip { background: var(--surface); border-bottom: 1px solid var(--line-strong); }
.breaking-strip .container { display: grid; gap: 0; grid-template-columns: repeat(4, 1fr); }
.breaking-item {
	padding: 1rem 1.3rem;
	border-right: 1px solid var(--line);
	font-family: var(--font-serif);
	font-size: 1.02rem;
	font-weight: 700;
	line-height: 1.32;
}
body.lang-bn .breaking-item { font-family: var(--font-serif-bn); }
.breaking-item:last-child { border-right: none; }
.breaking-item a:hover { color: var(--maroon); }
@media (max-width: 900px) {
	.breaking-strip .container { grid-template-columns: 1fr 1fr; }
	.breaking-item:nth-child(2) { border-right: none; }
}
@media (max-width: 560px) {
	.breaking-strip .container { grid-template-columns: 1fr; }
	.breaking-item { border-right: none; border-bottom: 1px solid var(--line); }
}

/* ==================================================================
   5. Hero (homepage lead)
   ================================================================== */
.hero-section { padding: 1.6rem 0; }
.hero-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.6rem; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

.lead-story {
	background: var(--cream);
	border-radius: var(--radius);
	overflow: hidden;
	display: grid;
	grid-template-rows: auto 1fr;
}
.lead-story .thumb { aspect-ratio: 16/9; overflow: hidden; }
.lead-story .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lead-story .body { padding: 1.4rem 1.6rem 1.7rem; }
.lead-story h1, .lead-story h2 { font-size: clamp(1.5rem, 2.6vw, 2.2rem); }
.lead-story .deck { margin-top: 0.7rem; color: var(--ink-soft); font-size: 1rem; max-width: 62ch; }

.secondary-grid { display: grid; gap: 1.4rem; grid-template-columns: 1fr; align-content: start; }

.section-label {
	font-family: var(--font-sans);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--maroon);
}
.meta-row { display: flex; gap: 0.5rem; align-items: center; font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.35rem; }
.badge-breaking {
	display: inline-flex; align-items: center; gap: 0.3rem;
	background: var(--live); color: #fff; font-size: 0.68rem; font-weight: 700;
	letter-spacing: 0.05em; text-transform: uppercase; padding: 0.18rem 0.5rem; border-radius: 2px;
}

/* ==================================================================
   6. Cards
   ================================================================== */
.card-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .card-grid { grid-template-columns: 1fr; } }

.card { display: flex; flex-direction: column; }
.card .thumb {
	aspect-ratio: 3/2; overflow: hidden; border-radius: var(--radius); background: var(--line);
	position: relative;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.card a:hover .thumb img { transform: scale(1.04); }
.card .body { padding-top: 0.75rem; }
.card h3 { font-size: 1.02rem; line-height: 1.32; }
.card a:hover h3 { color: var(--maroon); }
.card .deck { margin-top: 0.4rem; font-size: 0.86rem; color: var(--ink-soft); }

.card.variant-compact { flex-direction: row; gap: 0.9rem; }
.card.variant-compact .thumb { width: 96px; height: 72px; flex-shrink: 0; aspect-ratio: auto; }
.card.variant-compact .body { padding-top: 0; }
.card.variant-compact h3 { font-size: 0.92rem; }

.card.variant-text .body { padding-top: 0; }
.card.variant-text h3 { font-size: 0.95rem; }

/* ==================================================================
   7. Most Read
   ================================================================== */
.most-read { padding: 2.4rem 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); }
.section-heading {
	font-family: var(--font-sans);
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	margin-bottom: 1.4rem;
	color: var(--ink);
}
.most-read-list { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.4rem; }
@media (max-width: 980px) { .most-read-list { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .most-read-list { grid-template-columns: repeat(2, 1fr); } }

.most-read-item { display: flex; gap: 0.7rem; }
.most-read-num {
	font-family: var(--font-serif);
	font-size: 2.2rem;
	font-weight: 700;
	color: var(--line-strong);
	line-height: 1;
	flex-shrink: 0;
}
.most-read-item .thumb { aspect-ratio: 4/3; border-radius: var(--radius); overflow: hidden; margin-bottom: 0.5rem; }
.most-read-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.most-read-item h4 { font-size: 0.88rem; font-family: var(--font-sans); font-weight: 600; line-height: 1.32; }
body.lang-bn .most-read-item h4 { font-family: var(--font-sans-bn); }
.most-read-item a:hover h4 { color: var(--maroon); }

/* ==================================================================
   8. Content layout (latest grid + sidebar)
   ================================================================== */
.content-layout { display: grid; grid-template-columns: 1fr 320px; gap: 2.4rem; padding-top: 2.4rem; padding-bottom: 2.4rem; align-items: start; }
@media (max-width: 980px) { .content-layout { grid-template-columns: 1fr; } }

.stream-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 1.4rem; }

.load-more-status { text-align: center; padding: 2rem 0; color: var(--ink-faint); font-size: 0.88rem; }
.load-more-status .spinner {
	display: inline-block; width: 16px; height: 16px; border-radius: 50%;
	border: 2px solid var(--line-strong); border-top-color: var(--maroon);
	animation: fp-spin 0.7s linear infinite; vertical-align: -3px; margin-right: 0.5rem;
}
@keyframes fp-spin { to { transform: rotate(360deg); } }
.load-more-btn {
	border: 1px solid var(--line-strong); border-radius: 3px; padding: 0.6rem 1.4rem;
	font-size: 0.86rem; font-weight: 600;
}
.load-more-btn:hover { border-color: var(--maroon); color: var(--maroon); }

.sidebar { position: sticky; top: 5.5rem; display: flex; flex-direction: column; gap: 2rem; }
.widget-title { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 1rem; padding-bottom: 0.7rem; border-bottom: 1px solid var(--line-strong); }
.trending-list { display: flex; flex-direction: column; gap: 1rem; }
.trending-list li { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.trending-list li:last-child { border: none; padding-bottom: 0; }
.trending-list h4 { font-size: 0.9rem; line-height: 1.35; }
.trending-list a:hover h4 { color: var(--maroon); }
.trending-list .meta-row { margin-top: 0.3rem; }

.ad-slot {
	border: 1px dashed var(--line-strong);
	border-radius: var(--radius);
	min-height: 250px;
	display: grid;
	place-items: center;
	color: var(--ink-faint);
	font-size: 0.78rem;
	text-align: center;
	padding: 1rem;
}

/* ==================================================================
   9. Single article
   ================================================================== */
.article-header { max-width: 78ch; margin: 0 auto; padding: 2.4rem 1.4rem 1.2rem; text-align: left; }
.article-header h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
.article-header .deck { margin-top: 0.9rem; font-size: 1.15rem; color: var(--ink-soft); }
.article-byline { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 1.2rem; font-size: 0.85rem; color: var(--ink-faint); padding-top: 1.1rem; border-top: 1px solid var(--line); }
.article-byline b { color: var(--ink); }

.article-hero-image { max-width: var(--container); margin: 0 auto 2rem; padding: 0 1.4rem; }
.article-hero-image img { border-radius: var(--radius); width: 100%; aspect-ratio: 16/9; object-fit: cover; }

.article-body { max-width: 72ch; margin: 0 auto; padding: 0 1.4rem 2.5rem; font-size: 1.08rem; line-height: 1.75; }
.article-body p { margin: 0 0 1.3rem; }
.article-body h2, .article-body h3 { margin: 2rem 0 1rem; }
.article-body img { border-radius: var(--radius); margin: 1.6rem 0; }
.article-body blockquote { border-left: 3px solid var(--maroon); margin: 1.8rem 0; padding: 0.2rem 0 0.2rem 1.4rem; font-family: var(--font-serif); font-size: 1.2rem; color: var(--ink-soft); }
.article-body a { color: var(--maroon); text-decoration: underline; text-underline-offset: 2px; }

.related-posts { border-top: 1px solid var(--line-strong); padding: 2.6rem 0; margin-top: 1rem; }

/* Continuous article-to-article reader */
.reader-divider {
	max-width: 72ch;
	margin: 3.2rem auto 2rem;
	padding: 0 1.4rem;
	text-align: center;
	position: relative;
}
.reader-divider::before {
	content: "";
	display: block;
	height: 1px;
	background: var(--line-strong);
	margin-bottom: -0.8rem;
}
.reader-divider-label {
	background: var(--paper);
	padding: 0 1rem;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--maroon);
}
.reader-sentinel {
	padding: 2.5rem 0 4rem;
	text-align: center;
	font-size: 0.85rem;
	color: var(--ink-faint);
}

/* ==================================================================
   10. Footer
   ================================================================== */
.site-footer { background: var(--ink); color: var(--cream); margin-top: 3rem; }
.footer-contact-bar {
	border-bottom: 1px solid rgba(251,243,228,0.12);
	padding-top: 1.6rem;
	padding-bottom: 1.6rem;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.4rem;
	text-align: center;
}
@media (max-width: 720px) { .footer-contact-bar { grid-template-columns: 1fr; } }
.footer-contact-bar .label { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(251,243,228,0.55); margin-bottom: 0.4rem; }
.footer-contact-bar .value { font-weight: 600; }
.footer-social { display: flex; gap: 0.9rem; justify-content: center; }
.footer-social a { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(251,243,228,0.24); border-radius: 50%; }
.footer-social a:hover { border-color: var(--gold); color: var(--gold); }

.footer-bottom { padding-top: 1.6rem; padding-bottom: 2rem; display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; align-items: center; justify-content: space-between; }
.footer-brand { font-family: var(--font-serif); font-size: 1.1rem; font-weight: 700; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: 0.85rem; }
.footer-nav a { color: rgba(251,243,228,0.72); }
.footer-nav a:hover { color: var(--gold); }
.footer-legal { width: 100%; font-size: 0.78rem; color: rgba(251,243,228,0.5); border-top: 1px solid rgba(251,243,228,0.1); padding-top: 1.2rem; margin-top: 0.4rem; }

/* ==================================================================
   11. Archive / search / 404
   ================================================================== */
.page-title-bar { padding-top: 2rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--line-strong); margin-bottom: 2rem; }
.page-title-bar h1 { font-size: 1.9rem; }
.page-title-bar .archive-desc { margin-top: 0.5rem; color: var(--ink-soft); }

.no-results { padding: 3rem 0; text-align: center; color: var(--ink-faint); }

/* ==================================================================
   12. Utility
   ================================================================== */
.visually-hidden-on-desktop { display: block; }
@media (min-width: 1080px) { .visually-hidden-on-desktop { display: none; } }
.back-to-top {
	position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 40;
	width: 42px; height: 42px; border-radius: 50%;
	background: var(--ink); color: var(--cream);
	display: grid; place-items: center;
	opacity: 0; visibility: hidden; transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
