/* ==========================================================================
   صياغة — Arabic RTL blog on AI prompt engineering
   ========================================================================== */

:root {
  --ink-900: #0d0b1f;
  --ink-800: #14102b;
  --ink-700: #1d1740;
  --violet: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-glow: rgba(139, 92, 246, .22);
  --cyan: #22d3ee;

  --bg: #ffffff;
  --bg-alt: #f6f5fc;
  --surface: #ffffff;
  --border: #e6e3f2;
  --text: #17132e;
  --text-muted: #635d80;
  --shadow: 0 1px 3px rgba(20, 16, 43, .06), 0 10px 30px rgba(20, 16, 43, .07);
  --shadow-lg: 0 6px 18px rgba(20, 16, 43, .1), 0 28px 56px rgba(20, 16, 43, .16);

  --radius: 14px;
  --radius-lg: 22px;
  --wrap: 1140px;
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg: #0d0b1f;
  --bg-alt: #14102b;
  --surface: #1a1538;
  --border: #2c2456;
  --text: #ece9fb;
  --text-muted: #9d95c4;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.28);
  --shadow-lg: 0 6px 18px rgba(0,0,0,.4), 0 28px 56px rgba(0,0,0,.5);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}

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

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 20px; }
.center { text-align: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; gap: 18px; height: 70px; }
.logo { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 1.3rem; letter-spacing: -.3px; white-space: nowrap; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--violet), var(--cyan));
  display: grid; place-items: center; color: #fff; font-size: 1.15rem; flex-shrink: 0;
}
.logo small { display: block; font-size: .6rem; font-weight: 700; letter-spacing: 3px; color: var(--text-muted); }
.nav-links { display: flex; gap: 4px; margin-inline-start: auto; list-style: none; }
.nav-links a { padding: 9px 15px; border-radius: 10px; font-weight: 600; font-size: .95rem; color: var(--text-muted); transition: .18s; }
.nav-links a:hover, .nav-links a.active { background: var(--bg-alt); color: var(--text); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  display: grid; place-items: center; font-size: 1.05rem; transition: .18s;
}
.icon-btn:hover { border-color: var(--violet); color: var(--violet); }
.burger { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 26px; border-radius: 12px; font-weight: 700; font-size: .97rem;
  font-family: inherit; border: 1px solid transparent; cursor: pointer; transition: .2s;
  white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--violet), var(--violet-600)); color: #fff; box-shadow: 0 6px 20px var(--violet-glow); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px var(--violet-glow); }
.btn-ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn-ghost:hover { border-color: var(--violet); color: var(--violet); }
.btn-sm { padding: 10px 18px; font-size: .88rem; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(900px 420px at 80% -10%, rgba(34,211,238,.14), transparent 60%),
    linear-gradient(160deg, var(--ink-900), var(--ink-700) 65%, var(--ink-800));
  color: #ece9fb; padding: 86px 0 94px; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset-inline-end: -160px; top: -120px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--violet-glow), transparent 68%); pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 780px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(139,92,246,.14); border: 1px solid rgba(139,92,246,.34);
  color: #c4b5fd; padding: 7px 16px; border-radius: 999px; font-size: .84rem; font-weight: 700; margin-bottom: 22px;
}
.hero h1 { font-size: clamp(2rem, 5.2vw, 3.35rem); font-weight: 800; line-height: 1.25; letter-spacing: -1px; margin-bottom: 18px; }
.hero h1 span { background: linear-gradient(120deg, var(--violet), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: clamp(1rem, 2.1vw, 1.15rem); color: #b3a9d6; max-width: 640px; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero .btn-ghost { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.16); color: #ece9fb; }
.hero .btn-ghost:hover { border-color: var(--cyan); color: var(--cyan); }

/* ---------- Sections ---------- */
.section { padding: 74px 0; }
.section-alt { background: var(--bg-alt); }
.section-head { margin-bottom: 42px; }
.section-head .label { color: var(--violet); font-weight: 800; font-size: .82rem; letter-spacing: 1.4px; display: block; margin-bottom: 10px; }
.section-head h2 { font-size: clamp(1.55rem, 3.4vw, 2.15rem); font-weight: 800; letter-spacing: -.6px; line-height: 1.35; margin-bottom: 12px; }
.section-head p { color: var(--text-muted); max-width: 640px; font-size: 1.02rem; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 26px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow); transition: .22s; display: flex; flex-direction: column;
  padding: 26px;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--violet) 45%, var(--border)); }
