/*
Theme Name:        PYQ Explained
Description:       A clean, mobile-first theme for Kerala PSC previous-year-question sites. Exam cards, filterable latest sets, a "try a question" widget, Malayalam-friendly typography, and built-in styling for the PYQ Quiz plugin.
Version:           1.1.1
Requires at least: 5.8
Tested up to:      6.8
Requires PHP:      7.4
Author:            PYQ Explained
License:           GNU General Public License v2 or later
License URI:       https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:       pyq-explained
Tags:              blog, education, custom-colors, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
	--accent: #0b6b5d;
	--ink: #10201c;
	--muted: #4a5a55;
	--line: #c9d5d0;
	--line-soft: #e1e8e5;
	--bg: #f2f5f3;
	--card: #ffffff;
	--gold: #f2b230;
	--blue: #3c6fb4;
	--tone-0: #cde9e2;
	--tone-1: #f9e2a8;
	--tone-2: #d9e4f5;
	--font: "Sora", "Noto Sans Malayalam", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-ml: "Noto Sans Malayalam", "Sora", system-ui, 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.65;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
button, input { font-family: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.ml { font-family: var(--font-ml); }

.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
	position: fixed !important; top: 8px; left: 8px; z-index: 100000; width: auto; height: auto;
	clip: auto; margin: 0; padding: 12px 18px; background: var(--ink); color: #fff; border-radius: 8px;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { margin-top: 64px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; }
.section-title { margin: 0; font-size: 30px; line-height: 1.25; letter-spacing: -.01em; }
.section-note { color: var(--muted); font-size: 15px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.link-strong { font-weight: 600; color: var(--accent); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header { background: var(--card); border-bottom: 1px solid var(--line-soft); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; padding-top: 16px; padding-bottom: 16px; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand .custom-logo { max-height: 44px; width: auto; display: block; }
.brand-mark {
	flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff;
	display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-weight: 700; font-size: 20px; }
.brand-tag { font-size: 12px; color: var(--muted); }

.primary-nav { flex: 1; display: flex; justify-content: center; }
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 28px; }
.primary-nav a { display: inline-block; padding: 8px 0; text-decoration: none; font-size: 15px; font-weight: 600; }
.primary-nav a:hover,
.primary-nav .current-menu-item > a,
.primary-nav .current-cat > a { color: var(--accent); }

.search-toggle {
	display: none; flex: none; width: 44px; height: 44px; border-radius: 12px; align-items: center; justify-content: center;
	border: 1.5px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; margin-left: auto;
}

.search-form {
	display: flex; align-items: center; gap: 8px; min-width: 240px; height: 44px; padding: 0 6px 0 16px;
	border: 1.5px solid var(--line); border-radius: 999px; background: var(--card);
}
.search-form .search-icon { flex: none; color: var(--muted); }
.search-form input[type="search"] {
	flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; color: var(--ink); height: 100%;
}
.search-form:focus-within { border-color: var(--accent); }
.search-form button {
	flex: none; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--ink); color: #fff;
	font-weight: 600; font-size: 13px; cursor: pointer;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
	display: flex; flex-wrap: wrap; gap: 40px; align-items: center;
	background: var(--accent); color: #fff; border-radius: 28px; padding: 56px; margin-top: 32px;
}
.hero-copy { flex: 1 1 480px; min-width: 0; }
.hero-badge {
	display: inline-block; background: var(--gold); color: var(--ink); font-weight: 700; font-size: 13px;
	letter-spacing: .06em; text-transform: uppercase; padding: 6px 14px; border-radius: 999px;
}
.hero-title { margin: 20px 0 0; font-size: 52px; line-height: 1.12; font-weight: 700; letter-spacing: -.02em; }
.hero-ml { margin: 20px 0 0; font-size: 19px; line-height: 1.8; color: #e6f2ef; font-family: var(--font-ml); }
.hero-sub { margin: 12px 0 0; font-size: 16px; color: #cfe6e1; }
.hero-actions { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
	display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 12px 26px;
	border-radius: 999px; font-weight: 700; font-size: 16px; text-decoration: none; border: 2px solid transparent; cursor: pointer;
}
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { filter: brightness(.96); }
.btn-ghost { border-color: #fff; color: #fff; font-weight: 600; }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }

.newest-card {
	flex: 1 1 320px; max-width: 420px; min-width: 0; background: var(--card); color: var(--ink); border-radius: 22px;
	padding: 28px; text-decoration: none; display: flex; flex-direction: column; gap: 20px;
}
.newest-card:hover { box-shadow: 0 8px 24px rgba(16, 32, 28, .18); }
.newest-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.newest-date { font-size: 14px; color: var(--muted); }
.newest-body { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.newest-tile {
	width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: var(--tone-0);
	display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 48px;
}
.newest-thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 14px; object-fit: cover; }
.newest-title { font-weight: 700; font-size: 22px; line-height: 1.3; }
.newest-cat { font-size: 15px; color: var(--muted); margin-top: 6px; }
.newest-go { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--accent); }

/* ==========================================================================
   Cards, tiles, rows
   ========================================================================== */
