/*
Theme Name:   Janmitra
Theme URI:    https://www.thejanmitra.com
Description:  Lightweight Hindi news theme for The Janmitra — no jQuery, CLS-safe ad slots, mobile-first.
Version:      1.0.0
Requires at least: 6.3
Tested up to: 6.8
Requires PHP: 8.0
License:      GPL-2.0-or-later
Text Domain:  janmitra
*/

/* ---------- Tokens ---------- */
:root {
	--brand: #9b1b1f;
	--brand-dark: #761418;
	--brand-soft: #fbeeee;
	--ink: #161616;
	--ink-2: #3d3d3d;
	--muted: #6b6b6b;
	--line: #e7e2dc;
	--bg: #ffffff;
	--bg-soft: #f6f3ef;
	--footer: #151515;
	--radius: 6px;
	--gutter: 16px;
	--container: 1200px;
	--font: "Mukta", "Noto Sans Devanagari", "Hind", system-ui, -apple-system, "Segoe UI", sans-serif;
	--shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .06);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font);
	font-size: 1rem;
	line-height: 1.65;
	text-rendering: optimizeLegibility;
}
img, video, iframe { max-width: 100%; height: auto; }
img { display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .5em; font-weight: 700; }
button { font: inherit; cursor: pointer; }
.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link:focus {
	clip: auto; width: auto; height: auto; z-index: 100; top: 8px; left: 8px;
	background: var(--bg); padding: 8px 12px; box-shadow: var(--shadow);
}
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* ---------- Top bar ---------- */
.topbar { display: none; background: var(--bg-soft); border-bottom: 1px solid var(--line); font-size: .875rem; color: var(--ink-2); }
.topbar__inner { display: flex; align-items: center; gap: 16px; min-height: 36px; }
.topbar__date { font-weight: 600; }
.topbar .menu { display: flex; gap: 16px; margin: 0 0 0 auto; padding: 0; list-style: none; }

/* ---------- Header ---------- */
.site-header { background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header__inner { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.site-branding { flex: 1; min-width: 0; }
.site-branding img { width: auto; max-height: 44px; }
.site-title { font-size: 1.75rem; font-weight: 800; color: var(--brand); margin: 0; line-height: 1; }
.header-actions { display: flex; gap: 4px; }
.icon-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--ink);
}
.icon-btn:hover { background: var(--bg-soft); color: var(--brand); }
.header-social { display: none; gap: 4px; }

/* Search panel */
.search-panel { display: none; border-top: 1px solid var(--line); padding: 12px 0; }
.search-panel.is-open { display: block; }
.search-form { display: flex; gap: 8px; }
.search-form input[type="search"] {
	flex: 1; min-width: 0; height: 44px; padding: 0 14px; font: inherit; font-size: 1rem;
	border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--ink);
}
.search-form button {
	height: 44px; padding: 0 18px; border: 0; border-radius: var(--radius);
	background: var(--brand); color: #fff; font-weight: 600;
}