.tag { align-self: flex-start; background: rgba(139,92,246,.12); color: var(--violet); font-size: .74rem; font-weight: 700; padding: 5px 13px; border-radius: 999px; margin-bottom: 15px; }
[data-theme="dark"] .tag { background: rgba(139,92,246,.2); color: #c4b5fd; }
.card h3 { font-size: 1.2rem; font-weight: 800; line-height: 1.55; margin-bottom: 12px; letter-spacing: -.3px; }
.card p { color: var(--text-muted); font-size: .95rem; line-height: 1.9; flex: 1; margin-bottom: 18px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); font-size: .84rem; color: var(--text-muted); }
.read-more { color: var(--violet); font-weight: 700; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 34px; }
.filter { padding: 9px 20px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-family: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; transition: .18s; }
.filter:hover { border-color: var(--violet); color: var(--violet); }
.filter.active { background: linear-gradient(135deg, var(--violet), var(--violet-600)); border-color: transparent; color: #fff; }

/* ---------- Article ---------- */
.article-header { background: var(--bg-alt); padding: 54px 0 44px; border-bottom: 1px solid var(--border); }
.breadcrumb { font-size: .86rem; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumb a:hover { color: var(--violet); }
.breadcrumb span { margin-inline: 7px; opacity: .5; }
.article-header h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.42; letter-spacing: -.7px; margin-bottom: 16px; max-width: 880px; }
.article-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-muted); font-size: .9rem; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; padding: 54px 0 74px; align-items: start; }
.article-body { font-size: 1.06rem; line-height: 2.05; min-width: 0; }
.article-body > * + * { margin-top: 20px; }
.article-body h2 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.4px; margin-top: 44px; padding-inline-start: 15px; border-inline-start: 4px solid var(--violet); line-height: 1.5; }
.article-body h3 { font-size: 1.18rem; font-weight: 700; margin-top: 30px; line-height: 1.6; }
.article-body ul, .article-body ol { padding-inline-start: 24px; }
.article-body li + li { margin-top: 10px; }
.article-body li::marker { color: var(--violet); font-weight: 700; }
.article-body strong { font-weight: 700; color: var(--text); }
.callout { background: var(--bg-alt); border: 1px solid var(--border); border-inline-start: 4px solid var(--violet); border-radius: var(--radius); padding: 22px 24px; margin-block: 30px; }
.callout strong { display: block; margin-bottom: 7px; color: var(--violet); }

/* prompt example box */
.prompt-box {
  background: var(--ink-900); color: #d9d3f5; border-radius: var(--radius);
  padding: 20px 22px; margin-block: 24px; font-size: .96rem; line-height: 1.85;
  border: 1px solid var(--ink-700); position: relative; overflow-x: auto;
}
.prompt-box::before {
  content: 'مثال أمر'; position: absolute; inset-block-start: 0; inset-inline-end: 0;
  background: var(--violet); color: #fff; font-size: .68rem; font-weight: 700;
  padding: 4px 12px; border-end-start-radius: 10px;
}
.prompt-box.bad::before { content: '✗ ضعيف'; background: #ef4444; }
.prompt-box.good::before { content: '✓ أفضل'; background: #22c55e; }
.prompt-box code, .prompt-box { font-family: 'Cairo', monospace; }

table { width: 100%; border-collapse: collapse; margin-block: 26px; font-size: .95rem; }
th, td { padding: 13px 15px; border: 1px solid var(--border); text-align: start; }
th { background: var(--bg-alt); font-weight: 700; }
.table-scroll { overflow-x: auto; margin-block: 26px; }
.table-scroll table { margin-block: 0; }

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 92px; display: grid; gap: 22px; }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.side-card h4 { font-size: 1rem; font-weight: 800; margin-bottom: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--border); }
.side-links { list-style: none; }
.side-links li + li { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.side-links a { font-size: .93rem; font-weight: 600; line-height: 1.6; transition: .18s; }
.side-links a:hover { color: var(--violet); }

/* ---------- Page head / prose ---------- */
.page-head { background: var(--bg-alt); padding: 54px 0; border-bottom: 1px solid var(--border); margin-bottom: 54px; }
.page-head h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -.7px; margin-bottom: 12px; }
.page-head p { color: var(--text-muted); max-width: 640px; font-size: 1.03rem; }
.prose { max-width: 780px; font-size: 1.04rem; line-height: 2; }
.prose > * + * { margin-top: 18px; }
.prose h2 { font-size: 1.4rem; font-weight: 800; margin-top: 38px; letter-spacing: -.4px; }
.prose ul { padding-inline-start: 24px; }
.prose li + li { margin-top: 9px; }
.prose li::marker { color: var(--violet); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink-900); color: #a69fce; padding: 56px 0 26px; margin-top: 20px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(2, 1fr); gap: 40px; padding-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,.1); }
.footer-brand .logo { color: #ece9fb; margin-bottom: 15px; }
.footer-brand p { font-size: .93rem; line-height: 1.9; max-width: 340px; }
.footer-col h4 { color: #ece9fb; font-size: .97rem; font-weight: 700; margin-bottom: 16px; }
.footer-col ul { list-style: none; display: grid; gap: 11px; }
.footer-col a { font-size: .92rem; transition: .18s; }
.footer-col a:hover { color: var(--cyan); }
.footer-bottom { padding-top: 24px; text-align: center; font-size: .88rem; }
.footer-bottom a { color: var(--violet); font-weight: 600; }

/* ---------- Misc ---------- */
.to-top { position: fixed; inset-inline-end: 24px; bottom: 24px; width: 46px; height: 46px; border-radius: 13px; border: none; background: linear-gradient(135deg, var(--violet), var(--violet-600)); color: #fff; font-size: 1.2rem; cursor: pointer; display: grid; place-items: center; opacity: 0; visibility: hidden; transform: translateY(12px); transition: .25s; z-index: 90; box-shadow: 0 6px 20px var(--violet-glow); }
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .article-layout { grid-template-columns: 1fr; gap: 40px; }
  .sidebar { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}
@media (max-width: 780px) {
  .burger { display: grid; }
  .nav-links {
    position: fixed; inset-block: 70px 0; inset-inline-end: 0; width: min(280px, 82vw);
    background: var(--bg); border-inline-start: 1px solid var(--border); flex-direction: column;
    gap: 6px; padding: 22px 18px; margin: 0; transform: translateX(100%); transition: transform .28s; box-shadow: var(--shadow-lg);
  }
  .nav-links.open { transform: none; }
  .nav-links a { display: block; }
  .nav-actions .btn { display: none; }
  .hero { padding: 60px 0 66px; }
  .section { padding: 54px 0; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
