:root {
  --bg: #0e0e10;
  --surface: #151518;
  --text: #f5f5f7;
  --muted: #bfbfc7;
  --accent: #ea9500;
  --gold: #f1c766;
  --ring: rgba(241, 199, 102, .55);
  --border: rgba(255, 255, 255, .08);
}

.light {
  --bg: #f7f7f9;
  --surface: #ffffff;
  --text: #111118;
  --muted: #585b63;
  --accent: #b76300;
  --gold: #caa24a;
  --ring: rgba(183, 99, 0, .45);
  --border: rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  transition: transform .15s, box-shadow .2s, background .2s;
  color: #111;
  background: var(--gold);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0, 0, 0, .18); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .06); }

/* =========================
   NAVBAR — ALWAYS SOLID
   ========================= */
header.site {
  position: sticky;
  top: 0;
  z-index: 1000;

  /* Solid background (no transparency) */
  background-color: #111111;
  border-bottom: 1px solid var(--border);

  /* Remove glass/blur if any */
  background-image: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

body.light header.site {
  background-color: #ffffff;
  border-bottom: 1px solid var(--border);
}

/* Brand + links readable on both themes */
header.site .brand,
header.site .navlinks a {
  color: #ffffff;
}
body.light header.site .brand,
body.light header.site .navlinks a {
  color: #111111;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand { font-weight: 900; letter-spacing: .08em; display:inline-flex; align-items:center; gap:8px; }
.brand span { opacity: .85; }

.navlinks { display: none; gap: 6px; }
.navlinks a {
  position: relative;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  opacity: .95;
}
.navlinks a:after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 4px;
  height: 2px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .18s;
}
.navlinks a:hover { opacity: 1; }
.navlinks a:hover:after, .navlinks a.active:after { transform: scaleX(1); }

.nav-cta { display: flex; gap: 8px; align-items: center; }

.toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  height: 36px; width: 36px;
  border-radius: 10px;
  display: inline-grid; place-items: center;
  cursor: pointer;
}
.toggle:hover { outline: 2px solid var(--ring); }

@media (min-width: 900px) { .navlinks { display: flex; } }

/* =========================
   GENERAL TYPOGRAPHY/SECTIONS
   ========================= */
.hero { padding: 36px 0 10px; }

.urdu {
  font-family: 'Noto Nastaliq Urdu', 'Poppins', Inter, system-ui, sans-serif;
  font-size: 28px;
  font-weight: 700;
}

.h1 {
  font-family: Poppins, Inter, sans-serif;
  font-weight: 900;
  font-size: 40px;
  letter-spacing: .04em;
}

.tag { opacity: .8; font-size: 14px; }

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 880px) { .grid-3 { grid-template-columns: 1fr 1fr 1fr; } }

.leader { display: flex; gap: 14px; align-items: center; }
.leader img {
  width: 78px; height: 78px; object-fit: cover;
  border-radius: 999px;
  border: 2.5px solid var(--gold);
}

.section { padding: 28px 0; }
.section h1, .section h2 { font-size: 32px; margin: 0 0 6px; font-weight: 900; }
.section h3 { font-size: 20px; margin: 6px 0; font-weight: 800; }
.section .sub { opacity: .8; font-size: 14px; margin-bottom: 16px; }

/* =========================
   CIRCLE MENU
   ========================= */
.circle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 30px;
  justify-items: center;
  margin-top: 30px;
}

