/* Islahi Majlis — Scholarly Q&A · Navy + Cream · Onest */

@import url('https://fonts.googleapis.com/css2?family=Amiri:wght@400;700&family=Onest:wght@400;500;600;700&display=swap');

:root {
  --navy-950: #0a1424;
  --navy-900: #0f1f3d;
  --navy-800: #152947;
  --navy-700: #1c3560;
  --navy-600: #254a7a;
  --navy-500: #3a6499;
  --cream: #faf8f4;
  --cream-2: #f2ede4;
  --paper: #fffdf9;
  --ink: #0f1f3d;
  --ink-soft: #3d4f6a;
  --ink-faint: #6b7d96;
  --line: #e4dfd4;
  --line-soft: #ece8e0;
  --accent: #c9a227;
  --accent-hover: #b08e1a;
  --danger: #c44d3f;
  --hero-text: #faf8f4;
  --hero-sub: #c8d4e8;
  --topbar-text: #e8eef8;
  --shadow-sm: 0 1px 4px rgba(15, 31, 61, .08);
  --shadow-md: 0 8px 28px rgba(15, 31, 61, .12);
  --shadow-lg: 0 20px 48px rgba(15, 31, 61, .18);
  --radius: 12px;
  --radius-sm: 8px;
  --maxw: 1100px;
  --font: 'Onest', system-ui, sans-serif;
  --arabic: 'Amiri', serif;

  /* legacy aliases */
  --green-900: var(--navy-950);
  --green-800: var(--navy-900);
  --green-700: var(--navy-800);
  --green-600: var(--navy-700);
  --green-500: var(--navy-600);
  --gold-600: var(--accent-hover);
  --gold-500: var(--accent);
  --gold-400: #dfc06a;
  --parchment: var(--cream);
  --parchment-2: var(--cream-2);
  --serif: var(--font);
  --display: var(--font);
  --smallcaps: var(--font);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: 72px;
}
body.no-bottom-nav { padding-bottom: 0; }

a { color: var(--navy-700); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Top bar */
.topbar {
  background: var(--navy-950);
  color: var(--topbar-text);
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 36px; }
.topbar a { color: #a8b8d0; font-size: 12px; }

/* Header */
header.site {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
header.site .wrap {
  display: flex; align-items: center; gap: 16px;
  height: 64px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand .glyph {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--navy-900);
  display: grid; place-items: center;
  color: var(--cream); font-family: var(--arabic);
  font-size: 22px; font-weight: 700;
}
.brand .name b { font-size: 18px; font-weight: 700; color: var(--navy-900); display: block; letter-spacing: -.02em; }
.brand .name small { font-size: 10px; color: var(--ink-faint); letter-spacing: 1.2px; text-transform: uppercase; font-weight: 500; }

nav.main { display: flex; gap: 2px; margin-left: auto; align-items: center; flex-wrap: wrap; }
nav.main a {
  padding: 8px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
}
nav.main a:hover { background: var(--cream-2); color: var(--navy-900); }
nav.main a.active { background: var(--navy-900); color: var(--cream); }

.header-actions { display: flex; gap: 8px; align-items: center; }

/* Prominent Ask CTA */
.btn-ask {
  background: var(--accent) !important;
  color: var(--navy-950) !important;
  font-weight: 700 !important;
  padding: 10px 20px !important;
  box-shadow: 0 4px 14px rgba(201, 162, 39, .35) !important;
  border: none !important;
}
.btn-ask:hover {
  background: var(--accent-hover) !important;
  color: var(--navy-950) !important;
  transform: translateY(-1px);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; font-family: var(--font); font-size: 14px; font-weight: 600;
  padding: 10px 16px; border-radius: var(--radius-sm); border: none;
  transition: all .15s; text-decoration: none;
}
.btn-primary { background: var(--navy-900); color: var(--cream); }
.btn-primary:hover { background: var(--navy-800); color: var(--cream); transform: translateY(-1px); }
.btn-gold, .btn-accent { background: var(--accent); color: var(--navy-950); }
.btn-gold:hover, .btn-accent:hover { background: var(--accent-hover); color: var(--navy-950); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--navy-600); color: var(--navy-800); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; border-radius: var(--radius); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.acct .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy-800); color: var(--cream);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.acct .meta b { font-size: 13px; display: block; }
.acct .meta small { font-size: 11px; color: var(--ink-faint); }

/* Bottom nav — mobile-first navigation */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: var(--paper);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(15, 31, 61, .08);
  display: flex; justify-content: space-around; align-items: stretch;
  padding: 6px 8px max(6px, env(safe-area-inset-bottom));
}
.bottom-nav a, .bottom-nav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 4px; font-size: 10px; font-weight: 600; color: var(--ink-faint);
  background: none; border: none; cursor: pointer; font-family: var(--font);
  text-decoration: none; max-width: 80px;
}
.bottom-nav a .ico, .bottom-nav button .ico { font-size: 20px; line-height: 1; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--navy-900); }
.bottom-nav .nav-ask {
  flex: 1.2; max-width: 88px;
  background: var(--accent); color: var(--navy-950) !important;
  border-radius: 12px; margin: -8px 4px 0;
  padding: 10px 6px; box-shadow: var(--shadow-md);
}
.bottom-nav .nav-ask .ico { font-size: 22px; }

