/* ==========================================================================
   Owais A. Hussain — personal site
   A single stylesheet. Design tokens live at the top; change those first.
   ========================================================================== */

/* ------------------------------------------------------------ honorifics -- */
/* ﷺ ﷻ ﷽ ﷲ and the waqf mark ۚ, drawn from a 4 KB Amiri subset.

   Why this exists: Noto Nastaliq Urdu does contain ﷺ, but as a full
   calligraphic medallion that rises far above the line and collides with the
   line above it — which is what makes a couplet containing it look broken.
   Google Fonts makes it worse by serving a subset that omits the glyph
   entirely, so some visitors got a tofu box instead. Amiri draws the same
   honorific compactly, on the line, at text size.

   `unicode-range` limits this face to exactly those five codepoints, so the
   rest of the Urdu text is untouched Nastaliq. Self-hosted rather than pulled
   from Google, because the whole point is not to depend on which subset
   someone else decides to ship. */
@font-face {
  font-family: "Honorifics";
  src: url("../fonts/honorifics.woff2") format("woff2");
  unicode-range: U+06DA, U+FDF2, U+FDFA, U+FDFB, U+FDFD;
  font-display: swap;
}

/* --------------------------------------------------------------- tokens -- */
:root {
  --font-display: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  /* "Honorifics" must come first: a unicode-range face only claims its own
     five codepoints, so listing it ahead of Nastaliq is what makes it win
     for those and nothing else. */
  --font-urdu: "Honorifics", "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;

  --step--1: clamp(0.82rem, 0.79rem + 0.14vw, 0.89rem);
  --step-0: clamp(1rem, 0.96rem + 0.18vw, 1.08rem);
  --step-1: clamp(1.2rem, 1.12rem + 0.36vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.7vw, 1.85rem);
  --step-3: clamp(1.8rem, 1.5rem + 1.35vw, 2.6rem);
  --step-4: clamp(2.2rem, 1.6rem + 2.6vw, 3.9rem);

  --wrap: 1080px;
  --prose: 68ch;
  --radius: 10px;
  --gap: 1.5rem;

  --bg: #fbfaf8;
  --bg-soft: #f2f0ea;
  --surface: #ffffff;
  --text: #1a1a18;
  --text-muted: #5c5952;
  --text-faint: #8b877f;
  --border: #e4e0d7;
  --border-strong: #d3cec2;
  --accent: #0f6e63;
  --accent-hover: #0b544b;
  --accent-soft: rgba(15, 110, 99, 0.09);
  --shadow: 0 1px 2px rgba(26, 26, 24, 0.04), 0 8px 24px rgba(26, 26, 24, 0.05);
  --header-bg: rgba(251, 250, 248, 0.82);
}

html[data-theme="dark"] {
  --bg: #121211;
  --bg-soft: #1a1a18;
  --surface: #1a1a18;
  --text: #eceae5;
  --text-muted: #a8a39a;
  --text-faint: #7c776f;
  --border: #2c2b28;
  --border-strong: #3b3a36;
  --accent: #62d2be;
  --accent-hover: #8ae3d3;
  --accent-soft: rgba(98, 210, 190, 0.13);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.28);
  --header-bg: rgba(18, 18, 17, 0.8);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); font-weight: 600; }

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

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

/* Inline SVG icons default to the current text size. Components that need a
   fixed size (.btn, .chip, .theme-toggle) override this below. */
svg {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  flex: none;
}

code, pre, kbd {
  font-family: var(--font-mono);
  font-size: 0.88em;
}
code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
pre {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; border: 0; padding: 0; }

blockquote {
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--step--1);
  margin: 1.5rem 0;
}
th, td {
  text-align: left;
  padding: 0.6rem 0.8rem 0.6rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  border-bottom-color: var(--border-strong);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection { background: var(--accent-soft); }

/* ------------------------------------------------------------- utilities -- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2.5rem);
}

.prose { max-width: var(--prose); }
.prose h2 { margin-top: 2.4rem; }
.prose h3 { margin-top: 2rem; }

/* .page-body (the `page.wide: true` alternative to .prose, see
   _layouts/page.html) has no width cap, so a section like About's Gallery
   can sit directly inside it rather than inside .prose. It still needs the
   same top-of-section breathing room .prose gives its own headings. */
.page-body > h2 { margin-top: 2.4rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.9rem;
  display: block;
}

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--text-muted); }
.center { text-align: center; }
.urdu {
  font-family: var(--font-urdu);
  direction: rtl;
  line-height: 2.4;
}
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------------------------------------------------------------- header -- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: saturate(150%) blur(12px);
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 62px;
}
/* The brand is a home icon. Sized and padded to a 40px target: an icon-only
   link inherits the text size otherwise, which leaves a tap target under the
   24px minimum. */
