@font-face {
  font-family: "Vazirmatn";
  src: url("./fonts/Vazirmatn[wght].woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --background: #030303;
  --foreground: #fafafa;
  --card: #090909;
  --primary: #fafafa;
  --primary-foreground: #030303;
  --secondary: #171717;
  --secondary-foreground: #fafafa;
  --muted-foreground: #a3a3a3;
  --border: #262626;
  --grid-line: rgba(255, 255, 255, 0.035);
  --nav-bg: rgba(3, 3, 3, 0.78);
  --card-bg: rgba(9, 9, 9, 0.78);
  --card-hover: #0d0d0d;
  --blue: #3b82f6;
  --red: #ef4444;
  --yellow: #eab308;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 18px 60px rgba(0, 0, 0, 0.32);
}

html[data-theme="light"],
body[data-theme="light"] {
  --background: #fafafa;
  --foreground: #050505;
  --card: #ffffff;
  --primary: #050505;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #050505;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --grid-line: rgba(0, 0, 0, 0.045);
  --nav-bg: rgba(250, 250, 250, 0.78);
  --card-bg: rgba(255, 255, 255, 0.78);
  --card-hover: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 18px 60px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  color: var(--foreground);
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--background);
  background-size: 44px 44px;
  overflow-x: hidden;
  transition: background-color 180ms ease, color 180ms ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.11), transparent 26rem),
    radial-gradient(circle at 92% 28%, rgba(239, 68, 68, 0.08), transparent 22rem),
    radial-gradient(circle at 42% 96%, rgba(234, 179, 8, 0.08), transparent 24rem);
}

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

.container {
  width: min(1360px, calc(100% - 32px));
  margin-inline: auto;
}

header {
  position: sticky;
  top: 16px;
  z-index: 50;
  padding-top: 16px;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-radius: calc(var(--radius) + 10px);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  font-weight: 800;
  letter-spacing: -0.02em;
}


.nav-right,
.nav-links,
.nav-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.nav-links a,
.toggle-btn {
  color: var(--muted-foreground);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  transition: 180ms ease;
}

.toggle-btn {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card-bg);
  font-family: inherit;
}

.nav-links a:hover,
.toggle-btn:hover,
.toggle-btn.active {
  color: var(--foreground);
  background: var(--secondary);
}

.hero {
  min-height: calc(100vh - 86px);
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 24px;
  align-items: center;
  padding: 72px 0 48px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted-foreground);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.88rem;
  direction: ltr;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14);
}

.hero-title {
  max-width: 720px;
  margin-bottom: 22px;
  text-wrap: balance;
}

.hero-name {
  display: block;
  font-size: clamp(2.55rem, 6vw, 4.85rem);
  line-height: 1;
  letter-spacing: -0.07em;
  font-weight: 900;
}

.hero-subtitle {
  display: block;
  max-width: 590px;
  margin-top: 14px;
  color: var(--muted-foreground);
  font-size: clamp(1.15rem, 2.1vw, 1.72rem);
  line-height: 1.65;
  letter-spacing: -0.035em;
  font-weight: 650;
}

.accent-blue { color: var(--blue); }
.accent-red { color: var(--red); }
.accent-yellow { color: var(--yellow); }

.lead {
  max-width: 690px;
  color: var(--muted-foreground);
  line-height: 2;
  font-size: 1.03rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  padding: 0 15px;
  font-weight: 750;
  font-size: 0.92rem;
  transition: 160ms ease;
  box-shadow: var(--shadow-sm);
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--foreground) 24%, var(--border));
}

.btn.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn.blue {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.13);
  color: var(--blue);
}

.btn.red {
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
}

.btn.yellow {
  border-color: rgba(234, 179, 8, 0.42);
  background: rgba(234, 179, 8, 0.12);
  color: #ca8a04;
}

.panel {
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: calc(var(--radius) + 10px);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.profile-panel {
  padding: 12px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  color: var(--muted-foreground);
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
  direction: ltr;
}

.window-dots {
  display: flex;
  gap: 6px;
}

.window-dots span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #525252;
}

.window-dots span:nth-child(1) { background: var(--red); }
.window-dots span:nth-child(2) { background: var(--yellow); }
.window-dots span:nth-child(3) { background: var(--blue); }

.profile-grid {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.stat-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 16px;
}

.stat-card strong {
  display: block;
  margin-bottom: 7px;
  font-size: 1rem;
}

.stat-card p,
.card p,
.card li {
  color: var(--muted-foreground);
  line-height: 1.9;
  font-size: 0.94rem;
}

.pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  direction: ltr;
}

.pill.blue {
  color: var(--blue);
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.pill.red {
  color: var(--red);
  background: rgba(239, 68, 68, 0.13);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.code-block {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  padding: 16px;
  color: var(--foreground);
  direction: ltr;
  text-align: left;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.9;
  overflow-x: auto;
}

.section {
  padding: 76px 0;
}

.section-title {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.section-title h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.06em;
  line-height: 1.05;
}

.section-title p {
  color: var(--muted-foreground);
  line-height: 1.9;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--card-bg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: 160ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--foreground) 24%, var(--border));
  background: var(--card-hover);
}

.icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--secondary);
  color: var(--foreground);
  font-size: 1.05rem;
}

.icon.blue { color: var(--blue); border-color: rgba(59, 130, 246, 0.35); background: rgba(59, 130, 246, 0.1); }
.icon.red { color: var(--red); border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.09); }
.icon.yellow { color: #ca8a04; border-color: rgba(234, 179, 8, 0.35); background: rgba(234, 179, 8, 0.1); }

.card h3 {
  margin-bottom: 10px;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.project-card,
.article-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.project-link,
.article-link {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  color: inherit;
}

.project-image {
  position: relative;
  min-height: 154px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  background: var(--secondary);
}

.project-image::before,
.project-image::after,
.article-cover.placeholder::before,
.article-cover.placeholder::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
}

.project-image::before,
.article-cover.placeholder::before {
  width: 148px;
  height: 148px;
  inset-inline-end: -44px;
  top: -44px;
}

.project-image::after,
.article-cover.placeholder::after {
  width: 88px;
  height: 88px;
  inset-inline-start: 28px;
  bottom: 26px;
}

.project-image.blue,
.article-cover.blue {
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.34), transparent),
    linear-gradient(45deg, var(--card), var(--secondary));
}

.project-image.red,
.article-cover.red {
  background:
    linear-gradient(135deg, rgba(239, 68, 68, 0.3), transparent),
    linear-gradient(45deg, var(--card), var(--secondary));
}

.project-image.yellow,
.article-cover.yellow {
  background:
    linear-gradient(135deg, rgba(234, 179, 8, 0.28), transparent),
    linear-gradient(45deg, var(--card), var(--secondary));
}

.project-visual {
  position: absolute;
  inset-inline: 24px;
  bottom: 22px;
  display: grid;
  gap: 8px;
  direction: ltr;
}

.visual-line {
  height: 9px;
  width: var(--w);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

body[data-theme="light"] .visual-line {
  background: rgba(0, 0, 0, 0.35);
}

.project-body {
  flex: 1;
  padding: 18px;
}





.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  direction: ltr;
  vertical-align: middle;
}

.tag.blue { color: var(--blue); border-color: rgba(59, 130, 246, 0.32); }
.tag.red { color: var(--red); border-color: rgba(239, 68, 68, 0.32); }
.tag.yellow { color: #ca8a04; border-color: rgba(234, 179, 8, 0.32); }

.blog-head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
  align-items: end;
  margin-bottom: 24px;
}


.blog-head h2 {
  max-width: 560px;
  font-size: clamp(2.15rem, 5vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.07em;
}

.blog-head p {
  max-width: 520px;
  color: var(--muted-foreground);
  line-height: 1.9;
}

.blog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr);
  gap: 12px;
  align-items: stretch;
}

.article-stack {
  display: grid;
  gap: 12px;
}

.article-card.featured .article-link {
  min-height: 520px;
}

.article-card.compact .article-link {
  display: grid;
  grid-template-columns: 172px 1fr;
  min-height: 254px;
}

.article-cover {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  isolation: isolate;
}

.article-card.featured .article-cover {
  min-height: 292px;
}

.article-card.compact .article-cover {
  min-height: 100%;
  border-bottom: 0;
  border-inline-end: 1px solid var(--border);
}

.article-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}



.cover-lines {
  position: absolute;
  inset-inline: 24px;
  bottom: 24px;
  z-index: 1;
  display: grid;
  gap: 9px;
  direction: ltr;
}

