/* International League of Islamic Literature (Pakistan)
   Minimal academic, Islamic-inspired design system */

:root {
  /* Light-blue theme */
  --color-primary: #0b3a6a; /* deep academic blue */
  --color-secondary: #5eb1ff; /* clean light blue */
  --color-accent: #7fc7ff; /* soft sky accent */
  --color-bg: #f2f7ff; /* soft bluish background */
  --color-surface: #ffffff;
  --color-text: #2b2b2b;
  --color-muted: #5b5b5b;
  --color-border: rgba(11, 58, 106, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.10);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --container: 1100px;
  --gutter: clamp(14px, 4vw, 24px);

  --font-sans: "Source Sans 3", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --font-serif: "Crimson Pro", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;

  --step--1: clamp(0.95rem, 0.92rem + 0.18vw, 1.05rem);
  --step-0: clamp(1.05rem, 1.00rem + 0.30vw, 1.2rem);
  --step-1: clamp(1.25rem, 1.10rem + 0.70vw, 1.55rem);
  --step-2: clamp(1.55rem, 1.25rem + 1.30vw, 2.05rem);
  --step-3: clamp(1.95rem, 1.45rem + 2.10vw, 2.7rem);
  --step-4: clamp(2.4rem, 1.65rem + 3.00vw, 3.4rem);

  --line: 1.65;

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html:focus-within {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--line);
  color: var(--color-text);
  /* Sky-blue gradient background (fixed single frame) */
  background-image: linear-gradient(180deg, #3e5a76 0%, #2bb8ff 48%, #8fe8ff 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
}

@media (max-width: 860px) {
  /* Mobile browsers can render fixed backgrounds poorly */
  body {
    background-attachment: scroll;
  }
}

/* Global background watermark (map + grid + logo) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("../img/world-map.svg"), url("../img/patterns/grid.svg"), url("../img/logo.jpg");
  background-repeat: no-repeat;
  background-size: min(1180px, 92%), 320px 320px, min(720px, 70vw) auto;
  background-position: 90% 18%, center, 50% 40%;
  opacity: 0.05;
  pointer-events: none;
  z-index: 1;
}

/* Background texture (full screen) */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("../img/a.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  opacity: 0.14;
  pointer-events: none;
  z-index: 0;
}

/* (Removed) Floating flags background layer — replaced by the top flags carousel */

/* Flags carousel (above navbar) */
.flag-carousel {
  width: 100%;
  background: linear-gradient(180deg, rgba(242, 247, 255, 0.92), rgba(242, 247, 255, 0.72));
  border-bottom: 1px solid rgba(11, 58, 106, 0.08);
  overflow: hidden;
  direction: ltr;
}

.flag-carousel-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 4px var(--gutter);
  position: relative;
  /* True edge fade: items disappear as they reach edges */
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 10%, #000 90%, transparent 100%);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.flag-track {
  display: flex;
  align-items: center;
  gap: 18px;
  width: max-content;
  will-change: transform;
  padding: 2px 56px; /* room for edge fades */
}

.flag-carousel:hover .flag-track {
  /* handled by JS marquee (paused on hover) */
  opacity: 1;
}

.flag-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 18px;
  border-radius: 8px;
  border: 1px solid rgba(11, 58, 106, 0.10);
  background: rgba(255, 255, 255, 0.55);
  opacity: 0.75;
}

.flag-item img {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  display: block;
}

.flag-item.is-highlight {
  width: 36px;
  height: 23px;
  opacity: 1;
  border-color: rgba(42, 124, 199, 0.55);
  box-shadow: 0 12px 30px rgba(42, 124, 199, 0.22);
  background: rgba(127, 199, 255, 0.22);
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .flag-track {
    transform: none !important;
  }
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 3;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--color-secondary);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 10px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transform: translateY(-140%);
  transition: transform 160ms ease;
  z-index: 9999;
}

.skip-link:focus {
  transform: translateY(0);
  outline: 3px solid rgba(127, 199, 255, 0.55);
  outline-offset: 2px;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.surface {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.section {
  padding: clamp(26px, 4vw, 54px) 0;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 860px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: rgba(242, 247, 255, 0.75);
  color: var(--color-primary);
  font-size: var(--step--1);
}

.rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(127, 199, 255, 0.85), transparent);
  border: 0;
  margin: 18px 0;
}

