/* =========================================================
   Farhad Bayani — personal academic site
   Raw HTML/CSS template · FA (rtl) · CKB Sorani (rtl) · EN (ltr)
   Uses logical properties, so one stylesheet serves both directions.
   ========================================================= */

/* ---------- 0. Fonts (bundled locally in /fonts) ---------- */
/* Nazanin (free release by font-store.ir), same design family as B Nazanin; covers Kurdish too */
@font-face { font-family: "Nazanin Web"; font-weight: 400 500; font-display: swap; src: url(../fonts/Nazanin-Regular.woff2) format("woff2"), url(../fonts/Nazanin-Regular.woff) format("woff"); }
@font-face { font-family: "Nazanin Web"; font-weight: 600 900; font-display: swap; src: url(../fonts/Nazanin-Bold.woff2) format("woff2"), url(../fonts/Nazanin-Bold.woff) format("woff"); }
/* Noto Naskh: fallback only */
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 400; font-display: swap; src: local("Noto Naskh Arabic"), url(../fonts/NotoNaskhArabic-Regular.woff) format("woff"); }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 500 600; font-display: swap; src: local("Noto Naskh Arabic SemiBold"), url(../fonts/NotoNaskhArabic-SemiBold.woff) format("woff"); }
@font-face { font-family: "Noto Naskh Arabic"; font-weight: 700 900; font-display: swap; src: local("Noto Naskh Arabic Bold"), url(../fonts/NotoNaskhArabic-Bold.woff) format("woff"); }
/* Gill Sans MT is used when installed (Windows + Office, macOS "Gill Sans").
   Cabin (OFL, inspired by Gill/Johnston) is the bundled fallback.
   If you hold a Gill Sans MT web licence, add its woff2 here as "Gill Sans MT". */
@font-face { font-family: "Cabin Local"; font-weight: 400; font-display: swap; src: url(../fonts/Cabin-Regular.woff) format("woff"); }
@font-face { font-family: "Cabin Local"; font-weight: 400; font-style: italic; font-display: swap; src: url(../fonts/Cabin-Italic.woff) format("woff"); }
@font-face { font-family: "Cabin Local"; font-weight: 600; font-display: swap; src: url(../fonts/Cabin-SemiBold.woff) format("woff"); }

/* ---------- 1. Tokens ---------- */
:root {
  --bg: #e4e6ea;            /* gray page */
  --surface: #ffffff;
  --tint: #f2f3f6;          /* alternate sections */
  --tint-strong: #cdd4e3;   /* navy-tinted gray */
  --ink: #1a2233;
  --muted: #5a6273;
  --line: #d1d5dc;
  --brand: #1d2b53;         /* سرمه‌ای */
  --brand-deep: #121c3a;
  --on-brand: #ffffff;
  --accent: #b08a4f;        /* brass, used only for small marks */
  --shadow: 0 1px 2px rgba(18, 28, 58, .06), 0 8px 24px rgba(18, 28, 58, .08);

  --font-body: "Nazanin Web", "B Nazanin", "Noto Naskh Arabic", Tahoma, serif;
  --font-display: "Nazanin Web", "B Nazanin", "Noto Naskh Arabic", Tahoma, serif;
  --font-en: "Gill Sans MT", "Gill Sans", "Cabin Local", "Segoe UI", Arial, sans-serif;

  --radius-s: 4px;
  --radius-m: 10px;
  --radius-l: 24px;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(56px, 8vw, 104px);

  color-scheme: only light;
}

html[lang="en"] {
  --font-body: var(--font-en);
  --font-display: var(--font-en);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.3rem;
  line-height: 1.95;
  text-rendering: optimizeLegibility;
}
html[lang="en"] body { line-height: 1.65; font-size: 1.125rem; }

img, video, iframe { max-width: 100%; display: block; }
img { height: auto; }
[lang="en"] { font-family: var(--font-en); }
.pub__title[lang="en"], h1[lang="en"], h3[lang="en"] { font-weight: 600; line-height: 1.4; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: .25em; }
a:hover { color: var(--brand-deep); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.35;
  margin: 0 0 .5em;
  font-weight: 700;
  color: var(--ink);
}
html[lang="en"] h1, html[lang="en"] h2, html[lang="en"] h3 { font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2 * var(--gutter), 760px); margin-inline: auto; }
.section { padding-block: var(--section); }
.section--tint, .section--alt { background: var(--tint); }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
  position: absolute; inset-inline-start: 16px; top: -60px;
  background: var(--brand); color: var(--on-brand); padding: 8px 16px; border-radius: var(--radius-s); z-index: 100;
}
.skip-link:focus { top: 12px; }