.brand {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: -0.5rem;
  border-radius: 8px;
  color: var(--text);
  flex: none;
}
.brand svg { width: 36px; height: 36px; }
.brand:hover { color: var(--accent); background: var(--bg-soft); text-decoration: none; }

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  /* No overflow here: an overflow ancestor clips absolutely positioned
     descendants, which would hide the dropdown menus. Horizontal scrolling is
     applied only at the narrow breakpoint, where the menu switches to
     position:fixed and escapes the clip. */
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 0.4rem 0.62rem;
  border-radius: 6px;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--bg-soft); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--text); font-weight: 500; }

/* ------------------------------------------------------------ nav group -- */
.nav-group {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-group__parent {
  color: var(--text-muted);
  font-size: 0.92rem;
  padding: 0.4rem 0.2rem 0.4rem 0.62rem;
  border-radius: 6px 0 0 6px;
  white-space: nowrap;
}
.nav-group__parent:hover { color: var(--text); text-decoration: none; }
.nav-group__parent[aria-current="page"] { color: var(--text); font-weight: 500; }

.nav-group__toggle {
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  padding: 0.4rem 0.45rem 0.4rem 0.15rem;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  line-height: 0;
}
.nav-group__toggle svg { width: 13px; height: 13px; fill: currentColor; transition: transform 0.15s ease; }
.nav-group:hover .nav-group__parent,
.nav-group:hover .nav-group__toggle { background: var(--bg-soft); color: var(--text); }

.nav-group__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 15rem;
  list-style: none;
  margin: 0;
  padding: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s;
  z-index: 60;
}
.nav-group:hover .nav-group__menu,
.nav-group:focus-within .nav-group__menu,
.nav-group[data-open="true"] .nav-group__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-group[data-open="true"] .nav-group__toggle svg { transform: rotate(180deg); }

.nav-group__menu a {
  display: block;
  padding: 0.5rem 0.65rem;
  border-radius: 7px;
  color: var(--text);
}
.nav-group__menu a:hover { background: var(--bg-soft); text-decoration: none; }
.nav-group__title { display: block; font-size: 0.94rem; }
.nav-group__note {
  display: block;
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 0.1rem;
}
.nav-group__menu .nav-urdu .nav-group__title { font-size: 1.02rem; line-height: 1.9; }

@media (max-width: 680px) {
  /* The nav is a horizontal scroller on narrow screens, and an absolutely
     positioned menu inside it would be clipped. Anchor it to the header edge. */
  .nav-group__menu { position: fixed; left: auto; right: 0.8rem; top: 58px; }
}

@media (max-width: 680px) {
  /* Scroll the nav horizontally, and hint that it scrolls. */
  .site-nav {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 86%, transparent 100%);
    mask-image: linear-gradient(to right, #000 86%, transparent 100%);
  }
}

.theme-toggle {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.theme-toggle:hover { background: var(--bg-soft); color: var(--text); }
.theme-toggle svg { width: 16px; height: 16px; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html:not([data-theme="dark"]) .theme-toggle .icon-moon { display: none; }

/* ------------------------------------------------------------------ main -- */
main { display: block; }
.page-head {
  padding: clamp(2.6rem, 6vw, 4.5rem) 0 1.5rem;
}
.page-head h1 { margin-bottom: 0.4rem; }
.section { padding-block: clamp(2.2rem, 5vw, 3.6rem); }
.section--soft { background: var(--bg-soft); border-block: 1px solid var(--border); }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.section__head h2 { margin: 0; font-size: var(--step-2); }
.section__head a { font-size: 0.9rem; white-space: nowrap; }

/* ------------------------------------------------------------------ hero -- */
.hero { padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.hero h1 {
  font-size: var(--step-4);
  margin-bottom: 0.35em;
}
.hero__tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--step-1);
  color: var(--accent);
  margin-bottom: 1.4rem;
}
.hero__blurb { max-width: 58ch; font-size: var(--step-1); line-height: 1.55; color: var(--text-muted); }
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}

