/*
Theme Name: The Journal 2026
Description: Fast, mobile-first Malayalam news theme for The Journal News.
Version: 1.0.0
Requires PHP: 8.1
Text Domain: thejournal
*/

:root {
	--brand: #0568bf;
	--brand-dark: #034a8a;
	--red: #d2231c;
	--ink: #14171c;
	--ink-2: #4a515c;
	--muted: #6b7380;
	--line: #e3e6ea;
	--soft: #f3f5f8;
	--bg: #fff;
	--wrap: 1220px;
	--ml: "Noto Sans Malayalam", "Manjari", system-ui, sans-serif;
	--ml-serif: "Noto Serif Malayalam", "Noto Sans Malayalam", Georgia, serif;
	--r: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.65 var(--ml); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; font-weight: 700; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 100; width: auto; height: auto; clip: auto; background: #fff; padding: 8px 14px; border-radius: var(--r); }

/* ---------- Top bar ---------- */
.topbar { background: var(--ink); color: #c9ced6; font-size: 13px; }
.topbar .wrap { display: flex; justify-content: space-between; align-items: center; min-height: 34px; gap: 12px; }
.social { display: flex; gap: 14px; }
.social a { color: #c9ced6; display: inline-flex; }
.social a:hover { color: #fff; }
.social svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- Masthead ---------- */
.masthead .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 132px; height: auto; }
.brand .tagline { color: var(--muted); font-size: 13px; letter-spacing: .02em; border-left: 1px solid var(--line); padding-left: 12px; }
.header-ad { flex: 1; display: flex; justify-content: flex-end; min-width: 0; }
.header-ad img { max-height: 90px; width: auto; }

/* ---------- Navigation ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: var(--brand); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.08); }
.admin-bar .nav { top: 32px; }
.nav .wrap { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.nav-home { display: inline-flex; padding: 8px; border-radius: 6px; }
.nav-home svg { width: 20px; height: 20px; fill: #fff; }
.nav-home:hover { background: var(--brand-dark); }
.menu-toggle { display: none; }
.primary-menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; flex: 1; }
.primary-menu > li { position: relative; }
.primary-menu a { display: block; color: #fff; padding: 13px 8px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.primary-menu > li > a:hover, .primary-menu > li.current-menu-item > a, .primary-menu > li.current-category-ancestor > a { background: var(--brand-dark); color: #fff; }
.primary-menu .sub-menu { list-style: none; margin: 0; padding: 6px 0; position: absolute; top: 100%; left: 0; min-width: 210px; background: #fff; border-radius: 0 0 var(--r) var(--r); box-shadow: 0 12px 30px rgba(10,20,40,.16); opacity: 0; visibility: hidden; transform: translateY(4px); transition: .15s ease; }
.primary-menu .sub-menu .sub-menu { top: 0; left: 100%; border-radius: var(--r); }
.primary-menu li:hover > .sub-menu, .primary-menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.primary-menu .sub-menu a { color: var(--ink); font-weight: 500; padding: 8px 16px; font-size: 14px; }
.primary-menu .sub-menu a:hover { background: var(--soft); color: var(--brand); }
.primary-menu .menu-item-has-children > a::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border: solid currentColor; border-width: 0 2px 2px 0; transform: translateY(-3px) rotate(45deg); }
.search-toggle { margin-left: auto; }
.search-toggle summary { list-style: none; cursor: pointer; padding: 8px; border-radius: 6px; display: inline-flex; }
.search-toggle summary::-webkit-details-marker { display: none; }
.search-toggle summary svg { width: 20px; height: 20px; fill: #fff; }
.search-toggle[open] summary, .search-toggle summary:hover { background: var(--brand-dark); }
.search-toggle .search-form { position: absolute; right: 16px; top: 100%; background: #fff; padding: 10px; border-radius: 0 0 var(--r) var(--r); box-shadow: 0 12px 30px rgba(10,20,40,.16); width: min(420px, calc(100vw - 32px)); }
.search-form { display: flex; gap: 8px; }
.search-form input[type=search] { flex: 1; min-width: 0; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.search-form button { font: inherit; font-weight: 600; background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 0 16px; cursor: pointer; }

/* ---------- Breaking ticker ---------- */
.ticker { border-bottom: 1px solid var(--line); background: #fff; }
.ticker .wrap { display: flex; align-items: center; gap: 12px; min-height: 42px; overflow: hidden; }
.ticker-label { flex: none; background: var(--red); color: #fff; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 4px; display: inline-flex; align-items: center; gap: 6px; }
.ticker-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
.ticker-track { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.ticker-items { display: flex; gap: 40px; width: max-content; list-style: none; margin: 0; padding: 0; animation: ticker 60s linear infinite; }
.ticker-track:hover .ticker-items { animation-play-state: paused; }
.ticker-items a { font-size: 14px; font-weight: 500; white-space: nowrap; }
@keyframes ticker { to { transform: translateX(-50%); } }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Layout ---------- */
.site-main { padding: 24px 0 48px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.sidebar { position: sticky; top: 64px; display: grid; gap: 28px; }

/* ---------- Section headings ---------- */
.sec { margin-bottom: 36px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); margin-bottom: 16px; }
.sec-head h2 { font-size: 19px; padding-bottom: 6px; position: relative; }
.sec-head h2::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 2px; background: var(--brand); }
.sec-head .more { font-size: 13px; font-weight: 600; color: var(--brand); white-space: nowrap; }
.sec-head .more:hover { text-decoration: underline; }

/* ---------- Cards ---------- */
.card { display: grid; gap: 10px; align-content: start; }
.card .thumb { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: var(--r); background: var(--soft); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.card h3 { font-size: 16px; line-height: 1.5; }
.card .excerpt { color: var(--ink-2); font-size: 14px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-chip { display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand); letter-spacing: .02em; }
.thumb .cat-chip { position: absolute; left: 10px; bottom: 10px; background: var(--brand); color: #fff; padding: 2px 8px; border-radius: 4px; }
.meta { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Row card (thumb left) */
.card-row { grid-template-columns: 112px 1fr; gap: 12px; align-items: start; }
.card-row .thumb { aspect-ratio: 4 / 3; border-radius: 6px; }
.card-row h3 { font-size: 14.5px; line-height: 1.5; }

/* ---------- Lead block ---------- */
.lead { display: grid; grid-template-columns: 1.55fr 1fr; gap: 24px; margin-bottom: 36px; }
.lead-main .thumb { aspect-ratio: 16 / 9; }
.lead-main h2 { font-size: clamp(20px, 2.6vw, 30px); line-height: 1.38; }
.lead-main .excerpt { font-size: 15.5px; -webkit-line-clamp: 3; }
.lead-side { display: grid; gap: 16px; align-content: start; }
.lead-side .card-row { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.lead-side .card-row:last-child { border-bottom: 0; padding-bottom: 0; }

/* ---------- Grids ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px 20px; }
.split { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.stack { display: grid; gap: 16px; align-content: start; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }

/* Hyperlocal chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.chips a { font-size: 13px; font-weight: 600; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.chips a:hover { border-color: var(--brand); color: var(--brand); }
.band { background: var(--soft); border-radius: 12px; padding: 20px; }

/* ---------- Sidebar widgets ---------- */
.widget-title, .side-title { font-size: 17px; border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 14px; }
.most-read { list-style: none; margin: 0; padding: 0; counter-reset: mr; display: grid; gap: 14px; }
.most-read li { counter-increment: mr; display: grid; grid-template-columns: 32px 1fr; gap: 10px; align-items: start; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.most-read li:last-child { border-bottom: 0; padding-bottom: 0; }
.most-read li::before { content: counter(mr); font-size: 26px; font-weight: 800; line-height: 1; color: var(--brand); opacity: .35; }
.most-read a { font-size: 14.5px; font-weight: 600; line-height: 1.5; }
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.ad-slot { text-align: center; }
.ad-slot img, .ad-slot video { margin: 0 auto; border-radius: 6px; max-width: 100%; height: auto; display: block; }
.ad-label { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }

/* ---------- Single article ---------- */
.article { max-width: 760px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--brand); font-weight: 600; }
.article h1 { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.38; margin-bottom: 14px; }
.article .dek { font-size: 18px; color: var(--ink-2); margin: 0 0 16px; }
.byline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.byline .meta { font-size: 13.5px; }
.byline strong { color: var(--ink); }
.share { display: flex; gap: 8px; }
.share a, .share button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2); }
.share a:hover, .share button:hover { border-color: var(--brand); color: var(--brand); }
.share svg { width: 16px; height: 16px; fill: currentColor; }
.share .wa { background: #25d366; border-color: #25d366; color: #fff; }
.share .wa:hover { background: #1ebe5b; color: #fff; }
.hero-img { margin: 0 0 22px; }
.hero-img img { width: 100%; border-radius: var(--r); }
.hero-img figcaption, .entry figcaption, .wp-caption-text { font-size: 13px; color: var(--muted); margin-top: 6px; }
.entry { font-family: var(--ml-serif); font-size: 18px; line-height: 1.95; color: #23272e; overflow-wrap: break-word; }
.entry > * { margin: 0 0 1.15em; }
.entry h2, .entry h3 { font-family: var(--ml); margin-top: 1.6em; }
.entry h2 { font-size: 23px; } .entry h3 { font-size: 20px; }
.entry a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.entry img, .entry .wp-caption { border-radius: 6px; max-width: 100%; height: auto; }
.entry .wp-caption { width: auto !important; }
.entry blockquote { margin-left: 0; padding: 4px 0 4px 18px; border-left: 4px solid var(--brand); font-style: italic; color: var(--ink-2); }
.entry iframe, .entry video { max-width: 100%; }
.entry table { width: 100%; border-collapse: collapse; font-family: var(--ml); font-size: 15px; }
.entry td, .entry th { border: 1px solid var(--line); padding: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }
.tags a { font-size: 13px; background: var(--soft); padding: 4px 12px; border-radius: 999px; }
.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0; }
.post-nav a { display: block; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); font-weight: 600; font-size: 14.5px; line-height: 1.5; }
.post-nav a:hover { border-color: var(--brand); }
.post-nav small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-bottom: 4px; }
.post-nav .next { text-align: right; }

/* ---------- Archive ---------- */
.archive-head { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.archive-head h1 { font-size: clamp(24px, 3vw, 32px); }
.archive-head p { color: var(--ink-2); margin: 6px 0 0; }
.archive-list { display: grid; gap: 20px; }
.archive-list .card-row { grid-template-columns: 240px 1fr; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.archive-list .card-row h3 { font-size: 18px; }
.pagination { margin-top: 32px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination .page-numbers { min-width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; font-weight: 600; font-size: 14px; }
.pagination .page-numbers.current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination a.page-numbers:hover { border-color: var(--brand); }
.empty { padding: 48px 0; text-align: center; color: var(--ink-2); }
.empty .search-form { max-width: 460px; margin: 20px auto 0; }

/* ---------- Footer ---------- */
.site-footer { background: #0f1724; color: #b8c0cc; font-size: 14px; }
.site-footer a:hover { color: #fff; }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding: 44px 0 32px; }
.footer-top h2 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.footer-top p { margin: 0; line-height: 1.8; }
.footer-logo { width: 120px; margin-bottom: 14px; background: #fff; border-radius: 6px; padding: 6px; }
.footer-cats { list-style: none; margin: 0; padding: 0; columns: 2; }
.footer-cats li { padding: 3px 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); }
.footer-bottom .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 16px; font-size: 13px; }
.footer-menu { list-style: none; display: flex; flex-wrap: wrap; gap: 18px; margin: 0; padding: 0; }
.footer-social .social a { color: #b8c0cc; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
	.layout { grid-template-columns: 1fr; }
	.sidebar { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}
@media (max-width: 1200px) {
	.menu-toggle { display: block; }
	.menu-toggle summary { list-style: none; cursor: pointer; padding: 8px; display: inline-flex; border-radius: 6px; }
	.menu-toggle summary::-webkit-details-marker { display: none; }
	.menu-toggle summary svg { width: 22px; height: 22px; fill: #fff; }
	.nav-home { display: none; }
	.nav .primary-menu { display: none; }
	.nav .wrap { position: relative; }
	.menu-toggle[open] ~ .primary-menu { display: block; position: absolute; left: 0; right: 0; top: 100%; background: #fff; max-height: calc(100vh - 100px); overflow: auto; box-shadow: 0 16px 30px rgba(10,20,40,.2); }
	.menu-toggle[open] ~ .primary-menu a { color: var(--ink); padding: 11px 16px; border-bottom: 1px solid var(--line); }
	.menu-toggle[open] ~ .primary-menu > li > a:hover { background: var(--soft); color: var(--brand); }
	.primary-menu .sub-menu, .primary-menu .sub-menu .sub-menu { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; padding: 0 0 0 16px; border-radius: 0; background: var(--soft); }
	.primary-menu .menu-item-has-children > a::after { display: none; }
}
@media (max-width: 860px) {
	.header-ad { display: none; }
	.brand .tagline { display: none; }
	.masthead .wrap { justify-content: center; padding-top: 10px; padding-bottom: 10px; }
	.brand img { width: 110px; }
	.lead, .split, .two-col { grid-template-columns: 1fr; }
	.grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
	.footer-top { grid-template-columns: 1fr 1fr; }
	.footer-top > :first-child { grid-column: 1 / -1; }
	.archive-list .card-row { grid-template-columns: 150px 1fr; }
	.archive-list .card-row h3 { font-size: 16px; }
}
@media (max-width: 560px) {
	body { font-size: 15px; }
	.topbar .date { font-size: 12px; }
	.grid-3, .grid-4 { grid-template-columns: 1fr; }
	.grid-3 .card, .grid-4 .card { grid-template-columns: 112px 1fr; gap: 12px; }
	.grid-3 .card .thumb, .grid-4 .card .thumb { aspect-ratio: 4 / 3; border-radius: 6px; }
	.grid-3 .card .thumb .cat-chip, .grid-4 .card .thumb .cat-chip { display: none; }
	.grid-3 .card .excerpt, .grid-4 .card .excerpt { display: none; }
	.grid-3 .card h3, .grid-4 .card h3 { font-size: 14.5px; }
	.card-row { grid-template-columns: 100px 1fr; }
	.archive-list .card-row { grid-template-columns: 110px 1fr; gap: 12px; }
	.archive-list .card-row .excerpt { display: none; }
	.footer-top { grid-template-columns: 1fr; gap: 28px; }
	.entry { font-size: 17px; line-height: 1.9; }
	.post-nav { grid-template-columns: 1fr; }
	.band { padding: 16px; margin: 0 -16px; border-radius: 0; }
	.admin-bar .nav { top: 0; }
}
@media (prefers-reduced-motion: reduce) {
	* { animation: none !important; transition: none !important; }
	.ticker-track { overflow-x: auto; }
}