.kicker {
  margin: 0 0 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--color-secondary);
  font-weight: 600;
  font-size: var(--step--1);
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  color: var(--color-primary);
  line-height: 1.2;
}

h1 {
  font-size: var(--step-4);
  margin: 0 0 12px;
}

h2 {
  font-size: var(--step-2);
  margin: 0 0 10px;
}

h3 {
  font-size: var(--step-1);
  margin: 0 0 8px;
}

p {
  margin: 0 0 12px;
}

.muted {
  color: var(--color-muted);
}

/* (Removed) Bismillah block */

/* Header / Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(242, 247, 255, 0.78);
  border-bottom: 1px solid rgba(11, 58, 106, 0.12);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 9px 0;
  gap: 14px;
  min-height: 52px;
  /* Always keep header columns in physical LTR order (logo left, actions right)
     regardless of page language direction. */
  direction: ltr;
}

.site-nav {
  min-width: 0;
  overflow: visible;
}

/* Keep desktop nav on one line; never wrap into a second row */
@media (min-width: 1321px) {
  .site-nav {
    min-height: 40px;
    overflow: visible;
  }

  .site-nav > ul {
    flex-wrap: nowrap;
    overflow: visible;
  }
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-inline-start: auto;
}

/* (Nav no longer scrolls horizontally; keep it clean without scrollbars.) */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
}

.brand-logo img {
  width: 34px;
  height: 34px;
}

.brand-title {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  line-height: 1;
}

.brand-title strong {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}

.brand-title span {
  color: var(--color-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav-toggle {
  display: none;
  appearance: none;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 650;
}

.site-nav > ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px 8px;
  padding: 0;
  margin: 0;
  justify-content: center;
  flex-wrap: nowrap;
}

/* ─── Shared token for every nav item ─── */
.site-nav a,
.site-nav ul button {
  --_nav-fs: clamp(0.82rem, 0.78rem + 0.18vw, 0.92rem);
  --_nav-fw: 600;
  --_nav-px: 9px;
  --_nav-py: 5px;
  --_nav-r: 9px;

  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: var(--_nav-py) var(--_nav-px);
  border-radius: var(--_nav-r);
  border: 0;
  background: transparent;
  text-decoration: none;
  color: var(--color-primary);
  font-family: inherit;
  font-size: var(--_nav-fs);
  font-weight: var(--_nav-fw);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.site-nav a:hover,
.site-nav ul button:hover {
  background: rgba(127, 199, 255, 0.18);
}

.site-nav a[aria-current="page"],
.nav-dropdown-toggle.is-current {
  background: rgba(11, 58, 106, 0.06);
  box-shadow: inset 0 0 0 1px rgba(11, 58, 106, 0.18);
}

.nav-dropdown {
  position: relative;
  direction: ltr;
}

.nav-caret {
  font-size: 0.82em;
  opacity: 0.75;
  line-height: 1;
}

.nav-dropdown-menu {
  list-style: none;
  margin: 6px 0 0;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(11, 58, 106, 0.16);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-md);
  display: none;
  flex-direction: column;
  gap: 2px;
}

.nav-dropdown-menu a {
  width: 100%;
  justify-content: flex-start;
  padding: 10px 10px;
  border-radius: 12px;
}

.nav-dropdown[data-open="true"] .nav-dropdown-menu {
  display: block;
}

@media (min-width: 1321px) {
  .nav-dropdown {
    position: relative;
  }

  .nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    min-width: 220px;
    z-index: 200;
  }
}