/* --------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.15s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
html[data-theme="dark"] .btn--primary { color: #10201d; }
html[data-theme="dark"] .btn--primary:hover { color: #10201d; }

/* ----------------------------------------------------------------- stats -- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat { background: var(--bg); padding: 1.2rem 1.3rem; }
.stat__num {
  font-family: var(--font-display);
  font-size: var(--step-2);
  line-height: 1;
  display: block;
  margin-bottom: 0.3rem;
}
.stat__label {
  font-size: var(--step--1);
  color: var(--text-muted);
}
.section--soft .stat { background: var(--bg-soft); }

/* ----------------------------------------------------------------- cards -- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.35rem;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
a.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.card__meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.55rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  white-space: nowrap;
}
.card__meta > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.card__meta > span + span { margin-left: auto; }
.card__title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 500;
  color: var(--text);
  margin: 0 0 0.45rem;
  line-height: 1.2;
}
.card__body { color: var(--text-muted); font-size: 0.95rem; margin: 0; flex: 1; }
.card__foot { margin-top: 0.9rem; }

/* --------------------------------------------------------------- gallery -- */
.gallery-slideshow {
  position: relative;
  margin: 0 0 0.5rem;
}

.gallery-track {
  list-style: none;
  margin: 0;
  padding: 0.3rem 0.3rem 1.1rem;
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scroll-padding-left: 0.3rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.gallery-track::-webkit-scrollbar { height: 8px; }
.gallery-track::-webkit-scrollbar-track { background: transparent; }
.gallery-track::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.gallery-slide {
  position: relative;
  flex: 0 0 auto;
  width: min(420px, 78vw);
  scroll-snap-align: center;
  border-radius: calc(var(--radius) * 1.6);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}
.gallery-slide:hover { transform: translateY(-3px); }
.gallery-slide a { display: block; position: relative; }
.gallery-slide img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--bg-soft);
}
.gallery-slide__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3rem 1.1rem 0.9rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82) 0%, rgba(0, 0, 0, 0.5) 45%, rgba(0, 0, 0, 0) 78%);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Edge fades hint that the strip keeps going, in both directions. Sit above
   the track but below the nav buttons; only shown once there's room for a
   button beside them (see the media query below the nav rules). */
.gallery-slideshow::before,
.gallery-slideshow::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 1.1rem;
  width: clamp(24px, 6vw, 64px);
  pointer-events: none;
  z-index: 1;
}
.gallery-slideshow::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.gallery-slideshow::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }

.gallery-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.gallery-nav:hover { background: var(--accent); color: #fff; transform: translateY(-50%) scale(1.05); }
.gallery-nav svg { width: 22px; height: 22px; }
.gallery-nav--prev { left: -0.4rem; }
.gallery-nav--next { right: -0.4rem; }

/* Buttons need somewhere to sit outside the track without clipping it, and
   don't help much on a touchscreen anyway -- hide below the point they'd
   start overlapping the photos. */
@media (max-width: 640px) {
  .gallery-nav { display: none; }
}

/* GLightbox's own overlay stays dark regardless of site theme (the usual
   convention for a lightbox) — just match its caption type to the site. */
.gdesc-inner { font-family: var(--font-body); }

/* ------------------------------------------------------------------ tags -- */
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 100px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

/* A post with `published: false` never reaches the live site. It appears only
   in a local `--unpublished` build; the badge makes that unmistakable. */
.tag--draft {
  background: #fbe9c6;
  color: #8a5a00;
  text-transform: uppercase;
  vertical-align: middle;
}
html[data-theme="dark"] .tag--draft { background: #4a3a12; color: #f0c761; }

.draft-note {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 2rem;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px dashed #d8a93a;
  background: #fdf6e6;
  color: #7a5100;
  font-size: 0.9rem;
  text-align: left;
}
html[data-theme="dark"] .draft-note {
  background: #322612; border-color: #7a5f22; color: #f0c761;
}

/* ------------------------------------------------------------- item list -- */
.items { list-style: none; margin: 0; padding: 0; }
.item {
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
}
.item:first-child { border-top: 0; padding-top: 0; }
.item__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0.4rem 1.2rem;
}
.item__title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 500;
  margin: 0 0 0.15rem;
  line-height: 1.25;
}
.item__title a { color: var(--text); }
.item__title a:hover { color: var(--accent); }
.item__sub { color: var(--text-muted); font-size: 0.95rem; margin: 0 0 0.4rem; }
.item__year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-faint);
  white-space: nowrap;
}
.item__body { color: var(--text-muted); font-size: 0.95rem; }
.item ul { margin: 0.6rem 0 0; padding-left: 1.1rem; color: var(--text-muted); font-size: 0.95rem; }
.item li { margin-bottom: 0.3rem; }

