/* ==========================================================
   رزومه امیر مسعود خداوردی — سبک جدید (Bento مدرن)
   فهرست: 1.فونت 2.متغیرها 3.پایه 4.اجزا 5.هدر 6.هیرو 7.بخش‌ها
          8.تماس 9.فوتر و مودال 10.واکنش‌گرا
   ========================================================== */

/* 1. فونت‌ها (همه وزن‌ها؛ مسیر نسبت به پوشه css) */
@font-face { font-family: IRANSansX; font-weight: 300; font-style: normal; font-display: swap;
  src: url("../fonts/IRANSansXFaNum-300.woff2") format("woff2"), url("../fonts/IRANSansXFaNum-300.woff") format("woff"); }
@font-face { font-family: IRANSansX; font-weight: 400; font-style: normal; font-display: swap;
  src: url("../fonts/IRANSansXFaNum-400.woff2") format("woff2"), url("../fonts/IRANSansXFaNum-400.woff") format("woff"); }
@font-face { font-family: IRANSansX; font-weight: 500; font-style: normal; font-display: swap;
  src: url("../fonts/IRANSansXFaNum-500.woff2") format("woff2"), url("../fonts/IRANSansXFaNum-500.woff") format("woff"); }
@font-face { font-family: IRANSansX; font-weight: 600; font-style: normal; font-display: swap;
  src: url("../fonts/IRANSansXFaNum-600.woff2") format("woff2"), url("../fonts/IRANSansXFaNum-600.woff") format("woff"); }
@font-face { font-family: IRANSansX; font-weight: 700; font-style: normal; font-display: swap;
  src: url("../fonts/IRANSansXFaNum-700.woff2") format("woff2"), url("../fonts/IRANSansXFaNum-700.woff") format("woff"); }
@font-face { font-family: IRANSansX; font-weight: 800; font-style: normal; font-display: swap;
  src: url("../fonts/IRANSansXFaNum-800.woff2") format("woff2"), url("../fonts/IRANSansXFaNum-800.woff") format("woff"); }
@font-face { font-family: IRANSansX; font-weight: 900; font-style: normal; font-display: swap;
  src: url("../fonts/IRANSansXFaNum-900.woff2") format("woff2"), url("../fonts/IRANSansXFaNum-900.woff") format("woff"); }

/* 2. متغیرها */
:root {
  --bg: #f5f6f8; --surface: #fff; --ink: #0f1220; --text: #1b1f33; --muted: #646b82;
  --line: #e3e6ee; --accent: #3a56ff; --accent-soft: #e8ecff; --mint: #14b891;
  --r-lg: 28px; --r-md: 18px; --r-sm: 12px;
  --font: IRANSansX, "IRANSans", Vazirmatn, Tahoma, "Segoe UI", system-ui, sans-serif;
}
[data-theme="dark"] {
  --bg: #0a0d18; --surface: #12162a; --ink: #f2f4fc; --text: #e6e9f6; --muted: #98a0bc;
  --line: #222844; --accent: #8a9bff; --accent-soft: #1a2150; --mint: #3ddbb4;
}