.cover-lines span {
  display: block;
  height: 10px;
  width: var(--w);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
}

body[data-theme="light"] .cover-lines span {
  background: rgba(0, 0, 0, 0.28);
}

.article-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
}

.article-card.compact .article-content {
  padding: 18px;
  gap: 14px;
}

.article-card h3 {
  margin-bottom: 10px;
  line-height: 1.55;
  letter-spacing: -0.02em;
}

.article-card.featured h3 {
  max-width: 720px;
  font-size: clamp(1.42rem, 2.5vw, 2.2rem);
  line-height: 1.35;
  letter-spacing: -0.045em;
}

.article-card p {
  color: var(--muted-foreground);
  line-height: 1.9;
  font-size: 0.94rem;
}

.article-card.featured p {
  max-width: 680px;
  font-size: 1rem;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}


.contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.contact-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted-foreground);
  direction: ltr;
  text-align: left;
}

.contact-list a {
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--card);
  padding: 11px 12px;
  transition: 160ms ease;
}

.contact-list a:hover {
  color: var(--foreground);
  border-color: color-mix(in srgb, var(--foreground) 24%, var(--border));
}

footer {
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  text-align: center;
  padding: 34px 0 46px;
  font-size: 0.92rem;
  direction: ltr;
}

@media (max-width: 920px) {
  .hero,
  .section-title,
  .grid,
  .blog-head,
  .blog-layout,
  .contact {
    grid-template-columns: 1fr;
  }

  .hero {
    padding-top: 56px;
  }

  .nav {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-right,
  .nav-links {
    justify-content: flex-start;
  }

  .article-card.compact .article-link {
    grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
    min-height: 0;
  }

  .article-card.featured .article-link {
    min-height: 0;
  }

  .article-card.compact .article-cover {
    min-height: 0;
    aspect-ratio: auto;
    border-inline-end: 1px solid var(--border);
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  .article-card.compact .article-link {
    grid-template-columns: minmax(94px, 31%) minmax(0, 1fr);
  }

  .article-card.compact .article-cover {
    min-height: 100%;
  }

  .article-card.compact .article-content {
    padding: 14px;
    gap: 10px;
  }

  .article-card.compact h3 {
    margin-bottom: 6px;
    font-size: 0.96rem;
    line-height: 1.45;
  }

  .article-card.compact p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.86rem;
    line-height: 1.65;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .article-card.compact .tags {
    margin-top: 4px;
    gap: 5px;
  }

  .article-card.compact .tag {
    max-width: 100%;
    overflow: hidden;
    padding: 4px 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}




.container {
  margin-inline: auto;
}

header.container {
  width: min(1360px, calc(100% - 32px));
}

header {
  transition: transform 220ms ease, opacity 180ms ease;
  will-change: transform;
}

body.header-hidden header {
  transform: translateY(-120%);
  opacity: 0;
  pointer-events: none;
}

.page-main {
  width: min(1360px, calc(100% - 32px));
}

.about-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body::before {
  background:
    radial-gradient(circle at 10% 10%, rgba(59, 130, 246, 0.055), transparent 26rem),
    radial-gradient(circle at 92% 28%, rgba(239, 68, 68, 0.04), transparent 22rem),
    radial-gradient(circle at 42% 96%, rgba(234, 179, 8, 0.038), transparent 24rem);
}

.nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.brand {
  justify-self: start;
}

.nav-right {
  display: contents;
}

.nav-links {
  grid-column: 2;
  justify-content: center;
}

.nav-actions {
  grid-column: 3;
  justify-self: end;
  justify-content: flex-end;
}

.menu-toggle,
.nav-backdrop {
  display: none;
}

#themeToggle {
  min-width: 42px;
  border-color: var(--border);
  background: var(--secondary);
  color: var(--muted-foreground);
  font-size: 1rem;
}

#themeToggle:hover {
  color: var(--foreground);
  border-color: color-mix(in srgb, var(--foreground) 24%, var(--border));
}

.head-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: clamp(18px, 3vw, 38px);
  align-items: center;
  margin: 34px 0 18px;
  padding: clamp(34px, 6vw, 76px) 0 clamp(26px, 4vw, 54px);
}

.head-copy {
  display: grid;
  gap: 16px;
  max-width: 680px;
}

.head-title {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 3.65rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.head-title strong {
  color: var(--blue);
}

.head-line {
  margin: 0;
  max-width: 620px;
  color: var(--foreground);
  font-size: clamp(1rem, 1.45vw, 1.22rem);
  font-weight: 750;
  line-height: 1.8;
}

.head-summary {
  margin: 0;
  max-width: 650px;
  color: var(--muted-foreground);
  line-height: 1.95;
}

.head-photo-wrap {
  display: grid;
  place-items: center start;
}

.head-photo {
  position: relative;
  width: min(100%, 440px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--blue) 18%, var(--border));
  border-radius: calc(var(--radius) + 12px);
  background:
    radial-gradient(circle at 35% 28%, rgba(59, 130, 246, 0.18), transparent 35%),
    radial-gradient(circle at 76% 70%, rgba(234, 179, 8, 0.14), transparent 36%),
    var(--secondary);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.2),
    0 0 0 10px color-mix(in srgb, var(--blue) 5%, transparent);
}

.head-photo::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: calc(var(--radius) + 6px);
  background:
    linear-gradient(135deg, rgba(220, 38, 38, 0.14), transparent 28%),
    linear-gradient(315deg, rgba(59, 130, 246, 0.18), transparent 34%),
    color-mix(in srgb, var(--secondary) 78%, var(--card));
}

.head-photo img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.head-photo span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  direction: ltr;
  color: var(--foreground);
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 900;
}

.lead {
  max-width: 760px;
  font-size: 1rem;
}

.section-title h2 {
  font-size: clamp(1.85rem, 3.25vw, 2.65rem);
  letter-spacing: -0.04em;
}

.blog-head h2 {
  font-size: clamp(2rem, 4.2vw, 3.45rem);
  letter-spacing: -0.05em;
}

.content-title {
  font-size: clamp(1.72rem, 2.85vw, 2.55rem);
  letter-spacing: -0.035em;
}

.article-card.featured h3 {
  font-size: clamp(1.28rem, 2vw, 1.78rem);
  letter-spacing: -0.03em;
}

.project-image.has-cover,
.article-cover.has-cover {
  background: var(--secondary);
}

.project-image,
.article-cover {
  aspect-ratio: 16 / 9;
  min-height: 0;
}

.article-card.featured .article-cover {
  min-height: 0;
}

.article-card.compact .article-link {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.article-card.compact .article-cover {
  min-height: 0;
  border-bottom: 1px solid var(--border);
  border-inline-end: 0;
}

.blog-layout {
  grid-template-columns: minmax(0, 0.96fr) minmax(300px, 0.74fr);
  align-items: stretch;
}

.blog-layout .article-stack {
  grid-template-rows: repeat(3, minmax(0, 1fr));
}

.blog-layout .article-stack .article-card.compact .article-link {
  display: grid;
  grid-template-columns: minmax(180px, 42%) minmax(0, 1fr);
  min-height: 0;
  height: 100%;
}

.blog-layout .article-stack .article-card.compact .article-cover {
  aspect-ratio: auto;
  height: 100%;
  border-bottom: 0;
  border-inline-end: 1px solid var(--border);
}

.blog-layout .article-stack .article-card.compact .article-content {
  min-height: 0;
  gap: 12px;
  padding: 16px;
}

.blog-layout .article-stack .article-card.compact h3 {
  font-size: 1.02rem;
  line-height: 1.55;
}

.blog-layout .article-stack .article-card.compact p {
  line-height: 1.75;
  font-size: 0.9rem;
}

.blog-layout .article-stack .article-card.compact:nth-child(n + 4) {
  display: none;
}

.blog-layout > .article-card.featured .article-link {
  min-height: 100%;
}

.blog-layout > .article-card.featured .article-cover {
  aspect-ratio: 16 / 11;
}

.blog-layout > .article-card.featured .article-content {
  min-height: 0;
  padding: 20px;
}

.detail-overlay-hero {
  position: relative;
  display: block;
  min-height: clamp(360px, 42vw, 620px);
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 10px);
  overflow: hidden;
}

.detail-overlay-hero .detail-cover {
  height: 100%;
  min-height: inherit;
  border: 0;
  border-radius: inherit;
}

.detail-overlay-hero .article-cover,
.detail-overlay-hero .project-image {
  height: 100%;
}

