:root {
  --cream: #fbfaf6;
  --paper: #f4f2ec;
  --ink: #16201b;
  --ink-soft: #223028;
  --sage-50: #eef1e9;
  --sage-200: #cddabd;
  --sage-500: #6f8f5e;
  --sage-600: #587349;
  --sage-700: #45593a;
  --stone-600: #55564d;
  --stone-400: #8b8c81;
  --hairline: #e8e4d9;

  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --shadow-sm: 0 1px 2px rgba(22, 32, 27, 0.04), 0 1px 1px rgba(22, 32, 27, 0.03);
  --shadow-md: 0 10px 30px rgba(22, 32, 27, 0.08);
  --shadow-lift: 0 16px 40px rgba(22, 32, 27, 0.12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
  line-height: 1.75;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.section { padding: 68px 0; }
.section-tight { padding: 50px 0; }
.bg-paper { background: var(--paper); }
.bg-ink { background: var(--ink); color: var(--cream); }
.text-center { text-align: center; }

.eyebrow {
  font-family: "Fraunces", serif;
  font-style: italic;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--sage-600);
  margin: 0 0 12px;
}
.bg-ink .eyebrow { color: var(--sage-200); }

.mark {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--sage-600);
  margin-inline-end: 8px;
  flex-shrink: 0;
}

h1, h2, h3 { line-height: 1.4; margin: 0; font-weight: 500; letter-spacing: -0.01em; }
p { margin: 0; }
.muted { color: var(--stone-600); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 13px 26px;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-solid { background: var(--sage-600); color: var(--cream); box-shadow: var(--shadow-sm); }
.btn-solid:hover { background: var(--sage-700); box-shadow: 0 10px 24px rgba(88, 115, 73, 0.28); }
.btn-outline { border-color: rgba(22,32,27,0.15); color: var(--ink); background: var(--cream); }
.btn-outline:hover { border-color: var(--sage-500); color: var(--sage-600); box-shadow: var(--shadow-sm); }
.btn-dark { background: var(--ink); color: var(--cream); box-shadow: var(--shadow-sm); }
.btn-dark:hover { background: var(--ink-soft); box-shadow: 0 10px 24px rgba(22,32,27,0.25); }
.btn-outline-light { border-color: rgba(251,250,246,0.35); color: var(--cream); background: rgba(251,250,246,0.06); }
.btn-outline-light:hover { border-color: var(--cream); background: rgba(251,250,246,0.12); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn-row.center { justify-content: center; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(251,250,246,0.85); backdrop-filter: blur(10px); box-shadow: 0 1px 0 rgba(22,32,27,0.06); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 20px; }
.logo img { height: 36px; width: auto; }
.main-nav { display: none; align-items: center; gap: 28px; }
.main-nav a { font-size: 0.9rem; color: var(--ink-soft); transition: color .2s; }
.main-nav a:hover, .main-nav a.active { color: var(--sage-600); }
.header-cta { display: none; }
.menu-toggle { display: flex; flex-direction: column; gap: 5px; width: 38px; height: 38px; align-items: center; justify-content: center; border: none; border-radius: 999px; background: var(--sage-50); cursor: pointer; }
.menu-toggle span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--ink); }
.mobile-nav { display: none; flex-direction: column; border-top: 1px solid var(--hairline); padding: 10px 20px 20px; background: var(--cream); }
.mobile-nav.open { display: flex; }
.mobile-nav a { padding: 14px 4px; border-bottom: 1px solid rgba(232,228,217,0.7); font-size: 0.92rem; }
.mobile-nav .btn { margin-top: 12px; text-align: center; }

@media (min-width: 860px) {
  .main-nav { display: flex; }
  .header-cta { display: inline-block; }
  .menu-toggle { display: none; }
  .mobile-nav { display: none !important; }
}

