/* ======================================================================
   Pidot — سیستم طراحی سایت عمومی
   جهت‌گیری بصری: «نقشه‌ی مهندسی» — خط‌کش‌های دقیق، آبی سرمه‌ای عمیق به‌عنوان
   رنگ پایه (اعتماد + دقت فنی)، کهربایی گرم به‌عنوان رنگ تاکیدی (گرما + خلاقیت)،
   تایپوگرافی Vazirmatn برای خوانایی بهتر فارسی در هر دو حالت روشن/تاریک.
   ====================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&display=swap');

:root {
  --font-main: 'Vazirmatn', 'Tahoma', sans-serif;

  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --bg-soft: #eef1f8;
  --text: #1a2033;
  --text-muted: #5b6478;
  --border: #e2e5ef;

  --brand: #1d2b53;        /* سرمه‌ای عمیق */
  --brand-light: #2c3f78;
  --accent: #e8a33d;       /* کهربایی گرم */
  --accent-dark: #c9851f;
  --success: #1f9d61;
  --danger: #d4473c;

  --shadow-sm: 0 1px 3px rgba(20, 24, 45, 0.06), 0 1px 2px rgba(20, 24, 45, 0.08);
  --shadow-md: 0 8px 24px rgba(20, 24, 45, 0.10);
  --shadow-lg: 0 18px 48px rgba(20, 24, 45, 0.16);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --header-h: 68px;
  --transition: 220ms cubic-bezier(.4,0,.2,1);
}

[data-theme='dark'] {
  --bg: #0f1320;
  --bg-elevated: #171c2c;
  --bg-soft: #1d2336;
  --text: #edeff7;
  --text-muted: #9aa2bd;
  --border: #2a3147;

  --brand: #3a4f94;
  --brand-light: #4c63b0;
  --accent: #f0b955;
  --accent-dark: #e8a33d;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* اندازه‌ی پیش‌فرض آیکون‌های خطی (پارشیال icon.ejs) هر جا که داخل یک ظرف
   اندازه‌دار (مثل .icon-btn) قرار نگرفته باشند — بدون این قانون، SVG بدون
   width/height صریح می‌تواند در بعضی مرورگرها بسیار بزرگ رندر شود. */
svg[viewBox] { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }

body {
  margin: 0;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  text-align: right;
  line-height: 1.8;
  transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------- هدر ---------------------------------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; width: 100%;
}

.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.5rem; color: var(--brand);
}
[data-theme='dark'] .brand { color: var(--accent); }
.brand__mark {
  font-family: 'Georgia', serif; font-style: italic; font-size: 1.9rem; color: var(--accent);
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--bg-soft); border: 1px solid var(--border);
  color: var(--text); transition: background var(--transition), transform var(--transition);
  position: relative;
}
.icon-btn:hover { background: var(--accent); color: #2a1a02; transform: translateY(-2px); }
.icon-btn svg { width: 19px; height: 19px; }

.badge-dot {
  position: absolute; top: -2px; left: -2px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg-elevated);
}

.search-form {
  position: relative; flex: 1; max-width: 420px; display: none;
}
@media (min-width: 760px) { .search-form { display: block; } }
.search-form input {
  width: 100%; padding: 10px 42px 10px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-soft); color: var(--text);
  font-size: 0.92rem; transition: border-color var(--transition), box-shadow var(--transition);
}
.search-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,163,61,.2); }
.search-form button {
  position: absolute; inset-inline-start: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-muted); width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
}
.search-form svg { width: 18px; height: 18px; }

.search-live {
  position: absolute; top: calc(100% + 8px); right: 0; left: 0;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); max-height: 340px; overflow-y: auto; display: none; z-index: 60;
}
.search-live.is-open { display: block; }
.search-live a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-size: .88rem;
}
.search-live a:last-child { border-bottom: none; }
.search-live a:hover { background: var(--bg-soft); }
.search-live img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.search-live .cat { color: var(--text-muted); font-size: .76rem; }

.mobile-search-toggle { display: inline-flex; }
@media (min-width: 760px) { .mobile-search-toggle { display: none; } }

.mobile-search-bar {
  display: none; position: absolute; top: var(--header-h); right: 0; left: 0;
  padding: 10px 18px; background: var(--bg-elevated); border-bottom: 1px solid var(--border);
  max-width: none; z-index: 45;
}
.mobile-search-bar.is-open { display: block; }
@media (min-width: 760px) { .mobile-search-bar { display: none !important; } }