.detail-overlay-card {
  position: absolute;
  inset-inline-start: clamp(16px, 3vw, 34px);
  inset-inline-end: auto;
  bottom: clamp(16px, 3vw, 34px);
  z-index: 4;
  width: fit-content;
  max-width: min(760px, calc(100% - 68px));
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid color-mix(in srgb, var(--foreground) 12%, transparent);
  background: color-mix(in srgb, var(--card) 84%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.28);
}

.detail-overlay-card .content-title {
  margin-bottom: 0;
}

.side-panel-tags {
  margin-bottom: 16px;
}

.project-image.has-cover::before,
.project-image.has-cover::after,
.article-cover.has-cover::before,
.article-cover.has-cover::after {
  display: none;
}

.project-image img,
.article-cover img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
  object-fit: cover;
}

.about-card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.about-card-heading .icon {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.about-card-heading h3 {
  margin-bottom: 0;
}

.portrait-showcase {
  position: relative;
  min-height: 500px;
  border-radius: calc(var(--radius) + 18px);
}

.portrait-main {
  position: relative;
  display: grid;
  align-content: end;
  min-height: 500px;
  aspect-ratio: 4 / 5;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(var(--radius) + 18px);
  background:
    linear-gradient(var(--card), var(--card)) padding-box,
    linear-gradient(145deg, rgba(248, 113, 113, 0.34), rgba(96, 165, 250, 0.34) 48%, rgba(250, 204, 21, 0.3)) border-box;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.035),
    0 24px 70px rgba(0, 0, 0, 0.26),
    0 0 42px rgba(248, 113, 113, 0.09),
    0 0 52px rgba(96, 165, 250, 0.08),
    0 0 46px rgba(250, 204, 21, 0.07);
  overflow: visible;
}

.portrait-main::after {
  content: "";
  position: absolute;
  inset: -14px;
  z-index: -1;
  border-radius: calc(var(--radius) + 28px);
  background:
    radial-gradient(circle at 16% 12%, rgba(248, 113, 113, 0.16), transparent 32%),
    radial-gradient(circle at 88% 22%, rgba(96, 165, 250, 0.16), transparent 34%),
    radial-gradient(circle at 52% 96%, rgba(250, 204, 21, 0.14), transparent 32%);
  filter: blur(12px);
  opacity: 0.95;
  pointer-events: none;
}

.portrait-image,
.portrait-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.portrait-image {
  object-fit: cover;
  object-position: center;
  filter: saturate(0.96) contrast(1.04);
  border-radius: inherit;
}

.portrait-placeholder {
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 42%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
}

.page-main {
  padding: 58px 0 92px;
}

.content-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(380px, 0.94fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
}

.content-hero .card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.back-link {
  width: fit-content;
  margin-bottom: 18px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.content-title {
  max-width: 820px;
  line-height: 1.04;
  margin-bottom: 18px;
}

.content-summary {
  max-width: 780px;
  color: var(--muted-foreground);
  font-size: 1.04rem;
  line-height: 2;
}

.detail-cover {
  aspect-ratio: 16 / 9;
  min-height: clamp(260px, 30vw, 450px);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 10px);
  overflow: hidden;
}

.detail-cover .article-cover,
.detail-cover .project-image {
  min-height: 0;
  height: 100%;
  border-bottom: 0;
}

.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  align-items: start;
}

.prose {
  padding: 30px;
  display: grid;
  gap: 18px;
}

.prose h1,
.prose h2,
.prose h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  letter-spacing: -0.03em;
  line-height: 1.35;
}

.prose h1:first-child,
.prose h2:first-child,
.prose h3:first-child {
  margin-top: 0;
}

.prose p,
.prose li {
  color: var(--muted-foreground);
  line-height: 2;
  font-size: 1rem;
}

.prose p {
  margin: 0;
}

.prose ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 18px;
  padding-inline-start: 22px;
}

.prose ol {
  display: grid;
  gap: 8px;
  margin: 10px 0 18px;
  padding-inline-start: 22px;
}

.prose li > ul,
.prose li > ol {
  margin: 8px 0 0;
}

.prose a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--foreground) 36%, transparent);
  text-underline-offset: 4px;
}

.prose code {
  direction: ltr;
  unicode-bidi: isolate;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--secondary);
  color: var(--foreground);
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9em;
}

.prose-image {
  width: min(100%, 760px);
  margin: 12px auto;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 10px);
  background: var(--card-bg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.prose-image picture {
  display: block;
}

.prose-image img {
  display: block;
  width: 100%;
  max-height: 720px;
  object-fit: cover;
}

.prose-image figcaption {
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  padding: 10px 14px;
  font-size: 0.86rem;
  line-height: 1.7;
  text-align: center;
}

.side-panel {
  position: sticky;
  top: 116px;
}

.side-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.side-panel-title .icon {
  flex: 0 0 auto;
  margin-bottom: 0;
}

.side-panel-title h3 {
  margin: 0;
}

.toc-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.toc-list a {
  display: block;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--muted-foreground);
  padding: 9px 10px;
  line-height: 1.7;
  font-size: 0.86rem;
}

.toc-list a:hover {
  color: var(--foreground);
}

.toc-list a[data-level="3"] {
  margin-inline-start: 14px;
}

.archive-intro {
  margin-bottom: 24px;
}

.resume-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.42fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 28px;
}

.resume-hero .card {
  display: grid;
  align-content: center;
}

.resume-stats {
  display: grid;
  gap: 10px;
}

.resume-stat {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  padding: 16px;
}

.resume-stat strong {
  display: block;
  color: var(--foreground);
  font-size: 1.45rem;
  line-height: 1;
}

.resume-stat span {
  color: var(--muted-foreground);
  font-size: 0.82rem;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-archive-actions {
  justify-content: flex-end;
}

.posts-archive-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.article-card.compact .article-content {
  min-height: 0;
}

.article-footer .tags {
  margin-top: 0;
}

a.tag:hover {
  color: var(--foreground);
  border-color: color-mix(in srgb, var(--foreground) 24%, var(--border));
}

.contact-methods {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.contact-method {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--card-bg);
  color: var(--foreground);
  padding: 16px;
  font-size: 0.92rem;
  font-weight: 750;
  text-align: start;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.contact-method:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--contact-ink, var(--foreground)) 30%, var(--border));
  background: var(--card-hover);
}

.contact-method .icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  margin-bottom: 0;
  border: 1px solid color-mix(in srgb, var(--contact-ink, var(--foreground)) 34%, var(--border));
  border-radius: 11px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--contact-ink, var(--foreground)) 14%, transparent), transparent),
    var(--secondary);
  color: var(--contact-ink, var(--foreground));
}

.contact-method .icon i {
  display: block;
  font-size: 1.15rem;
  line-height: 1;
}

.contact-method.gmail {
  --contact-ink: #f8fafc;
  --contact-muted: var(--muted-foreground);
}

.contact-method.github {
  --contact-ink: #a855f7;
  --contact-muted: var(--muted-foreground);
}

.contact-method.linkedin {
  --contact-ink: #60a5fa;
  --contact-muted: var(--muted-foreground);
}

.contact-method.youtube {
  --contact-ink: #ff5b72;
  --contact-muted: var(--muted-foreground);
}

.contact-method.telegram {
  --contact-ink: #38bdf8;
  --contact-muted: var(--muted-foreground);
}

.contact-method.instagram {
  --contact-ink: #f472b6;
  --contact-muted: var(--muted-foreground);
}

.contact-method > span:not(.icon) {
  display: grid;
  gap: 5px;
  min-width: 0;
  width: 100%;
  margin-top: 2px;
  text-align: start;
}

.contact-method strong {
  color: var(--foreground);
  font-size: 0.84rem;
  line-height: 1.1;
}

.contact-method > span:not(.icon) > span {
  color: var(--contact-muted, var(--muted-foreground));
  direction: ltr;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  font-size: 0.72rem;
  line-height: 1.2;
}

.tag-page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.resume-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.resume-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.resume-list li {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted-foreground);
  padding: 12px;
  line-height: 1.8;
}