/* Hero */
.hero {
  background: linear-gradient(145deg, var(--navy-950), var(--navy-800));
  color: var(--hero-text); border-radius: var(--radius);
  padding: 40px 36px; margin: 24px 0; box-shadow: var(--shadow-lg);
}
.hero h1 { font-size: 34px; font-weight: 700; letter-spacing: -.03em; margin-bottom: 10px; line-height: 1.15; }
.hero p { font-size: 16px; color: var(--hero-sub); max-width: 520px; margin-bottom: 22px; }
.hero .searchbar { display: flex; gap: 8px; max-width: 480px; flex-wrap: wrap; }
.hero .searchbar input {
  flex: 1; min-width: 180px; padding: 12px 16px; border-radius: var(--radius-sm);
  border: none; font-family: var(--font); font-size: 15px;
}
.hero .stats { display: flex; gap: 28px; margin-top: 24px; flex-wrap: wrap; }
.hero .stats .stat b { font-size: 26px; font-weight: 700; display: block; color: var(--accent); }
.hero .stats .stat span { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--hero-sub); font-weight: 500; }

.hero-cta-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

/* Cards */
.card {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow-md); border-color: var(--line-soft); }

.section-head { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }
.section-head .ico {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--navy-900); color: var(--cream);
  display: grid; place-items: center; font-size: 16px; flex: none;
}
.section-head h2 { font-size: 20px; font-weight: 700; color: var(--navy-900); letter-spacing: -.02em; }
.section-head .sub { font-size: 13px; color: var(--ink-faint); font-weight: 400; }
.section-head .more { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--navy-700); }

.qcard h3 { font-size: 17px; font-weight: 600; line-height: 1.35; margin-bottom: 6px; }
.qcard h3 a { color: var(--ink); }
.qcard h3 a:hover { color: var(--navy-700); }
.qcard p.excerpt { font-size: 14px; color: var(--ink-soft); line-height: 1.55; }
.qcard .qmeta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--ink-faint); }
.qcard .qmeta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line); }
.qcard .tag {
  font-size: 11px; font-weight: 600; color: var(--navy-800);
  background: rgba(21, 41, 71, .08); padding: 3px 8px; border-radius: 20px;
}
.card-actions { display: flex; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.icon-btn {
  font-size: 12px; color: var(--ink-faint); background: none; border: none;
  cursor: pointer; padding: 4px 8px; border-radius: 6px; font-family: var(--font);
}
.icon-btn:hover { background: var(--cream-2); color: var(--navy-800); }
.icon-btn.saved { color: var(--accent); font-weight: 600; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.layout { display: grid; grid-template-columns: 1fr 280px; gap: 22px; align-items: start; margin: 24px 0; }
.sidebar .card { margin-bottom: 14px; }
.sidebar h4 { font-size: 14px; font-weight: 700; color: var(--navy-900); margin-bottom: 10px; }

.cat-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.cat-row:last-child { border-bottom: none; }
.cat-row .c-name { font-weight: 500; font-size: 14px; flex: 1; }
.cat-row .c-count { font-size: 12px; color: var(--ink-faint); }

/* Forms */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); font-family: var(--font); font-size: 15px;
  background: var(--paper); color: var(--ink);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--navy-600);
  box-shadow: 0 0 0 3px rgba(30, 58, 96, .12);
}
.field textarea { resize: vertical; min-height: 110px; }
.field .hint { font-size: 11px; color: var(--ink-faint); margin-top: 4px; }

.quick-auth {
  background: var(--cream-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 20px;
}
.quick-auth h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.quick-auth p { font-size: 13px; color: var(--ink-faint); margin-bottom: 12px; }
.quick-auth .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 500px) { .quick-auth .row { grid-template-columns: 1fr; } }

