@import url('https://fonts.googleapis.com/css2?family=Aref+Ruqaa:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400..700&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-size-root: 16px;
  --bg:        #0a0a0a;
  --bg-card:   #111111;
  --border:    #1f1f1f;
  --border-h:  #2e2e2e;
  --text:      #ededed;
  --muted:     #666;
  --muted-2:   #444;
  --accent:    #b87fff;
  --highlight-color: rgba(184, 127, 255, 0.3);
  --accent-dim: rgba(184,127,255,0.12);
  --font-ar:   'IBM Plex Sans Arabic', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-hand:   'Aref Ruqaa', sans-serif;
  --font-naskh:   'Noto Naskh Arabic', sans-serif;
  --panel-bg: #111;
  --hr-op: .25;
  --mark:    #e74c3c;
}

[data-theme="light"] {
  --bg:        #fafafa;
  --bg-card:   #f2f2f2;
  --border:    #e2e2e2;
  --border-h:  #c8c8c8;
  --text:      #111111;
  --muted:     #888;
  --muted-2:   #bbb;
  --accent:    #7c3aed;
  --highlight-color: rgba(124, 58, 237, 0.2);
  --panel-bg: rgba(245,245,245,0.96);
  --accent-dim: rgba(124,58,237,0.08);
  --hr-op: 1;
  --mark:    #4caf82;
}

html {
  font-size: var(--font-size-root, 16px);
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ar);
  font-size: 1.1rem;
  line-height: 1.8;
  min-height: 100vh;
  transition: background 0.2s ease, color 0.2s;
}

::selection {
  background-color: var(--text); 
  color: var(--bg);
}

#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
  flex-shrink: 0;
}
#theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-h);
  background: var(--bg-card);
}
#theme-toggle svg { display: block; transition: opacity .2s; }
.state {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 3rem 0;
}

.font-control-panel {
  position: fixed;
  z-index: 1000;
  background: var(--panel-bg);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  padding: 0.75rem;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
  font-family: var(--font-mono);
  top: 3.8rem;
  right: 50%;
  transform: translateX(50%);
  flex-direction: row;
  justify-content: center;
  align-items: center ;
  gap: 0.6rem;
  border-radius: 2rem;
  width: 85vw ;
  max-width: 800px;
  direction: ltr;
  margin: 0 auto;
}

.font-control-panel button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  width: 44px;
  height: 44px;
  border-radius: 2rem;
  cursor: pointer;
  display: inline-flex;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.font-control-panel button:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  margin: 0 4px;
  min-width: 72px;
  border-radius: 8px;
}

.font-control-panel .reset-btn {
  display: inline-block;
  justify-content: center;
  align-items: center;
  background: transparent;
  border-color: var(--muted-2);
  font-size: 1rem;
  letter-spacing: 0.5px;
  width: fit-content;
  padding: 0 1rem 8px;
}

.font-label {
  font-size: 0.65rem;
  color: var(--muted);
  position: fixed;
  right: 16px;
}

@media (max-width: 600px) {
  .font-label {
    display: none;
  }
}

[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] nav  { background: rgba(250,250,250,0.85); }
[data-theme="light"] footer { background: rgba(250,250,250,0.92); }
[data-theme="light"] #article-body { color: #333; }
[data-theme="light"] #article-body blockquote { background: #f0f0f0; color: #555; }
[data-theme="light"] #article-body code { background: #ececec; color: #333; border-color: var(--border); }
[data-theme="light"] #article-body pre  { background: #f0f0f0; }
[data-theme="light"] #article-body pre code { color: #444; }

nav {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  background: rgba(10,10,10,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

nav .back {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s;
}
nav .back:hover { color: var(--text); }
nav .logo {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-decoration: none;
}
nav .logo:hover { color: var(--text); }
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.font-panel-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.font-panel-toggle:hover {
  color: var(--text);
  border-color: var(--border-h);
  background: var(--bg-card);
}

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

.article-header {
  margin-bottom: 3rem;
}
.article-header .breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted-2);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.article-header .breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}
#article-title {
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.article-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.article-info .tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: #161616;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 3px;
}
.article-info .date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}
#article-body { color: #c9c9c9; }
#article-body h1,
#article-body h2,
#article-body h3,
#article-body h4 {
  color: var(--text);
  font-weight: 600;
  margin: 2.5rem 0 .8rem;
  line-height: 1.4;
}
#article-body h1 { font-size: 1.6rem; 
  border-bottom: 1px solid var(--border);
}
#article-body h2 { font-size: 1.3rem; 
   padding-bottom: .5rem; }
#article-body h3 { font-size: 1.1rem; }
#article-body p { margin-bottom: 1.3rem; text-indent: 1rem; }
p, li { text-align: justify; }
#article-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
#article-body a:hover { border-color: var(--accent); }
#article-body strong { color: var(--text); font-weight: 600; }
#article-body ul,
#article-body ol {
  padding-right: 14px;
  margin-bottom: 1.3rem;
}
#article-body blockquote {
  border-right: 3px solid var(--accent);
  padding: .8rem 1.2rem;
  margin: 1.5rem 0;
  background: #111;
  border-radius: 0 6px 6px 0;
  color: #999;
}
#article-body code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: #151515;
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}
#article-body pre {
  background: #0e0e0e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}
#article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8rem;
}
#article-body mark {
  background: linear-gradient(0deg, var(--mark) 40%, transparent 40%);
  padding: 0 2px;
  color: var(--text);
}
footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: .9rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: rgba(10,10,10,0.9);
  backdrop-filter: blur(4px);
  border-top: 1px solid var(--border);
  z-index: 55;
}
.footer {
  padding: 2rem 0 0;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 1.8rem;
  word-spacing: 8px;
  color: var(--muted);
  a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
  }
}
@media (max-width: 600px) {
  nav { padding: 0 1rem; }
  main { padding: 2rem 1rem 5rem; }
}
hr {
  border: none;
  height: 40px;
  background: url("https://0xdya.vercel.app/img/hr3.webp") no-repeat center;
  background-size: contain;
  opacity: var(--hr-op);
}