/* ---------- 3. Buttons & small parts ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  padding: .7em 1.4em;
  border-radius: 999px;
  font: inherit; font-weight: 600; font-size: .95rem;
  text-decoration: none; cursor: pointer;
  border: 1.5px solid var(--brand);
  background: var(--brand); color: var(--on-brand);
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--brand-deep); border-color: var(--brand-deep); color: var(--on-brand); }
.btn--ghost { background: transparent; color: var(--brand); }
.btn--ghost:hover { background: var(--tint); color: var(--brand-deep); }

.tag {
  display: inline-block;
  padding: .2em .8em;
  border-radius: 999px;
  background: var(--tint);
  color: var(--brand-deep);
  font-size: .85rem;
  text-decoration: none;
  white-space: nowrap;
}
a.tag:hover { background: var(--tint-strong); }
.tag--status { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }

.section-head {
  display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-block-end: 32px;
  padding-block-end: 16px;
  border-block-end: 1px solid var(--line);
}
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); }
.more-link { font-weight: 600; text-decoration: none; white-space: nowrap; }

/* ---------- 4. Masthead (calligraphy) + navigation bar ---------- */
.masthead {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-block-end: 1px solid var(--line);
}
.masthead__inner {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  min-height: 176px;
  padding-block: 16px 14px;
}
.logo { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; }
.logo__name { height: 156px; width: auto; display: block; }
.logo__rule { display: block; width: 110%; height: 1px; background: linear-gradient(90deg, transparent, var(--brand) 20%, var(--brand) 80%, transparent); opacity: .45; }
.logo__site { height: 30px; width: auto; display: block; }
.masthead__tag { height: 78px; width: auto; }
html[lang="en"] .masthead__tag-en {
  font-family: var(--font-en); font-size: 2rem; font-style: italic; color: var(--brand); letter-spacing: .02em;
}
.masthead__mark {
  position: absolute; z-index: 0;
  inset-block-start: -40px; inset-inline-start: 34%;
  height: 260px; width: auto;
  opacity: .05;
  pointer-events: none;
}

@media (max-width: 760px) {
  .masthead__inner { min-height: 112px; padding-block: 12px 6px; }
  .logo { gap: 5px; }
  .logo__name { height: 88px; }
  .logo__site { height: 20px; }
  .masthead__tag { height: 44px; }
  html[lang="en"] .masthead__tag-en { font-size: 1.3rem; }
  .masthead__mark { height: 160px; inset-inline-start: 20%; }
}

/* Navigation: navy rectangular boxes */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.3) blur(8px);
  border-block-end: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }

.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-inline: auto; }
.nav a {
  display: block;
  background: var(--brand); color: var(--on-brand);
  text-decoration: none;
  padding: .45em 1.15em;
  border-radius: var(--radius-s);
  font-size: .95rem; font-weight: 500;
  box-shadow: inset 0 -3px 0 transparent;
  transition: background .15s, box-shadow .15s;
}
.nav a:hover { background: var(--brand-deep); color: var(--on-brand); }
.nav a[aria-current="page"] { background: var(--brand-deep); box-shadow: inset 0 -3px 0 var(--accent); }

.lang-switch {
  display: flex; gap: 2px; padding: 3px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--surface);
  font-family: var(--font-body);
}
.lang-switch a {
  text-decoration: none; color: var(--muted);
  font-size: .82rem; padding: .2em .7em; border-radius: 3px; line-height: 1.7;
}
.lang-switch a[lang="en"] { font-family: var(--font-en); }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a[aria-current="true"] { background: var(--brand); color: var(--on-brand); }

.nav-toggle { display: none; }
.nav-burger { display: none; }