@media (max-width: 920px) {
  .portrait-showcase {
    order: 2;
  }

  .portrait-showcase {
    min-height: 0;
  }

  .content-hero,
  .content-layout,
  .head-section,
  .blog-layout,
  .archive-grid,
  .resume-hero,
  .resume-grid {
    grid-template-columns: 1fr;
  }

  .head-section {
    min-height: 0;
    gap: 24px;
    padding: 34px;
  }

  .about-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .head-photo-wrap {
    order: -1;
    place-items: center;
  }

  .head-photo {
    width: min(82vw, 380px);
  }

  .contact-methods {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-cover {
    min-height: clamp(240px, 48vw, 390px);
  }

  .side-panel {
    position: static;
  }

  body.nav-open {
    overflow: hidden;
  }

  header {
    will-change: auto;
  }

  body.nav-open header {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .nav {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
  }

  .brand {
    min-width: 0;
    justify-self: start;
    overflow: hidden;
    text-align: start;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-right {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    z-index: 80;
    display: flex;
    width: min(360px, calc(100vw - 28px));
    max-width: 100%;
    max-height: calc(100vh - 112px);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 14px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 8px);
    background: color-mix(in srgb, var(--card) 97%, var(--background));
    box-shadow: var(--shadow-md);
    padding: 16px;
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  }

  html[dir="rtl"] .nav-right {
    transform: translateY(-8px);
  }

  body.nav-open .nav-right {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }

  body:not(.nav-open) .nav-right {
    display: none;
  }

  .nav-links {
    order: 0;
    display: grid;
    width: 100%;
    align-self: stretch;
    justify-self: stretch;
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    justify-content: stretch;
  }

  .nav-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--secondary);
    color: var(--foreground);
    padding: 0 14px;
    text-align: center;
    white-space: normal;
  }

  .nav-links a:hover {
    background: var(--card-hover);
  }

  .nav-actions {
    order: 1;
    display: grid;
    width: 100%;
    align-self: stretch;
    justify-self: stretch;
    grid-column: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    justify-content: stretch;
    border-top: 1px solid var(--border);
    margin-top: 2px;
    padding-top: 12px;
  }

  .toggle-btn {
    min-height: 42px;
    border: 1px solid var(--border);
    background: var(--secondary);
    color: var(--foreground);
    padding: 0 10px;
  }

  .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    justify-self: end;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--secondary);
    color: var(--foreground);
    padding: 0;
    cursor: pointer;
  }

  .menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
  }

  .nav-backdrop {
    display: none;
  }

  body.nav-open .nav-backdrop {
    display: none;
  }

  .archive-grid .article-card.compact .article-link {
    display: grid;
    grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
    min-height: 0;
  }

  .blog-layout .article-stack .article-card.compact .article-link {
    display: grid;
    grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
    min-height: 0;
  }

  .blog-layout > .article-card.featured .article-link {
    display: grid;
    grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
    min-height: 0;
  }

  .blog-layout > .article-card.featured .article-cover {
    min-height: 0;
    aspect-ratio: auto;
    border-bottom: 0;
    border-inline-end: 1px solid var(--border);
  }

  .projects-archive-grid .project-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, 34%);
    min-height: 0;
  }

  .projects-archive-grid .project-image {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    aspect-ratio: auto;
    width: 100%;
    height: 100%;
    border-bottom: 0;
    border-inline-start: 1px solid var(--border);
    border-inline-end: 0;
  }

  .projects-archive-grid .project-body {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .article-card.compact p,
  .blog-layout > .article-card.featured p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .home-project-grid .project-card:not(:first-child) .project-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, 34%);
    min-height: 0;
  }

  .home-project-grid .project-card:not(:first-child) .project-image {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    aspect-ratio: auto;
    width: 100%;
    height: 100%;
    border-bottom: 0;
    border-inline-start: 1px solid var(--border);
    border-inline-end: 0;
  }

  .home-project-grid .project-card:not(:first-child) .project-body {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .home-project-grid .project-card:not(:first-child) .project-body p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .blog-layout .article-stack .article-card.compact:nth-child(n + 3) {
    display: none;
  }
}

@media (max-width: 560px) {
  html,
  body {
    overflow-x: hidden;
  }

  .container {
    width: min(1360px, calc(100% - 20px));
  }

  header.container,
  .page-main {
    width: min(1360px, calc(100% - 20px));
  }

  .nav,
  .panel,
  .portrait-showcase,
  .card,
  .stat-card,
  .article-card,
  .project-card,
  .content-hero,
  .content-layout,
  .resume-hero {
    min-width: 0;
  }

  .head-section {
    margin-top: 18px;
    padding: 22px;
  }

  .head-copy {
    gap: 16px;
    text-align: center;
  }

  .head-line,
  .head-summary {
    margin-inline: auto;
  }

  .head-title {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(1.72rem, 7.6vw, 2.1rem);
    line-height: 1.35;
  }

  .head-title strong {
    display: inline;
  }

  .head-photo {
    width: min(78vw, 320px);
  }

  .contact-methods {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-method {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 16px 12px;
  }

  .contact-method > span:not(.icon) {
    text-align: center;
  }

  .blog-layout .article-stack .article-card.compact .article-link {
    display: grid;
    grid-template-columns: minmax(94px, 31%) minmax(0, 1fr);
    min-height: 0;
  }

  .blog-layout .article-stack .article-card.compact .article-cover {
    aspect-ratio: auto;
    height: 100%;
    min-height: 100%;
    border-bottom: 0;
    border-inline-end: 1px solid var(--border);
  }

  .blog-layout > .article-card.featured .article-link {
    display: grid;
    grid-template-columns: minmax(94px, 31%) minmax(0, 1fr);
    min-height: 0;
  }

  .blog-layout > .article-card.featured .article-cover {
    aspect-ratio: auto;
    height: 100%;
    min-height: 100%;
    border-bottom: 0;
    border-inline-end: 1px solid var(--border);
  }

  .article-card.compact p,
  .blog-layout > .article-card.featured p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .home-project-grid .project-card:not(:first-child) .project-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(112px, 34%);
    min-height: 0;
  }

  .home-project-grid .project-card:not(:first-child) .project-image {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    aspect-ratio: auto;
    width: 100%;
    height: 100%;
    border-bottom: 0;
    border-inline-start: 1px solid var(--border);
    border-inline-end: 0;
  }

  .home-project-grid .project-card:not(:first-child) .project-body {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .home-project-grid .project-card:not(:first-child) .project-body p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .blog-head {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  .blog-layout {
    gap: 12px;
  }

  .blog-layout > .article-card.featured {
    order: 0;
  }

  .blog-layout .article-stack {
    gap: 12px;
    grid-template-rows: none;
  }

  .blog-layout > .article-card.featured .article-content,
  .blog-layout .article-stack .article-card.compact .article-content {
    padding: 16px;
  }

  .blog-layout > .article-card.featured h3 {
    margin-bottom: 6px;
    font-size: 0.96rem;
    line-height: 1.45;
    letter-spacing: 0;
  }

  .blog-layout > .article-card.featured p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.86rem;
    line-height: 1.65;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .home-project-grid .project-card:not(:first-child) .project-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(94px, 31%);
    min-height: 0;
  }

  .home-project-grid .project-card:not(:first-child) .project-image {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    aspect-ratio: auto;
    border-bottom: 0;
    border-inline-start: 1px solid var(--border);
    border-inline-end: 0;
  }

  .home-project-grid .project-card:not(:first-child) .project-body {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    padding: 14px;
  }

  .home-project-grid .project-card:not(:first-child) .project-body p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .archive-grid .article-card.compact .article-link {
    display: grid;
    grid-template-columns: minmax(94px, 31%) minmax(0, 1fr);
    min-height: 0;
  }

  .archive-grid .article-card.compact .article-cover {
    aspect-ratio: auto;
    height: 100%;
    min-height: 100%;
    border-bottom: 0;
    border-inline-end: 1px solid var(--border);
  }

  .projects-archive-grid .project-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(94px, 31%);
    min-height: 0;
  }

  .projects-archive-grid .project-image {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    min-height: 100%;
    aspect-ratio: auto;
    border-bottom: 0;
    border-inline-start: 1px solid var(--border);
    border-inline-end: 0;
  }

  .projects-archive-grid .project-body {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    padding: 14px;
  }

  .projects-archive-grid .project-body p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .article-card.compact .article-content {
    padding: 14px;
    gap: 10px;
  }

  .article-card.compact h3 {
    margin-bottom: 6px;
    font-size: 0.96rem;
    line-height: 1.45;
  }

  .article-card.compact p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.86rem;
    line-height: 1.65;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .article-card.compact .tags {
    margin-top: 4px;
    gap: 5px;
  }

  .article-card.compact .tag {
    max-width: 100%;
    overflow: hidden;
    padding: 4px 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .eyebrow,
  .lead,
  .section-title h2,
  .section-title p,
  .content-title,
  .content-summary,
  .article-card h3,
  .article-card p,
  .card h3,
  .card p,
  .stat-card p,
  .stat-card strong,
  .btn {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  header {
    top: 8px;
    padding-top: 8px;
  }

  body.nav-open {
    overflow: hidden;
  }

  .brand {
    width: auto;
    min-width: 0;
    padding: 2px 0;
    font-size: 0.84rem;
    line-height: 1.1;
    justify-self: start;
    text-align: start;
  }

  .article-footer,
  .stat-card {
    flex-wrap: wrap;
  }

  .stat-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-card > div {
    min-width: 0;
  }

  .stat-card strong {
    direction: ltr;
    text-align: left;
  }

  .archive-intro,
  .resume-hero,
  .content-hero .card {
    text-align: center;
  }

  .eyebrow,
  .cta-row,
  .archive-intro .back-link,
  .resume-hero .back-link,
  .content-hero .tags {
    margin-inline: auto;
    justify-content: center;
  }

  .home-archive-actions {
    margin-inline: 0;
    justify-content: flex-end;
  }

  .content-title {
    font-size: clamp(1.82rem, 9vw, 2.5rem);
    letter-spacing: -0.035em;
  }

  .detail-overlay-card {
    inset-inline-start: 10px;
    inset-inline-end: 10px;
    bottom: 10px;
    width: auto;
    max-width: none;
    padding: 12px;
  }

  .detail-overlay-hero {
    min-height: 470px;
  }

  .nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }

  .portrait-main {
    min-height: 430px;
  }

  .section {
    padding: 54px 0;
  }

  .prose {
    padding: 22px;
  }
}


/* WordPress contact SVG final override: smaller icons, same card layout. */
#contact .contact-methods .contact-method .icon {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  max-width: 38px !important;
  flex: 0 0 38px !important;
  border-radius: 11px !important;
  display: inline-grid !important;
  place-items: center !important;
  padding: 0 !important;
  margin: 0 !important;
}
#contact .contact-methods .contact-method .icon svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  display: block !important;
}
#contact .contact-methods .contact-method .icon svg path {
  fill: currentColor !important;
}


