:root {
  --green: #01411c;
  --green-mid: #0b6b32;
  --green-light: #e8f5e9;
  --gold: #c9a227;
  --cream: #f7f4ee;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --white: #ffffff;
  --shadow: 0 12px 40px rgba(1, 65, 28, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html, body { max-width: 100%; }
body {
  font-family: "Source Sans 3", "Noto Nastaliq Urdu", system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(201, 162, 39, 0.28);
}
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
img, video { max-width: 100%; height: auto; }
img { display: block; }
svg { max-width: 100%; }
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-mid); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container { width: min(1280px, 94%); margin: 0 auto; }

.home-shell {
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  gap: 1.1rem;
  align-items: start;
  padding: 1.2rem 0 2rem;
}
.side-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.85rem;
  position: sticky;
  top: 86px;
}
.side-panel h3 {
  font-family: "Playfair Display", serif;
  color: var(--green);
  font-size: 1.05rem;
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--gold);
}
.side-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: var(--green-light);
  color: var(--green);
  font-weight: 700;
  padding: 0.62rem 0.75rem;
  border-radius: 10px;
  margin-bottom: 0.45rem;
  cursor: pointer;
  font-size: 0.92rem;
}
.side-link:hover { background: #d5edd9; color: var(--green); }
.side-link.news {
  background: var(--green);
  color: #fff;
  font-size: 1.05rem;
  padding: 0.95rem 0.8rem;
  margin-bottom: 0.7rem;
}
.side-link.news:hover { background: var(--green-mid); color: #fff; }
.side-link.gold { background: #fff4d4; color: #6a5208; }
.side-link.gold:hover { background: #ffe9a8; color: #3d3004; }

.hero { min-height: auto; }
.hero-inner {
  min-height: auto;
  padding: 1.6rem 0 1.2rem;
}

.topbar {
  background: var(--green);
  color: #fff;
  font-size: 0.85rem;
  padding: 0.4rem 0;
}
.topbar .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.topbar a { color: #fff; }

header.site {
  background: #fff;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0; gap: 1rem; }
.logo { display: flex; align-items: center; gap: 0.7rem; color: var(--green); font-weight: 700; min-width: 0; }
.logo-mark {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--green);
  display: grid; place-items: center;
  color: #fff; font-size: 1.3rem;
  border: 2px solid var(--gold);
}
.logo span { font-family: "Playfair Display", serif; font-size: 1.25rem; line-height: 1.1; }
.logo small { display: block; font-weight: 400; font-size: 0.72rem; color: var(--muted); letter-spacing: .04em; }

nav ul { list-style: none; display: flex; gap: 1.1rem; flex-wrap: wrap; }
nav a { font-weight: 600; font-size: 0.95rem; color: var(--ink); position: relative; }
nav a.active, nav a:hover { color: var(--green); }
nav a.active::after {
  content: "";
  display: block;
  width: 1.35rem;
  height: 2px;
  margin-top: 0.22rem;
  background: var(--gold);
  border-radius: 2px;
}
nav a:focus-visible, .logo:focus-visible, .menu-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.menu-btn {
  display: none;
  background: none;
  border: 0;
  font-size: 1.45rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  color: var(--green);
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.nav-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-search svg { width: 18px; height: 18px; display: block; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 200;
  background: var(--gold);
  color: #111;
  font-weight: 700;
  padding: 0.55rem 1rem;
}
.skip-link:focus { left: 0.8rem; top: 0.8rem; }

.back-to-top {
  position: fixed;
  right: max(0.9rem, env(safe-area-inset-right));
  bottom: max(0.9rem, env(safe-area-inset-bottom));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 8px 20px rgba(1, 65, 28, 0.28);
  cursor: pointer;
  z-index: 40;
  display: none;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.back-to-top.show { display: grid; }
.back-to-top:hover { background: var(--green-mid); }

.hero {
  position: relative;
  background:
    linear-gradient(180deg, rgba(1,65,28,.55), rgba(1,65,28,.78)),
    url("../images/hero-flag.jpg") center/cover no-repeat;
  min-height: 72vh;
  color: #fff;
  overflow: hidden;
}
.hero-inner {
  min-height: 72vh;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: end;
  gap: 1.5rem;
  padding: 3rem 0 2rem;
}
.hero-portrait {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(4px);
}
.hero-portrait img { width: 100%; height: 220px; object-fit: cover; object-position: top; }
.hero-portrait figcaption {
  padding: 0.7rem 1rem 1rem;
  font-size: 0.9rem;
  text-align: center;
}
.hero-portrait strong { display: block; font-family: "Playfair Display", serif; font-size: 1.05rem; }
.hero-center { text-align: center; align-self: center; padding-bottom: 2rem; }
.flag-wrap { width: 88px; margin: 0 auto 1rem; filter: drop-shadow(0 8px 18px rgba(0,0,0,.35)); }
.hero h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.15;
  margin-bottom: 0.6rem;
}
.hero p.lead { font-size: 1.15rem; max-width: 460px; margin: 0 auto 1.4rem; opacity: .95; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: #1a1a1a;
  font-weight: 700;
  padding: 0.75rem 1.4rem;
  min-height: 44px;
  border-radius: 999px;
  margin: 0.2rem;
}
.btn:hover { background: #e0b83a; color: #111; }
.btn.ghost { background: transparent; color: #fff; border: 1px solid #fff; }

section { padding: 4rem 0; }
.section-title { text-align: center; margin-bottom: 2.2rem; }
.section-title h2 {
  font-family: "Playfair Display", serif;
  font-size: 2.1rem;
  color: var(--green);
}
.section-title p { color: var(--muted); max-width: 640px; margin: 0.4rem auto 0; }
.urdu { font-family: "Noto Nastaliq Urdu", serif; direction: rtl; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: -3.2rem;
  position: relative;
  z-index: 2;
}
.stat {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat b { display: block; font-size: 1.7rem; color: var(--green); font-family: "Playfair Display", serif; }
.stat span { color: var(--muted); font-size: 0.9rem; }

.grid-3, .grid-2, .grid-4 {
  display: grid; gap: 1.2rem;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.card img { height: 180px; width: 100%; object-fit: cover; background: #dfe8e1; }
.card-body { padding: 1.15rem 1.2rem 1.3rem; flex: 1; }
.card h3 { font-family: "Playfair Display", serif; color: var(--green); margin-bottom: 0.35rem; }
.card p { color: var(--muted); font-size: 0.95rem; }
.meta { font-size: 0.8rem; color: var(--green-mid); margin-top: 0.6rem; font-weight: 600; }
.badge {
  display: inline-block;
  background: var(--green-light);
  color: var(--green);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.province-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.4rem;
  align-items: start;
}
.province-split.single { grid-template-columns: 1fr; }
.ict-gallery-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  position: sticky;
  top: 88px;
}
.ict-gallery-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: var(--green);
  color: #fff !important;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  letter-spacing: .01em;
}
.ict-gallery-btn:hover { background: var(--green-mid); color: #fff !important; }
.ict-credit {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}
.ict-thumbs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.ict-thumbs a {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: #dfe8e1;
  cursor: zoom-in;
  position: relative;
}
.ict-thumbs img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  display: block;
}
.ict-thumbs a.wide { grid-column: 1 / -1; }
.ict-thumbs a.wide img { height: 148px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.gallery-grid figure {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 0;
}
.gallery-grid img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}
.gallery-grid figcaption {
  padding: 0.7rem 0.9rem 0.9rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.lb{display:none;position:fixed;inset:0;background:rgba(0,0,0,.92);z-index:90;align-items:center;justify-content:center;padding:1.25rem;flex-direction:column}
.lb.on{display:flex}
.lb img, #lb-img{
  width:min(1100px,94vw)!important;
  max-width:min(1100px,94vw)!important;
  height:auto!important;
  max-height:86vh!important;
  min-height:40vh!important;
  object-fit:contain!important;
  border-radius:8px;
  background:#111;
}
.lb p{color:#fff;margin:.75rem 0 0;text-align:center;max-width:720px}
.lb button{position:absolute;top:1rem;right:1rem;background:#fff;border:0;border-radius:999px;width:42px;height:42px;font-size:1.5rem;cursor:pointer}

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.8rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
th { background: var(--green); color: #fff; font-weight: 600; }
tr:hover td { background: #f3faf5; }

.prose { background: #fffdf8; padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow); overflow-wrap: anywhere; font-size: 1.08rem; line-height: 1.85; }
.prose h2, .prose h3 { font-family: "Playfair Display", serif; color: var(--green); margin: 1.4rem 0 0.5rem; line-height: 1.25; }
.prose h2 { font-size: clamp(1.4rem, 2vw, 1.85rem); }
.prose h3 { font-size: clamp(1.15rem, 1.5vw, 1.4rem); }
.prose p, .prose li { margin-bottom: 0.9rem; font-size: 1.05rem; line-height: 1.8; }
.prose ul { padding-left: 1.2rem; }
.prose img { height: auto; }

.district-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; }
.district-result {
  display: block;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 0.95rem 1rem;
  color: inherit;
  min-width: 0;
}
.district-result:hover { color: inherit; background: #f3faf5; }
.district-result strong { display: block; color: var(--green); font-size: 1.05rem; }
.district-result span { color: var(--muted); font-size: 0.88rem; }

.search-count { color: var(--muted); margin: 0 0 1rem; font-size: 0.92rem; }

.ad-slot {
  border: 1px dashed #b7cbbd;
  background: #f3f7f4;
  color: #6a7a6e;
  text-align: center;
  padding: 1.6rem;
  margin: 1.5rem 0;
  border-radius: 12px;
  font-size: 0.85rem;
}
.page-hero {
  background: linear-gradient(135deg, var(--green), #046a2e);
  color: #fff;
  padding: 3.2rem 0 2.4rem;
}
.page-hero h1 { font-family: "Playfair Display", serif; font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.2; }
.page-hero a { text-decoration: underline; text-underline-offset: 3px; }
.search {
  margin: 1rem 0 1.5rem;
}
.search input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid #d5ddd7;
  border-radius: 12px;
  font-size: 1rem;
  min-height: 48px;
}

form label { display: block; font-weight: 600; margin: 0.8rem 0 0.3rem; }
form input, form textarea, form select {
  width: 100%; padding: 0.75rem; border: 1px solid #d5ddd7; border-radius: 10px; font: inherit; font-size: 1rem;
}
form button { margin-top: 1rem; border: 0; cursor: pointer; min-height: 44px; }

footer {
  background: #012411;
  color: #d7e6db;
  padding: 2.6rem 0 calc(1.2rem + env(safe-area-inset-bottom));
  margin-top: 2rem;
}
footer a { color: #fff; }
footer a:hover { color: var(--gold); }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 1.5rem; }
.foot-grid p { margin-top: 0.55rem; }
.foot-bottom { border-top: 1px solid #1c4a2d; margin-top: 1.6rem; padding-top: 1rem; font-size: 0.85rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

.upload-note {
  background: #fff8e6;
  border-left: 4px solid var(--gold);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  font-size: 0.92rem;
}

.home-shell .stats { grid-template-columns: 1fr 1fr; }
@media (max-width: 1020px) {
  .home-shell { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .province-split { grid-template-columns: 1fr; }
  .ict-gallery-panel { position: static; }
  .district-results { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-portrait img { height: 260px; }
  .stats, .grid-3, .grid-4, .foot-grid { grid-template-columns: 1fr 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  section { padding: 2.4rem 0; }
  .page-hero { padding: 1.8rem 0 1.4rem; }
  .prose { padding: 1.15rem 1rem; }
  .menu-btn { display: grid; place-items: center; }
  nav { display: none; }
  nav.open {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    padding: 0.4rem 1rem 0.9rem;
    box-shadow: var(--shadow);
    z-index: 80;
    border-top: 1px solid #edf1ee;
  }
  nav.open ul { flex-direction: column; gap: 0; }
  nav.open a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0.25rem 0.1rem;
    border-bottom: 1px solid #f0f3f1;
  }
  nav.open .nav-search { justify-content: flex-start; }
  .logo span { font-size: 1.12rem; }
  .topbar { font-size: 0.78rem; }
}
@media (max-width: 560px) {
  .container { width: min(1280px, calc(100% - 1.3rem)); }
  .stats, .grid-2, .grid-3, .grid-4, .foot-grid, .district-results { grid-template-columns: 1fr; }
  section { padding: 1.7rem 0; }
  .card img { height: 160px; }
  th, td { padding: 0.65rem 0.7rem; font-size: 0.92rem; }
  .page-hero p { font-size: 0.98rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .district-result, .btn { transition: none; }
}
