/* ============================================
   BATCAVE THEME v3 — The Arkanji Blog
   IBM Plex Sans Arabic · Dark Mode · Warm Gold
   ============================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500&display=swap');

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

:root {
  --bg: #0C0C0E;
  --bg-surface: #141416;
  --bg-hover: #1a1a1e;
  --accent: #C8B88A;
  --accent-dim: rgba(200, 184, 138, 0.12);
  --text: #F0EDE6;
  --text-muted: #8A8A8F;
  --text-dim: #55555A;
  --border: #1e1e22;
  --max-width: 720px;
  --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

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

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Film grain texture */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

/* --- Header / Nav --- */
header {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(12, 12, 14, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 50;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
}

.site-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-logo-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  transition: color 0.2s;
}

.site-logo:hover .site-logo-text { color: var(--accent); }

nav { display: flex; gap: 1.8rem; }

nav a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

nav a:hover, nav a.active { color: var(--accent); }

/* --- Hero with Photo (homepage) --- */
.hero {
  padding: 5rem 0 3.5rem;
  display: flex;
  align-items: flex-start;
  gap: 2.5rem;
}

.hero-photo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
  opacity: 0;
  animation: fadeIn 0.6s ease-out 0.1s forwards;
}

.hero-text { flex: 1; }

.hero-text h1 {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
  opacity: 0;
  animation: fadeUp 0.6s ease-out 0.2s forwards;
}

.hero-text h1 .accent { color: var(--accent); }

.hero-sub {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.7;
  opacity: 0;
  animation: fadeUp 0.6s ease-out 0.35s forwards;
}

/* --- Section Divider --- */
.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border) 20%, var(--accent) 50%, var(--border) 80%, transparent);
  opacity: 0.35;
}

/* --- Posts Section --- */
.posts-section { padding: 3rem 0 2rem; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.8rem;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.section-link {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.section-link:hover { color: var(--accent); }

/* --- Post Cards (clean: date + title + desc, no tags) --- */
.post-card {
  display: block;
  padding: 1.3rem 1.4rem;
  margin-bottom: 0.4rem;
  border-radius: 12px;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s ease;
  border: 1px solid transparent;
}

.post-card:hover {
  background: var(--bg-hover);
  border-color: var(--border);
  transform: translateX(4px);
}

.post-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.post-card-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin-bottom: 0.45rem;
}

.post-card-title {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.35;
  margin-bottom: 0.35rem;
  transition: color 0.2s;
}

.post-card:hover .post-card-title { color: var(--accent); }

.post-card-desc {
  font-size: 0.86rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.55;
}

/* --- Single Post View --- */
article { padding-top: 3.5rem; }
.post-header { margin-bottom: 2.5rem; }

.post-header h1 {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.035em;
  margin-bottom: 0.8rem;
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  gap: 1.2rem;
}

/* --- Post Content (reading experience) --- */
.post-content {
  font-size: 1.02rem;
  line-height: 1.82;
}

.post-content p { margin-bottom: 1.5rem; }
.post-content em { font-style: italic; }

.post-content h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2.8rem 0 1rem;
  letter-spacing: -0.02em;
}

.post-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2rem 0 0.8rem;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-content a:hover { opacity: 0.8; }

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

.post-content code {
  font-size: 0.9rem;
  font-family: var(--font-mono);
  background: var(--bg-surface);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.post-content pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content ul, .post-content ol {
  margin: 1rem 0 1.5rem 1.2rem;
}

.post-content li { margin-bottom: 0.5rem; }

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 2rem 0;
  display: block;
}

.post-content figure {
  margin: 2.5rem 0;
}

.post-content figure img {
  margin: 0 0 0.6rem;
}

.post-content figcaption {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-align: center;
  font-style: italic;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* --- Back Link --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 3rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.back-link:hover { color: var(--accent); }

/* --- About Page --- */
.about-view { padding: 4rem 0 2rem; }

.about-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.about-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.about-hero-text h1 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.2rem;
}

.about-hero-text p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.about-body p {
  font-size: 1.02rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.about-body p.muted { color: var(--text-muted); }

.about-body h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2.5rem 0 0.8rem;
  letter-spacing: -0.02em;
}

.about-body strong { font-weight: 600; color: var(--text); }
.about-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

.about-links {
  display: flex;
  gap: 0.8rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.about-link-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.about-link-pill:hover { border-color: var(--accent); color: var(--accent); }
.about-link-pill svg { width: 13px; height: 13px; }

/* --- Footer --- */
footer {
  margin-top: 5rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.footer-socials {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.footer-socials a {
  color: var(--text-dim);
  transition: color 0.2s;
  display: flex;
  align-items: center;
}

.footer-socials a:hover { color: var(--accent); }

.footer-socials svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Animations --- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Responsive --- */
@media (max-width: 640px) {
  html { font-size: 16px; }

  header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .hero {
    flex-direction: column;
    gap: 1.5rem;
    padding: 3rem 0 2.5rem;
  }

  .hero-photo {
    width: 72px;
    height: 72px;
  }

  .hero-text h1 {
    font-size: 2rem;
  }

  .post-header h1 {
    font-size: 1.6rem;
  }
}
