/*
Theme Name: Nusuk Key Codes
Description: Lightweight theme for the Nusuk Key Codes community site. Works with the Nusuk Key Codes – Code Exchange plugin.
Version: 1.1.4
Author: Nusuk Key Codes
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: nkct
*/

:root {
	--g: #0F5132;
	--g2: #0B3D26;
	--gs: #E7F1EC;
	--gold: #C9A227;
	--golds: #FBF4DF;
	--ink: #1F2937;
	--muted: #5B6472;
	--line: #E7E2D6;
	--bg: #FAF7F0;
	--w: 1160px;
	--prose: 760px;
	--r: 18px;
	--font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 17px; line-height: 1.65; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; height: auto; }
a { color: var(--g); text-underline-offset: 3px; }
a:hover { color: var(--g2); }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); font-weight: 800; margin: 0 0 14px; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 800; margin: 2.2em 0 .6em; }
h3 { font-size: 1.2rem; font-weight: 700; margin: 1.6em 0 .5em; }
p { margin: 0 0 1.1em; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); }
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 999; width: auto; height: auto; clip: auto; background: #fff; padding: 10px 14px; border-radius: 8px; }
.wrap { max-width: var(--w); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(250, 247, 240, .92); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 18px; min-height: 70px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand svg { width: 40px; height: 40px; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: -.02em; line-height: 1.1; }
.brand-name b { color: #8A6D0B; font-weight: 800; }
.brand-sub { display: block; font-size: .72rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.badge-unofficial { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--g); background: var(--gs); padding: 4px 8px; border-radius: 999px; }
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.main-nav a { display: block; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .95rem; }
.main-nav a:hover { background: var(--gs); color: var(--g); }
.main-nav .current-menu-item > a, .main-nav .current_page_item > a, .main-nav .current_page_parent > a { background: var(--gs); color: var(--g); }
.header-cta { display: inline-flex; align-items: center; gap: 8px; background: var(--g); color: #fff !important; text-decoration: none; padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: .92rem; flex-shrink: 0; }
.header-cta:hover { background: var(--g2); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--ink); }
.nav-toggle svg { width: 22px; height: 22px; display: block; }
@media (max-width: 1020px) {
	.nav-toggle { display: block; }
	.header-cta { display: none; }
	.main-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 20px 18px; }
	.main-nav.is-open { display: block; }
	.main-nav ul { flex-direction: column; }
	.main-nav a { padding: 12px; font-size: 1rem; }
	.main-nav .nav-mobile-cta { display: block; margin-top: 8px; }
}
.main-nav .nav-mobile-cta { display: none; }
@media (max-width: 1020px) { .main-nav .nav-mobile-cta { display: block; margin-top: 8px; text-align: center; } }
@media (max-width: 420px) { .brand-sub { display: none; } .badge-unofficial { display: none; } }

/* Hero */
.hero { background: radial-gradient(90% 120% at 85% 10%, #1d7049 0%, var(--g) 40%, var(--g2) 100%); color: #fff; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23C9A227' stroke-opacity='.10' stroke-width='1.2'%3E%3Crect x='22' y='22' width='36' height='36'/%3E%3Crect x='22' y='22' width='36' height='36' transform='rotate(45 40 40)'/%3E%3C/g%3E%3C/svg%3E"); opacity: .9; pointer-events: none; }
.hero .wrap { position: relative; padding-top: 56px; padding-bottom: 92px; text-align: center; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); padding: 6px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; margin-bottom: 18px; }
.hero h1 { color: #fff; max-width: 820px; margin: 0 auto 14px; }
.hero h1 em { font-style: normal; color: var(--gold); }
.hero-sub { max-width: 640px; margin: 0 auto 26px; font-size: 1.08rem; color: rgba(255,255,255,.86); }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-actions .nkc-btn { padding: 14px 22px; font-size: 1.02rem; }
.hero-hadith { margin: 22px auto 0; font-size: .88rem; color: rgba(255,255,255,.7); max-width: 600px; }
.hero-stats { margin-top: -54px; position: relative; z-index: 2; }

/* Content */
.site-main { padding: 36px 0 64px; }
.page-head { padding: 44px 0 8px; }
.page-head .wrap { max-width: calc(var(--prose) + 40px); }
.page-head.is-wide .wrap { max-width: var(--w); }
.page-head p.lead { font-size: 1.12rem; color: var(--muted); margin: 0; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.entry { max-width: calc(var(--prose) + 40px); margin: 0 auto; padding: 0 20px; }
.entry.is-wide { max-width: var(--w); }
.entry > *:first-child { margin-top: 0; }
.entry ul, .entry ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.entry li { margin: .3em 0; }
.entry img { border-radius: 14px; }
.entry table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; background: #fff; border-radius: 14px; overflow: hidden; font-size: .95rem; }
.entry th, .entry td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.entry th { background: var(--gs); color: var(--g); font-weight: 700; }
.entry blockquote { margin: 1.4em 0; padding: 14px 20px; border-left: 4px solid var(--gold); background: var(--golds); border-radius: 0 14px 14px 0; }
.entry code { background: var(--gs); padding: 2px 6px; border-radius: 6px; font-size: .92em; }
.wp-block-table { margin: 0 0 1.4em; overflow-x: auto; }
.note { background: var(--gs); border-radius: 14px; padding: 16px 18px; margin: 1.4em 0; }
.post-meta { color: var(--muted); font-size: .9rem; margin-top: 8px; }
.home-content h2 { text-align: left; }

/* Blog cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 24px; display: flex; flex-direction: column; gap: 8px; transition: box-shadow .15s, transform .15s; }
.card:hover { box-shadow: 0 12px 30px rgba(15, 81, 50, .1); transform: translateY(-2px); }
.card h2, .card h3 { margin: 0; font-size: 1.2rem; }
.card h2 a, .card h3 a { color: var(--ink); text-decoration: none; }
.card h2 a::after, .card h3 a::after { content: ""; position: absolute; inset: 0; }
.card { position: relative; }
.card p { margin: 0; color: var(--muted); font-size: .95rem; }
.card .cat { font-size: .75rem; font-weight: 700; color: var(--g); text-transform: uppercase; letter-spacing: .06em; }
.pagination { margin-top: 30px; display: flex; gap: 6px; justify-content: center; }
.pagination .page-numbers { padding: 8px 14px; border-radius: 10px; background: #fff; border: 1px solid var(--line); text-decoration: none; }
.pagination .current { background: var(--g); color: #fff; border-color: var(--g); }
.related { max-width: calc(var(--prose) + 40px); margin: 40px auto 0; padding: 0 20px; }
.related h2 { font-size: 1.3rem; }

/* Footer */
.site-footer { background: var(--g2); color: rgba(255,255,255,.78); padding: 52px 0 26px; font-size: .93rem; }
.site-footer a { color: rgba(255,255,255,.88); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 30px; }
.footer-grid h2, .footer-grid h4 { color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin: 0 0 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer-brand .brand { color: #fff; margin-bottom: 12px; }
.footer-brand .brand-sub { color: rgba(255,255,255,.6); }
.site-footer .brand-name b { color: #E2BE4A; }
.footer-legal { border-top: 1px solid rgba(255,255,255,.12); margin-top: 36px; padding-top: 20px; font-size: .82rem; color: rgba(255,255,255,.6); display: grid; gap: 6px; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* 404 */
.notfound { text-align: center; padding: 60px 20px; }

/* ---------- Language switcher ---------- */
.lang-switch { display: flex; gap: 2px; align-items: center; margin-inline-start: 10px; padding-inline-start: 10px; border-inline-start: 1px solid var(--line); }
.lang-switch a, .lang-switch span { font-size: .82rem; font-weight: 600; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--muted); line-height: 1.3; }
.lang-switch a:hover { background: var(--gs); color: var(--g); }
.lang-switch .is-current { color: var(--g); background: var(--gs); }
.main-nav { display: flex; align-items: center; }
@media (max-width: 1020px) {
	.main-nav { display: none; }
	.main-nav.is-open { display: block; }
	.lang-switch { margin: 10px 0 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
}

/* ---------- RTL + language fonts ---------- */
.lang-ar body, body.lang-ar { font-family: "IBM Plex Sans Arabic", var(--font); }
body.lang-ur { font-family: "Noto Nastaliq Urdu", "IBM Plex Sans Arabic", var(--font); line-height: 2.1; font-size: 17px; }
body.lang-ur h1, body.lang-ur h2, body.lang-ur h3 { line-height: 1.9; letter-spacing: 0; }
body.lang-ar h1, body.lang-ar h2, body.lang-ar h3 { letter-spacing: 0; line-height: 1.45; }
body.lang-ur .hero h1 { font-size: clamp(1.8rem, 4.2vw, 2.7rem); }
.brand, .brand-name { direction: ltr; }
.brand-sub { direction: rtl; }
body:not(.rtl) .brand-sub { direction: ltr; }
[dir=rtl] .entry ul, [dir=rtl] .entry ol { padding-left: 0; padding-right: 1.3em; }
[dir=rtl] .entry th, [dir=rtl] .entry td { text-align: right; }
[dir=rtl] .entry blockquote { border-left: 0; border-right: 4px solid var(--gold); border-radius: 14px 0 0 14px; }
[dir=rtl] .main-nav { margin-left: 0; margin-right: auto; }
[dir=rtl] .nav-toggle { margin-left: 0; margin-right: auto; }
[dir=rtl] .footer-grid, [dir=rtl] .site-footer { text-align: right; }
[dir=rtl] .crumbs { direction: rtl; }

/* 1.1.1: keep header labels on one line */
.main-nav a, .badge-unofficial, .lang-switch a, .lang-switch span { white-space: nowrap; }
@media (min-width: 1021px) { .rtl .main-nav a { padding: 8px 9px; } }
html, body { overflow-x: clip; }
