/* ─── FONT CLASSES ─── */
.font-tajawal      { --body-font: 'Tajawal', sans-serif;        --display-font: 'Amiri', serif; }
.font-cairo        { --body-font: 'Cairo', sans-serif;          --display-font: 'Cairo', sans-serif; }
.font-amiri        { --body-font: 'Amiri', serif;               --display-font: 'Amiri', serif; }
.font-scheherazade { --body-font: 'Scheherazade New', serif;    --display-font: 'Scheherazade New', serif; }
.font-naskh        { --body-font: 'Noto Naskh Arabic', serif;   --display-font: 'Noto Naskh Arabic', serif; }

/* ─── LIGHT THEME ─── */
:root {
  --ink:            #1a1208;
  --paper:          #f5f0e8;
  --sepia:          #c8a96e;
  --rust:           #8b3a2a;
  --charcoal:       #3d3530;
  --muted:          #7a6e62;
  --line:           #d9ccb8;
  --highlight:      #f0e6cc;
  --toolbar-bg:     rgba(245,240,232,0.93);
  --toolbar-border: #d9ccb8;
  --btn-bg:         #ede5d4;
  --btn-active:     #8b3a2a;
  --btn-text:       #3d3530;
  --btn-active-txt: #fff;
}

/* ─── DARK THEME ─── */
.dark {
  --ink:            #e8dfd0;
  --paper:          #13100c;
  --sepia:          #9e7840;
  --rust:           #c97a58;
  --charcoal:       #bfb0a0;
  --muted:          #897b6d;
  --line:           #2a2318;
  --highlight:      #1c1710;
  --toolbar-bg:     rgba(19,16,12,0.95);
  --toolbar-border: #2a2318;
  --btn-bg:         #1c1710;
  --btn-active:     #c97a58;
  --btn-text:       #bfb0a0;
  --btn-active-txt: #13100c;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--body-font, 'Tajawal', sans-serif);
  font-size: 18px;
  line-height: 1.95;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(ellipse at 20% 10%, rgba(200,169,110,0.1) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 90%, rgba(139,58,42,0.07) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ─── TOOLBAR ─── */
.toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--toolbar-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 22px;
  gap: 14px;
  flex-wrap: wrap;
  transition: background 0.3s, border-color 0.3s;
}
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-label { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 1.5px; white-space: nowrap; transition: color 0.3s; }
.font-btn {
  background: var(--btn-bg); border: 1px solid var(--line); color: var(--btn-text);
  padding: 4px 12px; border-radius: 4px; font-size: 13px; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.font-btn:hover  { border-color: var(--sepia); color: var(--rust); }
.font-btn.active { background: var(--btn-active); color: var(--btn-active-txt); border-color: var(--btn-active); }
.dark-toggle { display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; flex-shrink: 0; }
.toggle-icon { font-size: 15px; line-height: 1; }
.toggle-track { width: 38px; height: 21px; background: var(--line); border-radius: 11px; position: relative; transition: background 0.3s; flex-shrink: 0; }
.toggle-thumb { position: absolute; top: 2.5px; right: 2.5px; width: 16px; height: 16px; background: var(--rust); border-radius: 50%; transition: transform 0.3s, background 0.3s; }
.dark .toggle-thumb { transform: translateX(-17px); }

/* ─── PAGE WRAPPER ─── */
.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 98px 40px 100px;
  position: relative;
  z-index: 1;
}
.page::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 4px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--sepia) 15%, var(--sepia) 85%, transparent);
  opacity: 0.4;
  transition: opacity 0.3s;
}