@media (max-width: 960px) {
  .site-header .wrap { justify-content: space-between; }
  .nav-burger {
    display: flex; align-items: center; gap: 10px;
    height: 42px; padding-inline: 14px;
    border-radius: var(--radius-s); background: var(--brand); color: var(--on-brand);
    cursor: pointer; font-size: .95rem;
  }
  .nav-burger span, .nav-burger span::before, .nav-burger span::after {
    content: ""; display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
  }
  .nav-burger span::before { position: absolute; top: -6px; }
  .nav-burger span::after { position: absolute; top: 6px; }

  .nav {
    position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 6px;
    background: var(--surface);
    border-block-end: 1px solid var(--line);
    padding: 12px var(--gutter) 16px;
    display: none;
  }
  .nav a { padding: .75em 1em; }
  .nav-toggle:checked ~ .nav { display: flex; }
}

/* ---------- 5. Hero ---------- */
.hero { padding-block: clamp(40px, 7vw, 88px) var(--section); overflow: hidden; }
.hero .wrap {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.hero__kicker { color: var(--brand); font-weight: 600; margin-block-end: 12px; }
.hero__name {
  font-size: clamp(2.8rem, 7.5vw, 5.4rem);
  line-height: 1.15;
  margin-block-end: .25em;
  letter-spacing: -.01em;
}
html[lang="en"] .hero__name { line-height: 1; letter-spacing: -.02em; }
.hero__role { font-size: 1.15rem; color: var(--muted); margin-block-end: 28px; max-width: 34em; }
.hero__lead {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  line-height: 1.8;
  padding-inline-start: 20px;
  border-inline-start: 3px solid var(--brand);
  margin-block-end: 32px;
  max-width: 30em;
}
html[lang="en"] .hero__lead { line-height: 1.5; font-style: italic; font-weight: 400; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero__portrait { position: relative; justify-self: center; width: min(100%, 420px); }
.hero__portrait::before {
  content: "";
  position: absolute;
  inset: 28px -28px -28px 28px;
  background: var(--tint-strong);
  border-radius: var(--radius-l) var(--radius-l) var(--radius-l) 4px;
  z-index: 0;
}
[dir="rtl"] .hero__portrait::before { inset: 28px 28px -28px -28px; border-radius: var(--radius-l) var(--radius-l) 4px var(--radius-l); }
.hero__portrait img {
  position: relative; z-index: 1;
  width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 20%;
  border-radius: var(--radius-l) var(--radius-l) 4px var(--radius-l);
  box-shadow: var(--shadow);
}
[dir="rtl"] .hero__portrait img { border-radius: var(--radius-l) var(--radius-l) var(--radius-l) 4px; }
.hero__badge {
  position: absolute; z-index: 2;
  inset-block-end: 24px; inset-inline-start: -24px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-m); padding: 12px 16px;
  box-shadow: var(--shadow); font-size: .85rem; line-height: 1.5; max-width: 220px;
}
.hero__badge strong { display: block; font-size: 1rem; color: var(--brand-deep); }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero__portrait { order: -1; width: min(72%, 300px); margin-block-end: 20px; }
  .hero__badge { inset-inline-start: auto; inset-inline-end: -12px; }
}

/* ---------- 6. Stats strip (real counts from CV) ---------- */
.facts {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-block: 1px solid var(--line);
}
.facts div { padding: 24px 16px; text-align: center; }
.facts div + div { border-inline-start: 1px solid var(--line); }
.facts b { display: block; font-family: var(--font-display); font-size: 2rem; color: var(--brand-deep); line-height: 1.3; }
.facts span { color: var(--muted); font-size: .9rem; }
@media (max-width: 640px) {
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts div:nth-child(3) { border-inline-start: 0; }
  .facts div:nth-child(n+3) { border-block-start: 1px solid var(--line); }
}

/* ---------- 7. Research interests ---------- */
.interests { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.interests li {
  padding: .5em 1.1em; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: .95rem;
}

/* ---------- 8. Publication list (rows, not cards) ---------- */
.pub-list { list-style: none; margin: 0; padding: 0; }
.pub {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 8px 24px;
  padding-block: 22px;
  border-block-end: 1px solid var(--line);
  align-items: start;
}
.pub__year { font-family: var(--font-display); font-weight: 700; color: var(--muted); font-size: 1.1rem; }
.pub__title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; line-height: 1.6; margin: 0 0 4px; }
html[lang="en"] .pub__title { font-weight: 600; line-height: 1.35; }
.pub__title a { color: var(--ink); text-decoration: none; }
.pub__title a:hover { color: var(--brand); text-decoration: underline; }
.pub__venue { color: var(--muted); font-size: .92rem; margin: 0; }
.pub__venue em { font-style: normal; color: var(--ink); }
.pub__side { display: flex; flex-direction: column; align-items: end; gap: 6px; }
@media (max-width: 640px) {
  .pub { grid-template-columns: 1fr; }
  .pub__year { font-size: .95rem; }
  .pub__side { flex-direction: row; align-items: center; }
}

