:root {
  color-scheme: dark;
  --color-background: #08090b;
  --color-surface: rgba(255, 255, 255, 0.045);
  --color-surface-hover: rgba(13, 42, 73, 0.72);
  --color-text: #f4f4f5;
  --color-muted: #b8bcc5;
  --color-border: rgba(255, 255, 255, 0.12);
  --color-navy-light: #183f68;
  --color-focus: #37658e;
  --font-family-base: "Vazirmatn", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(
      circle at top,
      rgba(255, 255, 255, 0.08),
      transparent 34rem
    ),
    var(--color-background);
  color: var(--color-text);
  direction: rtl;
  font-family: var(--font-family-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.not-found-body {
  background:
    radial-gradient(
      circle at top,
      rgba(255, 255, 255, 0.08),
      transparent 34rem
    ),
    var(--color-background);
}

a {
  color: inherit;
}

a:focus-visible {
  outline: 2px solid var(--color-navy-light);
  outline-offset: 4px;
}

.site-header {
  display: flex;
  width: min(100% - 32px, 1120px);
  align-items: center;
  direction: ltr;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 auto;
  padding: 24px 0;
}

.site-header__brand,
.site-header__nav a {
  text-decoration: none;
}

.site-header__brand {
  font-size: 1rem;
  font-weight: 800;
  transition: color 180ms ease;
}

.site-header__brand:hover,
.site-header__brand:focus-visible {
  color: var(--color-focus);
}

.site-header__nav {
  display: flex;
  flex-wrap: wrap;
  direction: ltr;
  justify-content: flex-end;
  gap: 0.5rem;
}

.site-header__nav a {
  display: inline-flex;
  min-height: 2.1rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 0.82rem;
  color: var(--color-muted);
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
  transform: translateY(0);
  transition:
    border-color 220ms ease,
    background-color 220ms ease,
    color 220ms ease,
    box-shadow 220ms ease,
    transform 220ms ease;
}

.site-header__nav a:hover,
.site-header__nav a:focus-visible,
.site-header__nav a[aria-current="page"] {
  border-color: var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text);
}

.site-header__nav a:hover,
.site-header__nav a:focus-visible {
  box-shadow: 0 0 0 3px rgba(13, 42, 73, 0.22);
  transform: translateY(-1px);
}

.site-header__nav a[aria-current="page"] {
  box-shadow: inset 0 0 0 1px rgba(244, 244, 245, 0.02);
}

.portfolio-page {
  width: min(100% - 32px, 1120px);
  margin: 0 auto;
  padding: 46px 0 72px;
  animation: fade-in 700ms ease both;
  text-align: right;
}

.portfolio-hero {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 4vw, 3rem);
  text-align: right;
}

.portfolio-hero h2 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 3.25rem);
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: break-word;
  white-space: normal;
}

.portfolio-section {
  margin-top: clamp(3.5rem, 8vw, 6.5rem);
}

.portfolio-hero + .portfolio-section {
  margin-top: clamp(1.5rem, 4vw, 2.75rem);
}

.post-section + .portfolio-section {
  margin-top: clamp(2rem, 4vw, 3rem);
}

.blog-post-list {
  display: grid;
  width: min(100%, 880px);
  gap: 0.75rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.pagination {
  align-items: center;
  justify-content: flex-start;
  margin-top: 1rem;
}

.project-controls {
  display: flex;
  flex: 0 0 auto;
  gap: 0.4rem;
}

.project-control {
  position: relative;
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background-color: transparent;
  color: var(--color-text);
  cursor: pointer;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    opacity 180ms ease,
    transform 180ms ease;
}

.project-control::before {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
}

.project-control--previous::before {
  transform: translateX(-0.12rem) rotate(-45deg);
}

.project-control--next::before {
  transform: translateX(0.12rem) rotate(135deg);
}

.project-control:hover,
.project-control:focus-visible {
  border-color: var(--color-border);
  background-color: var(--color-surface);
  box-shadow: none;
  transform: translateY(-2px);
}

.project-control:disabled,
.project-control:disabled:hover,
.project-control:disabled:focus-visible,
.project-control[aria-disabled="true"],
.project-control[aria-disabled="true"]:hover,
.project-control[aria-disabled="true"]:focus-visible {
  border-color: transparent;
  background-color: transparent;
  box-shadow: none;
  cursor: default;
  opacity: 0.28;
  transform: none;
}

.blog-post-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.04);
  padding: 1rem 1.1rem;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.blog-post-card:hover,