/* v1.0.8 typography: Vazirmatn variable WOFF2 is bundled locally and used as the default font. */

.head-photo.has-image {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.head-photo.has-image::before {
  display: none !important;
}

.head-photo.has-image img {
  display: block !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

@media (max-width: 760px) {
  .head-photo,
  .head-photo.has-image {
    border: 0 !important;
    box-shadow: none !important;
  }
}

.home-archive-actions {
  justify-content: flex-end !important;
}

/* v1.0.9 tag vertical alignment fix: keep text centered in non-hover state with local Vazirmatn */
.tags .tag,
.tags a.tag,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
}


/* v1.1.0 precise tag text baseline fix for local Vazirmatn */
.tags .tag,
.tags a.tag,
.pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
}

.tags .tag .tag-label,
.tags a.tag .tag-label {
  display: block !important;
  line-height: 1 !important;
  transform: translateY(0.105em) !important;
  pointer-events: none;
}


/* Local icon glyph fallback: render about-card symbols as inline SVG so Android/mobile browsers do not hide unsupported font glyphs. */
.about-card-heading .icon .about-icon-svg {
  width: 18px;
  height: 18px;
  display: block;
  color: currentColor;
  overflow: visible;
}
.about-card-heading .icon svg path {
  vector-effect: non-scaling-stroke;
}


/* v1.2.0 enhancements: optimized media, typography polish, motion, filtering, and theme tokens */
html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}
html[data-theme="light"] { color-scheme: light; }

body {
  font-feature-settings: "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
:lang(fa), [dir="rtl"] body {
  line-height: 1.78;
  letter-spacing: -0.01em;
}
h1, h2, h3, .brand, .btn, .tag, .toggle-btn {
  font-variation-settings: "wght" inherit;
}
.prose p, .content-summary, .head-summary, .about-card p, .project-body p, .article-card p {
  text-wrap: pretty;
}

.project-image.has-cover,
.article-cover.has-cover,
.detail-cover .project-image.has-cover {
  overflow: hidden;
}
.project-image.has-cover img,
.article-cover.has-cover img,
.detail-cover .project-image.has-cover img,
.head-photo.has-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.project-meta-line {
  margin: -2px 0 8px;
  color: var(--muted-foreground);
  font-size: .82rem;
  font-weight: 650;
}
.project-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.reveal-on-scroll,
.reveal-section {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms cubic-bezier(.2,.8,.2,1), border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
  will-change: opacity, transform;
}
.reveal-on-scroll.is-visible,
.reveal-section.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.card:hover,
.project-card:hover,
.article-card:hover,
.contact-method:hover {
  transform: translateY(-3px);
}
.card,
.project-card,
.article-card,
.contact-method {
  transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
  .reveal-on-scroll,
  .reveal-section {
    opacity: 1 !important;
    transform: none !important;
  }
}

.project-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 22px 0 26px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  background: var(--card-bg);
  backdrop-filter: blur(14px);
}
.project-filters select,
.project-filters input {
  min-height: 42px;
}
.project-filters select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--secondary);
  color: var(--foreground);
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
}
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-foreground);
  font-weight: 750;
  padding: 0 6px;
}
.filter-check input {
  accent-color: var(--blue);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
@media (max-width: 700px) {
  .project-filters {
    display: grid;
    grid-template-columns: 1fr;
  }
  .project-filters .btn,
  .project-filters select {
    width: 100%;
  }
}

/* v1.3.4: reduce Persian detail overlay vertical thickness after local Vazirmatn metrics. */
html[lang="fa"] .detail-overlay-card,
html[dir="rtl"] .detail-overlay-card {
  padding-block: clamp(8px, 1.15vw, 13px) !important;
}

html[lang="fa"] .detail-overlay-card .content-title,
html[dir="rtl"] .detail-overlay-card .content-title {
  line-height: 1.18 !important;
  margin-block: 0 !important;
  padding-block: 0 !important;
  transform: translateY(0.035em);
}

@media (max-width: 760px) {
  html[lang="fa"] .detail-overlay-card,
  html[dir="rtl"] .detail-overlay-card {
    padding-block: 8px !important;
  }
}


/* v1.4.0: WebP-first image delivery, English text blocks, code blocks, and optimized post galleries. */
.prose .english-content,
.english-content,
.en-block {
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  line-height: 1.72;
  letter-spacing: 0;
  word-spacing: normal;
}
.prose .english-content p,
.english-content p { margin-block: 0 1em; }
.prose :where(pre, .code-block),
.code-block {
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
  display: block;
  overflow-x: auto;
  margin: 1.15rem 0;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(3, 7, 18, .62);
  color: var(--foreground);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .92rem;
  line-height: 1.75;
  white-space: pre;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
html[data-theme="light"] .prose :where(pre, .code-block),
html[data-theme="light"] .code-block {
  background: rgba(248, 250, 252, .82);
}
.code-block code,
.prose pre code {
  font: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
  border: 0;
}
.prose code:not(pre code) {
  direction: ltr;
  unicode-bidi: isolate;
  padding: .12em .36em;
  border-radius: .5em;
  background: var(--secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .9em;
}
.post-gallery {
  margin-top: 22px;
  padding: clamp(16px, 2.2vw, 24px);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 1.6vw, 16px);
  margin-top: 14px;
}
.gallery-item {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--secondary);
  transform: translateY(0);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.gallery-item:hover {
  transform: translateY(-3px);
  border-color: rgba(125, 211, 252, .45);
  box-shadow: 0 18px 48px rgba(0,0,0,.22);
}
.gallery-item picture,
.gallery-item img {
  width: 100%;
  height: 100%;
  display: block;
}
.gallery-item img {
  object-fit: cover;
}
@media (max-width: 760px) {
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .post-gallery { margin-top: 16px; }
}


/* v1.4.2: Natural post/detail and gallery image dimensions.
   Admin controls height; width follows each image aspect ratio automatically. */
.detail-cover {
  aspect-ratio: auto !important;
  min-height: 0 !important;
  height: auto !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 1.4vw, 18px);
  background: var(--card-bg);
}
.detail-overlay-hero {
  min-height: 0 !important;
  display: grid;
}
.detail-overlay-hero .detail-cover {
  min-height: clamp(260px, 32vw, 520px) !important;
}
.detail-cover .article-cover.has-cover,
.detail-cover .project-image.has-cover {
  width: auto !important;
  max-width: 100%;
  height: auto !important;
  min-height: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 0;
  background: transparent;
}
.detail-cover .article-cover.has-cover picture,
.detail-cover .project-image.has-cover picture {
  display: block;
  width: auto;
  max-width: 100%;
  line-height: 0;
}
.detail-cover .article-cover.has-cover img,
.detail-cover .project-image.has-cover img {
  width: auto !important;
  max-width: 100% !important;
  height: var(--ds-detail-image-height, 420px) !important;
  max-height: min(var(--ds-detail-image-height, 420px), 68vh);
  object-fit: contain !important;
  border-radius: calc(var(--radius) + 4px);
}
.gallery-grid {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.6vw, 16px);
}
.gallery-item {
  aspect-ratio: auto !important;
  width: min(calc(var(--ds-gallery-image-height, 220px) * var(--ratio, 1.3333)), 100%);
  height: var(--ds-gallery-image-height, 220px);
  flex: 0 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gallery-item picture {
  display: block;
  width: auto !important;
  height: 100% !important;
  max-width: 100%;
  line-height: 0;
}
.gallery-item img {
  width: auto !important;
  max-width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}
@media (max-width: 760px) {
  .detail-cover { padding: 8px; }
  .detail-cover .article-cover.has-cover img,
  .detail-cover .project-image.has-cover img {
    height: min(var(--ds-detail-image-height, 420px), 52vh) !important;
  }
  .gallery-item {
    height: min(var(--ds-gallery-image-height, 220px), 34vw);
  }
}


/* v1.4.3: Correct natural detail-photo layout.
   The photo height is controlled by the admin setting; the displayed width is
   derived from the image ratio, and the title overlay is now anchored to the
   actual photo frame instead of the full page card. */
.detail-overlay-hero {
  min-height: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: clamp(10px, 1.4vw, 18px);
  overflow: hidden;
}
.detail-media-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  border-radius: inherit;
  overflow: hidden;
  line-height: 0;
}
.detail-media-frame .detail-cover {
  width: auto !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  display: block !important;
  background: transparent !important;
}
.detail-media-frame .detail-natural-image {
  --detail-h: min(var(--ds-detail-image-height, 420px), 68vh);
  width: min(calc(var(--detail-h) * var(--ratio, 1.7778)), 100%) !important;
  height: var(--detail-h) !important;
  min-height: 0 !important;
  max-width: 100% !important;
  display: block !important;
  border-radius: inherit;
  overflow: hidden;
  background: transparent !important;
}
.detail-media-frame .detail-natural-image picture,
.detail-media-frame .detail-natural-image img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: contain !important;
  border-radius: inherit;
}
.detail-media-frame .detail-overlay-card {
  position: absolute !important;
  z-index: 5;
  inset-inline-start: clamp(12px, 2.2vw, 26px) !important;
  inset-inline-end: auto !important;
  bottom: clamp(12px, 2.2vw, 26px) !important;
  width: auto !important;
  max-width: calc(100% - clamp(24px, 4.4vw, 52px)) !important;
  line-height: normal;
}
.detail-media-frame .detail-overlay-card .content-title {
  max-width: 100%;
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  .detail-overlay-hero { padding: 8px; }
  .detail-media-frame .detail-natural-image {
    --detail-h: min(var(--ds-detail-image-height, 420px), 52vh);
  }
  .detail-media-frame .detail-overlay-card {
    inset-inline-start: 10px !important;
    bottom: 10px !important;
    max-width: calc(100% - 20px) !important;
  }
}