/* Project list header: title | org | year | tags, all on one wrapping line.
   Scoped as .proj-head rather than reusing .item__head/.item__sub, which stay
   a two-column grid for certifications/research/writing/index — this is a
   projects-page-only layout. */
.proj-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
}
.proj-head .item__title { margin: 0; }
.proj-org { color: var(--text-muted); font-size: 0.95rem; }
.proj-org::before,
.proj-head > .item__year::before,
.proj-head > .tags::before {
  content: "|";
  display: inline-block;
  margin: 0 0.6em;
  color: var(--text-faint);
  font-weight: 400;
}
.proj-head .tags { align-items: center; }

/* The three projects with their own page (TB REACH, Bubsy, Aao TB Mitao)
   get a title that reads as a link on sight, not just on hover — unlike
   every other .item__title a on the site, which looks like plain text
   until hovered. Scoped to .proj-head so that convention stays untouched
   elsewhere. */
.proj-head .item__title a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 0.15em;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.proj-head .item__title a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

/* Flag(s) or a globe, before the project title. */
.proj-flags {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}
.proj-flag {
  display: block;
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  border: 1px solid var(--border-strong);
}
.proj-flag--globe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-faint);
}
.proj-flag--globe svg { width: 100%; height: 100%; }

/* Collapsible project entries: <details> nested inside <li class="item">,
   so the existing .item border/padding and :first-child rule still apply. */
.item__details { position: relative; }
.item__details summary {
  cursor: pointer;
  list-style: none;
  padding-right: 2.5rem;
}
.item__details summary::-webkit-details-marker { display: none; }
.item__details:hover .item__title,
.item__details summary:hover .item__title { color: var(--accent); }
/* The toggle: a filled accent circle, not a faint character, so it reads as
   a control worth clicking rather than decoration. */
.item__details summary::after {
  content: "+";
  position: absolute;
  top: -0.2rem;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.item__details summary:hover::after {
  background: var(--accent);
  color: var(--bg);
  transform: scale(1.1);
}
.item__details[open] summary::after { content: "\2212"; }
.item__details .item__body { margin-top: 0.8rem; }

/* --------------------------------------------------------------- roles -- */
.role { border-top: 1px solid var(--border); padding: 1.6rem 0; }
.role:first-child { border-top: 0; }
.role__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.3rem 1.2rem;
  align-items: baseline;
}
.role__title { font-family: var(--font-display); font-size: var(--step-1); margin: 0; }
.role__org { color: var(--accent); font-weight: 500; }
.role__when {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  white-space: nowrap;
}

/* -------------------------------------------------------------- skill box -- */
.skill-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--gap);
}
.skill-group h3 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  margin-bottom: 0.7rem;
}
.skill-group ul { list-style: none; margin: 0; padding: 0; }
.skill-group li {
  font-size: 0.93rem;
  color: var(--text-muted);
  padding: 0.28rem 0;
  border-bottom: 1px dotted var(--border);
}

/* ------------------------------------------------------------------ bars -- */
.bars { display: grid; gap: 0.55rem; max-width: 30rem; }
.bar { display: grid; grid-template-columns: 2.2rem 1fr 2.2rem; align-items: center; gap: 0.7rem; }
.bar__label, .bar__value { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-faint); }
.bar__value { text-align: right; }
.bar__track { height: 8px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 100px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--accent); border-radius: 100px; }

/* ----------------------------------------------------------------- posts -- */
.post-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.post-body { margin-top: 2rem; }
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
}

/* --------------------------------------------------------------- callout -- */
.callout {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem;
}

