/* =============================================================================
   Gulshan-e-Razvi public site — mobile-first design system
   Base rules target phones; @media (min-width) blocks add desktop refinements.
   Colour schemes are CSS variable sets keyed on <html data-theme="...">.
   ========================================================================== */

@font-face {
  font-family: 'Jameel Noori Nastaleeq';
  src: url('../fonts/jameel-noori-nastaleeq.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Al Qalam Quran Majeed';
  src: url('../fonts/al-qalam-quran-majeed.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Amiri';
  src: url('../fonts/amiri-regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-ur: 'Jameel Noori Nastaleeq', 'Noto Nastaliq Urdu', serif;
  --font-ar: 'Al Qalam Quran Majeed', 'Amiri', 'Noto Naskh Arabic', 'Jameel Noori Nastaleeq', serif;
  --font-en: 'Noto Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --gold: #c9a227;
  --gold-2: #e6c35a;
  --gold-3: #fff0c2;
  --gold-ink: #5e4600;
  --cream: #fdf6e3;
  --cream-2: #f7e9c4;

  --teal: #147a80;
  --teal-50: #e3f4f5;
  --blue: #27508f;
  --blue-50: #e6ecf7;
  --maroon: #98304a;
  --maroon-50: #f8e6ec;

  --ink: #1b2420;
  --muted: #5f6b66;
  --paper: #f3f7f2;
  --surface: #ffffff;
  --line: #dfe7e1;

  --radius: 1rem;
  --radius-sm: .65rem;
  --shadow: 0 12px 32px rgba(15, 35, 25, .12);
  --shadow-sm: 0 3px 12px rgba(15, 35, 25, .08);
  --nav-h: 64px;
  --bar-h: 62px;
}

[data-theme="emerald"] { --brand-900: #063d27; --brand-700: #0b5d3b; --brand-600: #0f7a4d; --brand-500: #159a60; --brand-100: #d6efe2; --brand-50: #eaf7ef; }
[data-theme="teal"]    { --brand-900: #073a3d; --brand-700: #0f5e63; --brand-600: #147a80; --brand-500: #1a9aa1; --brand-100: #d3eeef; --brand-50: #e8f6f7; }
[data-theme="midnight"]{ --brand-900: #0b1a33; --brand-700: #142850; --brand-600: #1b3a6b; --brand-500: #27508f; --brand-100: #dbe3f2; --brand-50: #edf1f9; }
[data-theme="maroon"]  { --brand-900: #3a0f1a; --brand-700: #5c1a2a; --brand-600: #7a2238; --brand-500: #98304a; --brand-100: #f3dde3; --brand-50: #faeef1; }
[data-theme="indigo"]  { --brand-900: #1a1740; --brand-700: #2a2566; --brand-600: #3b3591; --brand-500: #4c46b2; --brand-100: #e3e1f5; --brand-50: #f1f0fa; }
[data-theme="olive"]   { --brand-900: #26300c; --brand-700: #3f4f16; --brand-600: #55691f; --brand-500: #6c8528; --brand-100: #e6ecd3; --brand-50: #f3f6ea; }
html:not([data-theme]) { --brand-900: #063d27; --brand-700: #0b5d3b; --brand-600: #0f7a4d; --brand-500: #159a60; --brand-100: #d6efe2; --brand-50: #eaf7ef; }

/* Five accent hues used to colour cards, icons and accordion rails in rotation */
.accent-1 { --accent: var(--brand-600); --accent-soft: var(--brand-100); --accent-ink: var(--brand-900); }
.accent-2 { --accent: var(--gold); --accent-soft: var(--gold-3); --accent-ink: var(--gold-ink); }
.accent-3 { --accent: var(--teal); --accent-soft: var(--teal-50); --accent-ink: #073a3d; }
.accent-4 { --accent: var(--blue); --accent-soft: var(--blue-50); --accent-ink: #0b1a33; }
.accent-5 { --accent: var(--maroon); --accent-soft: var(--maroon-50); --accent-ink: #3a0f1a; }

/* ---------- Base ---------- */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
[id] { scroll-margin-top: calc(var(--nav-h, 64px) + .75rem); } /* anchor targets stop below the sticky header */
body {
  background: var(--paper);
  background-image: radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--brand-100) 55%, transparent), transparent 42%), radial-gradient(circle at 100% 30%, color-mix(in srgb, var(--gold-3) 60%, transparent), transparent 38%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-en);
  font-size: calc(1rem * var(--fs-scale));
  line-height: 1.65;
  padding-bottom: var(--bar-h);
  min-height: 100svh;
  overflow-x: hidden;
}
html[lang="ur"] body { font-family: var(--font-ur); font-size: calc(1.05rem * var(--fs-scale)); line-height: 1.95; }
html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] h3, html[lang="ur"] h4, html[lang="ur"] h5, html[lang="ur"] h6 { line-height: 1.75; font-weight: 400; }
h1, h2, h3, h4, h5, h6 { color: var(--brand-900); }
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3 { font-weight: 700; letter-spacing: -.01em; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-700); }
img { max-width: 100%; height: auto; }
.ar { font-family: var(--font-ar); direction: rtl; line-height: 2.1; font-size: 1.4rem; }
.latin, bdi.latin { font-family: var(--font-en); direction: ltr; unicode-bidi: isolate; }
/* Numbers: isolated left-to-right but in the page's own font, so Urdu digits render in Nastaleeq. */
.digits, bdi.digits { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
html[lang="ur"] .hero-badge, html[lang="ur"] .year-chip, html[lang="ur"] .event-years span, html[lang="ur"] .album-cover .album-count, html[lang="ur"] .marks-table td.num, html[lang="ur"] .marks-table th.num, html[lang="ur"] .teacher-card .avatar, html[lang="ur"] .font-ctl .font-level, html[lang="ur"] .otp-steps span { font-family: var(--font-ur); }
.ur { font-family: var(--font-ur); direction: rtl; }
html[lang="en"] .ur { font-size: 1.15em; line-height: 1.8; } /* Nastaliq reads small beside Latin text (e.g. a Hifz miqdar on the results page); em keeps it on the A-/A+ scale */
.text-brand { color: var(--brand-600) !important; }
.text-brand-900 { color: var(--brand-900) !important; }
.text-gold { color: var(--gold) !important; }
.bg-brand { background: var(--brand-700) !important; color: #fff; }
.bg-brand-50 { background: var(--brand-50) !important; }
.bg-brand-100 { background: var(--brand-100) !important; }
.text-muted { color: var(--muted) !important; }
.skip-link { position: absolute; inset-inline-start: 0; top: -100px; background: var(--gold); color: var(--gold-ink); padding: .5rem 1rem; z-index: 2000; border-radius: 0 0 var(--radius-sm) 0; }
.skip-link:focus { top: 0; }
::selection { background: var(--gold-3); }

/* Bootstrap component mapping */
.btn { border-radius: 999px; padding: .6rem 1.25rem; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
html[lang="ur"] .btn { font-weight: 400; }
.btn-sm { min-height: 36px; padding: .35rem .9rem; }
.btn-primary { --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600); --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700); --bs-btn-active-bg: var(--brand-900); --bs-btn-active-border-color: var(--brand-900); --bs-btn-disabled-bg: var(--brand-500); --bs-btn-disabled-border-color: var(--brand-500); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand-600) 30%, transparent); }
.btn-outline-primary { --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-600); --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700); }
.btn-gold { --bs-btn-bg: var(--gold); --bs-btn-border-color: var(--gold); --bs-btn-color: #2b2000; --bs-btn-hover-bg: var(--gold-2); --bs-btn-hover-border-color: var(--gold-2); --bs-btn-hover-color: #2b2000; --bs-btn-active-bg: #b8901e; --bs-btn-active-border-color: #b8901e; --bs-btn-active-color: #2b2000; box-shadow: 0 6px 16px rgba(201, 162, 39, .35); }
.btn-outline-light { --bs-btn-hover-color: var(--brand-900); }
.badge-brand { background: var(--brand-100); color: var(--brand-900); font-weight: 600; border-radius: 999px; padding: .35em .8em; }
.badge-gold { background: var(--gold-3); color: var(--gold-ink); font-weight: 600; border-radius: 999px; padding: .35em .8em; }
.form-control, .form-select { min-height: 48px; border-radius: var(--radius-sm); border-color: var(--line); font-size: max(1rem, calc(1rem * var(--fs-scale))); }
.form-control:focus, .form-select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--brand-500) 25%, transparent); }
.form-label { font-weight: 600; color: var(--brand-900); }
html[lang="ur"] .form-label { font-weight: 400; }
.page-link { color: var(--brand-600); min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.active > .page-link, .page-link.active { background: var(--brand-600); border-color: var(--brand-600); }
.accordion-button { min-height: 56px; font-weight: 600; color: var(--brand-900); gap: .6rem; }
html[lang="ur"] .accordion-button { font-weight: 400; }
.accordion-button:not(.collapsed) { background: var(--accent-soft, var(--brand-50)); color: var(--accent-ink, var(--brand-900)); box-shadow: inset 0 -1px 0 var(--line); }
.accordion-button:focus { box-shadow: 0 0 0 .25rem color-mix(in srgb, var(--brand-500) 25%, transparent); }
.breadcrumb { --bs-breadcrumb-divider: '›'; font-size: calc(.9rem * var(--fs-scale)); margin: 0; }
[dir="rtl"] .breadcrumb { --bs-breadcrumb-divider: '‹'; }
.breadcrumb a { color: rgba(255,255,255,.8); }
.breadcrumb .active { color: var(--gold-2); }
.table > :not(caption) > * > * { padding: .65rem .75rem; }
.table thead th { background: var(--brand-50); color: var(--brand-900); font-weight: 600; border-bottom: 2px solid var(--brand-100); }
.alert-brand { background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-900); border-radius: var(--radius-sm); }

/* ---------- Header / navigation ---------- */
/* Bismillah line above the header: scrolls away while the header below stays sticky */
.bismillah-bar { background: var(--brand-900); color: var(--gold-2); font-family: var(--font-ar); font-size: .8rem; font-weight: 400; line-height: 2; text-align: center; direction: rtl; padding: .1rem 1rem; }
.site-header { position: sticky; top: 0; z-index: 1030; background: linear-gradient(180deg, var(--brand-50), var(--brand-100)); border-bottom: 3px solid var(--gold); transition: box-shadow .25s ease; }
.site-header.is-scrolled { box-shadow: var(--shadow-sm); }
.site-nav { min-height: var(--nav-h); padding: .35rem 0; }
.brand-logo { height: 42px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .brand-name { font-size: calc(1.05rem * var(--fs-scale)); color: var(--brand-900); font-weight: 700; white-space: nowrap; }
html[lang="ur"] .brand-text .brand-name { font-family: var(--font-ur); font-weight: 400; font-size: calc(1.15rem * var(--fs-scale)); line-height: 1.6; }
.brand-text .brand-sub { font-size: calc(.7rem * var(--fs-scale)); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-family: var(--font-en); }
html[lang="ur"] .brand-text .brand-sub { font-family: var(--font-ur); font-size: calc(.85rem * var(--fs-scale)); letter-spacing: 0; text-transform: none; line-height: 1.4; }
.nav-tools { display: flex; align-items: center; gap: .35rem; }
.lang-pill { border: 1.5px solid var(--brand-600); color: var(--brand-600); border-radius: 999px; padding: .15rem .7rem; font-weight: 600; font-family: var(--font-en); font-size: calc(.85rem * var(--fs-scale)); min-height: 36px; display: inline-flex; align-items: center; }
html[lang="en"] .lang-pill { font-family: var(--font-ur); font-size: calc(1rem * var(--fs-scale)); }
.lang-pill:hover { background: var(--brand-600); color: #fff; }
.nav-toggle { border: 0; background: var(--brand-50); color: var(--brand-900); width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; }
.desktop-nav { display: none; }
.desktop-nav .nav-link { color: var(--brand-900); font-weight: 600; padding: .6rem .9rem; border-radius: 999px; }
html[lang="ur"] .desktop-nav .nav-link { font-weight: 400; }
.desktop-nav .nav-link:hover, .desktop-nav .nav-link.active, .desktop-nav .show > .nav-link { background: var(--brand-50); color: var(--brand-700); }
.desktop-nav .dropdown-menu { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; margin-top: .5rem; min-width: 16rem; border-top: 3px solid var(--gold); }
.desktop-nav .dropdown-item { border-radius: var(--radius-sm); padding: .55rem .9rem; color: var(--ink); display: flex; align-items: center; gap: .6rem; }
.desktop-nav .dropdown-item:hover, .desktop-nav .dropdown-item.active { background: var(--brand-50); color: var(--brand-900); }
.desktop-nav .dropdown-item .bi { color: var(--gold); }
/* Nested menu (the admission forms): a flyout beside its parent entry on desktop */
.dropdown-submenu { position: relative; }
.dropdown-submenu-toggle { width: 100%; background: none; border: 0; text-align: start; font: inherit; cursor: pointer; }
.dropdown-submenu-toggle .submenu-caret { margin-inline-start: auto; font-size: .75em; color: var(--muted); }
.desktop-nav .dropdown-submenu > .dropdown-menu { display: none; position: absolute; top: -.5rem; inset-inline-start: calc(100% - .25rem); margin: 0; min-width: 14rem; }
.desktop-nav .dropdown-submenu:hover > .dropdown-menu, .desktop-nav .dropdown-submenu.show > .dropdown-menu { display: block; }
.nav-cta { display: none; }
.theme-picker { display: flex; gap: .4rem; align-items: center; }
.theme-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; position: relative; }
.theme-dot[data-theme-pick="emerald"] { background: #0f7a4d; }
.theme-dot[data-theme-pick="teal"] { background: #147a80; }
.theme-dot[data-theme-pick="midnight"] { background: #1b3a6b; }
.theme-dot[data-theme-pick="maroon"] { background: #7a2238; }
.theme-dot[data-theme-pick="indigo"] { background: #3b3591; }
.theme-dot[data-theme-pick="olive"] { background: #55691f; }
.theme-dot.active { box-shadow: 0 0 0 2px var(--gold); }
.theme-dot:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pattern-picker { display: grid; grid-template-columns: repeat(6, 34px); gap: .4rem; }
.pattern-dot { width: 34px; height: 34px; border-radius: 9px; border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; padding: 0; background-color: var(--brand-600); background-size: 44px 44px; background-position: center; }
.pattern-dot.active { box-shadow: 0 0 0 2px var(--gold); }
.pattern-dot:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.offcanvas-nav { width: min(88vw, 360px); }
.offcanvas-nav .offcanvas-header { background: linear-gradient(140deg, var(--brand-900), var(--brand-600)); color: #fff; padding: 1rem 1.25rem; }
.offcanvas-nav .offcanvas-header img { height: 40px; }
.offcanvas-nav .btn-close { filter: invert(1); opacity: .9; }
.offcanvas-nav .offcanvas-body { padding: .75rem 0 1.5rem; }
.mobile-menu { list-style: none; margin: 0; padding: 0; }
.mobile-menu > li { border-bottom: 1px solid var(--line); }
.mobile-menu a, .mobile-menu button { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .9rem 1.25rem; min-height: 52px; color: var(--ink); background: none; border: 0; text-align: start; font: inherit; font-weight: 600; }
html[lang="ur"] .mobile-menu a, html[lang="ur"] .mobile-menu button { font-weight: 400; font-size: 1.1rem; }
.mobile-menu a.active { color: var(--brand-700); background: var(--brand-50); }
.mobile-menu .bi { color: var(--gold); font-size: 1.15rem; width: 1.5rem; text-align: center; }
.mobile-menu button .bi-chevron-down { margin-inline-start: auto; color: var(--muted); transition: transform .25s; font-size: .9rem; }
.mobile-menu button[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.mobile-menu .submenu { list-style: none; padding: 0 0 .5rem; margin: 0; background: var(--brand-50); }
.mobile-menu .submenu a { padding-inline-start: 3.4rem; min-height: 46px; font-weight: 500; }
html[lang="ur"] .mobile-menu .submenu a { font-weight: 400; }
.mobile-menu .submenu button { padding-inline-start: 3.4rem; min-height: 46px; font-weight: 500; }
html[lang="ur"] .mobile-menu .submenu button { font-weight: 400; }
.mobile-menu .submenu .submenu { background: var(--brand-100); padding-bottom: .25rem; }
.mobile-menu .submenu .submenu a { padding-inline-start: 4.4rem; }
.mobile-tools { padding: 1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.mobile-tools .tools-row { display: flex; justify-content: space-between; align-items: center; }

/* ---------- Bottom action bar (phones) ---------- */
.bottom-bar { position: fixed; inset-inline: 0; bottom: 0; height: var(--bar-h); z-index: 1025; background: rgba(255,255,255,.97); border-top: 2px solid var(--gold); display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -4px 16px rgba(0,0,0,.06); }
.bottom-bar-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; color: var(--brand-900); font-size: calc(.72rem * var(--fs-scale)); font-family: var(--font-en); font-weight: 600; min-height: 44px; }
html[lang="ur"] .bottom-bar-item { font-family: var(--font-ur); font-size: calc(.9rem * var(--fs-scale)); font-weight: 400; line-height: 1.3; }
.bottom-bar-item .bi { font-size: 1.35rem; color: var(--brand-600); }
.bottom-bar-item.is-primary { color: var(--gold-ink); }
.bottom-bar-item.is-primary .bi { color: var(--gold); }

/* ---------- Hero (split layout) ---------- */
.hero { position: relative; overflow: hidden; color: #fff; background: linear-gradient(140deg, var(--brand-900) 0%, var(--brand-700) 55%, var(--brand-600) 100%); border-bottom: 4px solid var(--gold); }
.hero::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern, url('../img/patterns/star.svg')); background-size: 120px 120px; opacity: .13; pointer-events: none; }
.hero::after { content: ''; position: absolute; width: 60vw; height: 60vw; max-width: 560px; max-height: 560px; border-radius: 50%; background: radial-gradient(circle, rgba(230,195,90,.38) 0%, rgba(230,195,90,0) 65%); inset-inline-end: -20vw; top: -20vw; pointer-events: none; }
.hero-inner { position: relative; z-index: 1; padding: 2.25rem 0 2.5rem; display: flex; flex-direction: column; gap: 1.75rem; }
.hero-kicker { display: inline-flex; align-items: center; gap: .5rem; color: var(--gold-2); font-weight: 600; letter-spacing: .02em; font-size: calc(.95rem * var(--fs-scale)); }
.hero-kicker::before { content: ''; width: 28px; height: 2px; background: var(--gold); border-radius: 2px; }
.hero-title { color: #fff; font-size: clamp(1.75rem, 6.5vw, 3.4rem); margin: .35rem 0 .5rem; }
html[lang="ur"] .hero-title { line-height: 1.7; }
.hero-name { color: var(--gold-3); font-size: clamp(1.15rem, 4.2vw, 1.6rem); margin: 0 0 .5rem; }
.hero-tagline { color: rgba(255,255,255,.9); max-width: 40rem; font-size: calc(1.02rem * var(--fs-scale)); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.25rem; }
.hero-media { position: relative; }
.hero-media-frame { border-radius: var(--radius); overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.35); border: 3px solid rgba(230,195,90,.8); background: #000; }
.hero-media-frame img { width: 100%; display: block; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-badge { position: absolute; inset-inline-start: 1rem; bottom: -1rem; background: var(--gold); color: var(--gold-ink); border-radius: 999px; padding: .35rem .9rem; font-weight: 700; font-size: calc(.85rem * var(--fs-scale)); box-shadow: var(--shadow-sm); font-family: var(--font-en); }

/* Hero intro videos: a vertical scroller with language chips and step arrows (site.js drives it; the wheel scrolls the page, not the videos) */
.hero-scroller { position: relative; }
.vscroller-track { aspect-ratio: 16 / 9; overflow: hidden; scroll-behavior: smooth; }
.vscroller-item { height: 100%; }
.vscroller-item .lite-yt { height: 100%; aspect-ratio: auto; }
.vscroller-nav { position: absolute; inset-inline-end: .6rem; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: .35rem; z-index: 2; }
.vscroller-chip { border: 0; border-radius: 999px; padding: .25rem .7rem; font-size: calc(.8rem * var(--fs-scale)); font-weight: 700; background: rgba(0,0,0,.55); color: #fff; backdrop-filter: blur(4px); cursor: pointer; }
.vscroller-chip.active, .vscroller-chip:hover { background: var(--gold); color: var(--gold-ink); }
.vscroller-arrow { position: absolute; left: 50%; transform: translateX(-50%); width: 34px; height: 24px; border: 0; border-radius: 8px; background: rgba(0,0,0,.45); color: #fff; z-index: 2; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.vscroller-up { top: .4rem; }
.vscroller-down { bottom: .4rem; }
.vscroller-arrow:hover { background: var(--gold); color: var(--gold-ink); }
.vscroller-arrow[disabled] { opacity: .35; cursor: default; }
@media (prefers-reduced-motion: reduce) { .vscroller-track { scroll-behavior: auto; } }

/* ---------- Admission banner ---------- */
.admission-banner { background: linear-gradient(90deg, var(--gold-3), var(--cream)); border-bottom: 1px solid var(--cream-2); color: var(--gold-ink); }
.admission-banner--open { background: linear-gradient(90deg, var(--brand-100), var(--brand-50)); border-bottom-color: var(--brand-100); color: var(--brand-900); }
.admission-banner .inner { display: flex; flex-direction: column; gap: .5rem; padding: .85rem 0; }
.admission-banner .bi { font-size: 1.3rem; }
.admission-banner .dates { font-size: calc(.9rem * var(--fs-scale)); opacity: .9; }

/* ---------- Sections ---------- */
.section { padding: 3rem 0; position: relative; }
.section-alt { background: var(--surface); }
.section-brand { background: var(--brand-50); background-image: url('../img/pattern-dark.svg'); background-size: 120px 120px; }
.section-brand::before { content: ''; position: absolute; inset: 0; background: var(--brand-50); opacity: .93; pointer-events: none; }
.section-brand > .container { position: relative; }
.section-cream { background: var(--cream); background-image: url('../img/pattern-dark.svg'); background-size: 120px 120px; }
.section-cream::before { content: ''; position: absolute; inset: 0; background: var(--cream); opacity: .94; pointer-events: none; }
.section-cream > .container { position: relative; }
.section-dark { background: linear-gradient(160deg, var(--brand-900), var(--brand-700)); color: rgba(255,255,255,.9); }
.section-dark::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern, url('../img/patterns/star.svg')); background-size: 120px 120px; opacity: .1; pointer-events: none; }
.section-dark > .container { position: relative; }
/* Home-page sections: each one a different shade of the colour scheme, light to dark in the order they appear
   (HomeController assigns shade-1 to shade-7 in tile order, the last one dark), with the selected pattern showing through. */
.section[class*="shade-"] { position: relative; }
.section[class*="shade-"]::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern, url('../img/patterns/star.svg')); background-size: 120px 120px; opacity: .1; pointer-events: none; }
.section[class*="shade-"] > * { position: relative; }
.shade-1 { background: color-mix(in srgb, var(--brand-600) 5%, #fff); }
.shade-2 { background: color-mix(in srgb, var(--brand-600) 11%, #fff); }
.shade-3 { background: color-mix(in srgb, var(--brand-600) 18%, #fff); }
.shade-4 { background: color-mix(in srgb, var(--brand-600) 26%, #fff); }
.shade-5 { background: color-mix(in srgb, var(--brand-600) 34%, #fff); }
.shade-6 { background: color-mix(in srgb, var(--brand-600) 42%, #fff); }
.shade-7 { background: linear-gradient(160deg, var(--brand-900), var(--brand-700)); color: rgba(255,255,255,.9); }
.shade-1::before, .shade-2::before, .shade-3::before, .shade-4::before, .shade-5::before, .shade-6::before { filter: invert(1); opacity: .06; } /* the patterns are drawn white for dark grounds */
.shade-5 .section-sub, .shade-6 .section-sub { color: var(--brand-900); }
.shade-7 .section-title { color: #fff; }
.shade-7 .section-sub { color: rgba(255,255,255,.75); }
.shade-7 .section-link { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.6); --bs-btn-hover-bg: var(--gold); --bs-btn-hover-border-color: var(--gold); --bs-btn-hover-color: var(--gold-ink); }
.shade-7 .btn-primary { --bs-btn-bg: var(--gold); --bs-btn-border-color: var(--gold); --bs-btn-color: var(--gold-ink); --bs-btn-hover-bg: var(--gold-2); --bs-btn-hover-border-color: var(--gold-2); --bs-btn-hover-color: var(--gold-ink); }
.shade-7 .empty-state { color: rgba(255,255,255,.75); }
.shade-7 .card-soft, .shade-7 .donate-panel, .shade-7 .dua-card { color: var(--ink); } /* light cards keep dark text on the dark shade */
.section-heading { margin-bottom: 1.75rem; }
.section-title { font-size: clamp(1.5rem, 5vw, 2.25rem); margin: 0 0 .35rem; }
.section-sub { color: var(--muted); margin: 0; }
.gold-rule { width: 56px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); margin: .6rem 0 0; }
.section-heading.text-center .gold-rule { margin-inline: auto; }
.section-heading .section-link { margin-top: .75rem; }
.section-heading.on-dark .section-title { color: #fff; }
.section-heading.on-dark .section-sub { color: rgba(255,255,255,.75); }
.section-heading.on-dark .section-link { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.6); --bs-btn-hover-bg: var(--gold); --bs-btn-hover-border-color: var(--gold); --bs-btn-hover-color: var(--gold-ink); }

/* ---------- Cards ---------- */
.card-soft { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform .25s ease, box-shadow .25s ease; overflow: hidden; }
.card-soft::before { content: ''; position: absolute; inset-inline: 0; top: 0; height: 4px; background: linear-gradient(90deg, var(--accent, var(--brand-600)), var(--gold-2)); z-index: 1; }
.card-soft:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.news-card { display: flex; flex-direction: column; height: 100%; }
.news-card-img { aspect-ratio: 16 / 9; object-fit: contain; width: 100%; background: var(--brand-50); } /* the whole picture, centred */
.news-card-body { padding: 1.1rem 1.2rem 1.3rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.news-card .news-date { color: var(--brand-700); font-size: calc(.85rem * var(--fs-scale)); display: inline-flex; align-items: center; gap: .4rem; background: var(--brand-50); border-radius: 999px; padding: .15rem .7rem; align-self: flex-start; }
.news-card .news-title { font-size: calc(1.15rem * var(--fs-scale)); margin: 0; }
.news-card .news-title a { color: var(--brand-900); }
.news-card .news-summary { color: var(--muted); font-size: calc(.95rem * var(--fs-scale)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-card .news-more { margin-top: auto; }
.dept-card { padding: 1.25rem; display: flex; gap: 1rem; align-items: flex-start; height: 100%; background: linear-gradient(160deg, var(--surface) 55%, var(--accent-soft, var(--brand-50))); }
.dept-icon { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 16px; background: var(--accent, var(--brand-600)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.45rem; box-shadow: 0 8px 18px color-mix(in srgb, var(--accent, var(--brand-600)) 35%, transparent); }
.accent-2 .dept-icon { color: var(--gold-ink); }
.dept-link { display: inline-flex; align-items: center; gap: .3rem; margin-top: .5rem; color: var(--accent-ink, var(--brand-700)); font-weight: 700; font-size: calc(.9rem * var(--fs-scale)); }
.dept-card[data-nisab] { cursor: pointer; }
.dept-card:hover .dept-link { text-decoration: underline; }
.dept-card h3 { font-size: calc(1.15rem * var(--fs-scale)); margin: 0 0 .2rem; color: var(--accent-ink, var(--brand-900)); }
.dept-card .dept-meta { color: var(--muted); font-size: calc(1rem * var(--fs-scale)); font-weight: bold; }
.dua-card { background: linear-gradient(160deg, #fffdf5, var(--cream-2)); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 2px solid var(--gold-2); padding: 1.75rem 1.25rem; text-align: center; position: relative; overflow: hidden; }
.dua-card::before { content: ''; position: absolute; inset: 0; background-image: url('../img/pattern-dark.svg'); background-size: 120px 120px; opacity: .05; pointer-events: none; }
.dua-card > * { position: relative; }
.dua-arabic { font-family: var(--font-ar); font-size: 1.6rem; line-height: 2.1; color: var(--brand-900); direction: rtl; margin: 0 0 .75rem; }
.dua-translation { color: var(--ink); margin: 0 0 .5rem; }
.dua-ref { color: var(--gold-ink); font-size: calc(.9rem * var(--fs-scale)); font-weight: 600; }
.donate-panel { background: linear-gradient(160deg, var(--surface), var(--cream)); border: 2px solid var(--gold-2); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.donation-block { display: grid; gap: 1.25rem; }
.qr-frame { background: var(--surface); border: 3px solid var(--gold); border-radius: var(--radius); padding: .75rem; text-align: center; max-width: 340px; margin: 0 auto; box-shadow: var(--shadow-sm); }
.qr-frame img { width: 100%; max-width: 300px; border-radius: var(--radius-sm); }
.upi-id { display: inline-flex; align-items: center; gap: .5rem; background: var(--brand-50); border: 1px dashed var(--brand-500); border-radius: 999px; padding: .35rem .9rem; font-family: var(--font-en); font-size: calc(.9rem * var(--fs-scale)); direction: ltr; word-break: break-all; }
.bank-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--cream-2); }
.bank-table th, .bank-table td { padding: .7rem .9rem; border-bottom: 1px solid var(--cream-2); vertical-align: top; }
.bank-table th { color: var(--brand-900); width: 38%; background: var(--gold-3); font-weight: 600; }
html[lang="ur"] .bank-table th { font-weight: 400; }
.bank-table tr:last-child th, .bank-table tr:last-child td { border-bottom: 0; }
.bank-table td { font-family: var(--font-en); direction: ltr; text-align: start; }
.copy-btn { border: 0; background: var(--brand-50); color: var(--brand-700); border-radius: 999px; padding: 0 .55rem; font-size: calc(1rem * var(--fs-scale)); line-height: 1; margin-inline-start: .5rem; min-height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.copy-btn:hover { background: var(--brand-100); }
.video-card { display: block; color: inherit; }
.video-thumb { position: relative; aspect-ratio: 16 / 9; background: #0d1a15 center / cover no-repeat; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.play-btn { position: absolute; inset: 0; margin: auto; width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--brand-700); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; box-shadow: 0 8px 24px rgba(0,0,0,.3); transition: transform .25s ease, background .25s ease; padding-inline-start: 4px; }
.video-card:hover .play-btn, .lite-yt:hover .lite-yt-play { transform: scale(1.08); background: var(--gold); color: var(--gold-ink); }
.video-card .video-title { padding: .8rem 1rem 1rem; font-size: calc(.98rem * var(--fs-scale)); color: var(--brand-900); margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Lite YouTube embed: thumbnail until clicked */
.lite-yt { position: relative; aspect-ratio: 16 / 9; background: #000 center / cover no-repeat; cursor: pointer; overflow: hidden; }
.lite-yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lite-yt-play { position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--brand-700); border: 0; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; box-shadow: 0 8px 24px rgba(0,0,0,.35); transition: transform .25s ease, background .25s ease; padding-inline-start: 5px; }

/* ---------- Stats ---------- */
.stats-strip { position: relative; background: linear-gradient(90deg, var(--brand-700), var(--brand-600)); color: #fff; overflow: hidden; border-block: 3px solid var(--gold); }
.stats-strip::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern, url('../img/patterns/star.svg')); background-size: 120px 120px; opacity: .1; pointer-events: none; }
.stats-grid { position: relative; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 1.5rem; padding: 2rem 0; text-align: center; }
@media (min-width: 576px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
.stat-value { font-family: var(--font-en); font-size: 2rem; font-weight: 700; color: var(--gold-2); line-height: 1.1; }
html[lang="ur"] .stat-value { font-family: var(--font-ur); font-weight: 400; }
.stat-label { color: rgba(255,255,255,.88); font-size: calc(.92rem * var(--fs-scale)); }

/* Sister institutions */
.orgs-strip { position: relative; padding: 3rem 0; background: linear-gradient(160deg, var(--brand-900), var(--brand-700) 60%, color-mix(in srgb, var(--brand-700) 70%, var(--gold-ink))); color: #fff; overflow: hidden; }
.orgs-strip::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern, url('../img/patterns/star.svg')); background-size: 120px 120px; opacity: .1; pointer-events: none; }
.orgs-strip > .container { position: relative; }
.org-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius); padding: 1.25rem; height: 100%; display: flex; flex-direction: column; gap: 1rem; backdrop-filter: blur(6px); transition: transform .25s ease, background .25s ease; }
.org-card:hover { transform: translateY(-3px); background: rgba(255,255,255,.12); }
.org-head { display: flex; gap: .9rem; align-items: flex-start; }
.org-icon { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 16px; background: var(--gold); color: var(--gold-ink); display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.org-card h3 { color: #fff; font-size: calc(1.15rem * var(--fs-scale)); margin: 0 0 .2rem; }
.org-card .org-desc { color: rgba(255,255,255,.78); font-size: calc(.9rem * var(--fs-scale)); margin: 0; }
.org-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem .25rem; text-align: center; margin-top: auto; background: rgba(0,0,0,.18); border-radius: var(--radius-sm); padding: .75rem .25rem; } /* all four counters on one line; a long label wraps within its column */
.org-stats .stat-value { font-size: 1.45rem; }
.org-stats .stat-label { font-size: calc(.75rem * var(--fs-scale)); }

/* ---------- Gallery ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.gallery-tile { position: relative; display: block; border-radius: var(--radius-sm); overflow: hidden; background: var(--brand-50); aspect-ratio: 4 / 3; }
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.gallery-tile:hover img { transform: scale(1.05); }
.gallery-tile .tile-badge { position: absolute; inset-inline-end: .5rem; top: .5rem; background: rgba(0,0,0,.55); color: #fff; border-radius: 999px; padding: .15rem .55rem; font-size: calc(.75rem * var(--fs-scale)); font-family: var(--font-en); }
.gallery-tile .tile-play { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.92); color: var(--brand-700); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; padding-inline-start: 3px; }
.gallery-tile .tile-caption { position: absolute; inset-inline: 0; bottom: 0; background: linear-gradient(to top, rgba(0,0,0,.7), rgba(0,0,0,0)); color: #fff; padding: 1.25rem .6rem .5rem; font-size: calc(.85rem * var(--fs-scale)); }
.album-card { display: block; color: inherit; }
.album-cover { aspect-ratio: 4 / 3; background: var(--brand-50) center / cover no-repeat; position: relative; }
.album-cover .album-count { position: absolute; inset-inline-end: .6rem; bottom: .6rem; background: rgba(0,0,0,.55); color: #fff; border-radius: 999px; padding: .2rem .65rem; font-size: calc(.78rem * var(--fs-scale)); font-family: var(--font-en); display: inline-flex; gap: .5rem; z-index: 1; }
.album-card .album-body { padding: .9rem 1rem 1.1rem; }
.album-card .album-title { font-size: calc(1.05rem * var(--fs-scale)); margin: 0 0 .2rem; color: var(--brand-900); }
.album-card .album-meta { color: var(--muted); font-size: calc(.85rem * var(--fs-scale)); }
.year-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 88px; min-height: 48px; padding: .4rem 1.1rem; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--brand-600); color: var(--brand-700); font-family: var(--font-en); font-weight: 700; font-size: calc(1.05rem * var(--fs-scale)); }
.year-chip:hover, .year-chip.active { background: var(--brand-600); color: #fff; }
/* Album / event cards cycle through random photos: site.js appends each new frame with a random fx-* start state,
   then adds .is-in so it transitions into place; the directional effects also push the old frame out (.is-out). */
.slideshow { overflow: hidden; isolation: isolate; }
.slideshow .slides { position: absolute; inset: 0; overflow: hidden; }
.slideshow .slides img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1), clip-path .9s ease, filter .9s ease; }
.slideshow .fx-fade { opacity: 0; }
.slideshow .fx-zoom-in { opacity: 0; transform: scale(1.25); }
.slideshow .fx-zoom-out { opacity: 0; transform: scale(.8); }
.slideshow .fx-blur { opacity: 0; filter: blur(12px); }
.slideshow .fx-left { transform: translateX(100%); }
.slideshow .fx-right { transform: translateX(-100%); }
.slideshow .fx-up { transform: translateY(100%); }
.slideshow .fx-down { transform: translateY(-100%); }
.slideshow .fx-wipe { clip-path: inset(0 0 0 100%); }
.slideshow .fx-wipe-r { clip-path: inset(0 100% 0 0); }
.slideshow .is-in { opacity: 1; transform: none; }
.slideshow .fx-blur.is-in { filter: blur(0); }
.slideshow .fx-wipe.is-in, .slideshow .fx-wipe-r.is-in { clip-path: inset(0); }
.slideshow .is-out.fx-left { transform: translateX(-100%); }
.slideshow .is-out.fx-right { transform: translateX(100%); }
.slideshow .is-out.fx-up { transform: translateY(-100%); }
.slideshow .is-out.fx-down { transform: translateY(100%); }
.event-years { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.event-years span { background: var(--gold-3); color: var(--gold-ink); border-radius: 999px; padding: .05rem .55rem; font-size: calc(.78rem * var(--fs-scale)); font-family: var(--font-en); }

/* ---------- Page header (inner pages) ---------- */
.page-header { position: relative; background: linear-gradient(140deg, var(--brand-900), var(--brand-700)); color: #fff; padding: 1.75rem 0 2rem; overflow: hidden; border-bottom: 4px solid var(--gold); }
.page-header::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern, url('../img/patterns/star.svg')); background-size: 120px 120px; opacity: .1; pointer-events: none; }
.page-header::after { content: ''; position: absolute; width: 40vw; height: 40vw; max-width: 420px; max-height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(230,195,90,.3) 0%, rgba(230,195,90,0) 65%); inset-inline-end: -12vw; top: -18vw; pointer-events: none; }
.page-header .container { position: relative; }
.page-title { color: #fff; font-size: clamp(1.6rem, 6vw, 2.5rem); margin: .35rem 0 .25rem; }
.page-sub { color: rgba(255,255,255,.85); margin: 0; max-width: 46rem; }

/* ---------- Results / OTP ---------- */
.otp-card { max-width: 480px; margin: 0 auto; padding: 1.5rem 1.25rem; }
.otp-card .form-control { font-family: var(--font-en); direction: ltr; text-align: center; font-size: 1.35rem; letter-spacing: .1em; min-height: 56px; }
.otp-input { letter-spacing: .5em !important; font-size: 1.75rem !important; }
.otp-steps { display: flex; justify-content: center; gap: .5rem; margin-bottom: 1rem; }
.otp-steps span { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-50); color: var(--brand-900); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-en); font-weight: 700; font-size: calc(.85rem * var(--fs-scale)); }
.otp-steps span.active { background: var(--brand-600); color: #fff; }
.otp-steps span.done { background: var(--gold); color: var(--gold-ink); }
.otp-error { display: none; }
.otp-error.show { display: block; }
.result-card { padding: 1.1rem 1.2rem; }
.result-card .result-head, .result-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.result-pending { padding: .6rem .8rem; background: var(--brand-50); border-radius: var(--radius-sm); }
.result-kv { display: grid; grid-template-columns: 1fr; gap: .4rem .75rem; margin: 0; }
.result-kv dt { color: var(--muted); font-weight: 500; font-size: calc(.85rem * var(--fs-scale)); margin: 0; }
.result-kv dd { margin: 0 0 .35rem; }
.result-badge { display: inline-flex; align-items: center; gap: .35rem; border-radius: 999px; padding: .3rem .85rem; font-weight: 700; font-size: calc(.9rem * var(--fs-scale)); }
html[lang="ur"] .result-badge { font-weight: 400; }
.rb-pass { background: #dff5e6; color: #0b5d3b; }
.rb-fail { background: #fde3e3; color: #8a1c1c; }
.rb-pending { background: #eef0ef; color: #4a524e; }
.rb-notselected { background: #fff0d1; color: #7a4d00; }
.marks-table td.num, .marks-table th.num { font-family: var(--font-en); direction: ltr; text-align: end; white-space: nowrap; }
.table-centered th, .table-centered td, .table-centered th.num, .table-centered td.num { text-align: center; } /* the exam results tables: every cell centred, numbers included */
.exam-block { border: 1px solid var(--ink); border-radius: .75rem; margin: 3px; padding: 3px; } /* one exam (term) of a year; the shade-N class gives its tint */
.exam-years .accordion-body { padding: 0; } /* the year's exams sit edge to edge inside the accordion */
.exam-years .result-pending { margin: 3px; padding: 3px; } /* a term without results yet: as tight as the exam blocks */
.summary-table thead { vertical-align: middle; } /* a wrapped heading (the miqdar column) keeps the others centred, not bottom-aligned */
.summary-table tbody td::before { text-align: start; } /* stacked on phones: the labels line up at the start, the values at the end */

/* ---------- Responsive stacked tables (phones) ---------- */
.table-stack thead { display: none; }
.table-stack tbody tr { display: block; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .6rem; background: var(--surface); padding: .35rem 0; }
.table-stack tbody td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .4rem .85rem; }
.table-stack tbody td::before { content: attr(data-label); color: var(--muted); font-size: calc(.85rem * var(--fs-scale)); flex: 0 0 40%; }
.table-stack tbody td.num { text-align: end; }

/* ---------- Contact ---------- */
.contact-card { padding: 1.25rem; display: flex; gap: 1rem; align-items: flex-start; height: 100%; }
.contact-card .ci { width: 48px; height: 48px; border-radius: 14px; background: var(--accent, var(--brand-600)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex: 0 0 auto; }
.accent-2 .ci { color: var(--gold-ink); }
.contact-card h3 { font-size: calc(1.05rem * var(--fs-scale)); margin: 0 0 .25rem; }
.map-frame { border-radius: var(--radius); overflow: hidden; border: 3px solid var(--gold-2); box-shadow: var(--shadow-sm); }
.map-frame iframe { width: 100%; height: 320px; border: 0; display: block; }
.social-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.social-links a { width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; background: var(--brand-50); color: var(--brand-700); }
.social-links a:hover { background: var(--brand-600); color: #fff; }

/* ---------- Prose (rich text from admin) ---------- */
.prose { max-width: 48rem; overflow-wrap: break-word; } /* a word longer than the line (a long link) breaks instead of running off a phone screen */
.text-wrap-safe { overflow-wrap: break-word; }
.prose p { margin-bottom: 1rem; }
.prose img { border-radius: var(--radius-sm); }
.prose blockquote { border-inline-start: 4px solid var(--gold); background: var(--brand-50); padding: .75rem 1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.verse { font-family: var(--font-ar); font-size: 1.5rem; line-height: 2.2; color: var(--brand-900); text-align: center; direction: rtl; background: linear-gradient(160deg, #fffdf5, var(--cream-2)); border-radius: var(--radius); padding: 1.25rem 1rem; border: 2px solid var(--gold-2); }
.tarana { font-family: var(--font-ur); direction: rtl; text-align: center; font-size: calc(1.15rem * var(--fs-scale)); line-height: 2.2; color: var(--brand-900); white-space: pre-line; }

/* ---------- Academics ---------- */
.sticky-subnav { position: sticky; top: var(--nav-h); z-index: 1020; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.sticky-subnav .nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.sticky-subnav .nav::-webkit-scrollbar { display: none; }
.sticky-subnav .nav-link { white-space: nowrap; color: var(--brand-900); font-weight: 600; padding: .8rem .9rem; min-height: 48px; }
html[lang="ur"] .sticky-subnav .nav-link { font-weight: 400; }
.sticky-subnav .nav-link.active { color: var(--brand-700); box-shadow: inset 0 -3px 0 var(--gold); }
.accordion-nisab .accordion-item { border-inline-start: 5px solid var(--accent, var(--brand-600)); margin-bottom: .6rem; border-radius: var(--radius-sm) !important; overflow: hidden; box-shadow: var(--shadow-sm); }
.accordion-nisab .accordion-button { border-radius: 0; }
.accordion-nisab .acc-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent, var(--brand-600)); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.accordion-nisab .accent-2 .acc-icon, .accent-2 .acc-icon { color: var(--gold-ink); }
.accordion-nisab .accordion-body { background: var(--surface); }
.student-toggle .bi { transition: transform .2s ease; }
.student-toggle:not(.collapsed) .bi { transform: rotate(180deg); }
.overview p:last-child { margin-bottom: 0; }
.overview { margin-bottom: 1.25rem; }
.class-summary { display: grid; gap: .6rem; }
.class-line { background: var(--accent-soft, var(--brand-50)); border-radius: var(--radius-sm); padding: .75rem .9rem; border-inline-start: 3px solid var(--accent, var(--brand-600)); }
@keyframes target-flash { 0%, 35% { box-shadow: 0 0 0 4px var(--gold); } 100% { box-shadow: 0 0 0 0 transparent; } }
.is-target { animation: target-flash 2.4s ease-out; }
.class-line-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .25rem; color: var(--accent-ink, var(--brand-900)); }
.class-card { padding: 1rem 1.1rem; height: 100%; }
.class-card h4 { font-size: calc(1.05rem * var(--fs-scale)); margin: 0 0 .2rem; color: var(--brand-900); }
.class-card .class-meta { color: var(--muted); font-size: calc(.85rem * var(--fs-scale)); }
.teacher-card { padding: 1rem; display: flex; gap: .85rem; align-items: center; height: 100%; }
.teacher-card .avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent, var(--brand-600)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; font-family: var(--font-en); }
.accent-2 .avatar { color: var(--gold-ink); }
.teacher-card .t-name { margin: 0; font-size: calc(1rem * var(--fs-scale)); color: var(--brand-900); }
.teacher-card .t-desig { color: var(--muted); font-size: calc(.85rem * var(--fs-scale)); }
.supp-chip { border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; transition: background .2s, color .2s; }
.supp-chip:hover, .supp-chip[aria-expanded="true"] { background: var(--gold); color: var(--gold-ink); }
.supp-chip .bi-chevron-down { transition: transform .25s; }
.supp-chip[aria-expanded="true"] .bi-chevron-down { transform: rotate(180deg); }
.supp-panel .prose { max-width: none; }
.supp-panel .acc-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--gold); color: var(--gold-ink); display: inline-flex; align-items: center; justify-content: center; }
.term-pill { display: inline-block; background: var(--gold-3); color: var(--gold-ink); border-radius: 999px; padding: .1rem .7rem; font-size: calc(.8rem * var(--fs-scale)); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer { position: relative; background: linear-gradient(160deg, var(--brand-900), #08130e); color: rgba(255,255,255,.85); padding: 2.5rem 0 1.5rem; overflow: hidden; border-top: 4px solid var(--gold); }
.site-footer::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern, url('../img/patterns/star.svg')); background-size: 120px 120px; opacity: .07; pointer-events: none; }
.site-footer .container { position: relative; }
.footer-title { color: var(--gold-2); font-size: calc(1.05rem * var(--fs-scale)); margin-bottom: .75rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.footer-links a { color: rgba(255,255,255,.85); display: inline-flex; align-items: center; gap: .4rem; min-height: 32px; }
.footer-links a:hover { color: var(--gold-2); }
.site-footer .social-links a { background: rgba(255,255,255,.08); color: #fff; }
.site-footer .social-links a:hover { background: var(--gold); color: var(--gold-ink); }
.footer-brand img { height: 56px; }
.footer-brand .fb-name { color: #fff; font-size: calc(1.15rem * var(--fs-scale)); margin-top: .5rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 2rem; padding-top: 1rem; font-size: calc(.85rem * var(--fs-scale)); color: rgba(255,255,255,.7); display: flex; flex-direction: column; gap: .5rem; }
.footer-bottom a { color: rgba(255,255,255,.8); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state .bi { font-size: 2.5rem; color: var(--brand-500); display: block; margin-bottom: .5rem; }

/* ---------- Motion ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0s); }
.reveal-left { transform: translateX(-28px); }
.reveal-right { transform: translateX(28px); }
.reveal-scale { transform: scale(.94); }
.reveal.is-visible { opacity: 1; transform: none; }

/* Home-page sections slide in from a random side (class picked by site.js). The section box itself never moves,
   so the observers in site.js can watch it; its content starts a viewport width away and slides into place
   (inside a tile the content slides into the frame). */
.slide-section { --slide-x: 100vw; }
.slide-section > * { opacity: .1; transform: translateX(var(--slide-x)); transition: opacity .9s ease, transform 1.1s cubic-bezier(.16, 1, .3, 1); will-change: transform, opacity; }
.slide-section.from-left { --slide-x: -100vw; }
.slide-section.is-visible > * { opacity: 1; transform: none; }
.slide-section .reveal { opacity: 1; transform: none; transition: none; }
.hero-inner > * { animation: heroIn .8s cubic-bezier(.2, .7, .2, 1) both; }
.hero-inner > *:nth-child(2) { animation-delay: .15s; }
@keyframes heroIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.dropdown-menu.show { animation: fadeDown .2s ease; }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.toast-copy { position: fixed; bottom: calc(var(--bar-h) + 1rem); inset-inline-start: 50%; transform: translateX(-50%); background: var(--brand-900); color: #fff; border-radius: 999px; padding: .5rem 1rem; font-size: calc(.9rem * var(--fs-scale)); z-index: 1100; opacity: 0; transition: opacity .25s; pointer-events: none; }
[dir="rtl"] .toast-copy { transform: translateX(50%); }
.toast-copy.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .slide-section > * { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .reveal, .hero-inner > * { opacity: 1 !important; transform: none !important; animation: none !important; transition: none !important; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

body, html{
    max-width: 100%;
    overflow-x: hidden;
    margin: 0px;
    padding: 0px;
}



/* ---------- RTL touches ---------- */
[dir="rtl"] .bi-flip { transform: scaleX(-1); }
[dir="rtl"] .dropdown-menu { text-align: right; }
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before { float: right; padding-left: .5rem; padding-right: 0; }

/* =============================================================================
   Enhancements for larger screens
   ========================================================================== */
@media (min-width: 576px) {
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
  .result-kv { grid-template-columns: 1fr 1fr; }
  .admission-banner .inner { flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (min-width: 768px) {
  html[lang="ur"] body { font-size: calc(1.125rem * var(--fs-scale)); line-height: 2; }
  .section { padding: 4rem 0; }
  .orgs-strip { padding: 4rem 0; }
  .hero-inner { padding: 3rem 0 3.5rem; }
  .stats-grid { grid-template-columns: repeat(6, 1fr); padding: 2.5rem 0; }
  .stat-value { font-size: 2.5rem; }
  .org-stats .stat-value { font-size: 1.6rem; }
  .table-stack thead { display: table-header-group; }
  .table-stack tbody tr { display: table-row; border: 0; margin: 0; padding: 0; background: transparent; }
  .table-stack tbody td { display: table-cell; padding: .65rem .75rem; border-bottom: 1px solid var(--line); }
  .table-stack tbody td::before { content: none; }
  .donation-block { grid-template-columns: 340px 1fr; align-items: start; }
  .donate-panel { padding: 1.75rem; }
  .map-frame iframe { height: 380px; }
  .brand-logo { height: 48px; }
  .otp-card { padding: 2rem 2rem; }
  .footer-bottom { flex-direction: row; justify-content: space-between; align-items: center; }
}

@media (min-width: 992px) {
  body { padding-bottom: 0; }
  .bottom-bar { display: none; }
  .hero-inner { flex-direction: row; align-items: flex-start; gap: 3rem; padding: 4.5rem 0 5rem; } /* both columns start at the same top edge */
  .hero-media { margin-top: .5rem; } /* level with the photo strip at the top of the text column (.marquee has the same top margin) */
  .hero-copy { flex: 1 1 56%; }
  .hero-media { flex: 1 1 44%; }
  .hero-tagline { font-size: calc(1.1rem * var(--fs-scale)); }
  .gallery-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
  .section { padding: 4.5rem 0; }
  .toast-copy { bottom: 1.5rem; }
}

/* Home page tiles (large screens): HomeLayout places the slide sections on a six-column grid (span 2 = a third,
   3 = a half, 4 = two thirds, 6 = a band); each section carries its cell as --r/--rs/--c/--s and the edge it touches
   as data-side. Phones keep the stacked order. A tile is a size container, so the Bootstrap columns inside follow
   the tile's width instead of the viewport's. */
@media (min-width: 992px) {
  .home-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.5rem; max-width: 95%; margin: 2.5rem auto; padding-inline: .75rem; reading-flow: grid-rows; } /* the tile grid uses nearly the whole width in every layout */
  .home-tiles > .section { --tile-px: 1rem; grid-row: var(--r) / span var(--rs, 1); grid-column: var(--c) / span var(--s); container: tile / inline-size; padding: 2rem var(--tile-px) 2.25rem; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
  .home-tiles > [data-span="2"] { --tile-px: .5rem; }
  .home-tiles > .section > .container, .home-tiles > .section .tab-pane > .container { max-width: none; } /* keeps its padding, which absorbs the .row negative margins */
  .home-tiles > .section > .marquee, .home-tiles > .section .tab-pane > .marquee { margin-inline: calc(-1 * var(--tile-px)); } /* also the toppers band's views */
  .home-tiles.layout-rail > [data-span="2"] { display: flex; flex-direction: column; justify-content: center; }
}
@container tile (max-width: 559px) { .home-tiles [class*="col-lg-"] { width: 100%; } } /* thirds and halves: one card per row, about stacked, dua full width */
@container tile (min-width: 560px) and (max-width: 879px) { .home-tiles .row > .col-lg-4 { width: 50%; } } /* two thirds: news and department cards two per row */
@container tile (max-width: 679px) { .home-tiles .donation-block { grid-template-columns: 1fr; } } /* the QR code above the bank table */

@media (min-width: 1200px) {
  .container { max-width: 1200px; }
  /* Desktop menu row: brand, menu, tools and Donate fit on one line from here. */
  .nav-toggle { display: none; }
  .desktop-nav { display: flex; align-items: center; }
  .nav-cta { display: inline-flex; }
  .desktop-nav .nav-link { padding-inline: .6rem; } /* tight until there is room to spare */
  .nav-tools { gap: .3rem; }
  .site-nav .font-ctl .font-level { display: none; } /* outranks the base rule declared later in this file */
  .site-nav { padding-inline: .5rem; }
}

@media (min-width: 1320px) {
  .desktop-nav .nav-link { padding-inline: .9rem; }
  .nav-tools { gap: .35rem; }
  .site-nav .font-ctl .font-level { display: inline-flex; }
  .hero-title { font-size: 3.4rem; }
}

@media print {
  .bismillah-bar, .site-header, .bottom-bar, .site-footer, .hero-actions, .sticky-subnav { display: none !important; }
  body { padding: 0; background: #fff; }
}

/* Razvi calendar navigator: one tile per month, images served by the admin app */
.rcal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.rcal-tile { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); color: var(--brand-900); transition: transform .25s ease, box-shadow .25s ease; }
a.rcal-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--brand-900); }
.rcal-tile img, .rcal-empty { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; background: var(--brand-50); }
.rcal-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 2.2rem; }
.rcal-tile.is-empty { opacity: .7; }
.rcal-cap { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .75rem; font-weight: 600; border-top: 3px solid var(--gold); }
html[lang="ur"] .rcal-cap { font-weight: 400; }
@media (min-width: 576px) { .rcal-grid { grid-template-columns: repeat(3, 1fr); gap: 1rem; } }
@media (min-width: 992px) { .rcal-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .rcal-grid { grid-template-columns: repeat(6, 1fr); } }

/* Text size (A- / A+), stored in the site_font cookie */
html { --fs-scale-root: 1; --fs-scale: var(--fs-scale-root); }
html[data-font="xs"] { --fs-scale-root: .75; }
html[data-font="s"] { --fs-scale-root: .875; }
html[data-font="l"] { --fs-scale-root: 1.125; }
html[data-font="xl"] { --fs-scale-root: 1.25; }
html[data-font="xxl"] { --fs-scale-root: 1.4; }
html[data-font="xxxl"] { --fs-scale-root: 1.55; }
/* The header and the bottom bar follow the control too, capped so their layout holds. */
/* The header and the bottom bar are navigation: they keep their size at every text-size step, so the desktop bar stays one row. */
.site-header, .bottom-bar { --fs-scale: 1; }
.desktop-nav .nav-link { white-space: nowrap; }
/* Only text smaller than 1.2rem follows the A- / A+ control: body copy, captions, labels, buttons.
   Headings, hero, titles and Arabic verses keep their size; header, menus and forms stay fixed. */
.btn { font-size: calc(var(--bs-btn-font-size) * var(--fs-scale)); }
.btn-lg { font-size: var(--bs-btn-font-size); }
.accordion-button { font-size: calc(1rem * var(--fs-scale)); }
h6, .fs-6 { font-size: calc(1rem * var(--fs-scale)) !important; }
.lead, .fs-5 { font-size: calc(1.25rem * var(--fs-scale)) !important; }
.dropdown-menu { --bs-dropdown-font-size: calc(1rem * var(--fs-scale)); }
.pagination { --bs-pagination-font-size: calc(1rem * var(--fs-scale)); }
.toast { --bs-toast-font-size: calc(.875rem * var(--fs-scale)); }
.tooltip { --bs-tooltip-font-size: calc(.875rem * var(--fs-scale)); }
.site-header, .bottom-bar { font-size: calc(1rem * var(--fs-scale)); }
html[lang="ur"] .site-header { font-size: calc(1.05rem * var(--fs-scale)); }
/* Navigation links keep their size at every text-size step. */
.desktop-nav .nav-link, .sticky-subnav .nav-link, .mobile-menu { font-size: 1rem; }
html[lang="ur"] .desktop-nav .nav-link, html[lang="ur"] .sticky-subnav .nav-link, html[lang="ur"] .mobile-menu { font-size: 1.05rem; }
.desktop-nav .dropdown-menu { --bs-dropdown-font-size: 1rem; }
.font-ctl { font-size: 1rem; }
.font-ctl { display: inline-flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.font-ctl button { background: transparent; border: 0; min-width: 42px; min-height: 40px; padding: 0 .6rem; font-family: var(--font-en); font-weight: 700; color: var(--brand-900); display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; }
.font-ctl > * + * { border-inline-start: 1.5px solid var(--line); }
.font-ctl button[data-font-step="1"] { font-size: 1.05rem; }
.font-ctl .font-level { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; padding: 0 .4rem; font-family: var(--font-en); font-size: .72rem; color: var(--muted); }
.font-ctl button:hover { background: var(--brand-50); }
.font-ctl button:disabled { opacity: .35; }

/* Photo viewer: auto-scrolling strip of gallery photos (two copies of the strip make the loop seamless) */
.marquee { position: relative; overflow: hidden; margin-top: .5rem; -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.marquee-track { display: flex; width: max-content; animation: marquee 50s linear infinite; }
[dir="rtl"] .marquee-track { animation-name: marquee-rtl; }
.marquee:hover .marquee-track, .marquee:focus-within .marquee-track { animation-play-state: paused; }
.marquee-group { display: flex; gap: .75rem; padding-inline-end: .75rem; }
.marquee-item { display: block; flex: 0 0 auto; width: 220px; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); background: var(--brand-50); }
.marquee-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.marquee-item:hover img { transform: scale(1.05); }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes marquee-rtl { to { transform: translateX(50%); } }
@media (min-width: 768px) { .marquee-item { width: 300px; } .marquee-track { animation-duration: 70s; } }
.marquee-top { width: 100%; max-width: 620px; } /* the hero photo strip: the whole column on phones, capped beside the intro video on wide screens */
/* News strip (home page): whole news cards scroll past as a marquee, one loop taking --marquee-duration; a single item sits centred */
.news-slide { max-width: 40rem; margin-inline: auto; }
.news-marquee .marquee-track { animation-duration: var(--marquee-duration, 60s); }
.news-marquee .marquee-group { align-items: stretch; gap: 1rem; padding-inline-end: 1rem; }
.news-marquee .marquee-item { display: flex; width: min(320px, 82vw); aspect-ratio: auto; border-radius: 0; overflow: visible; box-shadow: none; background: none; }
.news-marquee .marquee-item .news-card { width: 100%; }
.news-marquee .marquee-item img { height: auto; object-fit: contain; } /* the whole picture across the card's width, as on the news page (not the photo strip's crop) */
.news-marquee .marquee-item:hover img { transform: none; }
/* Toppers band (home page): rank 1 of every section in the latest published exam, on its own cream-to-gold ground; the cards scroll past like the news strip */
.section-toppers { position: relative; background: linear-gradient(160deg, var(--cream), var(--gold-3)); }
.section-toppers::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern, url('../img/patterns/star.svg')); background-size: 120px 120px; filter: invert(1); opacity: .06; pointer-events: none; }
.section-toppers > * { position: relative; }
.toppers-marquee .marquee-track { animation-duration: var(--marquee-duration, 90s); }
.toppers-marquee .marquee-group { align-items: stretch; gap: 1rem; padding-inline-end: 1rem; padding-block: .5rem; }
.toppers-marquee .marquee-item { display: flex; width: 210px; aspect-ratio: auto; border-radius: 0; overflow: visible; box-shadow: none; background: none; }
.toppers-marquee:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
/* The view chips (Bootstrap pills: overall, department-, class-, section-wise) and each view's one-line note */
.topper-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.75rem 0 1rem; }
.topper-tab { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .35rem 1.05rem; border-radius: 999px; border: 1.5px solid var(--brand-600); background: var(--surface); color: var(--brand-700); font-weight: 700; font-size: calc(.95rem * var(--fs-scale)); cursor: pointer; transition: background .2s, color .2s; }
.topper-tab:hover, .topper-tab.active { background: var(--brand-600); color: #fff; }
.topper-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
html[lang="ur"] .topper-tab { font-weight: 400; font-size: calc(1.05rem * var(--fs-scale)); }
.topper-note { margin: 0 0 .75rem; color: var(--muted); font-size: calc(.9rem * var(--fs-scale)); }
html[lang="ur"] .topper-note { font-size: calc(1rem * var(--fs-scale)); }
/* A view that stands still (one topper beside its department's tile, or the overall podium): centred, sliding sideways when wider than the screen */
.topper-row { display: flex; gap: 1rem; overflow-x: auto; padding: .5rem .25rem 1rem; scroll-snap-type: x proximity; }
.topper-row > :first-child { margin-inline-start: auto; }
.topper-row > :last-child { margin-inline-end: auto; }
.topper-row-item { flex: 0 0 auto; display: flex; width: 210px; scroll-snap-align: center; }
.topper-row-item.topper-dept-item { width: 132px; }
/* The overall position on the photo: gold, silver and bronze; the first place also ringed in gold */
.topper-medal { position: absolute; top: .5rem; inset-inline-start: .5rem; z-index: 1; display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .7rem; border-radius: 999px; font-weight: 700; font-size: calc(.95rem * var(--fs-scale)); box-shadow: var(--shadow-sm); }
html[lang="ur"] .topper-medal { font-weight: 400; }
.medal-1 { background: linear-gradient(135deg, #fbe39a, #c9a227); color: #4a3600; }
.medal-2 { background: linear-gradient(135deg, #f4f6f8, #a9b3bd); color: #27313b; }
.medal-3 { background: linear-gradient(135deg, #f3c9a4, #b4733f); color: #3d220d; }
.topper-podium .topper-card:has(.medal-1) { box-shadow: 0 0 0 3px var(--gold-2), var(--shadow); }
/* The overall podium scrolls like the other views on phones; from tablets up it stands still, centred, each card once (sliding sideways when ties make it wider than the screen) */
@media (min-width: 768px) {
  .marquee.topper-podium { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .marquee.topper-podium .marquee-track { width: auto; animation: none; }
  .marquee.topper-podium .marquee-group { margin-inline: auto; padding-inline-end: 0; }
  .marquee.topper-podium .marquee-group[aria-hidden="true"], .marquee.topper-podium .marquee-item[aria-hidden="true"] { display: none; }
}
.topper-card { width: 100%; display: flex; flex-direction: column; text-align: center; overflow: hidden; }
.topper-card::before { height: 5px; background: var(--accent, var(--brand-600)); } /* the department's colour, solid */
.topper-photo { position: relative; aspect-ratio: 3 / 4; background: var(--accent-soft, var(--brand-50)); overflow: hidden; }
.topper-photo img { position: absolute; inset: 0; width: auto; height: 80px; margin: auto; object-fit: cover; }
.topper-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--accent, var(--brand-600)); opacity: .45; font-size: 4.5rem; }
.topper-pct { position: absolute; bottom: .5rem; left: 0; right: 0; margin-inline: auto; width: fit-content; display: inline-flex; align-items: center; gap: .3rem; background: var(--gold); color: var(--gold-ink); border-radius: 999px; padding: .1rem .75rem; font-weight: 700; font-size: calc(1.05rem * var(--fs-scale)); box-shadow: var(--shadow-sm); }
html[lang="ur"] .topper-pct { font-weight: 400; }
.topper-body { padding: .75rem .75rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .25rem; flex: 1; }
.topper-name { font-size: calc(1.05rem * var(--fs-scale)); margin: 0; color: var(--brand-900); overflow-wrap: anywhere; }
.topper-father, .topper-place { margin: 0; color: var(--muted); font-size: calc(.88rem * var(--fs-scale)); line-height: 1.5; }
.topper-section { margin-top: auto; background: var(--accent-soft, var(--brand-100)); color: var(--accent-ink, var(--brand-900)); }
/* A department's tile leads its toppers, notched towards them; it and their cards (top bar, photo ground, section badge) take the colour of its card in the departments section */
.toppers-marquee .topper-dept-item { width: 132px; margin-inline-start: .75rem; }
.topper-dept { --dept-from: var(--accent, var(--brand-600)); --dept-to: color-mix(in srgb, var(--dept-from) 62%, #000); position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; padding: 1.25rem .6rem; text-align: center; color: #fff; border-radius: var(--radius); background: linear-gradient(165deg, var(--dept-from), var(--dept-to)); box-shadow: var(--shadow-sm); }
.topper-dept.accent-2 { --dept-from: var(--gold-2); --dept-to: var(--gold); color: var(--gold-ink); }
.topper-dept::after { content: ''; position: absolute; z-index: -1; top: 50%; inset-inline-end: -.45rem; width: .9rem; height: .9rem; border-radius: 2px; background: color-mix(in srgb, var(--dept-from), var(--dept-to)); transform: translateY(-50%) rotate(45deg); }
.topper-dept-icon { width: 3.25rem; height: 3.25rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 2px var(--gold-2); }
.topper-dept.accent-2 .topper-dept-icon { background: rgba(255, 255, 255, .35); box-shadow: inset 0 0 0 2px var(--gold-ink); }
.topper-dept-caption { font-size: calc(.8rem * var(--fs-scale)); opacity: .85; }
html[lang="en"] .topper-dept-caption { text-transform: uppercase; letter-spacing: .08em; }
html[lang="ur"] .topper-dept-caption { font-size: calc(1.05rem * var(--fs-scale)); }
.topper-dept-name { font-size: 1.35rem; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
html[lang="ur"] .topper-dept-name { font-size: 1.6rem; font-weight: 400; }
@media (min-width: 768px) {
  .toppers-marquee .marquee-item, .topper-row-item { width: 230px; }
  .toppers-marquee .topper-dept-item, .topper-row-item.topper-dept-item { width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  .marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .marquee .marquee-track { animation: none; } /* as specific as the right-to-left name and the strips' own durations, and later */
  .marquee-group[aria-hidden="true"] { display: none; }
  .marquee .marquee-item[aria-hidden="true"] { display: none; } /* the repeats that fill a short news or toppers strip */
}

/* Latest videos: one thumbnail at a time, sliding automatically */
.video-carousel { max-width: 720px; margin: 0 auto; padding-bottom: 2.5rem; }
.video-carousel .video-card { max-width: 640px; margin: 0 auto; }
.video-carousel .carousel-control-prev, .video-carousel .carousel-control-next { width: 3rem; opacity: .9; }
.video-carousel .carousel-indicators { margin-bottom: 0; }
.video-carousel .carousel-indicators [data-bs-target] { width: 10px; height: 10px; border-radius: 50%; }

/* News detail image: natural size, capped height, never stretched */
.news-figure { margin: 0 0 1.5rem; background: var(--brand-50); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.news-figure img { display: block; width: auto; max-width: 100%; max-height: min(70vh, 520px); margin: 0 auto; object-fit: contain; }

/* Today's dates + visitor counter, above the statistics on the home page */
.today-bar { background: var(--cream); border-top: 1px solid var(--cream-2); color: var(--brand-900); font-size: calc(.95rem * var(--fs-scale)); }
.today-bar > .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .35rem 1.5rem; padding-block: .6rem; }
.today-bar .bi { color: var(--brand-600); margin-inline-end: .2rem; }
.today-bar .today-visitors { color: var(--muted); }

/* Picture documents (e.g. the Mamoolaat poster) */
.doc-figure { margin: 0 auto 1.5rem; max-width: 900px; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.doc-figure img { display: block; width: 100%; height: auto; }
