:root {
  color-scheme: dark;
  --bg: #060910;
  --bg-soft: #0b111d;
  --panel: rgba(13, 20, 33, 0.74);
  --panel-strong: rgba(13, 22, 36, 0.94);
  --text: #f3f8ff;
  --muted: #aab7c8;
  --line: rgba(154, 255, 226, 0.14);
  --accent: #75ffd9;
  --accent-2: #89a9ff;
  --danger: #ff5f8f;
  --radius: 24px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  --container: min(1120px, calc(100% - 40px));
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 12%, rgba(117, 255, 217, 0.09), transparent 28rem),
    radial-gradient(circle at 92% 6%, rgba(137, 169, 255, 0.11), transparent 30rem),
    linear-gradient(135deg, #03050a 0%, #060910 52%, #08111d 100%);
  font-family: "Vazirmatn", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.8;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(117, 255, 217, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(117, 255, 217, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 72%);
}

.noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.2;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.4'/%3E%3C/svg%3E");
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.container {
  width: var(--container);
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(6, 9, 16, 0.76);
  backdrop-filter: blur(18px);
}

.nav,
.brand,
.nav-links,
.footer {
  display: flex;
  align-items: center;
}

.nav {
  justify-content: space-between;
  min-height: 76px;
}

.brand {
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--accent);
  background: linear-gradient(135deg, rgba(117, 255, 217, 0.22), rgba(137, 169, 255, 0.13));
  box-shadow: 0 0 28px rgba(117, 255, 217, 0.2);
  font-family: var(--mono);
}

.brand-text {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.brand-text small,
.eyebrow,
.breadcrumb,
.post-meta,
.article-meta,
.read-more {
  font-family: var(--mono);
}

.brand-text small {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 600;
  text-transform: uppercase;
}

.nav-links {
  gap: 10px;
}

.nav-links a,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
}

.nav-links a {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 48px;
  align-items: center;
  padding-block: clamp(64px, 8vw, 96px);
}

.blog-list-hero {
  display: block;
  text-align: center;
}

.blog-list-hero .hero-copy,
.blog-list-hero .hero-text {
  margin-inline: auto;
}

.blog-list-hero .hero-copy {
  max-width: 900px;
}

.blog-list-hero h1 {
  margin-inline: auto;
}

.blog-list-hero .hero-text {
  max-width: 720px;
}

.hero > *,
.article-hero-grid > *,
.post-card-link > * {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 900px;
  margin-bottom: 24px;
  font-size: clamp(2.25rem, 5vw, 4.6rem);
  line-height: 1.3;
  letter-spacing: -0.055em;
  overflow-wrap: anywhere;
}

.hero-text {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.04rem;
}

.terminal-card,
.post-card,
.article-cover,
.article-figure,
.article-code,
.article-callout,
.empty-state {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.018)), var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.terminal-card {
  overflow: hidden;
  border-radius: 26px;
  background-color: rgba(2, 6, 12, 0.9);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  direction: ltr;
}

.terminal-header span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--danger);
}

.terminal-header span:nth-child(2) {
  background: #ffd166;
}

.terminal-header span:nth-child(3) {
  background: var(--accent);
}

.terminal-card pre,
.article-code pre {
  margin: 0;
  padding: 24px;
  overflow-x: auto;
  color: #b8ffe9;
  direction: ltr;
  font: 600 0.92rem/1.9 var(--mono);
  text-align: left;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  padding-bottom: 88px;
}

.post-card {
  overflow: hidden;
  border-radius: var(--radius);
  transition: 180ms ease;
}

.post-card:hover {
  transform: translateY(-4px);
  border-color: rgba(117, 255, 217, 0.26);
}

.post-card.featured {
  grid-column: span 2;
}

.post-card-link {
  display: grid;
  height: 100%;
}

.featured .post-card-link {
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
}

.post-art,
.article-cover {
  position: relative;
  min-height: 245px;
  overflow: hidden;
}

.post-art {
  aspect-ratio: 16 / 10;
}