/* ---------------------------------------------------------------- footer -- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: clamp(3rem, 8vw, 6rem);
  padding-block: 2.5rem 3rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}
.footer-grid h4 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  margin-bottom: 0.7rem;
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 0.35rem; }
.footer-grid a { color: var(--text-muted); }
.footer-grid a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-faint);
}

/* ------------------------------------------------------------ link chips -- */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.86rem;
  color: var(--text-muted);
  background: var(--surface);
}
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip svg { width: 14px; height: 14px; }
.chip--on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
html[data-theme="dark"] .chip--on { color: #10201d; }
.chip--on:hover { color: #fff; border-color: var(--accent); }
html[data-theme="dark"] .chip--on:hover { color: #10201d; }
.chip__count {
  font-family: var(--font-mono);
  font-size: 0.72em;
  opacity: 0.65;
  margin-left: 0.15rem;
}

/* ------------------------------------------------------------------ misc -- */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
}
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
}

.course {
  border-top: 1px solid var(--border);
  padding: 0.9rem 0;
}
.course__title {
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--step-1);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text);
  text-decoration: none;
}
.course__title svg {
  width: 0.9rem;
  height: 0.9rem;
  flex: none;
  color: var(--text-faint);
}
.course__title:hover { color: var(--accent); }
.course__title:hover svg { color: var(--accent); }
.course .course__body {
  margin-top: 0.8rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: var(--prose);
}

/* The dedicated page a course/training title links out to (catalog-view.js
   renders its content from the matching JSON file at build time). */
.catalog-video {
  margin: 0 0 1.6rem;
  max-width: var(--prose);
}
.catalog-video video {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
  background: #000;
}
.catalog-video .course__meta { margin-top: 0.5rem; }
/* Date and venue, directly under the title of a training. */
.course__meta {
  margin: 0.35rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--text-faint);
}

/* ------------------------------------------------- course material lists -- */
/* Slide decks and handouts, listed under the course or training they belong
   to. The list is deliberately quiet: it sits below the outline and should not
   compete with it. */
.course__materials-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1.4rem 0 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}
.course__materials-label svg {
  width: 0.95rem;
  height: 0.95rem;
  flex: none;
}
.course__count {
  font-size: 0.72rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.course__files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
  gap: 0.1rem 1.6rem;
}
.course__files li a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.32rem 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 0;
  overflow-wrap: anywhere;
}
.course__files li a:hover { color: var(--accent); }
.course__ext {
  flex: none;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.02rem 0.3rem;
}
.course__files li a:hover .course__ext {
  border-color: var(--accent);
  color: var(--accent);
}

/* ----------------------------------------------------------------- hero -- */
/* Two columns on wide screens: text left, portrait right. The portrait comes
   first in the DOM order on mobile so the page opens with a face. */
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(200px, 26vw, 300px);
  gap: clamp(1.8rem, 5vw, 3.5rem);
  align-items: center;
}
.hero__portrait {
  margin: 0;
  position: relative;
}
.hero__portrait img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  display: block;
  filter: grayscale(100%) contrast(1.02);
}
html[data-theme="dark"] .hero__portrait img {
  filter: grayscale(100%) contrast(0.95) brightness(0.92);
}
@media (max-width: 760px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__portrait { order: -1; max-width: 168px; }
}

/* ------------------------------------------------------------ world map -- */
:root {
  --map-land: #e6e2d8;
  --map-stroke: #fbfaf8;
  --map-worked: #0f6e63;
  --map-visited: #7fbdb3;
}
html[data-theme="dark"] {
  --map-land: #2a2a27;
  --map-stroke: #121211;
  --map-worked: #62d2be;
  --map-visited: #2f7d70;
}

.countries { display: grid; gap: 1.8rem; }

.worldmap__frame { position: relative; }
.worldmap {
  display: block;
  width: 100%;
  height: auto;
}
.worldmap path {
  fill: var(--map-land);
  stroke: var(--map-stroke);
  stroke-width: 0.5;
  transition: fill 0.15s ease;
}
.worldmap path:hover { cursor: default; }
.worldmap path.is-active { fill: var(--accent-hover) !important; }

