/* ─── Design tokens ─────────────────────────────────────────────────────── */
:root {
  --green-900: #0d2b1e;
  --green-800: #1B4332;
  --green-700: #2D6A4F;
  --green-600: #40916C;
  --green-400: #74C69D;
  --green-100: #D8F3DC;
  --green-50:  #F0FAF3;

  --gold-500:  #B8966E;
  --gold-400:  #C9A84C;
  --gold-100:  #F5EDD5;

  --cream:     #FAFAF7;
  --white:     #FFFFFF;
  --text-900:  #1A1A18;
  --text-700:  #3D3D3A;
  --text-500:  #6B6B67;
  --text-300:  #AEAEAA;
  --border:    #E5E5E1;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.1);
  --radius:    10px;
  --radius-sm: 6px;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans:  'Inter', system-ui, sans-serif;
}

/* ─── Reset & base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-700);
  background: var(--cream);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

a { color: var(--green-700); text-decoration: none; transition: color .2s; }
a:hover { color: var(--green-600); }

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

h1, h2, h3, h4, h5 {
  font-family: var(--font-serif);
  color: var(--text-900);
  line-height: 1.25;
  font-weight: 500;
}

/* ─── Layout ────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--green-800);
  color: var(--white);
  border-color: var(--green-800);
}
.btn-primary:hover {
  background: var(--green-700);
  border-color: var(--green-700);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--green-800);
  border-color: var(--green-800);
}
.btn-outline:hover {
  background: var(--green-800);
  color: var(--white);
}

.btn-ghost {
  background: transparent;
  color: var(--text-500);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--border);
  color: var(--text-700);
}

.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Tags / badges ─────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--tag-color, #1B4332) 12%, transparent);
  color: var(--tag-color, #1B4332);
}
.tag--neutral { background: var(--border); color: var(--text-500); }
.tag--lg { padding: 5px 14px; font-size: .82rem; }

/* ─── Flash messages ────────────────────────────────────────────────────── */
.flash-container { position: fixed; top: 72px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn .25s ease;
}
.flash-success { background: var(--green-100); color: var(--green-800); border-left: 3px solid var(--green-600); }
.flash-error   { background: #fde8e8; color: #991b1b; border-left: 3px solid #f87171; }
@keyframes slideIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }

/* ─── Site header ───────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250,250,247,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.site-logo {
  display: flex;
  flex-direction: column;
  gap: 0;
  text-decoration: none;
}
.logo-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-900);
  line-height: 1.2;
}
.logo-sub {
  font-size: .7rem;
  color: var(--gold-500);
  letter-spacing: .05em;
  font-family: 'Traditional Arabic', 'Scheherazade New', serif;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
}
.nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  color: var(--text-700);
  transition: all .2s;
}
.nav-links a:hover,
.nav-links a.active {
  background: var(--green-50);
  color: var(--green-800);
}

.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--text-700); border-radius: 2px; transition: all .25s; }

/* ─── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 80vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--green-800);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(64,145,108,.35) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(184,150,110,.2) 0%, transparent 50%),
    linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 60%, var(--green-700) 100%);
}

/* Decorative geometric pattern */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.025) 0, rgba(255,255,255,.025) 1px, transparent 0, transparent 50%);
  background-size: 40px 40px;
}

.hero-content {
  position: relative;
  padding: 80px 24px;
  text-align: center;
}

.hero-bismillah {
  font-family: 'Traditional Arabic', 'Scheherazade New', 'Amiri', serif;
  font-size: 1.8rem;
  color: var(--gold-400);
  margin-bottom: 28px;
  letter-spacing: .03em;
  opacity: .9;
}

.hero-name {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 400;
  color: var(--white);
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero-title {
  font-size: .95rem;
  color: var(--green-400);
  letter-spacing: .15em;
  text-transform: uppercase;
  font-weight: 400;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: 1.1rem;
  color: rgba(255,255,255,.7);
  max-width: 520px;
  margin: 0 auto 36px;
  font-weight: 300;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 56px;
}

.hero .btn-primary {
  background: var(--gold-400);
  border-color: var(--gold-400);
  color: var(--green-900);
  font-size: 1rem;
  padding: 12px 28px;
}
.hero .btn-primary:hover { background: var(--gold-500); border-color: var(--gold-500); color: var(--white); }

.hero .btn-outline {
  border-color: rgba(255,255,255,.4);
  color: var(--white);
  font-size: 1rem;
  padding: 12px 28px;
}
.hero .btn-outline:hover { background: rgba(255,255,255,.1); color: var(--white); border-color: rgba(255,255,255,.6); }

.hero-stats {
  display: flex;
  gap: 40px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 36px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.hero-stats .stat { text-align: center; }
.hero-stats .stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--gold-400);
  line-height: 1;
}
.hero-stats .stat-label {
  display: block;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.5);
  margin-top: 4px;
}