/* Hero */
.hero-grid { display: grid; gap: 40px; align-items: center; padding: 48px 0 64px; }
.hero-media { position: relative; aspect-ratio: 4/5; overflow: hidden; background: var(--sage-50); border-radius: var(--r-lg); box-shadow: var(--shadow-md); }
.hero-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-title { font-size: 1.9rem; line-height: 1.35; }
.hero-lead { margin-top: 20px; font-size: 1rem; line-height: 1.9; color: var(--stone-600); }
.hero-mission { margin-top: 16px; font-size: 0.9rem; line-height: 1.8; color: var(--stone-600); }
.stats-row { margin-top: 40px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; border-top: 1px solid var(--hairline); padding-top: 24px; }
.stat-value { font-size: 1.4rem; color: var(--sage-600); font-weight: 500; }
.stat-label { margin-top: 4px; font-size: 0.72rem; line-height: 1.5; color: var(--stone-600); }

@media (min-width: 860px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 2.3rem; }
}

/* Cards grid */
.cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (min-width: 640px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .cards-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } .cards-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.project-card { display: block; background: var(--cream); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow .25s, transform .25s; }
.project-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-4px); }
.project-card .thumb { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--sage-50); }
.project-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.project-card:hover .thumb img { transform: scale(1.06); }
.project-card .badge { position: absolute; top: 12px; right: 12px; background: rgba(251,250,246,0.92); color: var(--ink); font-size: 11px; padding: 5px 12px; border-radius: 999px; box-shadow: var(--shadow-sm); }
.project-card .body { padding: 16px 18px; }
.project-card .body h3 { font-size: 1rem; }
.project-card .body p { margin-top: 4px; font-size: 0.85rem; color: var(--stone-600); }

/* Filters */
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 32px; }
.filter-pill { border: 1px solid var(--hairline); border-radius: 999px; padding: 7px 18px; font-size: 0.85rem; color: var(--stone-600); background: var(--cream); cursor: pointer; transition: all .2s; }
.filter-pill:hover { border-color: var(--sage-500); color: var(--sage-600); }
.filter-pill.active { border-color: var(--sage-600); background: var(--sage-600); color: var(--cream); box-shadow: var(--shadow-sm); }

/* Services */
.service-row { display: grid; gap: 28px; align-items: center; margin-bottom: 56px; }
.service-media { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--sage-50); border-radius: var(--r-lg); box-shadow: var(--shadow-md); }
.service-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.service-list { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.service-list li { display: flex; gap: 10px; font-size: 0.9rem; color: var(--ink-soft); }
.service-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; margin-top: 8px; background: var(--sage-600); flex-shrink: 0; }
@media (min-width: 860px) {
  .service-row { grid-template-columns: 1fr 1fr; }
  .service-row.reverse .service-media { order: 2; }
}

/* Quote / dark CTA (contained soft panel, not full-bleed) */
.panel-dark { background: var(--ink); color: var(--cream); border-radius: var(--r-lg); padding: 56px 32px; box-shadow: var(--shadow-md); }
@media (min-width: 640px) { .panel-dark { padding: 64px 56px; } }

.quote-block { max-width: 640px; margin: 0 auto; text-align: center; }
.quote-block blockquote { margin: 0; font-size: 1.15rem; line-height: 1.9; font-weight: 500; }
.quote-block .attribution { margin-top: 20px; font-size: 0.85rem; color: var(--stone-600); }
.bg-ink .quote-block .attribution, .panel-dark .quote-block .attribution { color: rgba(251,250,246,0.6); }

.dark-cta p.lead { max-width: 560px; margin: 16px auto 0; font-size: 0.9rem; line-height: 1.8; color: rgba(251,250,246,0.7); }

/* Forms */
.form-card { border: 1px solid var(--hairline); background: var(--cream); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 28px; }
.form-card h3 { display: flex; align-items: center; font-size: 1.1rem; margin-bottom: 6px; }
.form-card .form-desc { font-size: 0.85rem; color: var(--stone-600); margin-bottom: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 16px; }
.field-grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .field-grid.cols-2 { grid-template-columns: 1fr 1fr; } }
input, textarea, select {
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--cream);
  padding: 11px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--sage-500); box-shadow: 0 0 0 4px var(--sage-50); }