.worldmap__caption {
  text-align: center;
  margin: 0.6rem 0 0;
  min-height: 1.6em;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.worldmap__caption strong { color: var(--text); font-weight: 500; }

.countries__legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.6rem;
}
.countries__label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  margin-bottom: 0.8rem;
}
.countries__swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}
.countries__swatch--worked { background: var(--map-worked); }
.countries__swatch--visited { background: var(--map-visited); }
.countries__count {
  color: var(--text-faint);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.05rem 0.4rem;
}
.countries__note {
  margin: 0.9rem 0 0;
  font-size: 0.85rem;
  color: var(--text-faint);
  max-width: 44ch;
}

.flags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.flags--centred { justify-content: center; gap: 0.6rem; }
.flag {
  position: relative;
  line-height: 0;
  border-radius: 3px;
  outline-offset: 3px;
  cursor: default;
  transition: transform 0.15s ease;
}
.flag img {
  width: 30px;
  height: 22.5px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  display: block;
}
.flag:hover, .flag:focus-visible { transform: translateY(-2px); }

.flag__tip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 0.76rem;
  line-height: 1.3;
  padding: 0.3rem 0.55rem;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 5;
}
.flag__tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--text);
}
.flag:hover .flag__tip,
.flag:focus-visible .flag__tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* -------------------------------------------------------------- timeline -- */
.timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(96px, 1fr);
  gap: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 0.5rem;
}
.timeline__item {
  position: relative;
  padding: 2.4rem 0.7rem 0 0;
  min-width: 0;
}
.timeline__item::before {
  content: "";
  position: absolute;
  top: 1rem;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-strong);
}
.timeline__item::after {
  content: "";
  position: absolute;
  top: calc(1rem - 3.5px);
  left: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}
.timeline__item--major::after { background: var(--accent); }
.section--soft .timeline__item::after { background: var(--bg-soft); }
.section--soft .timeline__item--major::after { background: var(--accent); }
.timeline__year {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-faint);
  display: block;
  margin-bottom: 0.25rem;
}
.timeline__what {
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text);
  display: block;
}
.timeline__where {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.15rem;
}

/* ---------------------------------------------------------- card domains -- */
.card__domain {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 0.85rem;
}
.card__domain svg { width: 16px; height: 16px; }

/* ------------------------------------------------- Urdu / RTL typography -- */
/* Nastaliq renders small and needs far more leading than a Latin face, so the
   size and line-height below are deliberately generous. Applied to article
   bodies only — the site chrome stays LTR. */
.urdu {
  font-family: var(--font-urdu);
  line-height: 2.35;
  font-size: 1.12em;
}
.rtl {
  direction: rtl;
  text-align: right;
}
.rtl ul, .rtl ol { padding-left: 0; padding-right: 1.3rem; }
.rtl blockquote {
  border-left: 0;
  border-right: 2px solid var(--accent);
  padding: 0.2rem 1.2rem 0.2rem 0;
}
.rtl .post-nav { flex-direction: row-reverse; }

h1.urdu, h2.urdu, h3.urdu {
  line-height: 1.9;
  letter-spacing: 0;
}
.item__title.urdu { font-size: var(--step-1); line-height: 2; }

.nav-urdu {
  font-family: var(--font-urdu);
  font-size: 1.02rem !important;
  line-height: 2;
}

/* Verse. Line breaks are meaningful, so they are preserved rather than
   collapsed, and couplets are centred as they would be on the page. */
.poem,
.rtl .poem {
  white-space: pre-line;
  text-align: center;
  line-height: 2.9;
  margin: 2rem 0;
  font-size: 1.18em;
}
.poem + .poem { margin-top: 2.6rem; }
.poem-title {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9em;
  margin-bottom: 0.5rem;
}

/* Verse. A .verse holds a sequence of .stanza blocks — ashaar in a ghazal,
   four-line bands in a murabba, whatever the form is. Each stanza is its own
   block so the space *within* a stanza (line-height) is set independently of
   the space *between* stanzas (margin). Keeping those two apart is the whole
   typographic point: if they look the same, the poem reads as a flat list of
   lines instead of a sequence of units. */
.verse {
  margin: 2.5rem 0;
  text-align: center;
}
.verse .stanza {
  margin: 0 0 2.6rem;
  font-size: 1.2em;
  /* Nastaliq descends steeply and a misra can carry a superscript honorific,
     so the misras of a couplet need more room between them than Latin verse
     would. Still well under the 2.6rem that separates one couplet from the
     next — the gap within a couplet must stay visibly the smaller of the
     two, or the poem reads as a flat list of lines. */
  line-height: 2.25;
  text-wrap: balance;
}
.verse .stanza:last-child { margin-bottom: 0; }