/* ---------- 9. Books shelf ---------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px; }
.book { text-decoration: none; color: var(--ink); display: block; }
.book__cover {
  aspect-ratio: 2 / 3;
  border-radius: 3px 10px 10px 3px;
  padding: 18px 16px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: var(--brand); color: var(--on-brand);
  box-shadow: inset 6px 0 0 rgba(0, 0, 0, .15), var(--shadow);
  font-family: var(--font-display);
  transition: transform .25s;
}
[dir="rtl"] .book__cover { border-radius: 10px 3px 3px 10px; box-shadow: inset -6px 0 0 rgba(0, 0, 0, .15), var(--shadow); }
.book:hover .book__cover { transform: translateY(-4px); }
.book__cover b { font-size: 1.05rem; line-height: 1.7; }
.book__cover small { font-family: var(--font-body); font-size: .75rem; opacity: .85; }
.book--ink .book__cover { background: #3a4a6e; color: #fff; }
.book--tint .book__cover { background: var(--tint-strong); color: var(--ink); }
.book--brick .book__cover { background: #7d4335; color: #fff; }
.book__meta { margin-block-start: 12px; font-size: .88rem; color: var(--muted); line-height: 1.6; }

/* ---------- 10. Video grid ---------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 28px; }
.video-card { text-decoration: none; color: var(--ink); display: block; }
.video-card__thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius-m); overflow: hidden;
  background: linear-gradient(135deg, #1d2b53, #3c4f7d);
}
.video-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-card__play {
  position: absolute; inset: 0; margin: auto;
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  display: grid; place-items: center;
  transition: transform .2s;
}
.video-card__play::after {
  content: ""; width: 0; height: 0;
  border-block: 10px solid transparent;
  border-inline-start: 16px solid #1d2b53;
  margin-inline-start: 4px;
}
[dir="rtl"] .video-card__play::after { border-inline-start: 0; border-inline-end: 16px solid #1d2b53; margin-inline-start: 0; margin-inline-end: 4px; transform: scaleX(-1); }
.video-card:hover .video-card__play { transform: scale(1.08); }
.video-card__time {
  position: absolute; inset-block-end: 10px; inset-inline-end: 10px;
  background: rgba(0, 0, 0, .7); color: #fff; font-size: .78rem; padding: 2px 8px; border-radius: 4px;
}
.video-card h3 { margin: 14px 0 4px; font-size: 1.1rem; line-height: 1.6; }
.video-card p { margin: 0; color: var(--muted); font-size: .9rem; }

.player { aspect-ratio: 16 / 9; border-radius: var(--radius-m); overflow: hidden; background: #000; }
.player iframe, .player video { width: 100%; height: 100%; border: 0; }

/* ---------- 11. Writings (essays / notes) ---------- */
.writing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 40px; }
.writing {
  padding-block: 24px;
  border-block-start: 1px solid var(--line);
}
.writing__meta { font-size: .85rem; color: var(--muted); margin-block-end: 6px; }
.writing h3 { font-size: 1.2rem; line-height: 1.6; margin-block-end: 8px; }
.writing h3 a { color: var(--ink); text-decoration: none; }
.writing h3 a:hover { color: var(--brand); }
.writing p { color: var(--muted); font-size: .95rem; margin: 0; }

/* ---------- 12. Page header (inner pages) ---------- */
.page-head { padding-block: clamp(40px, 6vw, 72px) 32px; background: var(--tint); }
.page-head h1 { margin-block-end: 8px; }
.page-head p { color: var(--muted); max-width: 40em; margin: 0; }
.breadcrumb { font-size: .88rem; color: var(--muted); margin-block-end: 12px; }
.breadcrumb a { color: var(--muted); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-block: 28px 8px; }
.filter-bar a {
  text-decoration: none; padding: .4em 1em; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink); font-size: .9rem; background: var(--surface);
}
.filter-bar a:hover, .filter-bar a[aria-current="true"] { border-color: var(--brand); color: var(--brand-deep); background: var(--tint); }