.ltr-text { direction: ltr; text-align: right; }

.alert { padding: 14px 18px; margin-bottom: 20px; font-size: 0.9rem; border-radius: var(--r-sm); border: 1px solid; }
.alert-success { background: var(--sage-50); border-color: var(--sage-200); color: var(--sage-700); }
.alert-error { background: #fbeaea; border-color: #e3b9b9; color: #8a2c2c; }

/* Footer */
.site-footer { background: var(--paper); }
.footer-grid { display: grid; gap: 32px; padding: 56px 0; }
.footer-heading { font-size: 0.9rem; font-weight: 500; margin-bottom: 12px; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-links li, .footer-links a { font-size: 0.85rem; color: var(--stone-600); }
.footer-links a:hover { color: var(--sage-600); }
.social-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 999px; background: var(--cream); color: var(--stone-600); box-shadow: var(--shadow-sm); transition: all .2s; }
.social-icon:hover { color: var(--sage-600); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.footer-bottom { text-align: center; font-size: 0.75rem; color: var(--stone-400); padding: 20px 0; }
@media (min-width: 860px) { .footer-grid { grid-template-columns: repeat(3, 1fr); } }

/* Gallery */
.gallery-main { position: relative; aspect-ratio: 16/10; overflow: hidden; background: var(--sage-50); border-radius: var(--r-lg); box-shadow: var(--shadow-md); }
.gallery-main img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.gallery-thumbs a { position: relative; width: 96px; height: 64px; overflow: hidden; border-radius: var(--r-sm); border: 2px solid transparent; transition: border-color .2s, transform .2s; }
.gallery-thumbs a:hover { transform: translateY(-2px); }
.gallery-thumbs a.active { border-color: var(--sage-600); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; border-top: 1px solid var(--hairline); padding-top: 24px; margin-top: 32px; }
@media (min-width: 640px) { .meta-grid { grid-template-columns: repeat(3, 1fr); } }
.meta-grid .label { font-size: 0.72rem; color: var(--stone-400); }
.meta-grid .value { margin-top: 4px; font-weight: 500; }

/* Timeline (resume/about) */
.timeline { list-style: none; margin: 0; padding-right: 26px; border-right: 2px solid var(--hairline); display: flex; flex-direction: column; gap: 28px; }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; right: -31px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--sage-600); background: var(--cream); }
.timeline .period { font-size: 0.75rem; color: var(--stone-400); }
.timeline .role { margin-top: 4px; font-weight: 500; }
.timeline .place { color: var(--sage-600); font-size: 0.9rem; }
.timeline .desc { margin-top: 8px; font-size: 0.9rem; line-height: 1.8; color: var(--stone-600); }

.skill-bar { margin-bottom: 12px; }
.skill-bar .name { font-size: 0.8rem; color: var(--stone-600); margin-bottom: 4px; }
.skill-bar .track { height: 7px; border-radius: 999px; background: var(--sage-50); overflow: hidden; }
.skill-bar .fill { height: 7px; border-radius: 999px; background: linear-gradient(90deg, var(--sage-500), var(--sage-600)); }

.chip { display: inline-block; border: 1px solid var(--hairline); background: var(--cream); border-radius: 999px; padding: 9px 18px; font-size: 0.88rem; color: var(--ink-soft); margin: 0 6px 10px 0; transition: all .2s; }
.chip:hover { border-color: var(--sage-500); color: var(--sage-600); }
.cert-card { border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--cream); box-shadow: var(--shadow-sm); padding: 18px; transition: box-shadow .2s, transform .2s; }
.cert-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cert-card .year { font-size: 0.72rem; color: var(--stone-400); }
.cert-card .title { margin-top: 4px; font-size: 0.9rem; font-weight: 500; }
.cert-card .place { margin-top: 4px; font-size: 0.8rem; color: var(--stone-600); }

.grid-2 { display: grid; gap: 40px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

:focus-visible { outline: 2px solid var(--sage-600); outline-offset: 3px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