/* Mobile / tablet: collapse to Menu */
@media (max-width: 1320px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }

  .header-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "nav nav";
    align-items: center;
  }

  .brand {
    grid-area: brand;
  }

  .header-actions {
    grid-area: actions;
    margin-inline-start: 0;
  }

  .site-nav {
    grid-area: nav;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 100;
    background: rgba(242, 247, 255, 0.97);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(11, 58, 106, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease;
  }

  .site-nav[data-open="true"] {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .site-nav > ul {
    flex-direction: column;
    align-items: stretch;
    padding: 10px var(--gutter) 16px;
    gap: 4px;
    overflow: visible;
  }

  .site-nav a {
    padding: 11px 10px;
  }

  .site-nav button {
    padding: 11px 10px;
    width: 100%;
    justify-content: space-between;
  }

  .nav-dropdown-menu {
    box-shadow: none;
    background: transparent;
    border: 0;
    padding: 0 0 0 12px;
    margin: 0;
  }

  .nav-dropdown-menu a {
    border: 1px solid rgba(11, 58, 106, 0.10);
    background: rgba(242, 247, 255, 0.70);
  }
}

/* (moved to max-width: 1200px) */

/* Page header */
.page-head {
  padding: clamp(20px, 3vw, 34px) 0 0;
}

.page-hero {
  padding: clamp(18px, 3vw, 28px);
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.06;
  background-image: url("../img/patterns/geometry.svg");
  background-size: 420px auto;
  background-repeat: repeat;
  pointer-events: none;
}

.page-hero > * {
  position: relative;
}

.hero-split {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
  align-items: center;
}

@media (max-width: 860px) {
  .hero-split {
    grid-template-columns: 1fr;
  }
}

.hero-media {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(11, 58, 106, 0.14);
  background: linear-gradient(180deg, rgba(127, 199, 255, 0.24), rgba(11, 58, 106, 0.06));
}

.hero-media img {
  display: block;
  width: 100%;
  height: 240px;
  object-fit: cover;
}

.hero-note {
  padding: 10px 12px;
  font-size: 0.92rem;
  color: var(--color-muted);
}

.home-hero {
  position: relative;
}

/* (Removed) Home hero flag chips — replaced by the top flags carousel */

.callout {
  border-left: 3px solid rgba(42, 124, 199, 0.45);
  padding-left: 12px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 860px) {
  .stat-row {
    grid-template-columns: 1fr;
  }
}

.stat {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(11, 58, 106, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  color: var(--color-primary);
  line-height: 1.05;
}

.stat span {
  font-size: 0.92rem;
  color: var(--color-muted);
}

.preview {
  display: grid;
  gap: 10px;
}

.preview-thumb {
  width: 100%;
  height: 140px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(11, 58, 106, 0.12);
  background: rgba(255, 255, 255, 0.75);
}

.preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.big-date {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(11, 58, 106, 0.12);
  background: rgba(242, 247, 255, 0.90);
}

.big-date strong {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--color-primary);
}

.big-date span {
  font-size: 0.92rem;
  color: var(--color-muted);
}

.quote {
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(11, 58, 106, 0.12);
  background: rgba(255, 255, 255, 0.78);
}

.quote blockquote {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--color-primary);
  line-height: 1.35;
}

.quote cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  color: var(--color-muted);
  font-size: 0.95rem;
}

/* (Removed) Newsletter */

.lead {
  font-size: var(--step-1);
  color: var(--color-muted);
  max-width: 70ch;
}

/* Page tabs (local navigation) */
.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(11, 58, 106, 0.16);
  background: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 650;
}

.tab-link[aria-current="page"] {
  background: rgba(127, 199, 255, 0.16);
  border-color: rgba(11, 58, 106, 0.18);
}

/* Cards / lists */
.card {
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.card h3 {
  margin-top: 0;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--color-muted);
  font-size: var(--step--1);
  margin-top: 8px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(11, 58, 106, 0.18);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--step--1);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

.btn:focus-visible,
.site-nav a:focus-visible,
.nav-toggle:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(127, 199, 255, 0.65);
  outline-offset: 3px;
}

.btn-primary {
  background: linear-gradient(180deg, rgba(127, 199, 255, 0.22), rgba(11, 58, 106, 0.10));
  color: var(--color-primary);
}