.search-box { display: flex; gap: 8px; max-width: 460px; margin-block-start: 24px; }
.search-box input {
  flex: 1; font: inherit; padding: .65em 1.1em; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}

.group-title { margin-block: 48px 4px; font-size: 1.4rem; scroll-margin-top: 96px; }
.group-title small { font-family: var(--font-body); font-weight: 400; font-size: .9rem; color: var(--muted); margin-inline-start: 8px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-block-start: 48px; }
.pagination a, .pagination span {
  min-width: 42px; height: 42px; display: grid; place-items: center; padding-inline: 10px;
  border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink);
}
.pagination span[aria-current] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- 13. Article (single) ---------- */
.article-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 56px;
  padding-block: 48px var(--section);
}
@media (max-width: 960px) { .article-layout { grid-template-columns: 1fr; } }

.article-head { padding-block: clamp(40px, 6vw, 72px) 40px; border-block-end: 1px solid var(--line); }
.article-head h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); line-height: 1.5; max-width: 22em; }
html[lang="en"] .article-head h1 { line-height: 1.2; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: .92rem; margin-block-start: 16px; }
.article-meta span::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-inline-end: 8px; vertical-align: middle; }

.abstract {
  background: var(--tint); border-radius: var(--radius-m);
  padding: 24px 28px; margin-block-end: 40px;
}
.abstract h2 { font-size: 1.1rem; margin-block-end: 8px; }
.abstract p:last-child { margin: 0; }
.keywords { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 14px; }

.prose { max-width: 68ch; font-size: 1.1rem; line-height: 2.05; }
html[lang="en"] .prose { line-height: 1.75; font-family: var(--font-display); font-size: 1.2rem; }
.prose h2 { font-size: 1.6rem; margin-block: 2em .6em; }
.prose h3 { font-size: 1.25rem; margin-block: 1.6em .5em; }
.prose blockquote {
  margin: 2em 0; padding: 4px 24px;
  border-inline-start: 3px solid var(--brand);
  font-family: var(--font-display); font-size: 1.25rem; color: var(--brand-deep);
}
.prose figure { margin: 2em 0; }
.prose figure img { border-radius: var(--radius-m); width: 100%; }
.prose figcaption { font-size: .88rem; color: var(--muted); margin-block-start: 8px; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li { margin-block-end: .4em; }
.prose sup a { text-decoration: none; }

.references { font-size: .92rem; color: var(--muted); border-block-start: 1px solid var(--line); margin-block-start: 48px; padding-block-start: 24px; }
.references ol { padding-inline-start: 1.4em; }

.aside-box { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; margin-block-end: 20px; background: var(--surface); }
.aside-box h3 { font-size: 1rem; margin-block-end: 12px; font-family: var(--font-body); }
.aside-sticky { position: sticky; top: 96px; }
.toc { list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.toc li { padding-block: 6px; border-block-end: 1px dashed var(--line); }
.toc li:last-child { border: 0; }
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--brand); }
.cite-box { font-size: .85rem; line-height: 1.7; color: var(--muted); background: var(--bg); padding: 12px; border-radius: var(--radius-s); margin: 0 0 12px; }
.share { display: flex; gap: 8px; flex-wrap: wrap; }
.share a {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink); text-decoration: none; font-size: .78rem; font-weight: 700;
}
.share a:hover { background: var(--tint); }

.author-box {
  display: flex; gap: 20px; align-items: center;
  border-block: 1px solid var(--line); padding-block: 24px; margin-block-start: 48px;
}
.author-box img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; object-position: center 20%; }
.author-box p { margin: 0; color: var(--muted); font-size: .95rem; }
.author-box strong { color: var(--ink); font-size: 1.05rem; }

