:root {
  --bg: #0f0f10;
  --bg-elev: #18181b;
  --fg: #d6d6d4;
  --fg-muted: #8c8c8a;
  --accent: #7eb88c;
  --error: #d97a7a;
  --rule: #26262a;
  --max-w: 38rem;
  --serif: ui-serif, Georgia, "Iowan Old Style", Charter, "Vazirmatn", "Noto Naskh Arabic", Tahoma, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Vazirmatn", "Noto Sans Arabic", Tahoma, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  padding: 4rem 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

.site-header,
main {
  width: 100%;
  max-width: var(--max-w);
}

.site-header { margin-bottom: 3rem; }

.site-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.site-title a {
  color: var(--fg);
  text-decoration: none;
}

.site-title a:hover { color: var(--accent); }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover { text-decoration: underline; }

.tree {
  list-style: disc;
  padding-inline-start: 1.5rem;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.9;
  color: var(--fg);
}

.tree ul {
  list-style: circle;
  padding-inline-start: 1.5rem;
  margin: 0;
}

.tree ul ul { list-style: square; }

.tree li { margin: 0; }

.tree li::marker { color: var(--fg-muted); }

.tree a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tree a:hover { color: var(--fg); }

.tree a.dim,
.tree a.dim:hover { color: var(--fg-muted); }

.tree li.dim,
.tree li.loading,
.tree li.error { color: var(--fg-muted); }
.tree li.error { color: var(--error); }

.tree + article { margin-top: 2rem; }

.post h1 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0 0 0.5rem;
}

.post h2 {
  font-size: 1.125rem;
  margin: 2.5rem 0 0.75rem;
}

.post h3 {
  font-size: 1rem;
  margin: 2rem 0 0.5rem;
}

.post p { margin: 1.1rem 0; }

.post ul, .post ol { padding-inline-start: 1.5rem; }
.post li { margin: 0.3rem 0; }

.post blockquote {
  border-inline-start: 3px solid var(--accent);
  padding-inline-start: 1rem;
  margin: 1.5rem 0;
  color: var(--fg-muted);
  font-style: italic;
}

.post code {
  font-size: 0.95em;
  background: var(--bg-elev);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.post pre {
  background: var(--bg-elev);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
}

.post pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

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

.post a { text-decoration: underline; text-underline-offset: 2px; }

.post img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem auto;
  border-radius: 6px;
}

#music-search {
  font-family: var(--mono);
  font-size: 0.875rem;
  color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  margin: 0.4rem 0 0.6rem;
  width: 100%;
  max-width: 20rem;
}

#music-search:focus {
  outline: none;
  border-color: var(--accent);
}

.dim { color: var(--fg-muted); }

.loading, .error {
  color: var(--fg-muted);
  font-style: italic;
}

.error { color: var(--error); }

[dir="rtl"] {
  font-family: "Vazirmatn", "Noto Naskh Arabic", Tahoma, var(--serif);
  line-height: 1.85;
}

[dir="rtl"] code,
[dir="rtl"] pre {
  font-family: var(--mono);
  direction: ltr;
  text-align: left;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0.5rem 0 0;
  max-width: 28rem;
}

.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--fg-muted);
  font-size: 0.875rem;
}

.contact-form input,
.contact-form textarea {
  font-family: var(--mono);
  font-size: 0.9375rem;
  color: var(--fg);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.55rem 0.7rem;
  width: 100%;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.contact-form button {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.9375rem;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: 4px;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
}

.contact-form button:hover { filter: brightness(1.1); }

.post-nav {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
}

.post-nav a {
  color: var(--accent);
  text-decoration: none;
  max-width: 48%;
}

.post-nav a:hover { text-decoration: underline; }

.post-nav-prev { margin-inline-end: auto; }
.post-nav-next { margin-inline-start: auto; text-align: end; }

.projects {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.project {
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--rule);
}

.project:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.project-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.45rem;
  color: var(--fg);
}

.project-name a {
  color: var(--fg);
  text-decoration: none;
}

.project-name a:hover { color: var(--accent); }

.project-desc {
  margin: 0 0 0.7rem;
  color: var(--fg);
  line-height: 1.7;
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-size: 0.75rem;
  color: var(--fg-muted);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
}

.project-links {
  display: flex;
  gap: 1rem;
  margin-inline-start: auto;
  font-size: 0.8125rem;
}

.project-links a {
  text-decoration: underline;
  text-underline-offset: 2px;
}