/* A separator between the last stanza and any dedication that follows. */
.verse + .post-source,
.prose > .verse + * .post-source { margin-top: 2.5rem; }

/* A section label inside a poem — گرہ, بند, or a movement marker. */
.verse__label {
  font-family: var(--font-urdu);
  font-size: 0.95rem;
  color: var(--text-faint);
  margin: 0 auto 1.8rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border);
  max-width: 9rem;
}

/* The letter heading an acrostic stanza. The letters read down the poem to
   spell a word, so each is marked rather than left looking like a stray
   character adrift above the verse. */
.verse__letter {
  display: block;
  font-family: var(--font-urdu);
  font-size: 1.45rem;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

/* A stanza that closes on a repeated refrain — the last lines of a musaddas
   band. Slightly set apart from the lines above it. */
.verse .stanza--refrain { color: var(--text); }
.verse .refrain { display: block; margin-top: 0.9rem; }

/* A source reference sitting under the couplet it belongs to — a Quranic ayah
   or a hadith. Set small and quiet so it reads as an attribution, not a line
   of the poem. It is part of the preceding stanza, so the stanza's own bottom
   margin still separates the couplets. */
.verse__cite {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-urdu);
  font-size: 0.72em;
  line-height: 1.8;
  color: var(--text-faint);
}
.verse__cite a { color: inherit; }

/* A note to self standing in for a misra that is not written yet — the sense
   of the line, held in place until the line arrives. Set in brackets and in
   the body font rather than Nastaliq, so it is unmistakably scaffolding and
   not verse. Only ever appears in a draft. */
.verse__note {
  font-family: var(--font-body);
  font-size: 0.78em;
  color: var(--text-faint);
  font-style: italic;
}

/* A quoted couplet — a translated ayah or hadith carried in verse. Marked so
   the reader can see it is being reported rather than said. */
.verse .stanza--quote {
  border-inline-start: 2px solid var(--accent-soft);
  padding-inline-start: 1.1rem;
  display: inline-block;
  text-align: inherit;
}

.post-source {
  color: var(--text-faint);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: 2.5rem;
}

.heading-alt {
  color: var(--text-faint);
  font-size: 0.62em;
  margin-inline-start: 0.5rem;
  white-space: nowrap;
}

/* Verse reads better as a centred composition than as a block pinned to the
   left margin, so poetry posts centre their measure and their heading. */
.prose--centred { margin-inline: auto; }
.verse-head { text-align: center; }

/* An Urdu heading still needs dir="rtl" for correct shaping and punctuation,
   but aligning it right inside a 68ch measure strands it mid-page, away from
   the eyebrow above it. Align it with everything else instead. */
.page-head h1.urdu,
.page-head .lede.urdu { text-align: left; }

/* ...except on a verse page, where the whole head is centred with the poem.
   Two classes on the same element, so this beats the rule above rather than
   relying on source order. */
.page-head.verse-head h1.urdu,
.page-head.verse-head .lede.urdu,
.page-head.verse-head h1,
.page-head.verse-head .lede { text-align: center; }

/* Same reasoning inside a post list, which mixes languages: keeping every
   entry on one left edge stops Urdu titles from drifting to the far side of
   the column. dir="rtl" is retained, so the text itself still shapes and
   orders correctly. */
.items .item__title.urdu,
.items .item__body.urdu { text-align: left; }

@media (max-width: 560px) {
  .verse .stanza { font-size: 1.08em; line-height: 2.1; margin-bottom: 2rem; }
}

/* Latin text inside an RTL block (code, URLs, English words). */
.rtl code, .rtl pre, .rtl .ltr {
  direction: ltr;
  text-align: left;
  font-family: var(--font-mono);
  unicode-bidi: embed;
}
.rtl pre { display: block; }