/* v1.4.4: True natural aspect-ratio detail images.
   The admin setting controls the target image height. The browser calculates
   the width from the real image ratio. Nothing is cropped, stretched, or forced
   to fill the section. On narrow screens the image scales down proportionally. */
.detail-overlay-hero {
  min-height: 0 !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: clamp(10px, 1.4vw, 18px) !important;
  overflow: visible !important;
}
.detail-media-frame {
  --detail-target-h: min(var(--ds-detail-image-height, 420px), 68vh);
  position: relative !important;
  display: block !important;
  width: min(calc(var(--detail-target-h) * var(--ratio, 1.7778)), 100%) !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin-inline: auto !important;
  overflow: visible !important;
  line-height: 0 !important;
  border-radius: calc(var(--radius) + 4px) !important;
}
.detail-media-frame .detail-cover,
.detail-media-frame .article-cover.has-cover,
.detail-media-frame .project-image.has-cover,
.detail-cover .article-cover.has-cover,
.detail-cover .project-image.has-cover,
.detail-media-frame .detail-natural-image {
  aspect-ratio: var(--ratio, 1.7778) !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-width: 100% !important;
  display: block !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: calc(var(--radius) + 4px) !important;
  background: transparent !important;
}
.detail-media-frame .detail-cover picture,
.detail-media-frame .detail-natural-image picture,
.detail-media-frame .detail-cover img,
.detail-media-frame .detail-natural-image img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center center !important;
  border-radius: calc(var(--radius) + 4px) !important;
}
.detail-media-frame .detail-cover picture,
.detail-media-frame .detail-natural-image picture {
  aspect-ratio: var(--ratio, 1.7778) !important;
  line-height: 0 !important;
  overflow: hidden !important;
}
.detail-media-frame .detail-overlay-card {
  position: absolute !important;
  z-index: 5 !important;
  inset-inline-start: clamp(12px, 2.2vw, 26px) !important;
  inset-inline-end: auto !important;
  bottom: clamp(12px, 2.2vw, 26px) !important;
  width: auto !important;
  max-width: calc(100% - clamp(24px, 4.4vw, 52px)) !important;
  line-height: normal !important;
}
.detail-media-frame .detail-overlay-card .content-title {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
}
@media (max-width: 760px) {
  .detail-overlay-hero { padding: 8px !important; }
  .detail-media-frame {
    --detail-target-h: min(var(--ds-detail-image-height, 420px), 52vh);
    width: min(calc(var(--detail-target-h) * var(--ratio, 1.7778)), 100%) !important;
  }
  .detail-media-frame .detail-overlay-card {
    inset-inline-start: 10px !important;
    bottom: 10px !important;
    max-width: calc(100% - 20px) !important;
  }
}



/* v1.4.5: Image Optimization settings now match true aspect-ratio rendering.
   Admin sets visual height only; width is calculated from the real image ratio.
   Generated WordPress sizes are proportional max-width sources, not cropped boxes. */
.detail-media-frame .detail-natural-image img,
.detail-media-frame .detail-cover img {
  image-rendering: auto;
}


/* v1.4.6: definitive width/length-based detail and gallery images.
   The admin controls visible image length/max-width. Height is calculated by the
   browser from the real image ratio. No crop, no fixed height, no stretch. */
.detail-overlay-hero {
  min-height: 0 !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: clamp(10px, 1.4vw, 18px) !important;
  overflow: visible !important;
}
.detail-media-frame {
  position: relative !important;
  display: block !important;
  width: min(var(--ds-detail-image-width, 1100px), 100%) !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin-inline: auto !important;
  overflow: visible !important;
  line-height: 0 !important;
  border-radius: calc(var(--radius) + 4px) !important;
}
.detail-media-frame .detail-cover,
.detail-media-frame .article-cover.has-cover,
.detail-media-frame .project-image.has-cover,
.detail-cover .article-cover.has-cover,
.detail-cover .project-image.has-cover,
.detail-media-frame .detail-natural-image,
.detail-media-frame .detail-cover picture,
.detail-media-frame .detail-natural-image picture {
  aspect-ratio: var(--ratio, auto) !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  display: block !important;
  padding: 0 !important;
  overflow: hidden !important;
  border-radius: calc(var(--radius) + 4px) !important;
  background: transparent !important;
  line-height: 0 !important;
}
.detail-media-frame .detail-cover img,
.detail-media-frame .detail-natural-image img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center center !important;
  border-radius: calc(var(--radius) + 4px) !important;
}
.detail-media-frame .detail-overlay-card {
  position: absolute !important;
  z-index: 5 !important;
  inset-inline-start: clamp(12px, 2.2vw, 26px) !important;
  inset-inline-end: auto !important;
  bottom: clamp(12px, 2.2vw, 26px) !important;
  width: auto !important;
  max-width: calc(100% - clamp(24px, 4.4vw, 52px)) !important;
  line-height: normal !important;
}
.gallery-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: clamp(10px, 1.6vw, 16px) !important;
}
.gallery-item {
  width: min(var(--ds-gallery-image-width, 360px), 100%) !important;
  height: auto !important;
  aspect-ratio: auto !important;
  flex: 0 1 min(var(--ds-gallery-image-width, 360px), 100%) !important;
  display: block !important;
  overflow: hidden !important;
}
.gallery-item picture,
.gallery-item img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
}
@media (max-width: 760px) {
  .detail-overlay-hero { padding: 8px !important; }
  .detail-media-frame { width: min(var(--ds-detail-image-width, 1100px), calc(100vw - 32px)) !important; }
  .detail-media-frame .detail-overlay-card {
    inset-inline-start: 10px !important;
    bottom: 10px !important;
    max-width: calc(100% - 20px) !important;
  }
}