.blog-post-card:focus-within {
  border-color: var(--color-navy-light);
  background-color: var(--color-surface-hover);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28);
  transform: translateY(-2px);
}

.post-meta {
  margin: 0 0 0.55rem;
  color: var(--color-muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.post-meta time {
  display: inline;
  color: inherit;
  direction: ltr;
  font: inherit;
  unicode-bidi: isolate;
}

.blog-post-card .post-meta {
  margin: 0 0 0.55rem;
  color: rgba(184, 188, 197, 0.88);
  font-weight: 700;
}

.blog-post-card h3 {
  margin: 0;
  font-size: clamp(1.16rem, 2.2vw, 1.45rem);
  line-height: 1.22;
  overflow-wrap: break-word;
}

.blog-post-card h3 a {
  display: inline;
  margin-top: 0;
  color: var(--color-text);
  font: inherit;
}

.blog-post-card h3 a:hover,
.blog-post-card h3 a:focus-visible {
  color: var(--color-text);
}

.blog-post-card p:not(.post-meta) {
  max-width: 46rem;
  margin: 0.65rem 0 0;
  color: var(--color-muted);
  font-size: 0.98rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

.blog-post-card a {
  display: inline-flex;
  margin-top: 0.9rem;
  color: var(--color-muted);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 180ms ease;
}

.blog-post-card a:hover,
.blog-post-card a:focus-visible {
  color: var(--color-focus);
}

.post-section {
  padding-top: clamp(1.5rem, 4vw, 3.5rem);
}

.blog-post-content {
  width: min(100%, 720px);
  margin: 0 auto;
  color: rgba(244, 244, 245, 0.88);
  font-size: 1.06rem;
  line-height: 1.82;
}

.post-header {
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.post-header h1 {
  margin: 0 0 0.85rem;
  color: var(--color-text);
  font-size: clamp(2rem, 4.4vw, 2.65rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: break-word;
}

.post-header .post-meta {
  margin: 0;
  color: rgba(184, 188, 197, 0.9);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.45;
}

.post-header .post-header__divider {
  margin: 0.5rem 0 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

.blog-post-content p {
  margin: 0 0 1.35rem;
  overflow-wrap: break-word;
}

.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4 {
  color: var(--color-text);
  letter-spacing: 0;
  overflow-wrap: break-word;
}

.blog-post-content h2 {
  margin: 3rem 0 1rem;
  font-size: 1.65rem;
  line-height: 1.22;
}

.blog-post-content h3 {
  margin: 2.4rem 0 0.85rem;
  font-size: 1.34rem;
  line-height: 1.28;
}

.blog-post-content h4 {
  margin: 2rem 0 0.75rem;
  font-size: 1.12rem;
  line-height: 1.35;
}

.blog-post-content a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  overflow-wrap: anywhere;
  transition: none;
}

.blog-post-content ul,
.blog-post-content ol {
  margin: 0 0 1.45rem;
  padding-right: 1.35rem;
  padding-left: 0;
}

.blog-post-content li {
  margin-bottom: 0.55rem;
  padding-right: 0.15rem;
}

.blog-post-content blockquote {
  margin: 2rem 0;
  border-right: 3px solid var(--color-navy-light);
  padding: 0.1rem 1rem 0.1rem 0;
  color: rgba(244, 244, 245, 0.76);
}

.blog-post-content blockquote p:last-child,
.blog-post-content li:last-child {
  margin-bottom: 0;
}

.blog-post-content figure {
  width: 100%;
  margin: clamp(2.1rem, 6vw, 3.2rem) 0;
}

.blog-post-content img,
.blog-post-content video {
  display: block;
  max-width: 100%;
  height: auto;
  margin-right: auto;
  margin-left: auto;
  border-radius: 6px;
}

.blog-post-content > img,
.blog-post-content > video {
  margin-top: clamp(2.1rem, 6vw, 3.2rem);
  margin-bottom: clamp(2.1rem, 6vw, 3.2rem);
}

.blog-post-content figcaption {
  max-width: 42rem;
  margin: 0.75rem auto 0;
  color: rgba(184, 188, 197, 0.86);
  font-size: 0.86rem;
  line-height: 1.55;
  text-align: center;
}

.blog-post-content figcaption p {
  margin: 0;
}

.blog-post-content pre,
.blog-post-content table {
  max-width: 100%;
  overflow-x: auto;
}

.blog-post-content pre {
  margin: 1.8rem 0;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  padding: 1rem;
  direction: ltr;
  text-align: left;
}

.blog-post-content code {
  direction: ltr;
  font-size: 0.92em;
  unicode-bidi: isolate;
}

.blog-post-content :not(pre) > code {
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 0.08rem 0.28rem;
}

.blog-post-content hr {
  margin: 3rem 0;
  border: 0;
  border-top: 1px solid var(--color-border);
}

.contact-band a {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background-color: rgba(255, 255, 255, 0.06);
  padding: 0.65rem 0.9rem;
  text-decoration: none;
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.contact-band a:focus-visible,
.contact-band a:hover {
  border-color: var(--color-navy-light);
  background-color: var(--color-surface-hover);
}

.contact-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  direction: ltr;
  justify-content: flex-end;
  gap: 1.5rem;
  border-top: 1px solid var(--color-border);
  padding-top: 2rem;
}

.contact-social {
  display: flex;
  flex-wrap: wrap;
  margin-left: auto;
  min-width: 0;
  direction: ltr;
  justify-content: flex-end;
  gap: 0.65rem;
}

.contact-social a {
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
}

.contact-social a:hover,
.contact-social a:focus-visible {
  box-shadow: 0 0 0 3px rgba(13, 42, 73, 0.28);
  transform: translateY(-2px);
}

.contact-social img {
  display: block;
  width: 1.08rem;
  height: 1.08rem;
  filter: invert(1);
  opacity: 0.9;
}

.not-found-page {
  display: flex;
  width: min(100% - 32px, 1120px);
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 32px 0;
}

.not-found {
  width: min(100%, 820px);
  text-align: center;
}

.not-found h1 {
  margin: 0;
}

.not-found__code {
  display: inline-block;
  margin: 0;
  color: var(--color-text);
  font-size: clamp(5rem, 18vw, 12rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0;
  text-decoration: none;
}

.not-found__code:hover,
.not-found__code:focus-visible {
  color: var(--color-text);
  text-decoration: none;
  transform: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portfolio-page {
    animation: none;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 760px) {
  .post-header h1 {
    font-size: 2.1rem;
  }

  .contact-band {
    align-items: flex-end;
    flex-direction: column;
  }

  .contact-social {
    justify-content: flex-end;
  }

}

@media (max-width: 600px) {
  .site-header {
    width: min(100% - 28px, 1120px);
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 0;
  }

  .site-header__nav {
    justify-content: flex-start;
  }

  .portfolio-page {
    width: min(100% - 28px, 1120px);
    padding: 20px 0 48px;
  }

  .post-section {
    padding-top: 1rem;
  }

  .blog-post-content {
    font-size: 1rem;
    line-height: 1.78;
  }

  .post-header {
    margin-bottom: 2rem;
  }

  .post-header h1 {
    font-size: 1.7rem;
    line-height: 1.12;
  }

  .post-header .post-meta {
    font-size: 0.88rem;
  }

  .blog-post-content h2 {
    margin-top: 2.4rem;
    font-size: 1.42rem;
  }

  .blog-post-content h3 {
    font-size: 1.22rem;
  }

  .blog-post-content figure {
    margin: 2rem 0;
  }

  .blog-post-content figcaption {
    font-size: 0.82rem;
    text-align: right;
  }

  .not-found-page {
    width: min(100% - 28px, 1120px);
    min-height: 100vh;
    padding: 24px 0;
  }
}

@media (max-width: 380px) {
  .contact-social {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 0.35rem;
  }

  .contact-social a {
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
  }

  .contact-social img {
    width: 1rem;
    height: 1rem;
  }
}