/* ─── Sections ──────────────────────────────────────────────────────────── */
.section-featured,
.section-recent { padding: 72px 0; }
.section-categories { padding: 64px 0; background: var(--white); }
.section-quote { padding: 72px 0; background: var(--green-800); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 36px;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 400;
}

.section-link { font-size: .9rem; color: var(--green-700); }
.section-link:hover { color: var(--green-600); }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.cards-grid {
  display: grid;
  gap: 24px;
}
.cards-grid--3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cards-grid--2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow .25s, transform .25s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card--featured { border-color: var(--green-100); }

.card-img { aspect-ratio: 16/9; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s; }
.card:hover .card-img img { transform: scale(1.04); }
.card-img--sm { aspect-ratio: 16/7; }

.card-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.card-title {
  font-size: 1.12rem;
  font-weight: 500;
  line-height: 1.35;
}
.card-title a { color: var(--text-900); }
.card-title a:hover { color: var(--green-700); }

.card-abstract {
  font-size: .88rem;
  color: var(--text-500);
  line-height: 1.55;
  flex: 1;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-size: .78rem;
  color: var(--text-300);
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.card-read {
  font-size: .82rem;
  font-weight: 600;
  color: var(--green-700);
  margin-top: auto;
}

/* ─── Category grid ─────────────────────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px 22px;
  background: var(--cream);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  text-align: center;
  transition: all .2s;
  text-decoration: none;
  border-top: 4px solid var(--cat-color);
}
.category-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  background: var(--white);
}

.category-count {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: var(--cat-color);
  line-height: 1;
}
.category-name {
  font-size: .82rem;
  font-weight: 500;
  color: var(--text-700);
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ─── Memorial quote ─────────────────────────────────────────────────────── */
.memorial-quote {
  text-align: center;
  max-width: 620px;
  margin: 0 auto;
}
.memorial-quote p {
  font-family: 'Traditional Arabic', 'Scheherazade New', 'Amiri', serif;
  font-size: 2.2rem;
  color: var(--gold-400);
  line-height: 1.4;
  margin-bottom: 16px;
}
.memorial-quote cite {
  display: block;
  font-style: italic;
  color: rgba(255,255,255,.55);
  font-size: .95rem;
}

/* ─── Page hero ─────────────────────────────────────────────────────────── */
.page-hero {
  background: var(--green-800);
  padding: 56px 0;
  text-align: center;
}
.page-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--white);
  font-weight: 400;
  margin-bottom: 8px;
}
.page-hero p { color: rgba(255,255,255,.6); font-size: .9rem; letter-spacing: .05em; text-transform: uppercase; }

/* ─── Works page ─────────────────────────────────────────────────────────── */
.works-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  padding-top: 48px;
  padding-bottom: 80px;
  align-items: start;
}

.works-sidebar {
  position: sticky;
  top: 80px;
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
}

.filter-group { margin-bottom: 22px; }
.filter-label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-300);
  margin-bottom: 8px;
}

.filter-input,
.filter-select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  background: var(--cream);
  color: var(--text-700);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color .2s;
}
.filter-input:focus,
.filter-select:focus { border-color: var(--green-600); }

.filter-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.filter-item {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text-500);
  transition: all .15s;
}
.filter-item:hover { background: var(--green-50); color: var(--green-800); }
.filter-item.active {
  background: var(--green-50);
  color: var(--green-800);
  font-weight: 600;
  border-left: 3px solid var(--item-color, var(--green-600));
  padding-left: 9px;
}

/* ─── Pagination ─────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 40px; flex-wrap: wrap; }
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text-700);
  border: 1.5px solid var(--border);
  transition: all .15s;
}
.page-btn:hover { border-color: var(--green-600); color: var(--green-700); }
.page-btn.active { background: var(--green-800); color: var(--white); border-color: var(--green-800); }
.page-btn:not([href]) { width: auto; padding: 0 12px; }

/* ─── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-500);
}
.empty-state p { margin-bottom: 20px; }

/* ─── Article detail ─────────────────────────────────────────────────────── */
.article-header {
  background: var(--green-800);
  padding: 56px 0 48px;
}
.article-header-inner { max-width: 840px; }

.article-breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: .8rem;
  margin-bottom: 16px;
}
.article-breadcrumb a { color: rgba(255,255,255,.6); }
.article-breadcrumb a:hover { color: var(--gold-400); }
.article-breadcrumb span { color: rgba(255,255,255,.3); }

.article-title {
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  color: var(--white);
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: 28px;
  max-width: 800px;
}

.article-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
}
.article-meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.4); }
.meta-value { font-size: .9rem; color: rgba(255,255,255,.8); }
.meta-value a { color: var(--gold-400); }