.btn-secondary {
  background: rgba(242, 247, 255, 0.85);
  color: var(--color-primary);
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(127, 199, 255, 0.18);
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1000px) {
  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.gallery-item {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.gallery-item img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.gallery-item figcaption {
  padding: 10px 12px;
  font-size: var(--step--1);
  color: var(--color-muted);
}

/* Events page — slightly larger thumbnails for seminar archive */
.event-archive .gallery-item img {
  height: 200px;
}

@media (max-width: 720px) {
  .event-archive .gallery-item img {
    height: 160px;
  }
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table.clean-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(11, 58, 106, 0.14);
  border-radius: 14px;
  overflow: hidden;
}

table.clean-table th,
table.clean-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(11, 58, 106, 0.10);
  text-align: left;
  vertical-align: top;
}

table.clean-table th {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  color: var(--color-secondary);
  background: rgba(242, 247, 255, 0.92);
}

table.clean-table td {
  font-size: 0.98rem;
}

table.clean-table tbody tr:nth-child(even) td {
  background: rgba(242, 247, 255, 0.55);
}

table.clean-table tbody tr:hover td {
  background: rgba(127, 199, 255, 0.22);
}

table.clean-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Forms */
.form {
  display: grid;
  gap: 12px;
}

label {
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(11, 58, 106, 0.22);
  background: rgba(255, 255, 255, 0.92);
  font: inherit;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.field-note {
  font-size: var(--step--1);
  color: var(--color-muted);
}

.error {
  color: #8b1a1a;
  font-size: var(--step--1);
}

/* Footer */
.site-footer {
  padding: 20px 0;
  background: rgba(242, 247, 255, 0.92);
  position: relative;
}

.site-footer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: min(var(--container), calc(100% - (var(--gutter) * 2)));
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(11, 58, 106, 0.20), transparent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.footer-title {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.15;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.footer-links a {
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1.35;
  font-weight: 600;
}

.tiny {
  font-size: 0.92rem;
  color: var(--color-muted);
}

.footer-copy {
  text-align: center;
  margin: 12px auto 0;
}

/* Small animation utility */
.fade-up {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

.lang-switch {
  position: relative;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  direction: ltr;
}

.lang-menu-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(11, 58, 106, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--color-primary);
  cursor: pointer;
  font-family: inherit;
  transition: background 140ms ease, border-color 140ms ease;
}

.lang-menu-toggle:hover {
  background: rgba(127, 199, 255, 0.22);
  border-color: rgba(11, 58, 106, 0.28);
}

.lang-menu-toggle:focus-visible {
  outline: 3px solid rgba(127, 199, 255, 0.55);
  outline-offset: 2px;
}

[data-lang-dropdown][data-open] .lang-menu-toggle {
  background: rgba(11, 58, 106, 0.1);
  border-color: rgba(11, 58, 106, 0.32);
}

.lang-menu-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--color-primary);
}

.lang-menu-panel {
  list-style: none;
  margin: 0;
  padding: 6px;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  min-width: 11.5rem;
  border-radius: 14px;
  border: 1px solid rgba(11, 58, 106, 0.16);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-md);
  z-index: 200;
}

.lang-menu-panel[hidden] {
  display: none;
}

.lang-menu-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--color-primary);
  font: inherit;
  font-weight: 600;
  font-size: var(--step--1);
  text-align: start;
  cursor: pointer;
  transition: background 140ms ease;
}

.lang-menu-item:hover {
  background: rgba(127, 199, 255, 0.2);
}

.lang-menu-item.is-active {
  background: rgba(11, 58, 106, 0.08);
  box-shadow: inset 0 0 0 1px rgba(11, 58, 106, 0.14);
}

/* ─── Mobile / Small-screen responsive ─────────────────────────────── */

/* Tablet: stat row 2-col instead of cramped 3-col */
@media (max-width: 700px) {
  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Phones (≤ 600px) */
@media (max-width: 600px) {
  /* Tighten section spacing */
  .section {
    padding: 18px 0;
  }

  /* Header: shrink brand text on very small screens */
  .brand-title span {
    display: none;
  }

  /* Nav toggle label */
  .nav-toggle {
    font-size: 0.88rem;
    padding: 7px 10px;
  }

  /* Hero: reduce padding, hide image on tiny screens to save space */
  .page-hero {
    padding: 16px;
  }

  .hero-split {
    gap: 14px;
  }

  .hero-media {
    display: none;
  }

  /* Stats: single column */
  .stat-row {
    grid-template-columns: 1fr;
  }

  /* Buttons: full width on small phones */
  .btn-row {
    flex-direction: column;
    gap: 8px;
  }

  .btn {
    width: 100%;
    justify-content: center;
    padding: 13px 12px;
  }

  /* Cards: reduce padding */
  .card {
    padding: 14px;
  }

  /* Gallery: single column */
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Tables: let them scroll */
  .table-wrap {
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter);
  }

  /* Footer stacks naturally via existing rule; reduce padding */
  .site-footer {
    padding: 14px 0;
  }

  /* Forms: tighter inputs */
  input,
  textarea,
  select {
    padding: 10px 10px;
  }

  /* Page tabs: wrap tightly */
  .page-tabs {
    gap: 6px;
  }

  .tab-link {
    font-size: 0.88rem;
    padding: 5px 9px;
  }
}

/* Very small phones (≤ 400px) */
@media (max-width: 400px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 12px;
  }

  .page-hero {
    padding: 12px;
  }

  /* Hide brand "Pakistan" sub-label */
  .brand-title {
    gap: 4px;
  }
}