/* 3. پایه */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.85; transition: background .25s, color .25s; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.skip-link { position: absolute; top: -60px; right: 16px; z-index: 100; padding: 8px 16px; border-radius: 8px; background: var(--accent); color: #fff; }
.skip-link:focus { top: 12px; }

/* 4. اجزای مشترک */
.container { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
section { padding: 72px 0; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 32px; }
.section-head h2 { margin: 0; max-width: 520px; font-size: clamp(22px, 2.5vw, 30px); line-height: 1.4; font-weight: 800; letter-spacing: -.5px; color: var(--ink); }
.section-head p { margin: 0; max-width: 360px; font-size: 13px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.card { position: relative; }
/* افکت نور دنبال‌کننده موس روی باکس‌ها */
.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%); }
@media (hover: hover) { .card:hover::after { opacity: 1; } .card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; font-size: 14px; border-radius: 999px; border: 1px solid transparent; font-weight: 600; transition: transform .2s; }
.btn:hover { transform: translateY(-2px); }
.btn-primary, .btn-solid { background: var(--ink); color: var(--bg); }
.btn-ghost { border-color: var(--line); background: var(--surface); color: var(--text); }

/* 5. هدر شناور */
.topbar { position: sticky; top: 12px; z-index: 30; margin-top: 12px; }
.nav { height: 64px; padding: 0 14px 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; white-space: nowrap; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: 15px; }
.brand small { display: block; margin-top: -6px; font-size: 11px; font-weight: 400; color: var(--muted); }
.nav-links { display: flex; gap: 6px; font-size: 14px; }
.nav-links a { padding: 6px 14px; border-radius: 999px; color: var(--muted); transition: .2s; }
.nav-links a:hover { background: var(--accent-soft); color: var(--accent); }
.nav-actions { display: flex; gap: 8px; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.menu-btn { display: none; }

/* 6. هیرو */
.hero { padding: 64px 0 48px; }
.hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 56px; align-items: center; }
.hero h1 { margin: 0 0 22px; font-size: clamp(27px, 3.8vw, 46px); line-height: 1.4; font-weight: 800; letter-spacing: -.8px; color: var(--ink); }
.hero .lead { max-width: 520px; margin: 0 0 28px; font-size: 15px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 44px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.hero-facts li { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); line-height: 1.6; }
.hero-facts strong { display: block; margin-bottom: 2px; font-size: 14px; color: var(--ink); }
.portrait { position: relative; max-width: 390px; margin-inline: auto; }
.portrait-frame { position: relative; overflow: hidden; border-radius: 32px; padding: 10px; background: linear-gradient(160deg, var(--accent-soft), var(--surface)); border: 1px solid var(--line); box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--accent) 55%, transparent); }
.portrait-frame img { width: 100%; aspect-ratio: 4/4.8; object-fit: cover; object-position: top; border-radius: 24px; }
.portrait-caption { position: absolute; inset: auto 22px 22px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.portrait-caption strong { display: block; font-size: 14px; color: var(--ink); }
.portrait-caption em { display: flex; align-items: center; gap: 6px; font-style: normal; white-space: nowrap; color: var(--ink); }
.portrait-caption i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 25%, transparent); }
.portrait-chip { position: absolute; padding: 6px 14px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 12px; font-weight: 600; box-shadow: 0 10px 24px -10px rgba(0,0,0,.4); }
.chip-a { top: 28px; left: -14px; } .chip-b { top: 96px; right: -14px; background: var(--accent); color: #fff; }

/* 7. بخش‌ها (چیدمان Bento) */
.about-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 16px; }
.about-card { padding: 36px; border-radius: var(--r-lg); }
.about-card h3 { margin: 0 0 10px; font-size: 18px; color: var(--ink); }
.about-card p { margin: 0 0 24px; color: var(--muted); }
.details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0; }
.details div { padding: 14px 16px; border-radius: var(--r-sm); background: var(--bg); min-width: 0; }
.details dt { font-size: 12px; color: var(--muted); }
.details dd { margin: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.quote { display: flex; flex-direction: column; justify-content: space-between; padding: 36px; border-radius: var(--r-lg); background: var(--accent); color: #fff; }
[data-theme="dark"] .quote { color: #0a0d18; }
.quote blockquote { margin: 0; font-size: 18px; font-weight: 800; line-height: 1.8; }
.quote p { margin: 16px 0 0; font-size: 14px; opacity: .85; }

.skills { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 14px; }
.skill { display: flex; flex-direction: column; justify-content: space-between; min-height: 136px; padding: 24px; }
.skill-top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; color: var(--ink); }
.skill-top span:last-child { color: var(--accent); }
.meter { height: 10px; margin: 16px 0 10px; border-radius: 10px; background: var(--bg); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 10px; background: linear-gradient(90deg, var(--accent), var(--mint)); }
.skill small { color: var(--muted); }

/* رزومه: تاریخ | خط زمان با آیکون | کارت */
.timeline { display: grid; max-width: 940px; }
.step { display: grid; grid-template-columns: 150px 44px 1fr; gap: 0 18px; padding-bottom: 18px; }
.step-date { padding-top: 12px; font-size: 14px; font-weight: 800; color: var(--ink); }
.rail { position: relative; display: flex; justify-content: center; }
.rail::before { content: ""; position: absolute; top: 0; bottom: -18px; width: 2px; background: var(--line); }
.step:first-child .rail::before { top: 30px; }
.step:last-child .rail::before { bottom: auto; height: 30px; }
.node { position: relative; z-index: 1; width: 44px; height: 44px; margin-top: 6px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--mint); background: var(--bg); color: var(--mint); }
.node.edu { border-color: var(--accent); color: var(--accent); }
.step:first-child .node { background: var(--accent); color: #fff; box-shadow: 0 0 0 6px var(--accent-soft); }
[data-theme="dark"] .step:first-child .node { color: #0a0d18; }
.step-body { padding: 20px 24px; }
.step-body.edu { border-inline-start: 3px solid var(--accent); }
.step-body.course { border-inline-start: 3px solid var(--mint); }
.step-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.chip { display: inline-block; padding: 1px 12px; border-radius: 999px; background: color-mix(in srgb, var(--mint) 18%, transparent); font-size: 11px; font-weight: 600; color: var(--ink); }
.chip-edu { background: var(--accent-soft); color: var(--accent); }
.pill.live { padding: 1px 12px; border-radius: 999px; border: 1px solid var(--mint); font-size: 11px; color: var(--mint); }
.step-body h3 { margin: 0 0 4px; font-size: 15px; color: var(--ink); }
.step-body p { margin: 0; font-size: 13px; color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 0; padding: 0; list-style: none; }
.tags li { padding: 2px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: 11px; color: var(--muted); }

.services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.service { padding: 28px; transition: transform .2s, border-color .2s; }
.service:hover { transform: translateY(-4px); border-color: var(--accent); }
.service-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 20px; }
.service h3 { margin: 16px 0 6px; font-size: 15px; color: var(--ink); }
.service p { margin: 0; font-size: 13px; color: var(--muted); }

.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { padding: 7px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; transition: .2s; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.count { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.count select { padding: 7px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.meta { margin: 14px 0 18px; font-size: 12px; color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.project { display: block; overflow: hidden; border-radius: var(--r-lg); transition: transform .2s; }
a.project:hover { transform: translateY(-4px); }
.project-art { position: relative; height: 190px; display: grid; place-items: center; background: var(--accent-soft); }
.project-art img { width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; top: 12px; right: 12px; padding: 3px 12px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); font-size: 11px; font-weight: 600; color: var(--accent); }
.mock { width: 60%; height: 66%; display: grid; place-content: center; justify-items: center; gap: 8px; border-radius: var(--r-sm); background: var(--surface); }
.mock i { display: block; width: 72px; height: 7px; border-radius: 8px; background: var(--accent); opacity: .55; }
.mock i:nth-child(2) { width: 40px; opacity: .25; }
.mock b { width: 36px; height: 36px; border-radius: 50%; background: var(--mint); }
.project-body { padding: 20px 24px 24px; }
.project-body h3 { margin: 0 0 4px; font-size: 15px; color: var(--ink); }
.project-body p { margin: 0; font-size: 13px; color: var(--muted); }

.certs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.cert { display: flex; flex-direction: column; padding: 10px; border-radius: var(--r-lg); text-align: right; color: inherit; transition: transform .2s; }
.cert:hover { transform: translateY(-4px); }
.cert-frame { position: relative; overflow: hidden; height: 260px; display: grid; place-items: center; padding: 18px; border-radius: 18px; background: linear-gradient(145deg, var(--accent-soft), var(--bg)); }
.cert-frame img { position: absolute; inset: 18px; width: calc(100% - 36px); height: calc(100% - 36px); object-fit: contain; border-radius: 6px; box-shadow: 0 18px 36px -14px rgba(10,20,50,.45); transition: transform .3s; }
.cert:hover .cert-frame img { transform: scale(1.03); }
.cert-view { position: absolute; inset: auto 0 14px; margin-inline: auto; width: max-content; padding: 6px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 12px; opacity: 0; transform: translateY(8px); transition: .25s; }
.cert:hover .cert-view, .cert:focus-visible .cert-view { opacity: 1; transform: none; }
.cert-body { padding: 16px 12px 10px; }
.cert-body h3 { margin: 4px 0 2px; font-size: 16px; color: var(--ink); }
.cert-body p { margin: 0; font-size: 13px; color: var(--muted); }
.note { margin-top: 16px; font-size: 12px; color: var(--muted); }

/* 8. تماس و فرم */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.contact-info { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 14px; }
.contact-box { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 20px 12px; border-radius: var(--r-lg); text-align: center; transition: transform .2s, border-color .2s; }
.contact-box:hover { transform: translateY(-4px); border-color: var(--b); }
.contact-icon { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 50%; color: var(--b); background: color-mix(in srgb, var(--b) 14%, transparent); }
.contact-box strong { font-size: 15px; color: var(--ink); }
.contact-box small { max-width: 100%; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.telegram { --b: #229ed9; } .whatsapp { --b: #25d366; } .bale { --b: #1fb6a6; } .email { --b: var(--accent); }
.form { display: grid; gap: 14px; padding: 32px; border-radius: var(--r-lg); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.field input, .field textarea { width: 100%; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--text); }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { min-height: 130px; resize: vertical; }
.form-message { min-height: 22px; font-size: 13px; color: var(--accent); }

/* 9. فوتر، دکمه بالا، مودال */
.footer { margin-top: 24px; padding: 28px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.to-top { position: fixed; bottom: 20px; left: 20px; z-index: 20; width: 46px; height: 46px; display: none; border: 0; border-radius: 50%; background: var(--ink); color: var(--bg); }
.to-top.show { display: block; }
.modal { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; padding: 24px; background: rgba(5,9,20,.88); }
.modal.open { display: grid; }
.modal img { max-width: min(100%, 1100px); max-height: 86vh; border-radius: var(--r-sm); object-fit: contain; }
.modal button { position: absolute; top: 20px; left: 20px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: #fff; color: #111; font-size: 22px; }

/* 10. واکنش‌گرا */
@media (max-width: 900px) {
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .skills, .services, .projects { grid-template-columns: repeat(2, 1fr); }
  .skill:first-child { grid-column: auto; }
  .section-head { flex-direction: column; align-items: start; gap: 8px; }
}
@media (max-width: 680px) {
  section { padding: 48px 0; }
  .menu-btn { display: grid; }
  .nav-links { display: none; position: absolute; top: 72px; right: 0; left: 0; flex-direction: column; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
  .nav-links.open { display: flex; }
  .brand small { display: none; }
  .hero { padding-top: 40px; }
  .hero h1 { font-size: 26px; }
  .portrait { order: -1; width: min(68%, 280px); }
  .hero-facts { grid-template-columns: 1fr; }
  .certs, .form-row { grid-template-columns: 1fr; }
  .about-card, .quote, .form { padding: 24px; }
  .footer-inner { flex-direction: column; text-align: center; }
}
@media (max-width: 420px) {
  .skills, .services, .projects, .details { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

/* رزومه و تماس در موبایل */
@media (max-width: 680px) {
  .step { grid-template-columns: 44px 1fr; gap: 0 12px; }
  .step-date { grid-column: 2; grid-row: 1; padding: 0 0 6px; font-size: 13px; color: var(--accent); }
  .rail { grid-column: 1; grid-row: 1 / 3; }
  .step-body { grid-column: 2; grid-row: 2; }
  .contact-box { min-height: 130px; }
}
@media (max-width: 900px) { .contact-grid, .certs { grid-template-columns: 1fr; } .chip-a { left: 0; } .chip-b { right: 0; } }
@media (max-width: 680px) { .skill { min-height: 0; } .contact-info { grid-template-columns: 1fr 1fr; } .cert-frame { height: 220px; } }
@media (max-width: 420px) { .contact-info { grid-template-columns: 1fr; } }

/* هدر: عکس و دکمه تماس */
.brand-photo { width: 44px; height: 44px; flex-shrink: 0; overflow: hidden; border-radius: 50%; border: 2px solid var(--accent); background: var(--accent-soft); }
.brand-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; transform: scale(1.9); transform-origin: 50% 24%; }
.nav-actions { align-items: center; }
.nav-cta { padding: 9px 18px; font-size: 13px; white-space: nowrap; }
.project .more { display: inline-block; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--accent); }

/* صفحه جزئیات پروژه */
.pj-hero { padding: 56px 0 24px; }
.crumbs { margin-bottom: 20px; font-size: 13px; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.pj-hero h1 { margin: 10px 0; font-size: clamp(26px, 3.6vw, 40px); line-height: 1.5; font-weight: 800; color: var(--ink); }
.pj-hero .lead { max-width: 720px; margin: 0 0 20px; color: var(--muted); }
.pj-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; font-size: 13px; }
.pj-meta li { padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.pj-meta .tool { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.pj-missing { padding: 20px; border-radius: var(--r-md); background: var(--surface); }
.pj-body { padding-top: 24px; }
.pj-cover { margin: 0 0 32px; overflow: hidden; border-radius: var(--r-lg); }
.pj-cover img { width: 100%; max-height: 520px; object-fit: cover; cursor: zoom-in; }
.prose { max-width: 760px; margin-bottom: 48px; font-size: 16px; }
.prose p { margin: 0 0 1em; color: var(--text); }
.pj-h { margin: 0 0 16px; font-size: 20px; color: var(--ink); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 48px; }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r-md); border: 1px solid var(--line); cursor: zoom-in; transition: transform .2s; }
.gallery img:hover { transform: scale(1.02); }


/* ==========================================================
   نسخه ۳: وسط‌چین‌شدن کارت‌ها، کادر کشویی، تماس، صفحه پروژه، موبایل
   ========================================================== */
html, body { overflow-x: clip; }

/* کارت‌ها همیشه وسط‌چین هستند (حتی ردیف آخر ناقص) */
.skills, .services, .projects, .certs { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.skills > *, .services > *, .projects > * { flex: 0 1 calc((100% - 32px) / 3); min-width: 0; }
.certs > * { flex: 0 1 calc((100% - 16px) / 2); min-width: 0; }
@media (max-width: 900px) { .skills > *, .services > *, .projects > * { flex-basis: calc((100% - 16px) / 2); } }
@media (max-width: 600px) { .skills > *, .services > *, .projects > *, .certs > * { flex-basis: 100%; } }

/* کادر کشویی (select) */
select, .count select { -webkit-appearance: none; appearance: none; min-width: 84px; padding: 9px 16px 9px 38px; border: 1px solid var(--line); border-radius: 999px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--text);
  background-color: var(--surface); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a93b2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; transition: border-color .2s, box-shadow .2s; }
select:hover, .count select:hover { border-color: var(--accent); }
select:focus-visible, .count select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select option { background: var(--surface); color: var(--text); }

/* بخش تماس: پنل یکپارچه */
.contact-panel { display: grid; grid-template-columns: 1fr 1.05fr; overflow: hidden; border: 1px solid var(--line); border-radius: 32px; background: var(--surface); box-shadow: 0 30px 60px -40px rgba(14,26,58,.4); }
.contact-side { display: flex; flex-direction: column; gap: 14px; padding: 44px; color: #fff; background: radial-gradient(120% 90% at 100% 0%, #4b63ff 0%, transparent 60%), linear-gradient(160deg, #16205a, #0b1030); }
.eyebrow { align-self: flex-start; padding: 2px 14px; border-radius: 999px; background: rgba(255,255,255,.14); font-size: 12px; font-weight: 600; }
.contact-side h2 { margin: 0; font-size: clamp(24px, 2.6vw, 32px); line-height: 1.5; font-weight: 800; color: #fff; }
.contact-side p { margin: 0; font-size: 14px; color: #c9d1f0; }
.contact-info { margin-top: auto; padding-top: 18px; gap: 12px; }
.contact-box { padding: 18px 10px; border: 1px solid rgba(255,255,255,.16); border-radius: 20px; background: rgba(255,255,255,.08); color: #fff; }
.contact-box:hover { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.15); }
.contact-icon { background: #fff; width: 48px; height: 48px; }
.contact-box strong { font-size: 14px; color: #fff; }
.contact-box small { font-size: 11px; color: #c9d1f0; }
.contact-form { display: grid; gap: 4px; align-content: center; padding: 44px; }
.contact-form h3 { margin: 0; font-size: 20px; color: var(--ink); }
.contact-form .muted { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.hp { position: absolute !important; inset-inline-start: 0; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); opacity: 0; pointer-events: none; }
.captcha-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.captcha-img { width: 220px; max-width: 100%; height: 64px; border: 1px solid var(--line); border-radius: 12px; background: #eef1fa; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; pointer-events: none; }
.captcha-row input { flex: 1 1 140px; min-width: 0; }
.form-message.ok { color: var(--mint); font-weight: 600; }
.form-message.err { color: #e0445d; }
@media (max-width: 900px) { .contact-panel { grid-template-columns: 1fr; } .contact-side, .contact-form { padding: 28px 22px; } }

/* صفحه پروژه */
.pj-hero { padding: 40px 0 24px; background: linear-gradient(180deg, var(--accent-soft), transparent); }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 24px; }
.crumbs span:nth-child(even) { opacity: .4; }
.pj-hero-grid { display: grid; grid-template-columns: 1.4fr .6fr; gap: 32px; align-items: start; }
.pj-hero h1 { margin: 12px 0 10px; font-size: clamp(26px, 3.6vw, 42px); }
.pj-info { padding: 24px; }
.pj-info h2 { margin: 0 0 14px; font-size: 16px; color: var(--ink); }
.pj-info dl { display: grid; gap: 14px; margin: 0; }
.pj-info dt { font-size: 12px; color: var(--muted); }
.pj-info dd { margin: 0; font-weight: 600; color: var(--ink); }
.pj-info .tags { margin: 6px 0 0; }
.pj-cover { margin: 0 0 36px; }
.pj-cover img { width: 100%; max-height: 560px; }
.pj-grid { display: grid; grid-template-columns: 1.5fr .5fr; gap: 32px; align-items: start; margin-bottom: 48px; }
.prose { max-width: none; margin: 0; line-height: 2.1; }
.prose p { margin: 0 0 1.2em; }
.pj-cta { position: sticky; top: 96px; display: grid; gap: 10px; padding: 24px; text-align: center; }
.pj-cta h3 { margin: 0; font-size: 16px; color: var(--ink); }
.pj-cta p { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.pj-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 48px 0; }
.pj-nav a { display: block; padding: 18px 22px; border-radius: var(--r-md); transition: transform .2s; }
.pj-nav a:hover { transform: translateY(-3px); }
.pj-nav small { color: var(--muted); }
.pj-nav strong { display: block; color: var(--ink); }
.pj-nav .next { text-align: left; }
@media (max-width: 900px) { .pj-hero-grid, .pj-grid { grid-template-columns: 1fr; } .pj-cta { position: static; } .pj-nav { grid-template-columns: 1fr; } .pj-nav .next { text-align: right; } }

/* موبایل: هدر، منو، عکس */
@media (max-width: 680px) {
  .topbar { top: 8px; margin-top: 8px; }
  .nav { height: 58px; padding: 0 8px; gap: 8px; }
  .brand { flex: 1 1 auto; min-width: 0; gap: 8px; font-size: 13px; }
  .brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand-photo { width: 38px; height: 38px; }
  .nav-actions { flex-shrink: 0; gap: 6px; }
  .icon-btn { width: 38px; height: 38px; }
  .nav-cta { width: 38px; height: 38px; padding: 0; border-radius: 50%; }
  .nav-cta .lbl { display: none; }
  .nav-links { top: 66px; }
  .hero-grid { gap: 36px; }
  .portrait { width: min(80%, 320px); margin-bottom: 8px; }
  .portrait-chip.chip-a { left: 8px; }
  .portrait-chip.chip-b { right: 8px; }
  .portrait-caption { inset: auto 14px 14px; padding: 10px 12px; }
}

/* مدارک: ۳ ستون در دسکتاپ */
.certs > * { flex: 0 1 calc((100% - 32px) / 3); }
.cert-frame { height: 230px; }
@media (max-width: 900px) { .certs > * { flex-basis: calc((100% - 16px) / 2); } }
@media (max-width: 600px) { .certs > * { flex-basis: 100%; } }

/* دکمه مشاهده همه پروژه‌ها و صفحه پروژه‌ها */
[hidden] { display: none !important; }
.more-wrap { display: flex; justify-content: center; margin-top: 32px; }
.tools-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { min-width: 200px; padding: 9px 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-size: 13px; }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