/* منوی موبایل (همبرگر) */
.nav-drawer {
  position: fixed; inset: 0; background: rgba(10,12,22,.5); z-index: 90;
  opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.nav-drawer.is-open { opacity: 1; pointer-events: auto; }
.nav-drawer__panel {
  position: absolute; top: 0; inset-inline-end: 0; height: 100%; width: min(320px, 86%);
  background: var(--bg-elevated); box-shadow: var(--shadow-lg);
  padding: 20px; transform: translateX(105%); transition: transform var(--transition);
  display: flex; flex-direction: column; gap: 4px; overflow-y: auto;
}
[dir='rtl'] .nav-drawer__panel { transform: translateX(-105%); }
.nav-drawer.is-open .nav-drawer__panel { transform: translateX(0); }
.nav-drawer__close {
  align-self: flex-start; background: var(--bg-soft); border-radius: 50%;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: none; color: var(--text); margin-bottom: 14px;
}
.nav-drawer a {
  display: block; padding: 12px 10px; border-radius: var(--radius-sm);
  font-weight: 600; color: var(--text);
}
.nav-drawer a:hover { background: var(--bg-soft); color: var(--accent-dark); }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-moon { display: none; }
[data-theme='dark'] .theme-toggle .icon-sun { display: none; }
[data-theme='dark'] .theme-toggle .icon-moon { display: block; }

/* -------------------------------- بنر اسلایدر -------------------------------- */

.hero-slider {
  position: relative; width: 100%; aspect-ratio: 16 / 7; max-height: 480px;
  overflow: hidden; background: var(--brand);
}
@media (max-width: 640px) { .hero-slider { aspect-ratio: 4 / 3; max-height: 420px; } }

.hero-slider__track { display: flex; height: 100%; transition: transform 650ms cubic-bezier(.65,0,.35,1); }
.hero-slider__slide { flex: 0 0 100%; height: 100%; position: relative; }
.hero-slider__slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slider__slide .caption {
  position: absolute; bottom: 24px; inset-inline-start: 24px;
  background: rgba(15,19,32,.55); backdrop-filter: blur(6px);
  color: #fff; padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 600;
}

.hero-slider__arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 42px; height: 42px; border-radius: 50%; border: none;
  background: rgba(255,255,255,.85); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: background var(--transition);
}
.hero-slider__arrow:hover { background: #fff; }
.hero-slider__arrow.prev { inset-inline-start: 16px; }
.hero-slider__arrow.next { inset-inline-end: 16px; }
.hero-slider__arrow svg { width: 20px; height: 20px; }

.hero-slider__dots {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; z-index: 5;
}
.hero-slider__dots button {
  width: 9px; height: 9px; border-radius: 50%; border: none; background: rgba(255,255,255,.5);
  transition: background var(--transition), width var(--transition);
}
.hero-slider__dots button.is-active { background: var(--accent); width: 22px; border-radius: 6px; }

/* -------------------------------- بخش‌ها -------------------------------- */

.section { padding: 48px 0; }
.section--tight { padding: 28px 0; }

.section-title {
  font-size: 1.5rem; font-weight: 800; text-align: center; margin: 0 0 28px;
  position: relative; color: var(--brand);
}
[data-theme='dark'] .section-title { color: var(--accent); }
.section-title::after {
  content: ''; display: block; width: 56px; height: 4px; background: var(--accent);
  margin: 10px auto 0; border-radius: 3px;
}

.reveal { opacity: 0; transform: translateY(26px); transition: opacity 700ms ease, transform 700ms ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* شبکه‌ی ۹ دسته‌ی خدمات */
.category-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
@media (max-width: 560px) { .category-grid { grid-template-columns: repeat(2, 1fr); } }

.category-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 24px 10px; min-height: 128px;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  font-weight: 700; font-size: 0.95rem; color: var(--text);
}
.category-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.category-card__icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--bg-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
}
[data-theme='dark'] .category-card__icon { color: var(--accent); }
.category-card__icon svg { width: 22px; height: 22px; }

/* اسلایدر افقی نمونه‌پروژه‌ها */
.proj-slider {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 6px 2px 18px; scrollbar-width: thin;
}
.proj-slider::-webkit-scrollbar { height: 7px; }
.proj-slider::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }

.proj-card {
  flex: 0 0 240px; scroll-snap-align: start;
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: hidden; box-shadow: var(--shadow-sm); transition: transform var(--transition), box-shadow var(--transition);
}
.proj-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.proj-card__img { width: 100%; height: 160px; object-fit: cover; background: var(--bg-soft); }
.proj-card__body { padding: 12px 14px; }
.proj-card__cat { font-size: .74rem; color: var(--accent-dark); font-weight: 700; }
.proj-card__title { font-weight: 700; margin: 4px 0; font-size: .95rem; }
.proj-card__loc { font-size: .78rem; color: var(--text-muted); }