/* --------------------------------------------------------------- comments -- */
.comments {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}
.comments__heading { font-size: var(--step-1); margin-bottom: 0.3rem; }
.comments__note {
  color: var(--text-faint);
  font-size: 0.88rem;
  margin-bottom: 1.6rem;
}
.comments__list { list-style: none; margin: 0; padding: 0; }
.comment {
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
}
.comment__meta {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.comment__author { font-weight: 500; font-size: 0.94rem; }
.comment__meta time {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-faint);
}
.comment__body { color: var(--text-muted); font-size: 0.95rem; }
.comment__body p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------- imported content -- */
/* Posts carried over from Blogspot bring their own markup. These rules keep
   that content inside the site's own measure and spacing. */
.post-body img {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
  margin: 1.8rem auto;
}
.post-body figure { margin: 1.8rem 0; }
.post-body figcaption {
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
  margin-top: 0.5rem;
}
.post-body table { display: block; overflow-x: auto; }

/* A photograph from a travel piece. The originals are 640px wide, so the
   figure is capped there rather than stretched — an upscaled photo looks
   worse than a small sharp one. Caption sits under the frame, quiet. */
.post-figure {
  margin: 2.2rem auto;
  max-width: min(100%, 640px);
}
.post-figure img {
  width: 100%;
  height: auto;
  margin: 0;
}
.post-figure figcaption {
  margin-top: 0.6rem;
  line-height: 1.7;
  text-align: center;
}

/* A lead image opening a post. It is the first thing on the page, so it runs
   the full measure and sits tight under the title rather than floating in the
   middle of the reading column. */
.post-figure--lead {
  max-width: 100%;
  margin: 0 0 2.4rem;
}
/* An Urdu caption still reads right-to-left, but stays centred under its
   photo rather than pushing to one edge. */
.rtl .post-figure figcaption { text-align: center; }

/* Two figures in a row on a wide screen would fight the reading column, so
   they simply stack. On a narrow screen the cap is the column width. */
@media (max-width: 560px) {
  .post-figure { margin: 1.6rem auto; }
}

/* Lists inside imported prose. */
.post-body ul, .post-body ol { margin: 1.2rem 0; padding-inline-start: 1.4rem; }
.post-body li { margin-bottom: 0.5rem; }
.rtl.post-body ul, .rtl.post-body ol { padding-inline-start: 1.4rem; }

/* A quoted passage inside a post — an ayah, a hadith, a line from a book. */
.post-body blockquote {
  margin: 1.8rem 0;
  padding-inline-start: 1.2rem;
  border-inline-start: 3px solid var(--accent-soft);
  color: var(--text-muted);
}
.post-body blockquote p:last-child { margin-bottom: 0; }
/* The source of a quotation — a surah, a hadith collection, a book. */
.post-body blockquote footer {
  margin-top: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-style: normal;
}

/* Console output, source listings and config files carried over from the old
   blog. These are wide by nature, so the block scrolls inside itself rather
   than pushing the page sideways. */
.post-body pre {
  max-width: 100%;
  font-size: 0.8rem;
  line-height: 1.55;
  tab-size: 4;
}
.post-body pre code { white-space: pre; }

/* Imported technical prose runs identifiers through ordinary sentences —
   protocol="org.apache.coyote.http11.Http11NioProtocol" and the like. One of
   those is wider than a phone column and, with nowhere legal to break, drags
   the whole page sideways. Let the browser break inside a word, but only
   when the word genuinely cannot fit. */
.post-body p,
.post-body li,
.post-body h2,
.post-body h3,
.post-body figcaption { overflow-wrap: break-word; }

/* A two-column comparison. The wrapper is what scrolls on a narrow screen —
   a table that sets its own overflow cannot also size to its content. */
.table-wrap { overflow-x: auto; margin: 1.8rem 0; }
.compare { min-width: 34rem; margin: 0; }
.compare th {
  font-family: var(--font-body);
  font-size: 0.95rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  font-weight: 600;
}
.compare td { width: 50%; padding-right: 1.2rem; line-height: 1.6; }
.compare tbody tr:last-child td { border-bottom: 0; }

/* An English line dropped into an Urdu narrative — reported speech, a book
   quotation. It reads left-to-right in the body font, not the mono font the
   generic .ltr rule uses for code. */
.rtl.post-body p.ltr {
  direction: ltr;
  text-align: left;
  font-family: var(--font-body);
  unicode-bidi: embed;
}

@media print {
  .site-header, .site-footer, .theme-toggle, .hero__actions { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; }
}

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