/* v1.4.7: final detail image ratio fix.
   The admin setting controls visible WIDTH only. Height is always automatic from
   the real image aspect ratio. This override intentionally appears last and uses
   high specificity to neutralize older height-based rules. */
.detail-overlay-hero {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible !important;
}
.detail-overlay-hero > .detail-media-frame {
  position: relative !important;
  display: block !important;
  inline-size: min(var(--ds-detail-image-width, 1100px), calc(100vw - 80px)) !important;
  width: min(var(--ds-detail-image-width, 1100px), calc(100vw - 80px)) !important;
  max-inline-size: 100% !important;
  max-width: 100% !important;
  block-size: auto !important;
  height: auto !important;
  min-height: 0 !important;
  margin-inline: auto !important;
  line-height: 0 !important;
  overflow: visible !important;
}
.detail-overlay-hero > .detail-media-frame > .detail-cover,
.detail-overlay-hero > .detail-media-frame > .detail-cover > .detail-natural-image,
.detail-overlay-hero > .detail-media-frame > .detail-cover > .article-cover.has-cover,
.detail-overlay-hero > .detail-media-frame > .detail-cover > .project-image.has-cover,
.detail-overlay-hero > .detail-media-frame > .detail-cover picture {
  display: block !important;
  inline-size: 100% !important;
  width: 100% !important;
  max-inline-size: 100% !important;
  max-width: 100% !important;
  block-size: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  padding: 0 !important;
  line-height: 0 !important;
  overflow: hidden !important;
}
.detail-overlay-hero > .detail-media-frame > .detail-cover img.attachment-ds-detail,
.detail-overlay-hero > .detail-media-frame > .detail-cover img.size-ds-detail,
.detail-overlay-hero > .detail-media-frame > .detail-cover img {
  display: block !important;
  inline-size: 100% !important;
  width: 100% !important;
  max-inline-size: 100% !important;
  max-width: 100% !important;
  block-size: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
}
.detail-overlay-hero > .detail-media-frame > .detail-overlay-card {
  position: absolute !important;
  z-index: 5 !important;
  inset-inline-start: clamp(12px, 2.2vw, 26px) !important;
  inset-inline-end: auto !important;
  bottom: clamp(12px, 2.2vw, 26px) !important;
  max-inline-size: calc(100% - clamp(24px, 4.4vw, 52px)) !important;
  max-width: calc(100% - clamp(24px, 4.4vw, 52px)) !important;
  line-height: normal !important;
}
.gallery-grid .gallery-item {
  inline-size: min(var(--ds-gallery-image-width, 360px), 100%) !important;
  width: min(var(--ds-gallery-image-width, 360px), 100%) !important;
  block-size: auto !important;
  height: auto !important;
}
.gallery-grid .gallery-item img {
  inline-size: 100% !important;
  width: 100% !important;
  block-size: auto !important;
  height: auto !important;
  object-fit: contain !important;
}
@media (max-width: 760px) {
  .detail-overlay-hero > .detail-media-frame {
    inline-size: min(var(--ds-detail-image-width, 1100px), calc(100vw - 24px)) !important;
    width: min(var(--ds-detail-image-width, 1100px), calc(100vw - 24px)) !important;
  }
}


/* v1.4.8: remove the extra frame/gutter around detail images.
   The detail media area should be only the image itself, with the title card
   overlayed on top. No padded wrapper, border, shadow, or background is kept
   around the photo. */
