/* SatarCode — site styles v2
   Layout: a code-editor motif. Line-number gutters, a live typing hero,
   tracks as "files", articles as a document with a TOC rail. */
:root {
  --ink: #0B0F14;          /* headings, brand */
  --text: #2A313B;         /* body */
  --muted: #5E6773;        /* meta, captions */
  --line: #E3E7EA;         /* hairlines */
  --bg: #FFFFFF;
  --soft: #F4F7F6;         /* green-tinted neutral surface */
  --accent: #047857;       /* green that passes on white */
  --accent-bright: #10B981;/* brand green, marks only */
  --accent-tint: #E7F6F0;
  --editor: #0E1116;       /* code surfaces stay dark in both themes */
  --editor-2: #161B22;
  --editor-line: #262D37;
  --editor-text: #E6E8EC;
  --editor-dim: #6B7584;
  --radius: 14px;
  --max: 1120px;
  --read: 700px;
  --font-display: "Alexandria", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --font-latin: "Inter", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F3F5F7; --text: #CDD3DA; --muted: #8E98A5; --line: #222932;
    --bg: #0B0F14; --soft: #121820; --accent: #34D399; --accent-tint: #10251E;
    --editor: #0F141B; --editor-2: #151B24; --editor-line: #232B36;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #F3F5F7; --text: #CDD3DA; --muted: #8E98A5; --line: #222932;
  --bg: #0B0F14; --soft: #121820; --accent: #34D399; --accent-tint: #10251E;
  --editor: #0F141B; --editor-2: #151B24; --editor-line: #232B36;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 18px; line-height: 1.9;
}
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); text-wrap: balance; }

.wrap {
  max-width: var(--max); margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* English pages */
html[lang="en"] { --font-display: "Inter", "Segoe UI", sans-serif; --font-body: "Inter", "Segoe UI", sans-serif; }
html[lang="en"] body { line-height: 1.75; }
html[lang="en"] h1, html[lang="en"] h2 { letter-spacing: -0.025em; }
html[lang="en"] .hero h1 .hl { white-space: normal; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 12px; }
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none; direction: ltr;
  font-family: var(--font-latin); font-weight: 800; font-size: 23px; letter-spacing: -0.035em; color: var(--ink);
}
.brand img { width: 34px; height: 34px; }
.brand .c { color: var(--accent); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 8px 14px; border-radius: 999px; transition: background .15s, color .15s;
}
.nav a:hover { color: var(--ink); background: var(--soft); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-tint); }