.article-cover { padding: 32px 0 0; }
.article-cover-img { border-radius: var(--radius); max-height: 420px; width: 100%; object-fit: cover; }

.article-body-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 48px;
  padding-top: 48px;
  padding-bottom: 80px;
  align-items: start;
}

.article-abstract {
  background: var(--green-50);
  border-left: 4px solid var(--green-600);
  padding: 20px 24px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 36px;
}
.article-abstract h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--green-700);
  margin-bottom: 10px;
  font-family: var(--font-sans);
  font-weight: 600;
}
.article-abstract p { color: var(--text-700); line-height: 1.7; }

.article-sidebar { position: sticky; top: 80px; }
.sidebar-block {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.sidebar-block h4 {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-300);
  margin-bottom: 12px;
  font-family: var(--font-sans);
  font-weight: 600;
}

.related-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.related-list li { display: flex; flex-direction: column; gap: 2px; }
.related-list a { font-size: .88rem; color: var(--text-700); line-height: 1.4; }
.related-list a:hover { color: var(--green-700); }
.related-year { font-size: .75rem; color: var(--text-300); }

/* ─── Prose (markdown content) ──────────────────────────────────────────── */
.prose { line-height: 1.8; color: var(--text-700); }
.prose h1,.prose h2,.prose h3,.prose h4 { margin: 2em 0 .75em; color: var(--text-900); }
.prose h2 { font-size: 1.5rem; padding-bottom: .4em; border-bottom: 1px solid var(--border); }
.prose h3 { font-size: 1.2rem; }
.prose p { margin-bottom: 1.25em; }
.prose ul,.prose ol { margin: 0 0 1.25em 1.5em; }
.prose li { margin-bottom: .4em; }
.prose blockquote { border-left: 4px solid var(--green-400); padding: 12px 20px; margin: 1.5em 0; background: var(--green-50); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-style: italic; color: var(--text-500); }
.prose code { background: var(--border); padding: 2px 6px; border-radius: 4px; font-size: .875em; }
.prose pre { background: var(--text-900); color: var(--green-400); padding: 20px; border-radius: var(--radius-sm); overflow-x: auto; margin: 1.5em 0; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: .9rem; }
.prose th,.prose td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.prose th { background: var(--cream); font-weight: 600; }
.prose a { color: var(--green-700); text-decoration: underline; }
.prose img { border-radius: var(--radius-sm); margin: 1.5em 0; }
.prose strong { color: var(--text-900); font-weight: 600; }

/* ─── About page ─────────────────────────────────────────────────────────── */
.section-about { padding: 72px 0; }
.about-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 60px;
  align-items: start;
}

.about-photo-frame {
  background: var(--green-50);
  border-radius: var(--radius);
  aspect-ratio: 3/4;
  overflow: hidden;
  border: 1px solid var(--green-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.about-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--green-600);
  font-size: .82rem;
  opacity: .6;
}
.about-photo-placeholder svg { width: 80px; height: 80px; }

.about-sidebar h3 {
  font-family: var(--font-sans);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-300);
  margin-bottom: 10px;
  font-weight: 600;
}
.about-sidebar ul { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.about-sidebar li { font-size: .9rem; color: var(--text-700); padding-left: 12px; position: relative; }
.about-sidebar li::before { content: '◆'; position: absolute; left: 0; font-size: .5rem; top: .4em; color: var(--gold-500); }

/* ─── Site footer ───────────────────────────────────────────────────────── */
.site-footer {
  background: var(--green-900);
  padding: 40px 0;
  text-align: center;
}
.footer-inner { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.footer-inna {
  font-family: 'Traditional Arabic', 'Scheherazade New', 'Amiri', serif;
  font-size: 1.4rem;
  color: var(--gold-400);
  margin-bottom: 4px;
}
.footer-name { font-family: var(--font-serif); font-size: 1.1rem; color: var(--white); font-weight: 400; }
.footer-sub { font-size: .8rem; color: rgba(255,255,255,.45); }
.footer-copy { font-size: .75rem; color: rgba(255,255,255,.25); margin-top: 6px; }

/* ─── Error page ─────────────────────────────────────────────────────────── */
.error-page { text-align: center; padding: 100px 0; }
.error-page h1 { font-size: 6rem; color: var(--green-800); opacity: .3; margin-bottom: 16px; }
.error-page p { color: var(--text-500); margin-bottom: 28px; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .works-layout { grid-template-columns: 1fr; }
  .works-sidebar { position: static; }
  .article-body-layout { grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .about-photo-frame { max-width: 240px; }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    gap: 4px;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .site-header { position: relative; }
  .hero-stats { gap: 24px; }
  .works-layout { padding-top: 28px; }
}