.circle {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--surface, #222);
  color: var(--gold, #f1c766);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  text-decoration: none;
  font-size: 28px;
  transition: transform .25s ease, background .25s ease, color .25s ease, box-shadow .25s ease;
  overflow: visible;
}

.circle:hover {
  background: var(--gold, #f1c766);
  color: #111;
  opacity: 1 !important;
  transform: translate(-50%, 0) !important;
  box-shadow: 0 8px 18px rgba(0,0,0,.3);
}

/* Label under icon */
.circle .label {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  opacity: 1 !important;
  transform: translate(-50%, 0) !important;         /* visible by default */
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  color: var(--gold, #f1c766);
  background: rgba(241,199,102,.12);
  border: 1px solid rgba(241,199,102,.35);
  padding: 6px 10px;
  border-radius: 999px;
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
  pointer-events: none;
  backdrop-filter: blur(6px);
  z-index: 2;
}

/* Touch devices already OK since labels are visible by default */

/* =========================
   CARDS & UTILITIES
   ========================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  transition: transform .15s, box-shadow .2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(0, 0, 0, .18); }

.flex { display: flex; gap: 12px; align-items: center; }
.muted { opacity: .75; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

@media (max-width: 820px) {
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid.c2 { grid-template-columns: 1fr; }
  .grid.c3 { grid-template-columns: 1fr; }
}

.searchbar { display: flex; gap: 10px; align-items: center; }
.searchbar input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
}
.pill.active { background: var(--gold); color: #111; border-color: transparent; }

/* =========================
   FOOTER
   ========================= */
footer { border-top: 1px solid var(--border); margin-top: 28px; }
.footer-wrap {
  padding: 18px 0;
  display: grid; gap: 12px; align-items: center;
}
@media (min-width: 860px) { .footer-wrap { grid-template-columns: 1fr auto; } }

.social a {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.social a:hover { outline: 2px solid var(--ring); }

.small { font-size: 12px; }
.hidden { display: none; }
.breadcrumbs { font-size: 12px; opacity: .8; margin-bottom: 10px; }

/* =========================
   RESPONSIVE TWEAKS
   ========================= */
#navlinks { transition: transform .25s ease, opacity .2s ease; }

@media (max-width: 480px) {
  .circle { width: 96px; height: 96px; font-size: 24px; }
  .circle .label { font-size: 13px; }
}

@media (max-width: 600px) {
  .grid.c3 { grid-template-columns: 1fr; }
  .grid.c2 { grid-template-columns: 1fr; }
  .leader img { width: 64px; height: 64px; }
  .h1 { font-size: 32px; letter-spacing: .02em; }
  .urdu { font-size: 24px; }
}

@media (max-width: 600px) {
  .btn, .btn-ghost, .toggle { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media (max-width: 420px) {
  .section { padding: 22px 0; }
  .section h1, .section h2 { font-size: 28px; }
}

/* Hero/leaders tweaks */
@media (max-width: 900px) {
  .hero .grid-3 { gap: 16px; }
  .hero .leader { justify-content: center !important; text-align: center !important; }
  .hero .leader img { width: 64px !important; height: 64px !important; }
  .h1 { font-size: 32px; letter-spacing: .02em; }
  .urdu { font-size: 24px; }
  .hero .tag { display: inline-block; margin-top: 4px; }
}
@media (max-width: 420px) {
  .hero .leader img { width: 56px !important; height: 56px !important; }
  .h1 { font-size: 28px; }
  .urdu { font-size: 22px; }
}

/* ===== Gotras (castes.html) ===== */
@media (max-width: 720px) {
  .searchbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .searchbar input { width: 100%; font-size: 16px; min-height: 44px; }
}

#letters { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 520px) {
  #letters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 6px; margin-bottom: 4px; }
  #letters .pill { flex: 0 0 auto; min-height: 36px; font-size: 14px; padding: 6px 10px; }
}

#casteGrid.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { #casteGrid.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { #casteGrid.grid { grid-template-columns: 1fr; } }

@media (max-width: 640px) {
  #casteGrid .card { padding: 14px; border-radius: 14px; }
  #casteGrid .card .flex > div:last-child .small { font-size: 12px; }
}

#casteGrid .card .flex { align-items: center; }
#casteGrid .card .flex img,
#casteGrid .card .flex .emblem {
  width: 44px; height: 44px; border-radius: 999px; border: 2px solid var(--gold);
}

#casteGrid .card div:first-child + div { min-width: 0; }
#casteGrid .card div:first-child + div > div:first-child {
  font-weight: 800; word-break: break-word;
}

@media (min-width: 0px) {
  .searchbar.sticky {
    position: sticky; top: 64px;
    z-index: 40; background: var(--bg);
    padding-top: 8px; padding-bottom: 8px;
  }
}

@media (max-width: 520px) {
  #letters::-webkit-scrollbar { height: 6px; }
  #letters::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
}

/* =========================
   MOBILE DRAWER — SOLID
   ========================= */
@media (max-width: 899px) {
  header.site .nav #navlinks {
    position: fixed;
    inset: 64px 0 0 0;            /* below header */
    z-index: 1000;
    display: grid;
    gap: 8px;
    padding: 14px;
    border-top: 1px solid var(--border);

    /* Solid background */
    background-color: #151518;
    color: var(--text);

    /* kill any glass */
    background-image: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;

    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s ease, opacity .2s ease;
    box-shadow: 0 10px 28px rgba(0,0,0,.35);
  }

  body.light header.site .nav #navlinks {
    background-color: #ffffff;
    color: #111118;
    box-shadow: 0 10px 28px rgba(0,0,0,.08);
  }

  header.site .nav #navlinks.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  header.site .nav #navlinks a {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: transparent;
    font-size: 16px;
  }

  body.menu-open { overflow: hidden; height: 100vh; }
}