.featured .post-art {
  aspect-ratio: 4 / 3;
  min-height: 320px;
}

.post-art img,
.article-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.article-figure img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.placeholder-art {
  width: 100%;
  height: 100%;
  min-height: inherit;
  background:
    linear-gradient(120deg, rgba(7, 11, 18, 0.15), rgba(7, 11, 18, 0.84)),
    repeating-linear-gradient(90deg, rgba(117, 255, 217, 0.18) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, rgba(137, 169, 255, 0.15) 0 1px, transparent 1px 28px),
    radial-gradient(circle at 70% 35%, rgba(117, 255, 217, 0.28), transparent 18rem);
}

.post-content {
  padding: 28px;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.82rem;
}

.fa-copy {
  direction: rtl;
  text-align: right;
  letter-spacing: 0;
}

.post-content h2 {
  margin-bottom: 12px;
  font-size: clamp(1.35rem, 2.7vw, 2.15rem);
  line-height: 1.65;
}

.post-content p,
.article-summary,
.article-body p,
.article-body li {
  color: #d7e4f2;
}

.post-content p {
  line-height: 2.05;
}

.read-more {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 850;
}

.article-hero {
  padding-block: clamp(58px, 7vw, 88px) 34px;
}

.article-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(340px, 1.08fr);
  gap: 42px;
  align-items: center;
}

.breadcrumb {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 700;
}

.article-title {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4.8vw, 4.1rem);
  line-height: 1.45;
}

.article-summary {
  max-width: 760px;
  font-size: 1.06rem;
  line-height: 2.05;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.article-meta span,
.article-meta time {
  display: inline-flex;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.82rem;
}

.article-cover {
  aspect-ratio: 4 / 3;
  min-height: clamp(260px, 34vw, 430px);
  border-radius: var(--radius);
}

.article-shell {
  width: min(900px, calc(100% - 40px));
  margin-inline: auto;
  padding-block: 28px 88px;
}

.article-body {
  direction: rtl;
  text-align: right;
  letter-spacing: 0;
}

.article-body p,
.article-body li {
  font-size: 1.02rem;
  line-height: 2.15;
}

.article-body h2 {
  margin-top: 54px;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1.5;
  letter-spacing: 0;
}

.article-figure,
.article-code,
.article-callout {
  margin: 36px 0;
  overflow: hidden;
  border-radius: var(--radius);
}

.article-figure figcaption,
.article-code figcaption {
  padding: 14px 18px 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.9;
}

.article-code {
  direction: ltr;
  background: #03070d;
}

.article-code figcaption {
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  direction: rtl;
  text-align: right;
}

.article-callout {
  padding: 24px 26px;
  border-color: rgba(117, 255, 217, 0.18);
  border-right: 3px solid var(--accent);
  background:
    linear-gradient(135deg, rgba(117, 255, 217, 0.09), rgba(137, 169, 255, 0.08)),
    rgba(13, 22, 36, 0.74);
}

.article-footer-nav,
.pagination {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 58px;
}

.button.primary {
  color: #03120e;
  background: linear-gradient(135deg, var(--accent), #d9fff5);
}

.button.ghost,
.pagination a {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 34px;
  border-radius: var(--radius);
}

.footer {
  justify-content: space-between;
  gap: 18px;
  padding-block: 34px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .hero,
  .post-grid,
  .featured .post-card-link,
  .article-hero-grid {
    grid-template-columns: 1fr;
  }

  .post-card.featured {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  :root {
    --container: min(100% - 28px, 1120px);
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding-block: 16px;
  }

  .brand-text small {
    display: none;
  }

  h1 {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .hero {
    padding-block: 54px;
  }

  .post-content,
  .article-callout {
    padding: 22px;
  }

  .article-shell {
    width: var(--container);
    padding-bottom: 66px;
  }

  .article-code pre {
    padding: 18px;
    font-size: 0.8rem;
  }

  .article-footer-nav,
  .pagination,
  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
