:root {
  --accent: #2f7d4f;
  --accent-2: #d4a017;
  --bg: #f7f7fb;
  --surface: #ffffff;
  --text: #16161f;
  --muted: #6b6b7b;
  --border: #e7e7f0;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(20, 20, 40, 0.08);
  --font: "Segoe UI", Tahoma, "Cairo", "Arial", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f16;
    --surface: #181822;
    --text: #f2f2f7;
    --muted: #a3a3b5;
    --border: #2a2a38;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.1rem;
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.nav-links {
  display: flex;
  gap: 26px;
  align-items: center;
}

.nav-links a {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text); }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text);
  cursor: pointer;
}

@media (max-width: 700px) {
  .nav-links {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
    gap: 14px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

@media (max-width: 700px) {
  .hero { padding: 52px 0 44px; }
  .section { padding: 40px 0; }
}

/* Hero */
.hero {
  padding: 76px 0 64px;
  text-align: center;
  scroll-margin-top: 76px;
}

.avatar {
  width: 120px;
  height: 120px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.4rem;
  font-weight: 800;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 10px;
  font-weight: 800;
}

.hero p.tagline {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 560px;
  margin: 0 auto 26px;
}

.social-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.social-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.social-btn:hover { transform: translateY(-3px); }
.social-btn svg { width: 20px; height: 20px; fill: var(--text); }

/* Section */
.section {
  padding: 56px 0;
  scroll-margin-top: 76px;
}
.section + .section {
  border-top: 1px solid var(--border);
}
.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: "";
  width: 6px;
  height: 22px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

#about.section {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.about-card {
  padding: 28px;
}
.about-card p { color: var(--muted); margin: 0 0 18px; }

.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.skill-chip {
  padding: 8px 16px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Category tabs */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}
.category-tab {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.category-tab:hover { color: var(--text); }
.category-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: #fff;
}

.post-category {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 10px;
}

/* Posts grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.post-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover { transform: translateY(-4px); }

.post-cover {
  height: 160px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, var(--surface)), color-mix(in srgb, var(--accent-2) 30%, var(--surface)));
}
.post-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.post-date { color: var(--muted); font-size: 0.8rem; margin-bottom: 8px; }
.post-title { font-size: 1.1rem; font-weight: 800; margin: 0 0 10px; }
.post-excerpt { color: var(--muted); font-size: 0.92rem; flex: 1; margin: 0 0 14px; }
.post-readmore { color: var(--accent); font-weight: 700; font-size: 0.9rem; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* Post detail */
.post-detail-cover {
  width: 100%;
  height: 280px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 30%, var(--surface)), color-mix(in srgb, var(--accent-2) 30%, var(--surface)));
  margin-bottom: 24px;
}
.post-detail-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-detail h1 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin: 0 0 10px; }
.post-detail .post-date { margin-bottom: 24px; }
.post-detail .content p { margin: 0 0 18px; color: var(--text); }
.post-detail .content img.content-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 6px 0 18px;
  box-shadow: var(--shadow);
}
.video-embed {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 6px 0 18px;
  box-shadow: var(--shadow);
  background: #000;
}
.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.content-video {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 6px 0 18px;
  box-shadow: var(--shadow);
  display: block;
}
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 700; margin-bottom: 20px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .social-row { margin-bottom: 16px; }

/* Ads */
.ad-slot {
  margin: 8px 0;
}
.ad-slot:empty {
  display: none;
}
.ad-label {
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
}
.ad-banner-link {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
}
.ad-banner-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
}