/* ─────────────────────────────────────────────────────────────────── */

/* Urdu & Arabic: smaller fluid type scale + calmer line-height (Nastaliq/Arabic run tall) */
html[lang="ur"],
html[lang="ar"] {
  --step--1: clamp(0.84rem, 0.8rem + 0.12vw, 0.94rem);
  --step-0: clamp(0.9rem, 0.85rem + 0.18vw, 1.02rem);
  --step-1: clamp(0.98rem, 0.9rem + 0.28vw, 1.16rem);
  --step-2: clamp(1.1rem, 0.96rem + 0.48vw, 1.38rem);
  --step-3: clamp(1.22rem, 1rem + 0.72vw, 1.58rem);
  --step-4: clamp(1.34rem, 1.05rem + 0.95vw, 1.95rem);
  --line: 1.72;
  /* Slightly wider content + gutters for RTL pages */
  --container: 1180px;
  --gutter: clamp(18px, 2.2vw, 26px);
}

html[lang="ur"] body,
html[lang="ur"] body .btn,
html[lang="ur"] body .site-nav a,
html[lang="ur"] body .site-nav button {
  font-family: "Noto Nastaliq Urdu", "Noto Sans Arabic", var(--font-sans);
}

html[lang="ar"] body,
html[lang="ar"] body .btn,
html[lang="ar"] body .site-nav a,
html[lang="ar"] body .site-nav button {
  font-family: "Noto Sans Arabic", "Noto Nastaliq Urdu", var(--font-sans);
}

html[lang="ur"] body h2,
html[lang="ur"] body h3,
html[lang="ur"] body .brand-title strong {
  font-family: "Noto Nastaliq Urdu", "Noto Sans Arabic", var(--font-serif);
  line-height: 1.34;
}

html[lang="ur"] body h1 {
  font-family: "Noto Nastaliq Urdu", "Noto Sans Arabic", var(--font-serif);
  /* Nastaliq needs extra leading so descenders clear the next line */
  line-height: 1.52;
}

html[lang="ar"] body h2,
html[lang="ar"] body h3,
html[lang="ar"] body .brand-title strong {
  font-family: "Noto Sans Arabic", var(--font-serif);
  line-height: 1.34;
}

html[lang="ar"] body h1 {
  font-family: "Noto Sans Arabic", var(--font-serif);
  line-height: 1.44;
}

html[lang="ur"] .kicker,
html[lang="ar"] .kicker {
  text-transform: none;
  letter-spacing: 0.02em;
  margin-bottom: 18px;
}

html[lang="ur"] h1,
html[lang="ar"] h1 {
  margin-bottom: 24px;
}

html[lang="ur"] .page-hero,
html[lang="ar"] .page-hero {
  padding: clamp(26px, 4vw, 42px) clamp(22px, 3.4vw, 38px) clamp(30px, 5vw, 52px);
}

html[lang="ur"] .hero-split,
html[lang="ar"] .hero-split {
  gap: clamp(22px, 3.2vw, 38px);
}

html[lang="ur"] .hero-media img,
html[lang="ar"] .hero-media img {
  height: clamp(248px, 26vw, 288px);
}

html[lang="ur"] .home-hero,
html[lang="ar"] .home-hero {
  border-radius: calc(var(--radius-lg) + 4px);
}

html[lang="ur"] .lead,
html[lang="ar"] .lead {
  font-size: var(--step-0);
  line-height: 1.75;
  max-width: 62ch;
  margin-bottom: 16px;
}

html[lang="ur"] .page-hero .lead,
html[lang="ar"] .page-hero .lead {
  margin-top: 6px;
  line-height: 1.85;
}

html[lang="ur"] .hero-note,
html[lang="ar"] .hero-note {
  font-size: 0.86rem;
  line-height: 1.55;
  padding: 12px 14px;
  margin-top: 10px;
}

html[lang="ur"] .stat-row,
html[lang="ar"] .stat-row {
  gap: 14px;
  margin-top: 26px;
}

html[lang="ur"] .stat,
html[lang="ar"] .stat {
  padding: 16px 14px;
}

html[lang="ur"] .stat strong {
  font-family: "Noto Nastaliq Urdu", "Noto Sans Arabic", var(--font-serif);
  font-size: 1.22rem;
  line-height: 1.12;
}

html[lang="ar"] .stat strong {
  font-family: "Noto Sans Arabic", var(--font-serif);
  font-size: 1.22rem;
  line-height: 1.12;
}