/* ─── ARTICLE HEADER ─── */
header {
  border-bottom: 2px solid var(--sepia);
  padding-bottom: 40px;
  margin-bottom: 60px;
  text-align: center;
  animation: fadeIn 1s ease both;
  transition: border-color 0.3s;
}
.label {
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--rust);
  display: block;
  margin-bottom: 20px;
  transition: color 0.3s;
}
h1 { font-family: var(--display-font, 'Amiri', serif); font-size: clamp(2.4rem, 5vw, 3.8rem); font-weight: 700; color: var(--ink); line-height: 1.3; margin-bottom: 16px; transition: color 0.3s, font-family 0.1s; }
.subtitle {
  font-family: var(--display-font, 'Amiri', serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
  text-align: center;
  transition: color 0.3s, font-family 0.1s;
}

/* ─── ORNAMENT ─── */
.ornament { text-align: center; color: var(--sepia); font-size: 1.3rem; margin: 50px 0; opacity: 0.6; letter-spacing: 16px; transition: color 0.3s; }

/* ─── SECTIONS ─── */
section { margin-bottom: 60px; animation: fadeIn 0.8s ease both; }
section:nth-child(2)  { animation-delay: 0.07s; }
section:nth-child(3)  { animation-delay: 0.14s; }
section:nth-child(4)  { animation-delay: 0.21s; }
section:nth-child(5)  { animation-delay: 0.28s; }
section:nth-child(6)  { animation-delay: 0.35s; }
section:nth-child(7)  { animation-delay: 0.42s; }
section:nth-child(8)  { animation-delay: 0.49s; }
section:nth-child(9)  { animation-delay: 0.56s; }
section:nth-child(10) { animation-delay: 0.63s; }
section:nth-child(11) { animation-delay: 0.70s; }

h2 {
  font-family: var(--display-font, 'Amiri', serif);
  font-size: 1.55rem; font-weight: 700; color: var(--rust);
  margin-bottom: 24px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  transition: color 0.3s, border-color 0.3s, font-family 0.1s;
}
h2 .num {
  font-family: 'Tajawal', sans-serif; font-weight: 300; font-size: 0.72rem;
  color: var(--sepia); border: 1px solid var(--sepia); padding: 2px 8px;
  border-radius: 2px; letter-spacing: 2px; flex-shrink: 0; transition: color 0.3s, border-color 0.3s;
}

p { margin-bottom: 22px; color: var(--charcoal); text-align: justify; font-weight: 400; transition: color 0.3s; }
p:last-child { margin-bottom: 0; }

blockquote {
  border-right: 4px solid var(--rust); padding: 18px 24px 18px 0;
  margin: 36px 0; background: var(--highlight); border-radius: 0 4px 4px 0;
  transition: background 0.3s, border-color 0.3s;
}
blockquote p { font-family: var(--display-font, 'Amiri', serif); font-size: 1.1rem; font-style: italic; color: var(--rust); margin: 0; line-height: 1.85; }

strong { color: var(--ink); font-weight: 700; transition: color 0.3s; }
em     { font-style: italic; color: var(--rust); transition: color 0.3s; }

/* Term pill */
  .term {
    display: inline-block;
    background: var(--highlight);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 1px 7px;
    font-size: 0.88em;
    color: var(--muted);
    font-family: 'Tajawal', sans-serif;
    font-weight: 400;
    white-space: nowrap;
    transition: background 0.3s, border-color 0.3s, color 0.3s;
  }

/* ─── VERSE (Quran) ─── */
.verse {
  text-align: center;
  font-family: var(--display-font, 'Amiri', serif);
  font-size: 1.25rem;
  color: var(--rust);
  margin: 36px 0;
  padding: 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  line-height: 2;
  transition: color 0.3s, border-color 0.3s, font-family 0.1s;
}

.verse p {
  color: var(--rust);
  font-family: var(--display-font, 'Amiri', serif);
  font-size: 1.25rem;
  text-align: center;
  margin: 0;
}

/* ─── HADITH ─── */
.hadith {
  margin: 36px 0;
  padding: 20px 24px;
  border-right: 4px solid var(--sepia);
  background: var(--highlight);
  border-radius: 0 4px 4px 0;
  transition: background 0.3s, border-color 0.3s;
}
.hadith-label {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--sepia);
  font-weight: 500;
  display: block;
  margin-bottom: 10px;
  transition: color 0.3s;
}
.hadith p {
  font-family: var(--display-font, 'Amiri', serif);
  font-size: 1.1rem;
  color: var(--charcoal);
  margin: 0;
  line-height: 1.9;
}

/* ─── IMAGE CAPTION ─── */
.article-image {
  margin: 36px 0;
  text-align: center;
}
.article-image img {
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--line);
  transition: border-color 0.3s;
}
.article-image figcaption {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  transition: color 0.3s;
}

/* ─── TIMELINE ─── */
.timeline {
  margin: 36px 0;
  border-right: 3px solid var(--sepia);
  padding-right: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: border-color 0.3s;
}
.timeline-item { position: relative; }
.timeline-item::before {
  content: '';
  position: absolute;
  top: 8px; right: -31px;
  width: 10px; height: 10px;
  background: var(--rust);
  border-radius: 50%;
  transition: background 0.3s;
}
.timeline-label {
  font-family: 'Tajawal', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--sepia);
  letter-spacing: 1.5px;
  display: block;
  margin-bottom: 4px;
  transition: color 0.3s;
}
.timeline-item p { margin-bottom: 0; }

/* ─── FOOTER ─── */
footer {
  margin-top: 80px; padding-top: 30px;
  border-top: 1px solid var(--line);
  text-align: center; color: var(--muted); font-size: 0.85rem; font-weight: 300;
  transition: color 0.3s, border-color 0.3s;
}

/* ─── HOMEPAGE ─── */
.home-header {
  border-bottom: 2px solid var(--sepia);
  padding-bottom: 40px;
  margin-bottom: 60px;
  animation: fadeIn 1s ease both;
}
.home-header h1 { text-align: right; }
.home-header .subtitle { text-align: right; display: block; margin-top: 12px; }

.articles-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.articles-list li {
  border-bottom: 1px solid var(--line);
  animation: fadeIn 0.8s ease both;
  transition: border-color 0.3s;
}
.articles-list li:nth-child(1) { animation-delay: 0.05s; }
.articles-list li:nth-child(2) { animation-delay: 0.10s; }
.articles-list li:nth-child(3) { animation-delay: 0.15s; }
.articles-list li:nth-child(4) { animation-delay: 0.20s; }
.articles-list li:nth-child(5) { animation-delay: 0.25s; }

.articles-list a {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 24px 0;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s;
}
.articles-list a:hover { opacity: 0.7; }

.article-title {
  font-family: var(--display-font, 'Amiri', serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  transition: color 0.3s, font-family 0.1s;
}
.article-subtitle {
  font-family: var(--display-font, 'Amiri', serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
  flex: 1;
  transition: color 0.3s, font-family 0.1s;
}
.article-date {
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--sepia);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.3s;
}

/* ─── ANIMATIONS ─── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  .page  { padding: 90px 20px 70px; }
  body   { font-size: 17px; }
  .toolbar { padding: 8px 12px; }
  .font-btn { padding: 3px 9px; font-size: 12px; }
  .articles-list a { flex-wrap: wrap; gap: 6px; }
}