/* ---------- Primary nav (scrollable strip) ---------- */
.primary-nav { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 40; }
.primary-nav .menu {
	display: flex; gap: 2px; margin: 0; padding: 0; list-style: none;
	overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.primary-nav .menu::-webkit-scrollbar { display: none; }
.primary-nav .menu > li { position: relative; flex: none; }
.primary-nav .menu > li > a {
	display: block; padding: 10px 12px; font-weight: 600; font-size: 1.0625rem; color: #fff; white-space: nowrap;
}
.primary-nav .menu > li > a:hover,
.primary-nav .menu > .current-menu-item > a,
.primary-nav .menu > .current-category-ancestor > a { background: var(--brand-dark); color: #fff; }
.primary-nav .home-link a { display: flex; align-items: center; padding: 10px 12px; }
.primary-nav .sub-menu { display: none; }

/* ---------- Drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 90; visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer__overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .2s; }
.drawer__panel {
	position: absolute; top: 0; bottom: 0; left: 0; width: min(86vw, 360px); background: var(--bg);
	overflow-y: auto; transform: translateX(-100%); transition: transform .25s ease; padding: 12px 16px 32px;
}
.drawer.is-open .drawer__overlay { opacity: 1; }
.drawer.is-open .drawer__panel { transform: none; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer .search-form { margin-bottom: 8px; }
.drawer .menu { list-style: none; margin: 0; padding: 0; }
.drawer .menu a { display: block; padding: 10px 4px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 1.0625rem; }
.drawer .sub-menu { list-style: none; padding-left: 16px; margin: 0; }
.drawer .sub-menu a { font-weight: 400; }
.drawer .menu a[href="#"] { color: var(--muted); font-size: .875rem; pointer-events: none; border-bottom: 0; padding-bottom: 0; }
.drawer__social { display: flex; gap: 4px; margin-top: 16px; }
body.drawer-open { overflow: hidden; }

/* ---------- Ticker ---------- */
.ticker { border-bottom: 1px solid var(--line); background: var(--bg); }
.ticker__inner { display: flex; align-items: center; gap: 12px; min-height: 42px; overflow: hidden; }
.ticker__label {
	flex: none; background: var(--brand); color: #fff; font-weight: 700; font-size: .875rem;
	padding: 2px 10px; border-radius: 3px;
}
.ticker__viewport { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, #000 90%, transparent); }
.ticker__track { display: flex; gap: 40px; width: max-content; animation: ticker 60s linear infinite; }
.ticker__track a { white-space: nowrap; font-weight: 500; }
.ticker__track a::before { content: "●"; color: var(--brand); font-size: .6em; margin-right: 10px; vertical-align: middle; }
.ticker:hover .ticker__track, .ticker:focus-within .ticker__track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* ---------- Layout ---------- */
.site-main { padding: 20px 0 40px; }
.layout { display: grid; gap: 32px; }
.sidebar { display: grid; gap: 28px; align-content: start; }

/* ---------- Section heading ---------- */
.section { margin-bottom: 36px; }
.section-title {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	border-bottom: 2px solid var(--ink); margin-bottom: 16px;
}
.section-title h2 {
	margin: 0; font-size: 1.375rem; position: relative; padding-bottom: 6px;
}
.section-title h2::after {
	content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 4px; background: var(--brand);
}
.section-title .more { font-size: .9375rem; font-weight: 600; color: var(--brand); white-space: nowrap; }

/* ---------- Cards ---------- */
.card { position: relative; }
.card__media { display: block; overflow: hidden; border-radius: var(--radius); background: var(--bg-soft); aspect-ratio: 16 / 9; }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.card:hover .card__media img { transform: scale(1.03); }
.card__media--empty { display: flex; align-items: center; justify-content: center; color: var(--brand); font-weight: 800; font-size: 1.5rem; opacity: .5; }
.card__body { padding-top: 10px; }
.card__cat {
	display: inline-block; font-size: .8125rem; font-weight: 700; color: var(--brand); margin-bottom: 4px;
}
.card__title { font-size: 1.125rem; line-height: 1.45; margin: 0 0 6px; }
.card__title a:hover { color: var(--brand); }
.card__excerpt { color: var(--ink-2); margin: 0 0 6px; font-size: 1rem; }
.card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--muted); font-size: .8125rem; }

.card--lead .card__title { font-size: clamp(1.375rem, 4.5vw, 2rem); line-height: 1.35; }
.card--lead .card__excerpt { font-size: 1.0625rem; }

.card--row { display: grid; grid-template-columns: 1fr 112px; gap: 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.card--row:last-child { border-bottom: 0; }
.card--row .card__media { order: 2; aspect-ratio: 4 / 3; }
.card--row .card__body { padding-top: 0; }
.card--row .card__title { font-size: 1.0625rem; }

.card--text { padding: 12px 0; border-bottom: 1px solid var(--line); }
.card--text:last-child { border-bottom: 0; }
.card--text .card__title { font-size: 1.0625rem; margin: 0 0 4px; }

.numbered { counter-reset: n; list-style: none; margin: 0; padding: 0; }
.numbered li { counter-increment: n; display: grid; grid-template-columns: 36px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.numbered li:last-child { border-bottom: 0; }
.numbered li::before { content: counter(n); font-size: 1.75rem; font-weight: 800; color: var(--brand); line-height: 1; opacity: .85; }
.numbered a { font-weight: 600; line-height: 1.45; }

.grid { display: grid; gap: 20px; }

/* ---------- Home ---------- */
.hero { display: grid; gap: 8px; margin-bottom: 36px; }
.block-a { display: grid; gap: 8px; }

/* ---------- Widgets / sidebar boxes ---------- */
.widget, .box { background: var(--bg); }
.box__title, .widget-title {
	font-size: 1.125rem; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--brand);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.follow-box { background: var(--bg-soft); border-radius: var(--radius); padding: 16px; }
.follow-box p { margin: 0 0 12px; color: var(--ink-2); }
.follow-links { display: flex; flex-wrap: wrap; gap: 8px; }
.follow-links a {
	display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
	background: var(--bg); border: 1px solid var(--line); font-weight: 600; font-size: .9375rem;
}

/* ---------- Ad slots (space reserved = no CLS) ---------- */
.ad-slot { text-align: center; margin: 24px auto; overflow: hidden; }
.ad-slot__label { display: block; font-size: .6875rem; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.ad-slot--ad-header { min-height: 110px; margin: 12px auto; }
.ad-slot--ad-in-article, .ad-slot--ad-after-article { min-height: 300px; }
.ad-slot--ad-sidebar { min-height: 270px; margin: 0; }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-size: .875rem; color: var(--muted); margin-bottom: 12px; }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li + li::before { content: "›"; margin-right: 4px; }
.breadcrumb a:hover { color: var(--brand); }

/* ---------- Article ---------- */
.article-header { margin-bottom: 16px; }
.article-cat {
	display: inline-block; background: var(--brand); color: #fff; font-weight: 700; font-size: .8125rem;
	padding: 2px 10px; border-radius: 3px; margin-bottom: 10px;
}
.article-cat:hover { color: #fff; background: var(--brand-dark); }
.article-title { font-size: clamp(1.625rem, 5vw, 2.5rem); line-height: 1.3; margin: 0 0 12px; letter-spacing: -.005em; }
.article-dek { font-size: 1.1875rem; color: var(--ink-2); margin: 0 0 14px; line-height: 1.6; }
.article-meta {
	display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--muted); font-size: .9375rem;
	padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.article-meta .author { color: var(--ink); font-weight: 700; }
.article-meta span { display: inline-flex; align-items: center; gap: 4px; }
.article-meta .icon { width: 16px; height: 16px; }

.article-figure { margin: 0 0 20px; }
.article-figure img { width: 100%; border-radius: var(--radius); aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg-soft); }
.article-figure figcaption { font-size: .875rem; color: var(--muted); margin-top: 6px; }

.entry-content { font-size: 1.1875rem; line-height: 1.85; color: var(--ink); overflow-wrap: break-word; }
.entry-content > * { margin: 0 0 1.1em; }
.entry-content h2 { font-size: 1.5rem; margin-top: 1.5em; }
.entry-content h3 { font-size: 1.3125rem; margin-top: 1.4em; }
.entry-content a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.entry-content img { border-radius: var(--radius); height: auto; }
.entry-content figure { margin-left: 0; margin-right: 0; }
.entry-content figcaption, .entry-content .wp-caption-text { font-size: .875rem; color: var(--muted); text-align: center; }
.entry-content .wp-caption { max-width: 100%; }
.entry-content blockquote {
	margin-left: 0; padding: 12px 18px; border-left: 4px solid var(--brand); background: var(--bg-soft);
	font-size: 1.125rem; border-radius: 0 var(--radius) var(--radius) 0;
}
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 1rem; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 8px; }
.entry-content iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; }
.entry-content .alignleft { float: left; margin: .3em 1em .5em 0; }
.entry-content .alignright { float: right; margin: .3em 0 .5em 1em; }
.entry-content .aligncenter { margin-left: auto; margin-right: auto; }

.also-read {
	border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: var(--radius);
	padding: 12px 14px; background: var(--bg-soft); font-size: 1.0625rem; line-height: 1.5;
}
.also-read strong { display: block; color: var(--brand); font-size: .875rem; margin-bottom: 2px; }
.entry-content .also-read a { color: var(--ink); text-decoration: none; font-weight: 700; }
.entry-content .also-read a:hover { color: var(--brand); }

/* Share */
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0; }
.share__label { display: none; font-weight: 700; margin-right: 4px; }
.share a, .share button {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; min-width: 40px;
	padding: 0 12px; border: 0; border-radius: 999px; color: #fff; font-weight: 600; font-size: .9375rem;
}
.share a:hover, .share button:hover { color: #fff; filter: brightness(.92); }
.share .icon { width: 18px; height: 18px; }
.share--whatsapp { background: #1fa855; }
.share--facebook { background: #1877f2; }
.share--x { background: #111; }
.share--telegram { background: #229ed9; }
.share--copy, .share--native { background: var(--ink-2); }
.share--native { display: none !important; }
.has-native-share .share--native { display: inline-flex !important; }
.share__text { display: none; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.tags a { padding: 4px 12px; border-radius: 999px; background: var(--bg-soft); font-size: .9375rem; }
.tags a:hover { background: var(--brand-soft); }

.author-box { display: flex; gap: 14px; padding: 16px; background: var(--bg-soft); border-radius: var(--radius); margin: 24px 0; }
.author-box img { border-radius: 50%; width: 64px; height: 64px; }
.author-box h2 { font-size: 1.0625rem; margin: 0 0 4px; }
.author-box p { margin: 0; color: var(--ink-2); font-size: .9375rem; }

.related { margin-top: 32px; }

/* ---------- Archive ---------- */
.archive-header { margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.archive-header h1 { font-size: clamp(1.5rem, 4vw, 2.125rem); margin: 0; }
.archive-header h1 span { color: var(--brand); }
.archive-header p { color: var(--ink-2); margin: 6px 0 0; }
.archive-lead { margin-bottom: 8px; }

.pagination { margin: 28px 0 0; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; padding: 0 12px;
	border: 1px solid var(--line); border-radius: var(--radius); font-weight: 600;
}
.pagination .current { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Team page styles live in the janmitra-team plugin (janmitra-team.css). */

/* ---------- Page / 404 ---------- */
.page-title { font-size: clamp(1.5rem, 4vw, 2.25rem); margin-bottom: 16px; }
.not-found { text-align: center; padding: 32px 0; }
.not-found__code { font-size: 4.5rem; font-weight: 800; color: var(--brand); line-height: 1; }
.not-found .search-form { max-width: 480px; margin: 20px auto 32px; }

/* ---------- Comments ---------- */
.comments-area { margin-top: 32px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .children { list-style: none; padding-left: 20px; }
.comment-body { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment-meta { font-size: .875rem; color: var(--muted); }
.comment-author { font-weight: 700; color: var(--ink); }
.comment-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
	width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: var(--radius);
}
.comment-form .submit { background: var(--brand); color: #fff; border: 0; padding: 10px 20px; border-radius: var(--radius); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
	background: var(--footer); color: #bdbdbd; font-size: 1rem;
	border-top: 4px solid var(--brand); margin-top: 24px;
}
.site-footer a { color: #e6e6e6; transition: color .15s; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; gap: 32px; padding: 40px 0 32px; }

.footer-logo { display: inline-block; background: #fff; padding: 8px 14px; border-radius: var(--radius); line-height: 0; }
.footer-logo img { width: auto; max-height: 48px; }
.footer-about { margin: 16px 0 20px; line-height: 1.7; max-width: 38ch; color: #c4c4c4; }
.footer-follow { margin: 0 0 8px; font-size: .8125rem; font-weight: 700; letter-spacing: .04em; color: #8f8f8f; }
.footer-social { display: flex; flex-wrap: wrap; gap: 8px; }
.footer-social .icon-btn { width: 40px; height: 40px; background: #262626; color: #e6e6e6; }
.footer-social .icon-btn:hover { background: var(--brand); color: #fff; }

.footer-title {
	color: #fff; font-size: 1.125rem; margin: 0 0 14px; padding-bottom: 8px; position: relative;
}
.footer-title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 36px; height: 3px; background: var(--brand); border-radius: 2px; }
.footer-list { list-style: none; margin: 0; padding: 0; }
.footer-list--2col { columns: 2; column-gap: 24px; }
.footer-list li { break-inside: avoid; }
.footer-list a { display: inline-block; padding: 5px 0; }
.footer-list a:hover { color: #fff; transform: translateX(2px); }

.footer-bottom { background: #0e0e0e; padding: 14px 0; font-size: .875rem; color: #8f8f8f; }
.footer-bottom__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.back-to-top { font-weight: 600; }

/* ---------- Responsive ---------- */
@media (min-width: 600px) {
	.grid--2, .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
	.card--row { grid-template-columns: 1fr 140px; }
	.share__text, .share__label { display: inline; }
	.footer-grid { grid-template-columns: repeat(2, 1fr); }
	.footer-brand { grid-column: 1 / -1; }
}
@media (min-width: 900px) {
	.topbar { display: block; }
	.site-branding img { max-height: 64px; }
	.site-header__inner { min-height: 88px; }
	.header-social { display: flex; }
	.menu-toggle { display: none; }
	.grid--3 { grid-template-columns: repeat(3, 1fr); }
	.grid--4 { grid-template-columns: repeat(4, 1fr); }
	.hero { grid-template-columns: 1.6fr 1fr; gap: 24px; }
	.hero .hero__side { border-left: 1px solid var(--line); padding-left: 20px; }
	.block-a { grid-template-columns: 1.2fr 1fr; gap: 24px; }
	.footer-grid { grid-template-columns: 1.3fr 1.3fr .9fr; gap: 48px; }
	.footer-brand { grid-column: auto; }
	/* desktop dropdown */
	.primary-nav .menu { overflow: visible; flex-wrap: wrap; }
	.primary-nav .sub-menu {
		position: absolute; top: 100%; left: 0; z-index: 50; min-width: 200px; margin: 0; padding: 6px 0;
		list-style: none; background: var(--bg); box-shadow: var(--shadow); border-radius: 0 0 var(--radius) var(--radius);
	}
	.primary-nav li:hover > .sub-menu, .primary-nav li:focus-within > .sub-menu { display: block; }
	.primary-nav .sub-menu a { display: block; padding: 8px 16px; color: var(--ink); font-weight: 600; }
	.primary-nav .sub-menu a:hover { background: var(--bg-soft); color: var(--brand); }
	.primary-nav .menu-item-has-children > a::after { content: " ▾"; font-size: .75em; }
}
@media (min-width: 1024px) {
	.layout--sidebar { grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; }
	.sidebar--sticky { position: sticky; top: 64px; }
	.article { max-width: 760px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { animation: none !important; transition: none !important; }
	.ticker__viewport { overflow-x: auto; }
}

@media print {
	.topbar, .site-header .header-actions, .primary-nav, .ticker, .sidebar, .share, .ad-slot, .related, .comments-area, .site-footer { display: none !important; }
}