.slider-nav { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.slider-nav button {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-elevated); display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.slider-nav button:hover { background: var(--accent); color: #2a1a02; }
.slider-nav svg { width: 17px; height: 17px; }

/* -------------------------------- فوتر -------------------------------- */

.site-footer { background: var(--brand); color: #e7ebfb; margin-top: 40px; }
[data-theme='dark'] .site-footer { background: #0b0e18; }
.footer-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px;
  padding: 44px 0 24px;
}
.footer-grid h4 { font-size: 1rem; margin: 0 0 14px; color: var(--accent); }
.footer-grid p, .footer-grid li { color: #c3cbe8; font-size: .88rem; line-height: 2; }
.footer-grid li svg { color: var(--accent); margin-inline-end: 2px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12); padding: 16px 0; text-align: center;
  font-size: .82rem; color: #9fabd4;
}
.footer-bottom a { color: var(--accent); font-weight: 700; }
.enamad-wrap { margin-top: 10px; }

/* ---------------------------- راه‌های ارتباطی ---------------------------- */

.contact-methods {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 18px 0 10px;
}
.contact-method {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 78px; text-align: center; font-size: .74rem; color: var(--text-muted); font-weight: 600;
}
.contact-method__icon {
  width: 56px; height: 56px; border-radius: 16px; background: var(--bg-soft);
  display: flex; align-items: center; justify-content: center; color: var(--brand);
  transition: transform var(--transition), background var(--transition), color var(--transition);
  box-shadow: var(--shadow-sm);
}
[data-theme='dark'] .contact-method__icon { color: var(--accent); }
.contact-method:hover .contact-method__icon { transform: translateY(-4px) scale(1.05); background: var(--accent); color: #2a1a02; }
.contact-method__icon svg { width: 26px; height: 26px; }

/* -------------------------------- دکمه‌ها -------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 999px; font-weight: 700; font-size: .95rem;
  border: none; transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.btn-primary { background: var(--accent); color: #2a1a02; box-shadow: 0 6px 18px rgba(232,163,61,.35); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(232,163,61,.45); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: .82rem; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* -------------------------------- فرم‌ها -------------------------------- */

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: 7px; color: var(--text-muted); }
.field select, .field input[type="text"], .field input[type="number"], .field input[type="tel"], .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg-elevated); color: var(--text); font-size: .94rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field select:focus, .field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,163,61,.18);
}
.field textarea { resize: vertical; min-height: 90px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

/* -------------------------------- کارت تخمین قیمت -------------------------------- */

.estimator-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; box-shadow: var(--shadow-sm); margin-top: -46px; position: relative; z-index: 3;
}
@media (min-width: 760px) { .estimator-card { max-width: 560px; margin-inline: auto; } }

.category-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-light));
  color: #fff; padding: 36px 0 90px; text-align: center;
}
.category-hero h1 { margin: 0 0 8px; font-size: 1.5rem; }
.category-hero p { margin: 0; color: #cfd7f3; font-size: .9rem; }

.estimate-result {
  margin-top: 18px; padding: 18px; border-radius: var(--radius-md);
  background: var(--bg-soft); border: 1.5px dashed var(--accent);
  display: none;
}
.estimate-result.is-visible { display: block; animation: popIn 380ms ease; }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.estimate-result__range { font-size: 1.3rem; font-weight: 800; color: var(--brand); text-align: center; }
[data-theme='dark'] .estimate-result__range { color: var(--accent); }
.estimate-result__note { font-size: .82rem; color: var(--text-muted); margin-top: 8px; text-align: center; }
.estimate-result__breakdown { margin-top: 12px; font-size: .84rem; }
.estimate-result__breakdown div { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); }

.estimate-cta { margin-top: 14px; text-align: center; }

.lead-form { margin-top: 16px; display: none; }
.lead-form.is-visible { display: block; animation: popIn 380ms ease; }

.form-msg { margin-top: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .86rem; display: none; }
.form-msg.is-visible { display: block; }
.form-msg.success { background: rgba(31,157,97,.12); color: var(--success); }
.form-msg.error { background: rgba(212,71,60,.12); color: var(--danger); }

/* -------------------------------- گالری پروژه -------------------------------- */

.gallery {
  position: relative; border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-soft);
  aspect-ratio: 16/10; max-height: 560px;
}
.gallery__track { display: flex; height: 100%; transition: transform 500ms ease; }
.gallery__slide { flex: 0 0 100%; height: 100%; }
.gallery__slide img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 6px; }
.gallery__thumbs img {
  width: 84px; height: 64px; object-fit: cover; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; opacity: .65; transition: opacity var(--transition), border-color var(--transition);
  flex-shrink: 0;
}
.gallery__thumbs img.is-active { opacity: 1; border-color: var(--accent); }

.project-meta { display: flex; flex-wrap: wrap; gap: 20px; margin: 20px 0; }
.project-meta div { font-size: .85rem; }
.project-meta b { display: block; color: var(--text-muted); font-weight: 600; font-size: .76rem; margin-bottom: 3px; }

/* -------------------------------- عمومی -------------------------------- */

.breadcrumb { font-size: .82rem; color: var(--text-muted); margin-bottom: 14px; }
.breadcrumb a:hover { color: var(--accent-dark); }

.empty-state { text-align: center; padding: 60px 16px; color: var(--text-muted); }

.search-results-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 18px;
}

.page-hero { padding: 40px 0 10px; text-align: center; }
.page-hero h1 { font-size: 1.4rem; color: var(--brand); }
[data-theme='dark'] .page-hero h1 { color: var(--accent); }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,.15); border-top-color: var(--brand);
  animation: spin 700ms linear infinite; display: inline-block;
}
[data-theme='dark'] .spinner { border-color: rgba(255,255,255,.2); border-top-color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