/* ---------- 14. About / CV ---------- */
.about-intro { display: grid; grid-template-columns: 300px 1fr; gap: 56px; align-items: start; }
.about-intro img { border-radius: var(--radius-l); aspect-ratio: 4 / 5; object-fit: cover; object-position: center 20%; width: 100%; }
@media (max-width: 800px) { .about-intro { grid-template-columns: 1fr; } .about-intro img { max-width: 280px; } }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; inset-block: 8px; inset-inline-start: 7px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding-inline-start: 40px; padding-block-end: 28px; }
.timeline li::before {
  content: ""; position: absolute; inset-inline-start: 0; top: 8px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--brand);
}
.timeline time { font-size: .88rem; color: var(--brand); font-weight: 600; }
.timeline h3 { margin: 2px 0 4px; font-size: 1.15rem; }
.timeline p { margin: 0; color: var(--muted); font-size: .95rem; }

.cv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 40px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding-block: 10px; border-block-end: 1px solid var(--line); font-size: .95rem; }
.plain-list li b { display: block; font-weight: 600; }
.plain-list li span { color: var(--muted); font-size: .88rem; }

/* ---------- 15. Contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.2fr; gap: 56px; }
@media (max-width: 860px) { .contact { grid-template-columns: 1fr; } }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; gap: 14px; align-items: baseline; padding-block: 12px; border-block-end: 1px solid var(--line); }
.contact-list li b { min-width: 90px; font-weight: 600; color: var(--muted); font-size: .9rem; }
.contact-list a { word-break: break-word; }

.form { display: grid; gap: 16px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .form .row { grid-template-columns: 1fr; } }
.form label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; }
.form input, .form textarea, .form select {
  font: inherit; font-weight: 400; font-size: 1rem;
  padding: .7em 1em; border-radius: var(--radius-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.form textarea { min-height: 150px; resize: vertical; }
.form input:focus, .form textarea:focus, .form select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }

/* ---------- 16. Footer ---------- */
.site-footer { background: #121c3a; color: #c9d1d9; padding-block: 56px 28px; font-size: .95rem; }
.site-footer a { color: #e8ecef; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #fff; }
.site-footer h3 { color: #fff; font-size: 1.05rem; font-family: var(--font-body); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-bottom { margin-block-start: 40px; padding-block-start: 20px; border-block-start: 1px solid #2a3558; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: .85rem; color: #8b98a5; }
.footer-seal { display: flex; align-items: center; gap: 12px; }
.footer-seal img { width: 72px; height: 72px; }
.seal { width: 150px; height: auto; }
.socials { display: flex; gap: 8px; margin-block-start: 16px; }
.socials a {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid #34406a;
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
}
.socials a:hover { background: #2c3d6e; border-color: #2c3d6e; text-decoration: none; }

/* ---------- 17. Print ---------- */
@media print {
  .site-header, .site-footer, .aside-col, .share, .hero__actions { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ---------- 18. Brand helpers ---------- */
.about-intro img.seal { width: 150px; aspect-ratio: auto; border-radius: 0; object-fit: contain; }
html[lang="ckb"] .masthead__tag { height: 52px; }
@media (max-width: 760px) { html[lang="ckb"] .masthead__tag { height: 30px; } }

/* =========================================================
   19. Dynamic site (PHP) additions
   ========================================================= */
.flashes { padding-block-start: 16px; display: grid; gap: 8px; }
.flash { padding: 12px 18px; border-radius: var(--radius-s); font-weight: 600; border-inline-start: 4px solid; background: var(--surface); }
.flash--ok { border-color: #2f7d55; color: #1e5a3c; background: #e5f2ea; }
.flash--err { border-color: #b4432f; color: #8a2f20; background: #f9e7e3; }
.hp { position: absolute !important; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.empty { padding: 40px 0; color: var(--muted); text-align: center; }
.section--tight { padding-block-start: 8px; }
.muted { color: var(--muted); }
.lead { font-size: 1.2rem; color: var(--ink); margin-block: 0 1.4em; max-width: 68ch; }
.btn--block { width: 100%; justify-content: center; margin-block-start: 8px; }
.filter-bar small { color: var(--muted); font-size: .8em; margin-inline-start: 4px; }
.group-title { margin-block: 56px 20px; }

/* facts: column count follows the number of items */
.facts { grid-template-columns: repeat(var(--n, 4), 1fr); }
@media (max-width: 640px) { .facts { grid-template-columns: repeat(2, 1fr); } }

/* rich content written in the panel editor */
.prose--wide { max-width: none; }
.prose a:not(.btn) { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.prose mark { background: #fde68a; color: inherit; padding: 1px 4px; border-radius: 4px; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 32px 0; }
.prose pre { background: var(--brand-deep); color: #e7ecf7; padding: 16px 20px; border-radius: var(--radius-m); direction: ltr; text-align: left; overflow-x: auto; font: 13px/1.8 ui-monospace, monospace; white-space: pre-wrap; }
.prose .ta-center { text-align: center; }
.prose .ta-left { text-align: left; }
.prose .ta-right { text-align: right; }
.prose .ta-justify { text-align: justify; }
.prose figure.w-25 { width: 25%; }
.prose figure.w-50 { width: 50%; }
.prose figure.w-75 { width: 75%; }
.prose figure.w-100 { width: 100%; }
.prose figure.fig-right { float: right; margin: 6px 0 16px 26px; }
.prose figure.fig-left { float: left; margin: 6px 26px 16px 0; }
.prose figure.fig-center { margin-inline: auto; clear: both; }
.prose img { max-width: 100%; height: auto; }
.prose table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: .95em; line-height: 1.9; }
.prose th, .prose td { border: 1px solid var(--line); padding: 10px 16px; text-align: start; vertical-align: top; }
.prose th { background: var(--tint); font-weight: 700; }
.prose table.tbl-striped tbody tr:nth-child(even) td { background: var(--tint); }
@media (max-width: 640px) {
  .prose table { display: block; overflow-x: auto; white-space: nowrap; }
  .prose figure.w-25, .prose figure.w-50, .prose figure.w-75 { width: 100%; float: none; margin: 20px 0; }
}
/* CV text: section headings get a rule, lists read as a record */
.prose--cv { max-width: none; }
.prose--cv h2 { padding-block-end: 10px; border-block-end: 1px solid var(--line); margin-block-start: 1.6em; }
.prose--cv h2:first-child { margin-block-start: 0; }
.prose--cv ul { list-style: none; padding: 0; }
.prose--cv ul li { padding: 8px 0; border-block-end: 1px dashed var(--line); margin: 0; }

.cover { margin: 0 0 32px; }
.cover img { width: 100%; border-radius: var(--radius-m); }

/* books */
.book__cover--navy { background: var(--brand); color: #fff; }
.book__cover--ink { background: #3a4a6e; color: #fff; }
.book__cover--sage { background: var(--tint-strong); color: var(--ink); }
.book__cover--brick { background: #7d4335; color: #fff; }
.book__cover--gold { background: #b08a4f; color: #fff; }
.book__cover--img { padding: 0; overflow: hidden; background: var(--tint); }
.book__cover--img img { width: 100%; height: 100%; object-fit: cover; }
.book__meta .tag { margin-block-end: 6px; }
.book-detail { display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: start; }
.book-detail__cover .book__cover { aspect-ratio: 2 / 3; }
.book-detail__cover .book__cover b { font-size: 1.4rem; }
.book-detail h1 { margin-block: 14px 6px; }
.book-detail__sub { font-size: 1.2rem; color: var(--muted); }
.book-detail__facts { max-width: 520px; margin-block: 16px 24px; }
.book-detail__facts li { display: flex; gap: 16px; }
.book-detail__facts li b { min-width: 120px; color: var(--muted); font-weight: 600; }
@media (max-width: 760px) { .book-detail { grid-template-columns: 1fr; } .book-detail__cover { max-width: 220px; } }

/* video */
.wrap--video { width: min(100% - 2 * var(--gutter), 960px); margin-inline: auto; }
.video-title { font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin-block: 28px 8px; }
.player__empty { height: 100%; display: grid; place-items: center; color: #fff; }
.video-card__thumb img { position: absolute; inset: 0; }

/* about */
.about-side { display: grid; gap: 24px; justify-items: center; }
.about-side .about-photo { width: 100%; }

/* 404 */
.nf { text-align: center; }
.nf__code { font-family: var(--font-display); font-size: clamp(4rem, 12vw, 8rem); line-height: 1; color: var(--brand); margin: 0 0 12px; }
.wrap--narrow .search-box { margin-inline: auto; }

/* footer credit */
.zh-copyright a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.share button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); background: none; cursor: pointer; font: inherit; font-size: .9rem; }
.share button:hover { background: var(--tint); }
.contact-list li span { overflow-wrap: anywhere; }