html[lang="ur"] .stat span,
html[lang="ar"] .stat span {
  font-size: 0.86rem;
  line-height: 1.45;
  display: block;
  margin-top: 4px;
}

html[lang="ur"] .btn-row,
html[lang="ar"] .btn-row {
  gap: 14px;
  margin-top: 18px;
}

html[lang="ur"] .btn,
html[lang="ar"] .btn {
  padding: 11px 16px;
  font-size: var(--step--1);
}

html[lang="ur"] .card,
html[lang="ar"] .card {
  padding: 20px 20px 22px;
}

html[lang="ur"] .quote blockquote,
html[lang="ar"] .quote blockquote {
  font-size: 1.08rem;
  line-height: 1.48;
}

html[lang="ur"] .big-date strong,
html[lang="ar"] .big-date strong {
  font-size: 1.35rem;
}

html[lang="ur"] .site-nav a,
html[lang="ur"] .site-nav button,
html[lang="ar"] .site-nav a,
html[lang="ar"] .site-nav button {
  font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
}

html[lang="ur"] .meta,
html[lang="ar"] .meta {
  gap: 12px;
  line-height: 1.55;
}

html[lang="ur"] .preview,
html[lang="ar"] .preview {
  gap: 12px;
}

html[dir="rtl"] .callout {
  border-left: 0;
  border-right: 3px solid rgba(42, 124, 199, 0.45);
  padding-left: 0;
  padding-right: 12px;
}

/* Restore text direction inside header cells so nav/brand text is still RTL */
html[dir="rtl"] .brand,
html[dir="rtl"] .site-nav,
html[dir="rtl"] .header-actions {
  direction: rtl;
}

/* Nav dropdown and lang-switch are locked to LTR for positioning;
   restore RTL on their text content so labels render correctly */
html[dir="rtl"] .nav-dropdown-toggle,
html[dir="rtl"] .nav-dropdown-menu a,
html[dir="rtl"] .lang-menu-item {
  direction: rtl;
}

/* Only reverse nav item order on desktop — mobile nav is vertical */
@media (min-width: 1321px) {
  html[dir="rtl"] .site-nav > ul {
    flex-direction: row-reverse;
  }
}


html[dir="rtl"] .btn-row,
html[dir="rtl"] .footer-grid {
  direction: rtl;
}

html[dir="rtl"] .footer-copy {
  direction: rtl;
}

/* ─── RTL Mobile Resets ─────────────────────────────────────────────
   RTL overrides have higher specificity than plain mobile breakpoints.
   These rules restore proper mobile behaviour for Urdu / Arabic.
   ──────────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  /* Hero collapses to single column in RTL too */
  html[lang="ur"] .hero-split,
  html[lang="ar"] .hero-split {
    grid-template-columns: 1fr;
  }

  /* Stat row: 2-col on tablet for RTL */
  html[lang="ur"] .stat-row,
  html[lang="ar"] .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  html[lang="ur"] .stat-row,
  html[lang="ar"] .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  /* Hero padding */
  html[lang="ur"] .page-hero,
  html[lang="ar"] .page-hero {
    padding: 16px;
  }

  html[lang="ur"] .hero-split,
  html[lang="ar"] .hero-split {
    gap: 12px;
  }

  /* Stats: single column */
  html[lang="ur"] .stat-row,
  html[lang="ar"] .stat-row {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
  }

  /* Buttons: stack full-width */
  html[lang="ur"] .btn-row,
  html[lang="ar"] .btn-row {
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
  }

  html[lang="ur"] .btn,
  html[lang="ar"] .btn {
    width: 100%;
    justify-content: center;
  }

  /* Cards */
  html[lang="ur"] .card,
  html[lang="ar"] .card {
    padding: 14px;
  }

  /* Lead text: don't restrict max-width on mobile */
  html[lang="ur"] .lead,
  html[lang="ar"] .lead {
    max-width: 100%;
  }

  /* Headings: tighten bottom margin */
  html[lang="ur"] h1,
  html[lang="ar"] h1 {
    margin-bottom: 14px;
  }

  html[lang="ur"] .kicker,
  html[lang="ar"] .kicker {
    margin-bottom: 10px;
  }

  /* Nav items: always vertical on mobile (override row-reverse) */
  html[dir="rtl"] .site-nav > ul {
    flex-direction: column;
  }
}

