/*
Theme Name: Pavan Rate
Description: Fast, mobile-first theme for a Kerala gold rate and bullion news website. Works with the Kerala Gold Rate plugin.
Version: 1.4.3
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: pavanrate
*/

:root {
	--bg: #faf7f0;
	--surface: #ffffff;
	--ink: #1d1a14;
	--muted: #6b6455;
	--line: #e7e2d6;
	--line-strong: #d5cdb9;
	--chip: #f3efe6;
	--zebra: #faf8f3;
	--gold: #c99a2e;
	--gold-strong: #a87a12;
	--gold-soft: #f6ead0;
	--link: #8a5d00;
	--radius: 14px;
	--font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--font-ml: "Noto Sans Malayalam", "Manjari", "Kartika", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.6;
}
[lang="ml"], [lang="ml"] * { font-family: var(--font-ml); }
[lang="ml"] { line-height: 1.85; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); }
a:hover { color: var(--ink); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.4rem); letter-spacing: -.02em; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Rate strip */
.rate-strip { background: var(--ink); color: #f1e8d2; font-size: .85rem; font-variant-numeric: tabular-nums; }
.rate-strip-inner { display: flex; align-items: center; gap: 14px; min-height: 38px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.rate-strip-inner::-webkit-scrollbar { display: none; }
.rate-strip a { color: inherit; text-decoration: none; }
.rate-strip strong { color: #fff; }
.rs-k { color: #bfb08c; }
.rs-sep { width: 1px; height: 14px; background: #4a4335; }
.rs-date { margin-left: auto; color: #bfb08c; }
.rate-strip .kgr-chg { font-size: .75rem; padding: 1px 6px; }
.rate-strip .kgr-up { background: #4a1f1a; color: #ffb4a8; }
.rate-strip .kgr-down { background: #183824; color: #9fe0b4; }
.rate-strip .kgr-flat { background: #2e2a21; color: #cfc4a8; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: -.02em; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #f0cf72, var(--gold-strong)); box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.brand-tag { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.site-nav a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; }
.site-nav a:hover, .site-nav .current-menu-item > a { background: var(--chip); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line-strong); border-radius: 8px; width: 42px; height: 40px; cursor: pointer; }
.bars, .bars::before, .bars::after { display: block; width: 18px; height: 2px; background: var(--ink); margin: 0 auto; position: relative; }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; }
.bars::before { top: -6px; }
.bars::after { top: 6px; }
@media (max-width: 860px) {
	.brand-tag { display: none; }
	.nav-toggle { display: block; }
	.site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
	.site-nav.is-open { display: block; }
	.site-nav ul { flex-direction: column; }
	.site-nav a { padding: 12px; }
}

/* Home */
.site-main { padding: 24px 0 48px; }
.hero { margin-bottom: 18px; }
.hero h1 { margin-bottom: 6px; }
.hero-sub { margin: 0; color: var(--muted); max-width: 60ch; }
.hero-sub [lang="ml"] { display: block; color: var(--ink); font-weight: 600; margin-top: 2px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
@media (max-width: 960px) { .home-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.panel-title { font-size: 1.1rem; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.panel-title small { font-family: var(--font); color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.panel .kgr-history { min-width: 0; }
.panel .kgr-history th:nth-child(5), .panel .kgr-history td:nth-child(5),
.panel .kgr-history th:nth-child(6), .panel .kgr-history td:nth-child(6),
.panel .kgr-history th:nth-child(2), .panel .kgr-history td:nth-child(2) { display: none; }
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.news-list li:last-child { border-bottom: 0; }
.news-list a { color: var(--ink); text-decoration: none; font-weight: 600; display: block; line-height: 1.5; }
.news-list a:hover { color: var(--link); }
.news-list time { font-size: .8rem; color: var(--muted); font-family: var(--font); }
.more { display: inline-block; margin-top: 10px; font-weight: 600; font-size: .9rem; text-decoration: none; }
.info { margin-top: 16px; padding-top: 28px; border-top: 1px solid var(--line); }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
@media (max-width: 860px) { .info-grid { grid-template-columns: 1fr; } }
.info h3 { font-size: 1.02rem; }
.info p { color: #3d382d; margin: 0; }

/* Cards */
.list-head { margin-bottom: 20px; }
.list-desc { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-link { display: block; color: inherit; text-decoration: none; height: 100%; }
.card-link:hover .card-title { color: var(--link); }
.card-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.card-body { padding: 16px; }
.card-cat { display: inline-block; font-family: var(--font); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gold-strong); text-decoration: none; margin-bottom: 6px; }
.card-title { font-size: 1.08rem; margin: 0 0 6px; }
.card-ex { margin: 0 0 8px; color: #4a4437; font-size: .93rem; }
.card time { font-family: var(--font); font-size: .8rem; color: var(--muted); }
.nav-links { display: flex; gap: 8px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.nav-links a, .nav-links span { padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 8px; text-decoration: none; background: var(--surface); }
.nav-links .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Article */
.article-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
@media (max-width: 960px) { .article-grid { grid-template-columns: 1fr; } }
.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 4vw, 36px); }
.article-head h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
.meta { color: var(--muted); font-size: .88rem; font-family: var(--font); margin: 0 0 16px; }
.article-img { margin: 0 0 20px; }
.article-img img { border-radius: 10px; width: 100%; }
.prose { font-size: 1.06rem; max-width: 70ch; }
.prose h2 { font-size: 1.35rem; margin-top: 1.6em; }
.prose h3 { font-size: 1.12rem; margin-top: 1.4em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1em 0; font-variant-numeric: tabular-nums; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.prose th { background: var(--chip); }
.prose blockquote { margin: 1em 0; padding: 4px 0 4px 16px; border-left: 4px solid var(--gold); color: #3d382d; }
.prose li { margin-bottom: .35em; }
.tags a { display: inline-block; margin: 0 6px 6px 0; padding: 3px 10px; background: var(--chip); border-radius: 999px; font-size: .82rem; text-decoration: none; }
.post-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); font-weight: 600; }
.post-nav div:last-child { text-align: right; }
.post-nav a { text-decoration: none; }
.article-side { position: sticky; top: 84px; }
@media (max-width: 960px) { .article-side { position: static; } }
.article-side .kgr-big { font-size: 2.1rem; }
.article-side .kgr-grid th:nth-child(4), .article-side .kgr-grid td:nth-child(4) { display: none; }
.related { margin-top: 36px; }
.page-wrap { max-width: 860px; }
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; }
.widget-title { font-size: 1rem; }

/* Forms */
.search-form { display: flex; gap: 8px; margin-top: 12px; }
.search-field { flex: 1; font: inherit; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; }
.search-submit { font: inherit; font-weight: 600; padding: 10px 16px; border: 0; border-radius: 8px; background: var(--ink); color: #fff; cursor: pointer; }

/* Footer */
.site-footer { background: var(--ink); color: #cfc4a8; padding: 36px 0 20px; font-size: .92rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-inner > div { max-width: 520px; }
.footer-brand { color: #fff; font-weight: 800; font-size: 1.15rem; margin: 0 0 6px; }
.footer-note { margin: 0; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: #f1e8d2; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-copy { margin-top: 24px; padding-top: 16px; border-top: 1px solid #3a342a; font-size: .82rem; color: #9b9077; }
.home-main, .home-side, .article, .article-side { min-width: 0; }
.article-side .kgr-gram{text-align:left}.article-side .kgr-today-head{flex-direction:column;gap:10px}
.prose .kgr-table th,.prose .kgr-table td{border:0;border-bottom:1px solid var(--line);background:none;text-align:right}.prose .kgr-table th:first-child{text-align:left}.prose .kgr-history tbody tr:nth-child(even){background:var(--zebra)}

/* v1.2: logo */
.brand-mark { width: 32px; height: 32px; background: none; box-shadow: none; border-radius: 50%; }
.custom-logo-link { display: inline-flex; align-items: center; }
.custom-logo { height: 44px; width: auto; max-width: none; display: block; }
@media (max-width: 860px) { .custom-logo { height: 38px; } }
@media (max-width: 1100px) { .brand-tag { display: none; } }

/* v1.3: homepage month links */
.by-month { margin-top: 16px; padding-top: 28px; border-top: 1px solid var(--line); }
.by-month-sub { color: var(--muted); margin: 0 0 12px; }
.chip-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chip-list a { display: block; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: .9rem; color: var(--ink); }
.chip-list a:hover { background: var(--chip); }
.by-month-years { font-size: .95rem; line-height: 2; }

/* App-style bottom navigation (mobile) */
.bottom-nav { display: none; }
@media (max-width: 860px) {
	body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
	.bottom-nav { display: block; position: fixed; z-index: 90; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); background: #fff; border-radius: 999px; box-shadow: 0 6px 28px rgba(29, 26, 20, .16), 0 1px 3px rgba(29, 26, 20, .08); }
	.bottom-nav ul { list-style: none; margin: 0 auto; padding: 8px 6px; display: flex; max-width: 560px; }
	.bottom-nav li { flex: 1 1 0; min-width: 0; }
	.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; color: #3a3a3a; text-decoration: none; font-size: 11.5px; font-weight: 600; line-height: 1.2; border-radius: 999px; -webkit-tap-highlight-color: transparent; }
	.bottom-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
	.bottom-nav a.is-active { color: #a7770e; }
	.bottom-nav a.is-active svg { stroke-width: 2.3; }
	.bottom-nav a:active { background: #f6ecd6; }
}
@media print { .bottom-nav { display: none !important; } }
