/* =============================================================
   MASHINOM — Design Tokens & Foundation
   Direction: "Night Showroom" — cinematic dark automotive editorial
   Palette: derived from Eram Khodro brand (#862515 oxblood) on warm near-black
   ============================================================= */

/* ---------- Self-hosted variable fonts (SIL OFL 1.1) ----------
   چرا محلی: برای مخاطب ایران، CDN گوگل ممکن است کند یا در دسترس نباشد.
   فایل‌ها با licences در assets/fonts هستند. */
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/vazirmatn-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Vazirmatn";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/vazirmatn-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/space-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;

  /* ---------- Brand ramp (oxblood) ---------- */
  --brand-50:  #FCEFEB;
  --brand-100: #F7DAD2;
  --brand-200: #EDB4A4;
  --brand-300: #DE8572;
  --brand-400: #C6503B;
  --brand-500: #A8321F;
  --brand-600: #862515;   /* core brand — Eram Khodro */
  --brand-700: #5F1A0F;
  --brand-800: #451109;
  --brand-900: #2E0B06;
  --brand-950: #1C0703;

  /* ---------- Champagne (metallic accent) ---------- */
  --gold-100: #F8EDD9;
  --gold-200: #EEDCBC;
  --gold-300: #E3C08C;   /* primary accent text */
  --gold-400: #CFA365;
  --gold-500: #B08349;

  /* ---------- Warm neutrals ---------- */
  --ink-50:  #F7F3EF;
  --ink-100: #E6DED8;
  --ink-200: #BFB4AD;
  --ink-300: #9A8F89;
  --ink-400: #6E645F;
  --ink-500: #4B4340;
  --ink-600: #332D2B;
  --ink-700: #242020;
  --ink-750: #1C1918;
  --ink-800: #161413;
  --ink-850: #111010;
  --ink-900: #0C0B0A;
  --ink-950: #080706;

  /* ---------- Semantic surfaces ---------- */
  --bg:          var(--ink-950);
  --surface-1:   var(--ink-900);
  --surface-2:   var(--ink-850);
  --surface-3:   var(--ink-800);
  --surface-4:   var(--ink-750);
  --glass:       rgba(255, 255, 255, 0.045);
  --glass-strong:rgba(255, 255, 255, 0.075);
  --line:        rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.145);
  --line-brand:  rgba(198, 80, 59, 0.35);

  /* ---------- Text ---------- */
  --text:       #F4EFEA;
  --text-2:     var(--ink-200);
  --text-3:     var(--ink-300);
  --text-4:     #8B817B; /* mute readable on dark: >=4.6:1 روی همه سطوح */
  --text-inverse:#140D0B;

  /* ---------- Signal ---------- */
  --success: #4CC38A;
  --warning: #E7B24A;
  --danger:  #F0553F;
  --info:    #6EA8FE;
  --success-soft: rgba(76, 195, 138, 0.12);
  --danger-soft:  rgba(240, 85, 63, 0.12);

  /* ---------- Typography ---------- */
  --font-fa: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-en: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;

  --fs-display: clamp(2.75rem, 1.1rem + 5.4vw, 6rem);   /* 44 → 96 */
  --fs-h1:      clamp(2.15rem, 1.35rem + 2.6vw, 3.5rem); /* 34 → 56 */
  --fs-h2:      clamp(1.75rem, 1.3rem + 1.7vw, 2.75rem); /* 28 → 44 */
  --fs-h3:      clamp(1.3rem, 1.12rem + 0.7vw, 1.75rem); /* 21 → 28 */
  --fs-h4:      clamp(1.1rem, 1rem + 0.4vw, 1.3rem);
  --fs-lead:    clamp(1.02rem, 0.95rem + 0.35vw, 1.2rem);
  --fs-body:    1rem;
  --fs-sm:      0.875rem;
  --fs-xs:      0.78rem;
  --fs-micro:   0.68rem;

  --lh-display: 1.22;
  --lh-heading: 1.38;
  --lh-body:    1.9;
  --lh-tight:   1.5;

  /* ---------- Space & layout ---------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 2.5rem;
  --space-8: 3rem;
  --space-9: 4rem;
  --space-10: 5rem;
  --space-11: 7rem;

  --container: 1280px;
  --gutter: clamp(1.1rem, 4vw, 3rem);
  --section-y: clamp(4.5rem, 8.5vw, 8.5rem);
  --header-h: 84px;
  --header-h-sm: 68px;

  /* ---------- Radius ---------- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-2xl: 34px;
  --r-3xl: 44px;
  --r-pill: 999px;

  /* ---------- Elevation ---------- */
  --shadow-sm: 0 1px 0 rgba(255,255,255,.04) inset, 0 6px 18px -10px rgba(0,0,0,.9);
  --shadow-md: 0 1px 0 rgba(255,255,255,.05) inset, 0 24px 50px -28px rgba(0,0,0,.95);
  --shadow-lg: 0 1px 0 rgba(255,255,255,.06) inset, 0 40px 90px -40px rgba(0,0,0,1);
  --shadow-brand: 0 18px 44px -18px rgba(134, 37, 21, .75);
  --glow-brand: 0 0 0 1px rgba(198,80,59,.25), 0 18px 60px -24px rgba(134,37,21,.9);

  /* ---------- Motion ---------- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur-instant: 120ms;
  --dur-fast: 220ms;
  --dur-base: 340ms;
  --dur-slow: 560ms;
  --dur-cinematic: 900ms;

  /* ---------- Z-index scale ---------- */
  --z-base: 1;
  --z-raised: 10;
  --z-sticky: 40;
  --z-header: 100;
  --z-drawer: 200;
  --z-modal: 300;
  --z-cursor: 400;
}