/* ---------- Hero (home) ---------- */
.hero { padding-block: 72px 56px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; }
.hero > * { min-width: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600;
  color: var(--accent); background: var(--accent-tint); padding: 4px 14px; border-radius: 999px;
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-bright); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-bright) 25%, transparent); }
.hero h1 { font-size: clamp(36px, 5.6vw, 64px); line-height: 1.25; margin: 20px 0 16px; font-weight: 800; letter-spacing: -0.01em; }
.hero h1 .hl { color: var(--accent); position: relative; white-space: nowrap; }
.hero h1 .hl::after {
  content: ""; position: absolute; inset-inline: 0; bottom: .08em; height: .14em;
  background: var(--accent-bright); opacity: .28; border-radius: 4px;
}
.hero .lead { font-size: 20px; color: var(--muted); max-width: 34em; margin: 0 0 28px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 12px; font-weight: 600; font-size: 16px; text-decoration: none; transition: transform .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-ghost { color: var(--ink); border: 1px solid var(--line); background: var(--bg); }
.btn-ghost:hover { background: var(--soft); }
.btn svg { width: 18px; height: 18px; }

/* Editor card */
.editor {
  direction: ltr; background: var(--editor); color: var(--editor-text); border-radius: 18px;
  border: 1px solid var(--editor-line); overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(4, 30, 20, .45), 0 0 0 6px color-mix(in srgb, var(--accent-bright) 8%, transparent);
  font-family: var(--font-mono); font-size: 15px; line-height: 1.9;
}
.editor-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--editor-2); border-bottom: 1px solid var(--editor-line); }
.editor-bar i { width: 11px; height: 11px; border-radius: 50%; background: var(--editor-line); }
.editor-bar span { margin-left: 10px; font-size: 13px; color: var(--editor-dim); }
.editor-body { display: grid; grid-template-columns: auto 1fr; padding: 18px 0; overflow-x: auto; }
.gutter { padding: 0 16px 0 20px; color: var(--editor-dim); text-align: right; user-select: none; border-right: 1px solid var(--editor-line); }
.gutter b { font-weight: 400; color: var(--accent-bright); }
.code { padding: 0 20px; white-space: pre; min-width: 0; }
.code .ar { font-family: var(--font-body); }
.code .k { color: #C792EA; } .code .f { color: #82AAFF; } .code .s { color: #C3E88D; } .code .c { color: var(--editor-dim); }
.code .active { display: block; margin: 0 -20px; padding: 0 20px; background: color-mix(in srgb, var(--accent-bright) 10%, transparent); }
.caret { display: inline-block; width: 9px; height: 1.15em; vertical-align: -0.2em; background: var(--accent-bright); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Section headers ---------- */
.section { padding-block: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { font-size: clamp(24px, 3vw, 32px); margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: 16px; }
.ln { font-family: var(--font-mono); font-size: 13px; color: var(--accent); direction: ltr; unicode-bidi: isolate; }

/* ---------- Featured post ---------- */
.featured {
  display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  text-decoration: none; color: inherit; background: var(--bg); transition: border-color .2s, transform .2s;
}
.featured:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.featured > * { min-width: 0; }
.featured-art {
  background: var(--editor); position: relative; min-height: 280px; display: grid; place-items: center; overflow: hidden;
  background-image: linear-gradient(var(--editor-line) 1px, transparent 1px), linear-gradient(90deg, var(--editor-line) 1px, transparent 1px);
  background-size: 28px 28px;
}
.featured-art .map { direction: ltr; font-family: var(--font-mono); color: var(--editor-text); font-size: 15px; display: grid; gap: 10px; }
.featured-art .map span { display: flex; align-items: center; gap: 12px; }
.featured-art .map em { font-style: normal; color: var(--editor-dim); width: 64px; }
.featured-art .map i { height: 10px; border-radius: 5px; background: var(--accent-bright); }
.featured-art .map small { font-size: 12px; color: var(--editor-dim); }
.featured-art .map em { font-family: var(--font-body); }
.featured-body { padding: 36px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.featured-body h3 { font-size: clamp(24px, 2.6vw, 32px); line-height: 1.45; margin: 0; }
.featured-body p { margin: 0; color: var(--muted); }
.meta { color: var(--muted); font-size: 14px; }
.chip {
  align-self: flex-start; display: inline-block; font-size: 13px; font-weight: 600; color: var(--accent);
  background: var(--accent-tint); padding: 2px 12px; border-radius: 999px; line-height: 1.9;
}

/* ---------- Tracks ---------- */
.tracks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.track {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; background: var(--bg);
  display: flex; flex-direction: column; gap: 8px; transition: border-color .2s, background .2s;
}
.track:hover { border-color: var(--accent); background: var(--soft); }
.track .file { unicode-bidi: isolate; font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); }
.track h3 { font-size: 19px; margin: 0; line-height: 1.5; }
.track p { margin: 0; font-size: 15px; color: var(--muted); line-height: 1.75; }
.track .count { margin-top: auto; font-size: 13px; color: var(--accent); font-weight: 600; }

/* ---------- Upcoming list ---------- */
.upcoming { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.upcoming li { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.upcoming .ln { color: var(--muted); }
.upcoming strong { color: var(--ink); font-weight: 600; font-size: 18px; }
.soon { font-size: 13px; color: var(--muted); border: 1px dashed var(--line); padding: 2px 12px; border-radius: 999px; white-space: nowrap; }

/* ---------- Article ---------- */
.progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 30; background: transparent; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent-bright); }
.article-head { padding-block: 56px 32px; max-width: 860px; }
.article-head h1 { font-size: clamp(32px, 4.8vw, 52px); line-height: 1.3; margin: 16px 0; font-weight: 800; }
.article-head .sub { font-size: 20px; color: var(--muted); margin: 0 0 24px; }
.byline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 15px; color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--editor); display: grid; place-items: center; flex: none; }
.avatar img { width: 26px; height: 26px; }
.byline a { color: var(--ink); font-weight: 600; text-decoration: none; }
.layout { display: grid; grid-template-columns: minmax(0, var(--read)) 240px; gap: 64px; justify-content: space-between; padding-bottom: 32px; border-top: 1px solid var(--line); padding-top: 40px; }
.layout > * { min-width: 0; }
.toc { position: sticky; top: 96px; align-self: start; font-size: 15px; }
.toc h2 { font-family: var(--font-body); font-size: 13px; letter-spacing: .04em; color: var(--muted); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-inline-start: 1px solid var(--line); }
.toc a { display: block; padding: 6px 16px; color: var(--muted); text-decoration: none; line-height: 1.6; margin-inline-start: -1px; border-inline-start: 2px solid transparent; }
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--accent); border-inline-start-color: var(--accent); font-weight: 600; }

