/* ==========================================================================
   گالری ماشین مسیحا — style.css
   تم روز/شب با متغیرهای CSS؛ همه رنگ‌های متن/پس‌زمینه از متغیر می‌آیند
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.9;
  transition: background-color .35s ease, color .35s ease;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { line-height: 1.5; margin: 0 0 .5rem; font-weight: 800; }
p { margin: 0 0 1rem; }

/* ---------------- theme tokens ---------------- */
:root {
  --bg: #0b0d10;
  --bg-2: #0e1116;
  --surface: #14181f;
  --surface-2: #1b212b;
  --text: #f4f1e8;
  --muted: #b7b0a0;
  --faint: #8d8778;
  --gold: #d9b64a;
  --gold-strong: #e8ca68;
  --gold-dim: rgba(217, 182, 74, .12);
  --border: rgba(217, 182, 74, .20);
  --border-2: rgba(255, 255, 255, .09);
  --shadow: 0 22px 55px rgba(0, 0, 0, .55);
  --header-bg: rgba(11, 13, 16, .82);
  --input-bg: #10141a;
  --radius: 18px;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f7f4ec;
  --bg-2: #efeadd;
  --surface: #fffdf7;
  --surface-2: #f2ecdf;
  --text: #241e10;
  --muted: #605943;
  --faint: #8a8268;
  --gold: #8a6a12;
  --gold-strong: #6d540e;
  --gold-dim: rgba(138, 106, 18, .10);
  --border: rgba(138, 106, 18, .30);
  --border-2: rgba(20, 15, 0, .12);
  --shadow: 0 18px 45px rgba(70, 55, 10, .14);
  --header-bg: rgba(247, 244, 236, .86);
  --input-bg: #ffffff;
  color-scheme: light;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 820px; }
.gold-text { color: var(--gold); }
.link-gold { color: var(--gold); font-weight: 700; font-size: .92rem; white-space: nowrap; }
.link-gold:hover { color: var(--gold-strong); }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-2);
}
.header-in { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--gold); }
.brand-mark { width: 38px; height: 38px; }
.brand-name { color: var(--text); font-size: 1.02rem; font-weight: 600; }
.brand-name b { color: var(--gold); font-weight: 900; }
.main-nav { display: flex; align-items: center; gap: .35rem; }
.nav-link {
  padding: .45rem .95rem; border-radius: 999px; color: var(--muted);
  font-size: .95rem; font-weight: 600; transition: .25s;
}
.nav-link:hover { color: var(--text); background: var(--gold-dim); }
.nav-link.active { color: var(--gold); background: var(--gold-dim); }
.nav-admin { display: inline-flex; align-items: center; }
.theme-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border-2); background: transparent; color: var(--muted);
  cursor: pointer; transition: .25s; margin-inline-start: .3rem;
}
.theme-btn:hover { color: var(--gold); border-color: var(--border); }
[data-theme="dark"] .ic-sun { display: block; }
[data-theme="dark"] .ic-moon { display: none; }
[data-theme="light"] .ic-sun { display: none; }
[data-theme="light"] .ic-moon { display: block; }
.burger { display: none; background: none; border: 0; cursor: pointer; padding: .4rem; }
.burger span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }

/* ---------------- hero (تصویر ثابت) ---------------- */
.hero { position: relative; min-height: min(86vh, 780px); display: flex; align-items: center; overflow: hidden; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0;
  background:
    linear-gradient(270deg, rgba(5, 6, 8, .92) 0%, rgba(5, 6, 8, .55) 42%, rgba(5, 6, 8, .18) 75%),
    linear-gradient(0deg, rgba(5, 6, 8, .88) 0%, rgba(5, 6, 8, 0) 40%);
}
.hero-content { position: relative; z-index: 2; max-width: 640px; padding: 4rem 0; margin-inline-start: max(1.25rem, calc((100vw - 1180px) / 2 + 1.25rem)); }
.hero-badge {
  display: inline-block; padding: .3rem 1rem; border: 1px solid rgba(217, 182, 74, .55);
  border-radius: 999px; color: #e8ca68; font-size: .82rem; font-weight: 600;
  background: rgba(10, 10, 12, .45); backdrop-filter: blur(6px);
}
.hero-content h1 { font-size: clamp(2.1rem, 5.4vw, 3.6rem); color: #ffffff; margin: 1rem 0 .8rem; text-shadow: 0 4px 30px rgba(0,0,0,.5); }
.hero-content h1 .gold-text { color: #e8ca68; }
.hero-content p { color: #e9e4d8; font-size: 1.06rem; max-width: 520px; text-shadow: 0 2px 14px rgba(0,0,0,.55); }
.hero-actions { display: flex; gap: .8rem; margin-top: 1.6rem; flex-wrap: wrap; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .72rem 1.7rem; border-radius: 999px; font-weight: 700; font-size: .96rem;
  border: 1px solid transparent; cursor: pointer; transition: .25s;
}
.btn-gold { background: linear-gradient(135deg, #e2c05a, #b8912a); color: #191307; box-shadow: 0 10px 26px rgba(184, 145, 42, .35); }
.btn-gold:hover { filter: brightness(1.07); transform: translateY(-2px); }
.btn-ghost { border-color: rgba(255, 255, 255, .5); color: #ffffff; background: rgba(10, 10, 14, .25); backdrop-filter: blur(6px); }
.btn-ghost:hover { border-color: #e8ca68; color: #e8ca68; }
.section .btn-ghost, .post-page .btn-ghost { border-color: var(--border); color: var(--gold); background: transparent; }

/* ---------------- sections ---------------- */
.section { padding: 4.2rem 0; }
.section-alt { background: var(--bg-2); border-block: 1px solid var(--border-2); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; }
.section-head h2 { font-size: 1.55rem; margin: 0; color: var(--text); }
.page-head { padding: 3.4rem 0 1.4rem; }
.page-head h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); color: var(--text); }
.page-head p { color: var(--muted); margin: 0; }

/* ---------------- grids & cards ---------------- */
.grid { display: grid; gap: 1.4rem; }
.cars-grid { grid-template-columns: repeat(3, 1fr); }
.posts-grid { grid-template-columns: repeat(3, 1fr); }
.car-card, .post-card {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: .3s;
  box-shadow: 0 8px 26px rgba(0, 0, 0, .12);
}
.car-card:hover, .post-card:hover { transform: translateY(-6px); border-color: var(--border); box-shadow: var(--shadow); }
.card-media { position: relative; aspect-ratio: 16/9.4; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.car-card:hover .card-media img, .post-card:hover .card-media img { transform: scale(1.05); }
.card-body { padding: 1.1rem 1.2rem 1.25rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.card-body h3 { font-size: 1.06rem; color: var(--text); margin: 0; }
.card-meta { display: flex; gap: 1rem; color: var(--faint); font-size: .83rem; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: .7rem; border-top: 1px dashed var(--border-2); }
.price { color: var(--gold); font-weight: 800; font-size: .95rem; }
.post-date { color: var(--faint); font-size: .8rem; }
.post-date.big { font-size: .9rem; color: var(--gold); }
.excerpt {
  color: var(--muted); font-size: .88rem; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------------- slider ---------------- */
.slider { position: relative; }
.slider-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(340px, 82vw);
  gap: 1.4rem; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: .4rem .2rem 1rem; scrollbar-width: none;
}
.slider-track::-webkit-scrollbar { display: none; }
.slider-track > * { scroll-snap-align: start; }
.slider-btn {
  position: absolute; top: 42%; transform: translateY(-50%); z-index: 5;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--surface); color: var(--gold); border: 1px solid var(--border);
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: .25s;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .2);
}
.slider-btn:hover { background: var(--gold); color: #191307; }
.slider-btn.prev { left: -10px; }
.slider-btn.next { right: -10px; }

/* ---------------- pagination ---------------- */
.pagination { display: flex; gap: .5rem; justify-content: center; margin-top: 2.4rem; }
.page-num {
  min-width: 42px; height: 42px; padding: 0 .6rem; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-2); color: var(--muted); font-weight: 700; transition: .2s;
}
.page-num:hover { border-color: var(--border); color: var(--gold); }
.page-num.active { background: linear-gradient(135deg, #e2c05a, #b8912a); color: #191307; border-color: transparent; }

/* ---------------- detail (car / post) ---------------- */
.crumbs { color: var(--faint); font-size: .85rem; margin-bottom: 1.6rem; }
.crumbs a:hover { color: var(--gold); }
.detail-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 2.2rem; align-items: start; }
.detail-media img { border-radius: var(--radius); border: 1px solid var(--border-2); box-shadow: var(--shadow); width: 100%; }
.detail-info h1 { font-size: 1.7rem; color: var(--text); }
.price-box {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gold-dim); border: 1px solid var(--border); border-radius: 14px;
  padding: .8rem 1.2rem; margin: 1.1rem 0;
}
.price-box span { color: var(--muted); font-size: .9rem; }
.price-box strong { color: var(--gold); font-size: 1.15rem; }
.specs { width: 100%; border-collapse: collapse; margin-bottom: 1.4rem; }
.specs td { padding: .65rem .4rem; border-bottom: 1px solid var(--border-2); font-size: .92rem; }
.specs td:first-child { color: var(--faint); width: 40%; }
.specs td:last-child { color: var(--text); font-weight: 600; }
.detail-actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.detail-desc { margin-top: 3rem; }
.detail-desc h2 { color: var(--text); }
.detail-desc p, .post-body p { color: var(--muted); font-size: 1rem; text-align: justify; }

/* post page */
.post-page h1 { font-size: clamp(1.5rem, 4vw, 2.2rem); color: var(--text); margin: .4rem 0 1.4rem; }
.post-hero-media img { border-radius: var(--radius); border: 1px solid var(--border-2); box-shadow: var(--shadow); margin-bottom: 2rem; }

/* ---------------- about strip ---------------- */
.about-in { display: grid; grid-template-columns: .9fr 1.1fr; gap: 2.6rem; align-items: center; }
.about-media img { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.about-text h2 { font-size: 1.7rem; color: var(--text); }
.about-text p { color: var(--muted); }
.about-list { list-style: none; padding: 0; margin: 1.2rem 0 1.6rem; }
.about-list li { color: var(--muted); padding: .35rem 0 .35rem 0; padding-right: 1.4rem; position: relative; }
.about-list li::before { content: '◆'; position: absolute; right: 0; color: var(--gold); font-size: .7rem; top: .75rem; }

/* ---------------- footer ---------------- */
.site-footer { background: var(--bg-2); border-top: 1px solid var(--border-2); margin-top: 2rem; }
.footer-grid { display: grid; grid-template-columns: 1.3fr .8fr .9fr; gap: 2.4rem; padding: 3rem 1.25rem 2rem; }
.footer-brand { margin-bottom: .8rem; }
.footer-text { color: var(--muted); font-size: .92rem; max-width: 340px; }
.site-footer h4 { color: var(--gold); font-size: 1rem; margin-bottom: .9rem; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { color: var(--muted); font-size: .9rem; padding: .28rem 0; }
.footer-links a:hover { color: var(--gold); }
.footer-bottom { border-top: 1px solid var(--border-2); padding: 1rem 0; }
.footer-bottom .container { color: var(--faint); font-size: .82rem; }

/* ---------------- 404 / empty ---------------- */
.notfound { text-align: center; padding: 6rem 0; }
.nf-code { font-size: 5rem; color: var(--gold); margin: 0; }
.notfound p { color: var(--muted); margin-bottom: 1.6rem; }
.empty { color: var(--faint); }

/* ==================================================================
   admin panel
   ================================================================== */
.admin-root { min-height: 72vh; padding: 2.6rem 0 4rem; }
.admin-box { max-width: 430px; margin: 4rem auto 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.2rem; box-shadow: var(--shadow); }
.admin-box h1 { text-align: center; color: var(--text); font-size: 1.3rem; }
.admin-box .sub { text-align: center; color: var(--faint); font-size: .85rem; margin-bottom: 1.6rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; color: var(--muted); font-size: .85rem; margin-bottom: .35rem; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%; background: var(--input-bg); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 12px;
  padding: .65rem .9rem; font-family: inherit; font-size: .92rem; transition: .2s;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-dim); }
.field textarea { min-height: 130px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-msg { border-radius: 10px; padding: .6rem .9rem; font-size: .85rem; margin-bottom: 1rem; display: none; }
.admin-msg.err { display: block; background: rgba(220, 60, 60, .12); color: #e07070; border: 1px solid rgba(220, 60, 60, .35); }
.admin-msg.ok { display: block; background: var(--gold-dim); color: var(--gold); border: 1px solid var(--border); }
[data-theme="light"] .admin-msg.err { color: #a32626; }

.admin-wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.admin-top h1 { color: var(--text); font-size: 1.4rem; margin: 0; }
.admin-top .user-chip { color: var(--faint); font-size: .85rem; }
.admin-tabs { display: flex; gap: .5rem; margin-bottom: 1.8rem; flex-wrap: wrap; }
.admin-tab {
  padding: .55rem 1.4rem; border-radius: 999px; border: 1px solid var(--border-2);
  background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; transition: .2s; font-size: .9rem;
}
.admin-tab.active { background: var(--gold-dim); border-color: var(--border); color: var(--gold); }
.admin-panel { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); padding: 1.6rem; }
.admin-panel h2 { color: var(--text); font-size: 1.1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.admin-list { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.admin-list li {
  display: flex; align-items: center; gap: .9rem; justify-content: space-between;
  padding: .8rem .4rem; border-bottom: 1px solid var(--border-2); flex-wrap: wrap;
}
.admin-list .item-title { color: var(--text); font-weight: 700; font-size: .93rem; display: flex; align-items: center; gap: .7rem; }
.admin-list .item-title img { width: 52px; height: 36px; object-fit: cover; border-radius: 8px; }
.admin-list .item-sub { color: var(--faint); font-size: .78rem; }
.badge { padding: .14rem .7rem; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge.pub { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--border); }
.badge.draft { background: rgba(140, 140, 140, .12); color: var(--faint); border: 1px solid var(--border-2); }
.admin-actions { display: flex; gap: .45rem; }
.mini-btn {
  padding: .35rem .9rem; border-radius: 9px; font-size: .78rem; font-weight: 700; cursor: pointer;
  border: 1px solid var(--border-2); background: transparent; color: var(--muted); transition: .2s;
}
.mini-btn:hover { border-color: var(--gold); color: var(--gold); }
.mini-btn.danger:hover { border-color: #d05555; color: #d05555; }
.mini-btn.gold { background: var(--gold-dim); border-color: var(--border); color: var(--gold); }

/* ==================================================================
   responsive
   ================================================================== */
@media (max-width: 980px) {
  .cars-grid, .posts-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .about-in { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .main-nav {
    position: fixed; inset: 68px 0 auto 0; background: var(--bg);
    flex-direction: column; align-items: stretch; padding: 1rem 1.4rem 1.4rem;
    border-bottom: 1px solid var(--border-2); display: none;
  }
  .main-nav.open { display: flex; }
  .nav-link { text-align: center; }
  .theme-btn { margin: .4rem auto 0; }
  .burger { display: block; }
  .hero-content { margin-inline-start: 1.25rem; margin-inline-end: 1.25rem; }
  .slider-btn.prev { left: 2px; }
  .slider-btn.next { right: 2px; }
}
@media (max-width: 560px) {
  .cars-grid, .posts-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