.anon-opt {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  color: var(--ink-faint); margin: -4px 0 14px; cursor: pointer;
}
.anon-opt input { width: 14px; height: 14px; accent-color: var(--navy-800); }

.pill { display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.pill-pending { background: rgba(201, 162, 39, .15); color: var(--accent-hover); }
.pill-answered { background: rgba(21, 41, 71, .1); color: var(--navy-800); }

/* Team cards */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.team-card { text-align: center; padding: 24px 18px; }
.team-card .photo-wrap { margin: 0 auto 12px; width: 88px; height: 88px; }
.team-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.team-card .role { font-size: 12px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.team-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.5; }

.profile-photo, .profile-photo-placeholder {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--accent);
}
.profile-photo-placeholder {
  background: var(--navy-800); color: var(--cream);
  display: grid; place-items: center; font-weight: 700; font-size: 28px;
}

.scholar-byline { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.scholar-byline img, .scholar-byline .av {
  width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none;
}
.scholar-byline .av {
  background: var(--navy-800); color: var(--cream);
  display: grid; place-items: center; font-weight: 700;
}

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(10, 20, 36, .55);
  backdrop-filter: blur(4px); display: none; place-items: center;
  z-index: 200; padding: 16px;
}
.modal-bg.open { display: grid; }
.modal {
  background: var(--paper); border-radius: var(--radius);
  max-width: 380px; width: 100%; padding: 26px;
  box-shadow: var(--shadow-lg); border-top: 3px solid var(--accent);
}
.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.modal .close { float: right; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink-faint); }
.modal .tabs { display: flex; gap: 4px; background: var(--cream-2); padding: 4px; border-radius: var(--radius-sm); margin: 14px 0; }
.modal .tabs button {
  flex: 1; padding: 8px; border: none; background: transparent; border-radius: 6px;
  font-family: var(--font); font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-faint);
}
.modal .tabs button.active { background: var(--paper); color: var(--navy-900); box-shadow: var(--shadow-sm); }

#toast-stack { position: fixed; bottom: 80px; right: 16px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy-900); color: var(--cream); padding: 12px 16px;
  border-radius: var(--radius-sm); font-size: 14px; max-width: 300px;
  border-left: 3px solid var(--accent); animation: fadeUp .25s ease;
}
.toast.err { border-left-color: var(--danger); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

footer.site {
  background: var(--navy-950); color: #a8b8d0;
  margin-top: 48px; padding: 36px 0 24px;
}
footer.site .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
footer.site h4 { color: var(--cream); font-size: 13px; font-weight: 700; margin-bottom: 12px; }
footer.site a { color: #8fa3be; display: block; padding: 3px 0; font-size: 13px; }
footer.site a:hover { color: var(--cream); }
footer.site .copy { text-align: center; margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-faint); }
.empty .big { font-size: 40px; margin-bottom: 10px; opacity: .4; }
.fade-in { animation: fadeUp .4s ease both; }
.stagger > * { animation: fadeUp .4s ease both; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .18s; }

.divider-orn { text-align: center; color: var(--accent); font-family: var(--arabic); font-size: 18px; margin: 8px 0; opacity: .5; }

/* Scholar portal */
.scholar-page { padding-bottom: 0; background: var(--cream); }
.scholar-top { background: var(--navy-950); border-bottom: 2px solid var(--accent); }
.scholar-top .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.scholar-brand { display: flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; }
.scholar-dash { display: grid; grid-template-columns: 260px 1fr; gap: 20px; margin: 24px 0 40px; }
.scholar-nav a, .scholar-nav button.snav {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 12px;
  border: none; background: transparent; border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; color: var(--ink-soft); cursor: pointer; text-align: left;
}
.scholar-nav a.active, .scholar-nav button.snav.active { background: var(--navy-900); color: var(--cream); }
.info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.scholar-login-wrap { max-width: 400px; margin: 48px auto; }

/* index2 gateway */
.gateway { max-width: 900px; margin: 40px auto; }
.gateway-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.gateway-panel { padding: 28px; }
.gateway-panel h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.gateway-panel .badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--accent); margin-bottom: 12px; display: block; }

.donate-box { text-align: center; padding: 48px 32px; }
.donate-box .big-icon { font-size: 48px; margin-bottom: 16px; opacity: .6; }

@media (max-width: 768px) {
  nav.main { display: none; }
  .layout, .scholar-dash, .gateway-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  footer.site .cols { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  header.site .btn-ask span.hide-mobile { display: none; }
}
@media (min-width: 769px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 0; }
}