.prose h2 { font-size: 28px; margin: 48px 0 10px; line-height: 1.5; scroll-margin-top: 90px; }
.prose h3 { font-size: 21px; margin: 32px 0 6px; }
.prose p, .prose li { margin: 0 0 16px; }
.prose ul, .prose ol { padding-inline-start: 24px; }
.prose li::marker { color: var(--accent); font-weight: 600; }
.prose > p:first-child { font-size: 20px; color: var(--ink); }
.prose blockquote {
  margin: 28px 0; padding: 18px 22px; background: var(--accent-tint); border-radius: var(--radius);
  color: var(--ink); font-weight: 600; font-size: 19px;
}
.prose strong { color: var(--ink); }

/* Code */
code, pre { font-family: var(--font-mono); }
:not(pre) > code { direction: ltr; unicode-bidi: isolate; background: var(--soft); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; font-size: .86em; }
.codeblock { direction: ltr; margin: 24px 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--editor-line); background: var(--editor); }
.codeblock-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px 8px 16px; background: var(--editor-2); border-bottom: 1px solid var(--editor-line); font-size: 13px; color: var(--editor-dim); }
.copy { font: 600 13px var(--font-body); color: var(--editor-text); background: transparent; border: 1px solid var(--editor-line); border-radius: 8px; padding: 4px 12px; cursor: pointer; min-height: 32px; }
.copy:hover { background: var(--editor-line); }
pre { text-align: left; color: var(--editor-text); padding: 18px 20px; overflow-x: auto; font-size: 15px; line-height: 1.75; margin: 0; background: var(--editor); }

.author-box { display: flex; gap: 18px; align-items: flex-start; margin-top: 48px; padding: 24px; background: var(--soft); border-radius: 18px; }
.author-box .avatar { width: 56px; height: 56px; }
.author-box .avatar img { width: 34px; height: 34px; }
.author-box h3 { margin: 0 0 4px; font-size: 18px; }
.author-box p { margin: 0; font-size: 16px; color: var(--muted); }

/* Simple pages */
article.page { max-width: var(--read); padding-block: 56px 24px; }
article.page h1 { font-size: clamp(30px, 4.5vw, 46px); line-height: 1.35; margin: 0 0 16px; }
article.page h2 { font-size: 24px; margin: 36px 0 8px; }
article.page p, article.page li { margin: 0 0 14px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 72px; background: var(--editor); color: #AEB6C2; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-block: 40px; font-size: 15px; }
.site-footer .brand { color: #F3F5F7; }
.site-footer .brand .c { color: var(--accent-bright); }
.site-footer a { color: #D7DCE3; }
.site-footer .tag { margin: 6px 0 0; color: #8E98A5; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding-block: 48px 32px; }
  .tracks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .toc { position: static; order: -1; margin-bottom: 24px; background: var(--soft); border-radius: var(--radius); padding: 16px 8px 8px; }
}
@media (max-width: 720px) {
  .featured { grid-template-columns: 1fr; }
  .featured-art { min-height: 200px; }
  .featured-body { padding: 24px; }
  .upcoming li { grid-template-columns: 40px 1fr; }
  .upcoming .soon { grid-column: 2; justify-self: start; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  .tracks { grid-template-columns: minmax(0, 1fr); }
  .editor { font-size: 13px; }
  .nav a { padding: 6px 10px; font-size: 14px; }
}