/* =============================================================
   Reset
   ============================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--brand-700) var(--ink-900);
  scrollbar-width: thin;
}

body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-fa);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  /*
    برای بریدن سرریز افقی.

    `clip` نه `hidden`: مقدار `hidden` بدنه را به ظرف اسکرول تبدیل می‌کند
    و چون بدنه خودش اسکرول نمی‌شود، `position: sticky` فرزندانش
    (نمایشگاه سنجاق‌شدهٔ صفحهٔ اصلی و ستون جزئیات) هیچ‌وقت میخکوب
    نمی‌شد — بخش ۳۰۰svh سنجاق می‌ماند ولی محتوایش با صفحه بالا می‌رفت
    و یک نوار خالی سیاه می‌ماند. `clip` همان سرریز را می‌برد، بدون
    ساختن ظرف اسکرول.
  */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* مرورگرهای قدیمی که `clip` را نمی‌شناسند: سرریز افقی بماند، هرچند
   sticky هم قربانی می‌شود. */
@supports not (overflow-x: clip) {
  body { overflow-x: hidden; }
}

img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

::selection {
  background: var(--brand-600);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--gold-300);
  outline-offset: 3px;
  border-radius: 6px;
}

:target { scroll-margin-top: calc(var(--header-h) + 24px); }

/* Global film grain — keeps the dark canvas from feeling flat */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 140px 140px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--ink-900); }
::-webkit-scrollbar-thumb {
  background: var(--ink-600);
  border-radius: 99px;
  border: 2px solid var(--ink-900);
}
::-webkit-scrollbar-thumb:hover { background: var(--brand-700); }

/* =============================================================
   Typography
   ============================================================= */
.display,
h1, h2, h3, h4 {
  font-weight: 800;
  line-height: var(--lh-heading);
  text-wrap: balance;
  letter-spacing: 0;
}

.display {
  font-size: var(--fs-display);
  font-weight: 900;
  line-height: var(--lh-display);
}

h1 { font-size: var(--fs-h1); font-weight: 800; }
h2 { font-size: var(--fs-h2); font-weight: 800; }
h3 { font-size: var(--fs-h3); font-weight: 700; }
h4 { font-size: var(--fs-h4); font-weight: 700; line-height: var(--lh-tight); }

p { text-wrap: pretty; }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.9;
  color: var(--text-2);
  font-weight: 400;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.kicker {
  font-family: var(--font-en);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand-300);
}

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.text-gold {
  color: var(--gold-300);
}

.text-gradient {
  background: linear-gradient(100deg, var(--gold-200) 0%, #FFFFFF 38%, var(--brand-300) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.text-brand { color: var(--brand-300); }
.text-muted { color: var(--text-3); }

/* =============================================================
   Layout primitives
   ============================================================= */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide { --container: 1440px; }
.container--narrow { --container: 920px; }

.section {
  position: relative;
  padding-block: var(--section-y);
}

.section--tight { padding-block: clamp(3rem, 5vw, 5rem); }

.section--edge {
  border-top: 1px solid var(--line);
}

.section--surface {
  background:
    radial-gradient(1200px 420px at 80% 0%, rgba(134, 37, 21, 0.10), transparent 70%),
    linear-gradient(180deg, var(--surface-2), var(--surface-1));
  border-block: 1px solid var(--line);
}

.grid { display: grid; gap: var(--space-5); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

.divider {
  height: 1px;
  border: 0;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  inset-block-start: 12px;
  inset-inline-start: 50%;
  transform: translate(-50%, -160%);
  z-index: 999;
  padding: 0.7rem 1.4rem;
  border-radius: var(--r-pill);
  background: var(--brand-600);
  color: #fff;
  font-weight: 700;
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* Icons */
.ic {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.ic--solid { fill: currentColor; stroke: none; }

/* =============================================================
   Scroll reveal system (progressive: only active when JS is on)
   ============================================================= */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity var(--dur-cinematic) var(--ease-out),
    transform var(--dur-cinematic) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

.js [data-reveal="fade"] { transform: none; }

.js [data-reveal="scale"] {
  transform: scale(0.94);
}

.js [data-reveal="clip"] {
  clip-path: inset(0 0 100% 0);
  opacity: 1;
  transform: none;
  transition: clip-path 1.1s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

.js [data-reveal="clip"].is-in {
  clip-path: inset(0 0 0 0);
}

/* Masked line reveal for headlines */
.js .line-mask {
  display: block;
  overflow: hidden;
  padding-block-end: 0.08em;
  margin-block-end: -0.08em;
}
.js .line-mask > span {
  display: block;
  transform: translate3d(0, 110%, 0);
  transition: transform 1.05s var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}
.js .line-mask.is-in > span { transform: none; }

/* =============================================================
   Reduced motion — kill decorative motion, keep content visible
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .js [data-reveal],
  .js .line-mask > span,
  .js [data-reveal="clip"] {
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
}

/* =============================================================
   Print (light fallback)
   ============================================================= */
@media print {
  body { background: #fff; color: #000; }
  body::after, .site-header, .mobile-nav, .backdrop, .footer__wordmark { display: none !important; }
  .js [data-reveal] { opacity: 1 !important; transform: none !important; }
}