.card-link { transition: box-shadow .15s ease; }
.card-link:hover { box-shadow: 0 8px 24px rgba(16, 32, 28, .12); }

.exam-grid { margin-top: 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.exam-card {
	background: var(--card); border-radius: 20px; padding: 28px; text-decoration: none;
	display: flex; flex-direction: column; gap: 12px; border-top: 6px solid var(--accent);
}
.exam-card.tone-1 { border-top-color: var(--gold); }
.exam-card.tone-2 { border-top-color: var(--blue); }
.exam-name { font-weight: 700; font-size: 24px; line-height: 1.25; }
.exam-latest { color: var(--muted); font-size: 15px; }
.exam-more { margin-top: 8px; font-weight: 600; color: var(--accent); }

.tile {
	flex: none; width: 56px; height: 56px; border-radius: 14px; background: var(--tone-0); color: var(--ink);
	display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px;
}
.tile.tone-1 { background: var(--tone-1); }
.tile.tone-2 { background: var(--tone-2); }

.with-side { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.with-side-main { flex: 999 1 620px; min-width: 0; }
.with-side-aside { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chips[hidden] { display: none; }
.chip {
	min-height: 44px; padding: 0 20px; border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer;
	border: 2px solid var(--line); background: var(--card); color: var(--ink);
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.list { margin-top: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.row {
	display: flex; flex-direction: column; align-items: stretch; background: var(--card);
	border-radius: 20px; overflow: hidden; text-decoration: none; transition: box-shadow .15s ease;
}
.row:hover { box-shadow: 0 8px 24px rgba(16, 32, 28, .12); }
.row[hidden] { display: none; }
.row-thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; background: var(--bg); }
.row-thumb--ph {
	display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 44px;
	color: var(--ink); background: var(--tone-0);
}
.row-thumb--ph.tone-1 { background: var(--tone-1); }
.row-thumb--ph.tone-2 { background: var(--tone-2); }
.row-main { flex: 1; min-width: 0; padding: 16px 20px 20px; }
.row-title { display: block; font-weight: 700; font-size: 17px; line-height: 1.45; }
.row-meta { display: block; font-size: 14px; color: var(--muted); margin-top: 6px; }

/* ==========================================================================
   Try a question
   ========================================================================== */
.tq { background: var(--card); border: 2px solid var(--ink); border-radius: 20px; padding: 28px; }
.tq-question { margin: 14px 0 0; font-size: 19px; line-height: 1.7; font-weight: 600; font-family: var(--font-ml); white-space: pre-line; overflow-wrap: anywhere; }
.tq-more[hidden] { display: none; }
.tq-options { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.tq-opt {
	display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 16px; text-align: left;
	font-size: 16px; color: var(--ink); background: var(--card); border: 2px solid var(--line); border-radius: 14px; cursor: pointer;
}
.tq-opt:hover:not(:disabled) { border-color: var(--accent); background: var(--bg); }
.tq-opt:disabled { cursor: default; }
.tq-key { font-weight: 700; min-width: 28px; font-family: var(--font-ml); }
.tq-opt.is-correct { border-color: var(--accent); background: #ddf1eb; }
.tq-opt.is-wrong { border-color: #9a3412; background: #fde8dc; }
.tq-verdict { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: #eef6f3; font-size: 15px; font-family: var(--font-ml); }
.tq-verdict[hidden] { display: none; }
.tq-more { display: inline-flex; align-items: center; margin-top: 12px; min-height: 44px; font-weight: 600; color: var(--accent); }

.partner {
	background: var(--ink); color: #fff; border-radius: 20px; padding: 28px; text-decoration: none;
	display: flex; flex-direction: column; gap: 10px;
}
.partner-kicker { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.partner-title { font-weight: 700; font-size: 22px; line-height: 1.3; }
.partner-text { font-size: 15px; line-height: 1.8; color: #d6e3df; font-family: var(--font-ml); }
.partner-go { margin-top: 6px; font-weight: 600; color: var(--gold); }

/* Spotlight */
.spot-grid { margin-top: 24px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.spot-card { background: var(--card); border-radius: 20px; padding: 28px; text-decoration: none; display: flex; flex-direction: column; gap: 14px; }
.spot-thumb { width: 100%; aspect-ratio: 16 / 9; height: auto; object-fit: cover; border-radius: 14px; display: block; background: var(--bg); }
.spot-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.spot-label { font-weight: 700; color: var(--blue); }
.spot-text { font-size: 17px; line-height: 1.8; font-family: var(--font-ml); overflow-wrap: anywhere; }
.spot-go { margin-top: auto; font-weight: 600; color: var(--accent); }

/* About */
.about { display: flex; flex-wrap: wrap; gap: 40px; background: var(--card); border-radius: 28px; padding: 56px; }
.about-copy { flex: 1 1 420px; min-width: 0; }
.about-title { margin: 14px 0 0; font-size: 34px; line-height: 1.2; letter-spacing: -.01em; }
.about-text { margin: 18px 0 0; font-size: 18px; line-height: 1.9; font-family: var(--font-ml); }
.steps { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; list-style: none; margin: 0; padding: 0; }
.step { display: flex; gap: 18px; align-items: center; padding: 18px 20px; border-radius: 16px; background: var(--bg); }
.step-num {
	flex: none; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff;
	display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.step-ml { font-weight: 700; font-size: 18px; font-family: var(--font-ml); }
.step-en { font-size: 14px; color: var(--muted); }

/* ==========================================================================
   Posts and pages
   ========================================================================== */
.page-wrap { max-width: 860px; margin: 32px auto 0; padding: 0 24px; }
.page-head { margin-bottom: 24px; }
.page-title { margin: 0; font-size: 40px; line-height: 1.2; letter-spacing: -.02em; }
.page-desc { margin: 12px 0 0; color: var(--muted); }
.post-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--tone-0); font-size: 13px; font-weight: 700; text-decoration: none; }
.post-meta { margin-top: 12px; color: var(--muted); font-size: 14px; }
.post-thumb { margin: 24px 0 0; border-radius: 20px; overflow: hidden; }
.post-thumb img { display: block; width: 100%; }

.entry-content { margin-top: 28px; background: var(--card); border-radius: 24px; padding: 40px; font-size: 17px; line-height: 1.9; overflow-wrap: anywhere; }
.entry-content > :first-child { margin-top: 0; }
.entry-content > :last-child { margin-bottom: 0; }
.entry-content h2 { font-size: 22px; line-height: 1.5; margin: 2em 0 .6em; font-family: var(--font-ml); }
.entry-content h3 { font-size: 19px; margin: 1.6em 0 .5em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content li { margin: .3em 0; }
.entry-content a { color: var(--accent); }
.entry-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.entry-content blockquote { margin: 1.5em 0; padding: 4px 20px; border-left: 4px solid var(--gold); color: var(--muted); }

/* PYQ Quiz plugin: win the specificity fight with .entry-content rules */
.entry-content .pyq-quiz { font-size: 16px; line-height: 1.7; margin-top: 0; }
.entry-content .pyq-list { list-style: none; margin: 0; padding: 0; }
.entry-content .pyq-list > li { margin: 0; }
.entry-content .pyq-facts ul { margin: 0; padding-left: 1.25rem; }
.entry-content .pyq-quiz { --pyq-accent: var(--accent); --pyq-ink: var(--ink); --pyq-soft: var(--bg); }
.pyq-quiz-standalone { margin-top: 28px; }

.post-nav { margin-top: 28px; }
.post-nav .nav-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.post-nav a { display: block; background: var(--card); border-radius: 16px; padding: 18px 20px; text-decoration: none; }
.post-nav a:hover { box-shadow: 0 8px 24px rgba(16, 32, 28, .12); }
.post-nav .nav-next { text-align: right; grid-column: 2; }
.post-nav .nav-previous { grid-column: 1; }
.post-nav .nav-subtitle { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.post-nav .nav-title { display: block; font-weight: 600; margin-top: 4px; }

.related { margin-top: 40px; }
.related-title { margin: 0; font-size: 24px; line-height: 1.3; letter-spacing: -.01em; }

.pagination { margin-top: 28px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pagination .page-numbers {
	min-width: 44px; min-height: 44px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center;
	background: var(--card); border: 2px solid var(--line); border-radius: 999px; text-decoration: none; font-weight: 600;
}
.pagination .page-numbers.current { background: var(--ink); border-color: var(--ink); color: #fff; }

.empty { background: var(--card); border-radius: 20px; padding: 32px; }
.empty .search-form { margin-top: 16px; max-width: 420px; }

/* Comments */
.comments-area { margin-top: 28px; background: var(--card); border-radius: 24px; padding: 32px 40px; }
.comments-title { margin: 0 0 16px; font-size: 22px; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-body { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.comment-meta { font-size: 14px; color: var(--muted); }
.comment-respond input[type="text"], .comment-respond input[type="email"], .comment-respond input[type="url"], .comment-respond textarea {
	width: 100%; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 16px;
}
.comment-respond .submit { min-height: 44px; padding: 0 24px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 700; cursor: pointer; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer { margin-top: 64px; background: var(--ink); color: #d6e3df; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px 48px; justify-content: space-between; align-items: center; padding-top: 40px; padding-bottom: 40px; }
.footer-brand { font-weight: 700; font-size: 20px; color: #fff; }
.footer-copy { font-size: 14px; margin-top: 4px; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 28px; }
.footer-nav a { display: inline-block; padding: 8px 0; text-decoration: none; font-size: 15px; font-weight: 600; }
.footer-nav a:hover { color: var(--gold); }

/* ==========================================================================
   Tablet and phone
   ========================================================================== */
@media (max-width: 900px) {
	.exam-grid, .spot-grid { grid-template-columns: 1fr; }
	.hero { padding: 40px 28px; }
	.hero-title { font-size: 40px; }
	.about { padding: 40px 28px; }
}

@media (max-width: 782px) {
	.container { padding: 0 16px; }
	.section { margin-top: 40px; }
	.section-title { font-size: 24px; }

	.header-inner { padding-top: 12px; padding-bottom: 8px; gap: 8px 12px; }
	.brand { flex: 1; }
	.brand-name { font-size: 18px; }
	.search-toggle { display: inline-flex; margin-left: 0; }
	.primary-nav { order: 3; flex: 0 0 100%; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px; }
	.primary-nav::-webkit-scrollbar { display: none; }
	.primary-nav ul { flex-wrap: nowrap; gap: 8px; }
	.primary-nav a { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; background: var(--bg); display: inline-flex; align-items: center; font-size: 14px; white-space: nowrap; }
	.search-form { order: 4; flex: 0 0 100%; display: none; margin-bottom: 8px; }
	.search-form.is-open { display: flex; }

	.hero { margin-top: 16px; padding: 28px 22px; border-radius: 24px; gap: 24px; }
	.hero-badge { font-size: 12px; padding: 5px 12px; }
	.hero-title { font-size: 32px; line-height: 1.15; margin-top: 16px; }
	.hero-ml { font-size: 17px; }
	.hero-sub { font-size: 15px; }
	.hero-actions .btn { width: 100%; min-height: 52px; }
	.newest-card { max-width: none; flex-basis: 100%; padding: 20px; gap: 14px; }
	.newest-tile { font-size: 36px; }
	.newest-title { font-size: 18px; }

	.exam-grid { margin-top: 16px; gap: 12px; }
	.exam-card { border-top: 0; border-left: 6px solid var(--accent); padding: 20px 20px 20px 22px; border-radius: 18px; }
	.exam-card.tone-1 { border-left-color: var(--gold); }
	.exam-card.tone-2 { border-left-color: var(--blue); }
	.exam-name { font-size: 20px; }
	.exam-more { margin-top: 0; }

	.list { gap: 12px; margin-top: 16px; }
	.row { border-radius: 18px; }
	.row-main { padding: 14px 16px 16px; }
	.row-title { font-size: 16px; }
	.row-meta { font-size: 13px; }
	.row-thumb--ph { font-size: 36px; }
	.related { margin-top: 32px; }
	.related-title { font-size: 21px; }
	.chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-top: 14px; }
	.chips::-webkit-scrollbar { display: none; }
	.chip { flex: none; font-size: 14px; padding: 0 18px; }

	.tq { padding: 22px; }
	.tq-question { font-size: 18px; }
	.partner { padding: 24px; }
	.partner-title { font-size: 20px; }
	.spot-grid { margin-top: 16px; gap: 12px; }
	.spot-card { padding: 20px; border-radius: 18px; }
	.spot-text { font-size: 16px; }

	.about { padding: 28px 22px; border-radius: 24px; gap: 24px; }
	.about-title { font-size: 26px; }
	.about-text { font-size: 16px; }
	.step { padding: 14px 16px; gap: 14px; }
	.step-num { width: 36px; height: 36px; }
	.step-ml { font-size: 16px; }
	.step-en { font-size: 13px; }

	.page-wrap { padding: 0 16px; margin-top: 20px; }
	.page-title { font-size: 28px; }
	.entry-content { padding: 22px 18px; font-size: 16px; border-radius: 20px; }
	.entry-content h2 { font-size: 19px; }
	.comments-area { padding: 24px 18px; }
	.post-nav .nav-links { grid-template-columns: 1fr; }
	.post-nav .nav-next, .post-nav .nav-previous { grid-column: 1; text-align: left; }

	.footer-inner { padding-top: 32px; padding-bottom: 32px; }
	.footer-nav ul { flex-direction: column; gap: 0; }
	.footer-nav a { min-height: 44px; display: flex; align-items: center; }
}

@media (max-width: 600px) {
	.list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; scroll-behavior: auto !important; }
}