.detail-overlay-hero {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.detail-overlay-hero > .detail-media-frame {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
  border-radius: calc(var(--radius) + 4px) !important;
}
.detail-overlay-hero > .detail-media-frame > .detail-cover,
.detail-overlay-hero > .detail-media-frame > .detail-cover > .detail-natural-image,
.detail-overlay-hero > .detail-media-frame > .detail-cover > .article-cover.has-cover,
.detail-overlay-hero > .detail-media-frame > .detail-cover > .project-image.has-cover,
.detail-overlay-hero > .detail-media-frame > .detail-cover picture {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
  border-radius: inherit !important;
}
.detail-overlay-hero > .detail-media-frame > .detail-cover img {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: inherit !important;
  vertical-align: top !important;
}


/* v1.4.9: detail-page contact footer and safe mobile title overlay.
   The contact CTA button was removed from single pages. This footer reuses the
   homepage contact cards without changing the main design language. Long mobile
   titles are clamped so the image always remains visible. */
.detail-contact-footer {
  margin-top: clamp(32px, 6vw, 76px) !important;
  margin-bottom: clamp(18px, 4vw, 44px) !important;
}
.detail-contact-footer .section-title {
  margin-bottom: clamp(16px, 3vw, 28px) !important;
}
.detail-overlay-hero > .detail-media-frame > .detail-overlay-card {
  max-block-size: min(46%, 210px) !important;
  overflow: hidden !important;
}
.detail-overlay-hero > .detail-media-frame > .detail-overlay-card .content-title {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  overflow-wrap: anywhere !important;
  max-width: 100% !important;
}
@media (max-width: 760px) {
  .detail-overlay-hero > .detail-media-frame > .detail-overlay-card {
    inset-inline-start: 10px !important;
    inset-inline-end: 10px !important;
    bottom: 10px !important;
    max-inline-size: calc(100% - 20px) !important;
    max-width: calc(100% - 20px) !important;
    max-block-size: 34% !important;
    padding: 10px 14px !important;
    border-radius: 14px !important;
  }
  .detail-overlay-hero > .detail-media-frame > .detail-overlay-card .content-title {
    -webkit-line-clamp: 2 !important;
    font-size: clamp(1.2rem, 7vw, 2.05rem) !important;
    line-height: 1.18 !important;
    letter-spacing: -0.02em !important;
  }
  .detail-contact-footer .contact-methods {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 420px) {
  .detail-overlay-hero > .detail-media-frame > .detail-overlay-card {
    max-block-size: 30% !important;
    padding: 8px 12px !important;
  }
  .detail-overlay-hero > .detail-media-frame > .detail-overlay-card .content-title {
    font-size: clamp(1.05rem, 6.2vw, 1.55rem) !important;
    line-height: 1.16 !important;
  }
}


/* v1.5.0: mobile detail polish.
   Smaller mobile overlay title; detail-page contact footer has no heading and
   uses a 3 x 2 grid on phones. */
.detail-contact-footer-no-title .section-title {
  display: none !important;
}
@media (max-width: 760px) {
  .detail-overlay-hero > .detail-media-frame > .detail-overlay-card {
    max-block-size: 28% !important;
    padding: 8px 12px !important;
    border-radius: 13px !important;
  }
  .detail-overlay-hero > .detail-media-frame > .detail-overlay-card .content-title {
    -webkit-line-clamp: 2 !important;
    font-size: clamp(1rem, 5.2vw, 1.45rem) !important;
    line-height: 1.14 !important;
    letter-spacing: -0.015em !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title {
    margin-top: 28px !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-methods {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method {
    min-height: 86px !important;
    padding: 10px 6px !important;
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    text-align: center !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method .icon {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    border-radius: 10px !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method .icon svg {
    width: 17px !important;
    height: 17px !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method > span:not(.icon) {
    min-width: 0 !important;
    width: 100% !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method strong {
    font-size: 0.78rem !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method > span:not(.icon) > span {
    display: none !important;
  }
}
@media (max-width: 420px) {
  .detail-overlay-hero > .detail-media-frame > .detail-overlay-card {
    max-block-size: 26% !important;
    padding: 7px 10px !important;
  }
  .detail-overlay-hero > .detail-media-frame > .detail-overlay-card .content-title {
    font-size: clamp(0.92rem, 4.8vw, 1.25rem) !important;
    line-height: 1.12 !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-methods {
    gap: 7px !important;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method {
    min-height: 78px !important;
    padding: 8px 4px !important;
  }
}


/* v1.5.1: mobile floating nav polish and stable theme icons. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.theme-toggle .theme-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05em;
  height: 1.05em;
  color: currentColor;
}

.theme-toggle .theme-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

html[data-theme="dark"] .theme-toggle .theme-icon-sun,
body[data-theme="dark"] .theme-toggle .theme-icon-sun {
  display: none;
}

html[data-theme="light"] .theme-toggle .theme-icon-moon,
body[data-theme="light"] .theme-toggle .theme-icon-moon {
  display: none;
}

@media (max-width: 920px) {
  body {
    --ds-mobile-header-height: 64px;
  }

  header.container {
    position: fixed;
    top: max(8px, env(safe-area-inset-top));
    inset-inline: 10px;
    width: auto;
    margin-inline: 0;
    padding-top: 0;
    z-index: 1000;
    transition: transform 220ms ease, opacity 180ms ease;
  }

  body.admin-bar header.container {
    top: calc(46px + max(8px, env(safe-area-inset-top)));
  }

  body.header-hidden header.container {
    transform: translateY(calc(-100% - 18px));
    opacity: 0;
    pointer-events: none;
  }

  body.nav-open header.container {
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  body > main.container,
  body > main.page-main {
    padding-top: calc(var(--ds-mobile-header-height) + 16px);
  }

  .nav {
    border-radius: 18px;
    padding: 6px 7px;
    min-height: 0;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22);
  }

  .brand {
    padding: 0 4px;
    line-height: 1.15;
  }

  .menu-toggle {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .toggle-btn {
    min-height: 38px;
    border-radius: 12px;
    padding: 0 10px;
  }

  #themeToggle {
    min-width: 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 1rem;
  }

  .nav-right {
    top: calc(100% + 7px);
    border-radius: 18px;
    padding: 12px;
  }
}

@media (max-width: 420px) {
  header.container {
    inset-inline: 8px;
  }

  .nav {
    border-radius: 16px;
    padding: 5px 6px;
  }

  .menu-toggle,
  #themeToggle {
    width: 36px;
    height: 36px;
  }

  .toggle-btn {
    min-height: 36px;
  }
}


/* v1.5.3: restore clean profile image, thinner global nav, mobile icon-only contact footer, stable theme icon rendering. */
/* Keep the uploaded profile/header image in the clean no-frame state from the approved versions. */
.head-photo.has-image,
.head-photo.has-image:hover,
.head-photo.has-image:focus-within {
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.head-photo.has-image::before,
.head-photo.has-image::after {
  display: none !important;
  content: none !important;
}
.head-photo.has-image picture,
.head-photo.has-image img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  object-fit: cover !important;
}


/* ============================================================
   CONSOLIDATED NAV & HEADER (replaces all patch versions)
   v1.6.0 - single source of truth, no !important cascade
   ============================================================ */

/* --- Skip link (accessibility) --- */
.skip-to-main {
  position: absolute;
  top: -100px;
  inset-inline-start: 16px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--foreground);
  color: var(--background);
  border-radius: 0 0 8px 8px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: top 180ms ease;
  text-decoration: none;
}
.skip-to-main:focus {
  top: 0;
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* --- Header positioning --- */
header.container {
  width: min(1360px, calc(100% - 32px));
  position: sticky;
  top: 18px;
  z-index: 50;
  padding-top: 18px;
  transition: transform 260ms ease, opacity 220ms ease;
  will-change: transform, opacity;
}

body.admin-bar header.container {
  top: calc(32px + 18px);
}

body.header-hidden header.container {
  transform: translateY(calc(-100% - 36px));
  opacity: 0;
  pointer-events: none;
}

body.nav-open header.container {
  transform: none;
  opacity: 1;
  pointer-events: auto;
}

/* --- Nav: single consolidated rule --- */
header.container .nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 7px 9px;
  border-radius: calc(var(--radius) + 4px);
  border: 1px solid var(--border);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: visible;
  isolation: auto;
}

header.container .nav::before {
  display: none;
  content: none;
}

html[data-theme="light"] header.container .nav {
  background: var(--nav-bg);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

header.container .brand {
  justify-self: start;
  padding-block: 3px;
}

header.container .nav-right {
  display: contents;
}

header.container .nav-links {
  grid-column: 2;
  justify-content: center;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

header.container .nav-actions {
  grid-column: 3;
  justify-self: end;
  justify-content: flex-end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

header.container .nav-links a,
header.container .toggle-btn {
  padding: 7px 10px;
  min-height: 34px;
  border-radius: 10px;
  line-height: 1.1;
}

header.container #themeToggle {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
}

header.container .menu-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: none;
}

/* --- Theme icon toggle --- */
.theme-toggle .theme-icon {
  display: none;
}
html[data-theme="dark"] .theme-toggle .theme-icon-moon,
html:not([data-theme]) .theme-toggle .theme-icon-moon {
  display: inline-flex;
}
html[data-theme="light"] .theme-toggle .theme-icon-sun {
  display: inline-flex;
}

/* --- Lang toggle --- */
header.container .lang-toggle {
  min-width: 42px;
  width: 42px;
  font-weight: 700;
}

/* --- head-photo: no outline on focus-within (design choice, but keep keyboard visible) --- */
.head-photo.has-image:focus-within {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: 4px;
}

/* --- Page padding to clear sticky nav --- */
body > main.container,
body > main.page-main {
  padding-top: calc(72px + 18px);
}

body.single-project > main.page-main,
body.single-article > main.page-main,
body.single > main.page-main {
  padding-top: calc(72px + 24px);
}

/* --- Archive empty state --- */
.archive-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted-foreground);
  font-size: 1rem;
}

/* --- Archive pagination --- */
.archive-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 1.5rem 0 0;
}
.archive-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--muted-foreground);
  font-size: 0.9rem;
  transition: 160ms ease;
}
.archive-pagination .page-numbers:hover {
  background: var(--secondary);
  color: var(--foreground);
}
.archive-pagination .page-numbers.current {
  background: var(--secondary);
  color: var(--foreground);
  border-color: color-mix(in srgb, var(--foreground) 24%, var(--border));
}

/* --- blog-layout single article fallback --- */
.blog-layout--single {
  display: block;
}
.blog-layout--single .article-card.featured {
  max-width: 680px;
}

/* ============================================================
   MOBILE NAV (max-width: 920px) — consolidated
   ============================================================ */
@media (max-width: 920px) {
  header.container {
    top: max(14px, env(safe-area-inset-top));
    padding-top: 0;
  }

  body.admin-bar header.container {
    top: calc(46px + max(14px, env(safe-area-inset-top)));
  }

  body > main.container,
  body > main.page-main,
  body.single-project > main.page-main,
  body.single-article > main.page-main,
  body.single > main.page-main {
    padding-top: calc(56px + 20px);
  }

  header.container .nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 5px 6px;
    border-radius: 16px;
  }

  header.container .brand {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  header.container .nav-right {
    display: flex;
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-end: 0;
    z-index: 80;
    width: min(360px, calc(100vw - 28px));
    max-height: calc(100vh - 112px);
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 8px);
    background: color-mix(in srgb, var(--card) 97%, var(--background));
    box-shadow: var(--shadow-md);
    padding: 16px;
    opacity: 0;
    transform: translateY(-8px);
    visibility: hidden;
    transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
  }

  html[dir="rtl"] header.container .nav-right {
    transform: translateY(-8px);
  }

  body.nav-open header.container .nav-right {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
  }

  body:not(.nav-open) header.container .nav-right {
    display: none;
  }

  header.container .nav-links {
    order: 0;
    display: grid;
    width: 100%;
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  header.container .nav-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--secondary);
    color: var(--foreground);
    padding: 0 14px;
    text-align: center;
  }

  header.container .nav-actions {
    order: 1;
    display: grid;
    width: 100%;
    grid-column: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    border-top: 1px solid var(--border);
    margin-top: 2px;
    padding-top: 12px;
  }

  header.container .toggle-btn {
    min-height: 42px;
    border: 1px solid var(--border);
    background: var(--secondary);
    color: var(--foreground);
    padding: 0 10px;
  }

  header.container .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    justify-self: end;
    border: 1px solid var(--border);
    background: var(--secondary);
    color: var(--foreground);
    cursor: pointer;
  }

  header.container .menu-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
  }

  body.nav-open {
    overflow: hidden;
  }
}

/* ============================================================
   DETAIL CONTACT FOOTER - no title variant
   ============================================================ */
.detail-contact-footer.detail-contact-footer-no-title .section-title {
  display: none;
}

@media (max-width: 760px) {
  .detail-contact-footer.detail-contact-footer-no-title {
    margin-top: 22px;
    padding-top: 0;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-methods {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px 10px;
    justify-items: center;
    align-items: center;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method {
    flex-direction: column;
    text-align: center;
    padding: 16px 12px;
    min-height: 0;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method > span:not(.icon) {
    text-align: center;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method .icon {
    align-self: center;
    justify-content: center;
  }
  .detail-contact-footer.detail-contact-footer-no-title .contact-method .icon svg {
    width: 25px;
    height: 25px;
    display: block;
  }
}
