/*
 * css/style.css — Motive، معماری نسخه ۳ (چت ۳)
 *
 * این فایل چه می‌کند:
 *   ظاهر سایت سه‌بعدی موتیو را برای ساختار نسخه ۳ تعریف می‌کند:
 *   #gl  #track  header.top  section.scene[data-node="0..5"] > .panel
 *   دو حالت مستقل دارد:
 *   ۱) حالت پیش‌فرض / بدون WebGL (html.no-gl یا بدون کلاس js): هر شش بخش در جریان عادی صفحه،
 *      کامل و خوانا. هیچ‌چیز به JavaScript وابسته نیست و استایل‌های inline پنل‌ها (که ui.js می‌گذارد)
 *      با !important خنثی می‌شوند.
 *   ۲) حالت سه‌بعدی (فقط html.js:not(.no-gl)): بخش‌ها ثابت روی صحنه‌اند و ui.js با استایل inline
 *      opacity / transform / visibility / pointer-events هر پنل را کنترل می‌کند. CSS هیچ transition
 *      یا animation‌ای روی .panel نمی‌گذارد تا با ui.js تداخل نکند.
 *
 * از فایل‌های دیگر چه انتظاری دارد:
 *   HTML (front-page.php): ساختار فایل مرجع motive-site-8_1.html؛ کلاس js را یک اسکریپت inline
 *     در head روی html می‌گذارد.
 *   scene.js: فقط کلاس‌های no-gl و tier-high / tier-medium / tier-low را روی html می‌گذارد
 *     (پس از no-gl کلاس‌های tier برداشته می‌شوند).
 *   ui.js: کلاس ready روی html، کلاس‌های on و dn روی .cur، کلاس on و aria-current روی دکمه‌های .dots،
 *     حذف #loader بعد از پایان بارگذاری، و ساخت <pre id="err-panel" class="error-panel">.
 *   scene.js: کلاس hot روی .cur.
 *
 * کارت تماس: div.contact-head (عکس .me-photo + h2) طبق front-page.php؛ فشرده‌سازی‌اش فقط در حالت سه‌بعدی است.
 *
 * هندسه‌ی کارت و path.js (earthFinal): این اعداد نباید تغییر کنند، چون JS جای ایران را با آن‌ها حساب می‌کند:
 *   دسکتاپ: padding افقی صحنه = clamp(24px, 8vw, 120px)، عرض کارت = 32rem (در قد کمتر از ۵۲۰px: 22rem)
 *   موبایل: فاصله‌ی پایین = max(9vh, 56px)، ارتفاع تقریبی کارت ۲۹۵px (در قد کمتر از ۷۰۰px: ۲۴۵px)
 *   شرط موبایل: (max-width:760px), (max-aspect-ratio:4/5)  (همان matchMedia در scene.js)
 *
 * فونت: این فایل @font-face ندارد؛ بارگذاری وزیرمتن با چت ۱ است (HTML مرجع فعلاً از CDN می‌خواند).
 */

/* ============ ۱. متغیرها (نام‌های نسخه ۳) ============ */
:root {
  --ink: #010509;
  --deep: #04141d;
  --foam: #d9f6ff;
  --cyan: #3fd8f0;
  --amber: #ffb04a;
  --mute: rgba(217, 246, 255, .68);
  --line: rgba(160, 225, 245, .24);
  --f: 'Vazirmatn', 'Vazir', system-ui, Tahoma, sans-serif;
  --bar-h: 64px; /* ارتفاع تقریبی هدر؛ برای فاصله‌ی بالای بخش اول در حالت جریان عادی */
}

/* ============ ۲. پایه ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { background: var(--ink); -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--f);
  color: var(--foam);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.9;
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

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

/* لینک پرش به محتوا (در HTML مرجع نیست؛ برای ساختار نهایی چت ۱) */
.skip {
  position: fixed;
  inset-block-start: 8px;
  inset-inline-start: 8px;
  z-index: 100;
  padding: .55em 1.1em;
  border-radius: 999px;
  background: var(--ink);
  color: var(--foam);
  border: 1px solid var(--amber);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ============ ۳. لایه‌های سه‌بعدی: پیش‌فرض پنهان ============ */
/* فقط در html.js:not(.no-gl) نمایش داده می‌شوند (بخش ۴) */
#gl, .vig, .cur, .lbl, .dots, .gauge, #track, #loader { display: none; }

html.no-gl body {
  background: radial-gradient(120% 80% at 50% 0%, #0b3a4a 0, var(--deep) 45%, var(--ink) 100%) fixed;
}

/* ============ ۴. حالت سه‌بعدی: html.js:not(.no-gl) ============ */
html.js:not(.no-gl) #gl { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }
html.js:not(.no-gl) .vig { display: block; position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(130% 95% at 50% 45%, transparent 58%, rgba(1, 5, 9, .5)); }
html.js:not(.no-gl) #track { display: block; height: 1000vh; height: 1000svh; }

/* بارگذاری: ui.js کلاس ready را می‌گذارد و بعد عنصر را حذف می‌کند */
html.js:not(.no-gl) #loader { display: grid; position: fixed; inset: 0; z-index: 20; place-items: center; background: var(--ink); transition: opacity .8s ease .1s; }
html.ready:not(.no-gl) #loader { opacity: 0; pointer-events: none; }
.ld-in { width: min(78vw, 340px); text-align: center; }
.ld-t { font-weight: 200; font-size: 2.4rem; letter-spacing: -.02em; margin-bottom: 1.1rem; }
.ld-b { height: 1px; background: var(--line); overflow: hidden; }
.ld-b i { display: block; height: 100%; background: var(--amber); transform-origin: right; transform: scaleX(0); transition: transform .35s ease; }
#ld-txt { margin-top: .9rem; font-size: .82rem; color: var(--mute); min-height: 1.6em; }

/* بخش‌ها: ثابت روی صحنه؛ نمایش و محو را ui.js با استایل inline کنترل می‌کند */
html.js:not(.no-gl) .scene { position: fixed; inset: 0; z-index: 2; align-items: center; justify-content: flex-start; padding: 0 clamp(24px, 8vw, 120px); pointer-events: none; }
html.js:not(.no-gl) .panel {
  width: min(100%, 32rem);
  will-change: opacity, transform;
  pointer-events: auto;
  visibility: hidden;
  opacity: 0;
  background: linear-gradient(160deg, rgba(6, 24, 34, .58), rgba(2, 10, 16, .46));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
html.js:not(.no-gl) .hero { align-items: flex-start; padding-top: clamp(96px, 19vh, 180px); }
html.js:not(.no-gl) .hero .panel { width: min(100%, 46rem); padding: 0; border: 0; background: none; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; text-shadow: 0 1px 26px rgba(1, 5, 9, .75); }

/* مرورگر بدون backdrop-filter: پس‌زمینه‌ی مات‌تر برای خوانایی */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html.js:not(.no-gl) .scene:not(.hero) .panel { background: rgba(3, 14, 22, .9); }
}
/* گوشی ضعیف: بدون blur (هزینه‌ی GPU) با پس‌زمینه‌ی مات‌تر */
html.js.tier-low:not(.no-gl) .scene:not(.hero) .panel { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(3, 14, 22, .88); }

/* کارت تماس در حالت سه‌بعدی: عکس کوچک‌تر، و سقف ارتفاع تا کارت هیچ‌وقت از صفحه بیرون نزند.
   عرض کارت (۳۲rem) دست‌نخورده می‌ماند چون earthFinal در path.js روی آن حساب می‌شود. */
html.js:not(.no-gl) [data-node="5"] .me-photo { width: clamp(64px, 6vw, 88px); height: clamp(64px, 6vw, 88px); }
html.js:not(.no-gl) [data-node="5"] .panel { max-height: calc(100vh - 7rem); max-height: calc(100svh - 7rem); overflow-y: auto; overscroll-behavior: contain; }

html.js:not(.no-gl) .cue { display: flex; }
html.js:not(.no-gl) .lbl { display: block; position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none; opacity: 0; white-space: nowrap; will-change: transform, opacity; }
html.js:not(.no-gl) .dots { display: block; position: fixed; inset-inline-end: clamp(10px, 2.2vw, 28px); top: 50%; height: min(230px, 34vh); transform: translateY(-50%); width: 20px; z-index: 6; }
html.js:not(.no-gl) .gauge { display: flex; }
html.js:not(.no-gl) .cur { display: block; position: fixed; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 1px solid rgba(255, 176, 74, .85); border-radius: 50%; pointer-events: none; z-index: 9; opacity: 0; mix-blend-mode: screen; transition: width .25s, height .25s, margin .25s, background .25s, opacity .3s; }
@media (pointer: coarse) { html.js:not(.no-gl) .cur { display: none; } }

/* ورود اولیه‌ی hero: تنها لحظه‌ی هماهنگ صفحه */
html.js:not(.no-gl) .hero [data-in] { opacity: 0; }
html.js.ready:not(.no-gl) .hero h1[data-in] { animation: emerge 1.8s cubic-bezier(.2, .7, .2, 1) .4s forwards; }
html.js.ready:not(.no-gl) .hero [data-in]:not(h1) { animation: show 1.2s 1.3s ease forwards; }
@keyframes emerge { from { opacity: 0; letter-spacing: .28em; filter: blur(14px); } to { opacity: 1; letter-spacing: -.03em; filter: blur(0); } }
@keyframes show { from { opacity: 0; } to { opacity: 1; } }

/* ============ ۵. هدر، منو و gauge ============ */
.top {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 4vw, 46px) 14px;
}
.top::before { content: ""; position: absolute; inset: 0 0 -26px; background: linear-gradient(rgba(1, 5, 9, .6), transparent); z-index: -1; pointer-events: none; }
.brand { font-weight: 800; font-size: 1.15rem; text-decoration: none; justify-self: start; }
.menu { display: flex; gap: clamp(16px, 2.4vw, 34px); }
.menu a { font-size: .92rem; color: var(--mute); text-decoration: none; transition: color .2s; padding-block: .2em; }
.menu a:focus-visible { color: var(--foam); }
.gauge { justify-self: end; align-items: baseline; gap: .55em; font-size: .82rem; color: var(--mute); white-space: nowrap; }
.gauge b { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; font-weight: 300; font-size: 1.4rem; color: var(--foam); min-width: 3.4ch; text-align: end; }
.gauge i { font-style: normal; direction: ltr; unicode-bidi: isolate; }

/* نشانگر کنار صفحه: ui.js top هر دکمه را inline می‌گذارد و کلاس on را می‌چرخاند */
.dots::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line); }
.dots button { position: absolute; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; background: none; border: 0; cursor: pointer; }
.dots button span { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--ink); border: 1px solid rgba(217, 246, 255, .6); transition: transform .25s, background .25s, border-color .25s; }
.dots button.on span, .dots button[aria-current="true"] span { background: var(--amber); border-color: var(--amber); transform: scale(1.4); }
.dots .mk { position: absolute; left: 50%; top: 0; width: 3px; height: 34px; margin: -17px 0 0 -1.5px; border-radius: 2px; background: linear-gradient(transparent, var(--cyan), transparent); box-shadow: 0 0 14px var(--cyan); pointer-events: none; }

/* ============ ۶. بخش‌ها و پنل‌ها: جریان عادی (پیش‌فرض و no-gl) ============ */
.scene {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(40px, 8vw, 88px) clamp(18px, 5vw, 48px);
  scroll-margin-top: calc(var(--bar-h) + 8px); /* برای scrollIntoView در goNode حالت no-gl */
}
.hero { padding-top: calc(var(--bar-h) + clamp(40px, 8vw, 88px)); }

.panel {
  width: min(100%, 38rem);
  min-width: 0;
  padding: clamp(20px, 2.6vw, 34px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(6, 24, 34, .72), rgba(2, 10, 16, .62));
  box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
}
.hero .panel { width: min(100%, 46rem); padding: 0; border: 0; background: none; box-shadow: none; text-shadow: 0 1px 26px rgba(1, 5, 9, .75); }
.cue { display: none; }

/* حالت بدون WebGL: استایل‌های inline که ui.js پیش‌تر گذاشته باشد خنثی می‌شوند */
html.no-gl .panel { visibility: visible !important; opacity: 1 !important; transform: none !important; pointer-events: auto !important; will-change: auto; }
html.no-gl .hero [data-in] { opacity: 1 !important; animation: none !important; }

/* ============ ۷. محتوای پنل‌ها ============ */
h1, h2 { letter-spacing: 0; }
h1 { font-weight: 200; font-size: clamp(3.8rem, 14vw, 10.5rem); line-height: 1; letter-spacing: -.03em; margin-bottom: .25em; }
h2 { font-weight: 300; font-size: clamp(1.8rem, 4.2vw, 3rem); line-height: 1.35; margin-bottom: .5em; }
.panel p { color: var(--mute); font-size: clamp(.96rem, 1.4vw, 1.06rem); max-width: 30rem; }
.role { font-size: 1rem; color: var(--amber); font-weight: 700; margin-bottom: .4rem; }
.panel .credit { margin-top: .9rem; font-size: .74rem; opacity: .7; }

.cta { display: inline-flex; align-items: center; min-height: 44px; margin-top: 1.6rem; padding: .65em 1.6em; border: 1px solid rgba(255, 176, 74, .75); border-radius: 999px; color: var(--foam); text-decoration: none; background: rgba(255, 176, 74, .08); transition: background .25s; }
.cta:focus-visible, .cta:active { background: rgba(255, 176, 74, .24); }

.cue { position: absolute; bottom: max(22px, env(safe-area-inset-bottom)); inset-inline: 0; flex-direction: column; align-items: center; gap: 10px; color: var(--mute); font-size: .82rem; pointer-events: none; }
.cue i { display: block; width: 1px; height: 44px; background: linear-gradient(var(--foam), transparent); transform-origin: top; animation: drip 2.4s ease-in-out infinite; }
@keyframes drip { 0% { transform: scaleY(0); opacity: 1; } 55% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.chips li { padding: .2em .95em; border: 1px solid var(--line); border-radius: 999px; font-size: .86rem; color: var(--foam); }

.works, .links { margin-top: 1.3rem; border-top: 1px solid var(--line); }
.works a, .links a { position: relative; display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; min-height: 44px; padding: 1rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.works a::after, .links a::after { content: ""; position: absolute; inset-inline-start: 0; bottom: -1px; height: 1px; width: 0; background: var(--amber); transition: width .45s ease; }
.works a:focus-visible::after, .links a:focus-visible::after { width: 100%; }
.works b, .links b { font-weight: 600; font-size: 1.12rem; }
.works span, .links span { min-width: 0; color: var(--mute); font-size: .88rem; overflow-wrap: anywhere; }

.steps { counter-reset: s; margin-top: 1.3rem; border-inline-start: 1px solid var(--line); }
.steps li { counter-increment: s; position: relative; padding: .3rem 0 .85rem; padding-inline: 1.4rem 0; }
.steps li::before {
  content: counter(s);
  content: counter(s, persian);
  position: absolute;
  inset-inline-start: -.8rem;
  top: .3rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--ink);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-size: .8rem;
  display: grid;
  place-items: center;
  line-height: 1;
}
.steps b { display: block; font-weight: 600; font-size: 1.08rem; }
.steps span { color: var(--mute); font-size: .9rem; }

/* سربرگ کارت تماس: عکس گرد و عنوان کنار هم (front-page.php: div.contact-head > .me-photo + h2#t5).
   .me-photo می‌تواند <img> یا <span> خالی (وقتی me.webp نیست) باشد؛ در هر دو حالت دایره‌ی ساده دیده می‌شود. */
.contact-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .9rem; }
.me-photo { display: block; flex: none; width: 96px; height: 96px; margin: 0; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); box-shadow: 0 0 0 4px rgba(217, 246, 255, .06); background: var(--deep); }
.contact-head h2 { flex: 1; min-width: 0; margin: 0; font-size: clamp(1.35rem, 2.4vw, 1.8rem); line-height: 1.55; overflow-wrap: anywhere; }
.contact-head ~ p + p:not(.credit) { margin-top: .6rem; }

/* برچسب‌های نقشه‌ی ایران (جای و اندازه را scene.js با استایل inline می‌دهد) */
#lbl-iran { font-weight: 200; color: var(--foam); line-height: 1; text-shadow: 0 0 30px rgba(255, 176, 74, .55), 0 2px 24px rgba(1, 5, 9, .9); }
#lbl-gulf { font-weight: 400; color: rgba(170, 232, 248, .9); line-height: 1; text-shadow: 0 1px 12px rgba(1, 5, 9, .95); }

/* نشانگر ماوس: ui.js کلاس‌های on و dn، scene.js کلاس hot */
.cur.on { opacity: 1; }
.cur.hot { width: 58px; height: 58px; margin: -29px 0 0 -29px; background: rgba(255, 176, 74, .12); }
.cur.dn { width: 22px; height: 22px; margin: -11px 0 0 -11px; background: rgba(63, 216, 240, .3); }

/* hover فقط روی دستگاه‌هایی که hover دارند (موبایل به آن وابسته نیست) */
@media (hover: hover) {
  .menu a:hover { color: var(--foam); }
  .cta:hover { background: rgba(255, 176, 74, .24); }
  .works a:hover::after, .links a:hover::after { width: 100%; }
}

/* ============ ۸. پنل خطا (ui.js می‌سازد: <pre id="err-panel" class="error-panel">) ============ */
/* پیام کاربر فارسی است و پیام دیباگ انگلیسی؛ جهت هر خط از محتوایش تعیین می‌شود */
.error-panel {
  position: fixed;
  inset-inline: 8px;
  bottom: 8px;
  z-index: 200;
  max-height: 40vh;
  overflow: auto;
  padding: .8rem 1rem;
  border: 1px solid #ff6b6b;
  border-radius: 10px;
  background: rgba(40, 0, 0, .92);
  color: #ffd6d6;
  font: 12px/1.8 var(--f);
  unicode-bidi: plaintext;
  text-align: start;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.error-panel[hidden] { display: none; }
/* بدون WebGL: پیام آخر صفحه می‌نشیند و روی محتوا نمی‌افتد */
html.no-gl .error-panel { position: static; margin: 24px clamp(18px, 5vw, 48px); }

/* ============ ۹. صفحه‌ی جزئیات پروژه (single-project.php؛ چت ۲) ============ */
/* مستقل از صحنه؛ خوانایی مهم‌تر از افکت است */
.project-page { min-height: 100vh; padding: calc(var(--bar-h) + clamp(24px, 5vw, 56px)) clamp(18px, 5vw, 48px) clamp(48px, 8vw, 96px); background: radial-gradient(120% 60% at 50% 0%, #0b3a4a 0, var(--deep) 42%, var(--ink) 100%); }
.project-article { width: min(100%, 46rem); margin-inline: auto; }
.project-back { display: inline-flex; align-items: center; gap: .5em; min-height: 44px; color: var(--mute); text-decoration: none; font-size: .92rem; transition: color .2s; }
.project-back-icon { width: 1.1em; height: 1.1em; flex: none; }
.project-hero { margin: 1.2rem 0 2rem; }
.project-eyebrow { color: var(--amber); font-weight: 700; font-size: .95rem; margin-bottom: .3rem; }
.project-title { font-weight: 300; font-size: clamp(1.9rem, 5.4vw, 3.2rem); line-height: 1.4; margin-bottom: .4em; }
.project-lead { color: var(--mute); font-size: clamp(1rem, 1.6vw, 1.12rem); max-width: 38rem; }
.project-meta { display: flex; flex-wrap: wrap; gap: 1.2rem 2.2rem; margin-top: 1.6rem; padding: 1rem 0; border-block: 1px solid var(--line); }
.project-meta-item { min-width: 7rem; }
.project-meta-label { display: block; font-size: .8rem; color: var(--mute); }
.project-meta-value { display: block; font-weight: 600; }
.project-tech { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.1rem; }
.project-tech-item { padding: .15em .9em; border: 1px solid var(--line); border-radius: 999px; font-size: .84rem; }
.project-visit { display: inline-flex; align-items: center; gap: .7em; min-height: 44px; margin-top: 1.4rem; padding: .6em 1.5em; border: 1px solid rgba(255, 176, 74, .75); border-radius: 999px; background: rgba(255, 176, 74, .08); text-decoration: none; transition: background .25s; }
.project-visit:focus-visible, .project-visit:active { background: rgba(255, 176, 74, .24); }
.project-visit-host { direction: ltr; unicode-bidi: isolate; color: var(--mute); font-size: .88rem; }
.project-cover { margin: 2rem 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--deep); }
.project-cover-img { width: 100%; }
.project-body { margin-top: 2rem; }
.project-section { padding-block: 1.4rem; border-top: 1px solid var(--line); }
.project-section-title { font-weight: 600; font-size: 1.3rem; line-height: 1.5; margin-bottom: .5em; }
.project-section--problem .project-section-title { color: var(--amber); }
.project-section--work .project-section-title { color: var(--cyan); }
.project-section--result .project-section-title { color: var(--foam); }
.project-text, .project-content { color: var(--mute); font-size: 1.02rem; line-height: 2; max-width: 40rem; }
.project-content > * + * { margin-top: .9em; }
.project-content a { color: var(--foam); text-decoration-color: var(--amber); text-underline-offset: .25em; }
.project-content img { border-radius: 10px; }
.project-footer { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); font-size: .9rem; color: var(--mute); }
@media (hover: hover) {
  .project-back:hover { color: var(--foam); }
  .project-visit:hover { background: rgba(255, 176, 74, .24); }
}

/* ============ ۱۰. واکنش‌گرا ============ */

/* جریان عادی (no-gl / بدون js) روی موبایل: منو زیر برند، با اسکرول افقی داخل خودش */
@media (max-width: 760px) {
  :root { --bar-h: 92px; }
  .top { grid-template-columns: 1fr; row-gap: 4px; }
  .menu { overflow-x: auto; white-space: nowrap; gap: 1.2rem; scrollbar-width: none; }
  .menu::-webkit-scrollbar { display: none; }
  .menu a { padding-block: .55em; }
}

/* موبایل و صفحه‌ی باریک؛ همان شرط matchMedia در scene.js */
@media (max-width: 760px), (max-aspect-ratio: 4/5) {
  html.js:not(.no-gl) #track { height: 900vh; height: 900svh; }
  html.js:not(.no-gl) .menu { display: none; }
  html.js:not(.no-gl) .top { grid-template-columns: 1fr 1fr; }
  html.js:not(.no-gl) .scene { align-items: flex-end; padding-bottom: max(9vh, 56px); }
  html.js:not(.no-gl) .scene::before { content: ""; position: absolute; inset: 38% 0 0; background: linear-gradient(transparent, rgba(1, 5, 9, .55)); z-index: -1; pointer-events: none; }
  html.js:not(.no-gl) .hero { align-items: flex-start; padding-bottom: 0; }
  html.js:not(.no-gl) .hero::before { display: none; }
  html.js:not(.no-gl) .panel { width: 100%; padding: 18px 20px; }
  html.js:not(.no-gl) .hero .panel { padding: 0; }
  html.js:not(.no-gl) .dots { height: min(190px, 30vh); }
  /* کارت تماس روی موبایل: فشرده تا ارتفاعش نزدیک ۲۹۵px (مقدار path.js) بماند */
  .contact-head { gap: .75rem; margin-bottom: .5rem; }
  .me-photo { width: 64px; height: 64px; }
  .contact-head h2 { font-size: 1.35rem; line-height: 1.5; }
  html.js:not(.no-gl) [data-node="5"] .panel { padding: 14px 16px; max-height: calc(100vh - max(9vh, 56px) - 5rem); max-height: calc(100svh - max(9vh, 56px) - 5rem); }
  html.js:not(.no-gl) [data-node="5"] .me-photo { width: 52px; height: 52px; }
  html.js:not(.no-gl) [data-node="5"] .contact-head h2 { font-size: 1.15rem; }
  html.js:not(.no-gl) [data-node="5"] .panel p { font-size: .86rem; line-height: 1.6; }
  html.js:not(.no-gl) [data-node="5"] .contact-head ~ p + p:not(.credit) { margin-top: .4rem; }
  html.js:not(.no-gl) [data-node="5"] .links { margin-top: .6rem; }
  html.js:not(.no-gl) [data-node="5"] .links a { padding: .3rem 0; }
  html.js:not(.no-gl) [data-node="5"] .panel .credit { margin-top: .5rem; font-size: .7rem; line-height: 1.5; }
  h2 { font-size: 1.7rem; margin-bottom: .3em; }
  .works, .links { margin-top: .9rem; }
  .works a, .links a { padding: .6rem 0; }
  .steps li { padding-bottom: .55rem; }
}

/* گوشی کوتاه: متن کمکی کارت تماس فقط در حالت سه‌بعدی مخفی می‌شود (ارتفاع کارت برای path.js ثابت بماند).
   در no-gl این متن همیشه دیده می‌شود. */
@media (max-height: 700px) and (max-width: 760px) {
  html.js:not(.no-gl) [data-node="5"] .panel p:not(.credit) { display: none; }
  html.js:not(.no-gl) [data-node="5"] .me-photo { width: 44px; height: 44px; }
}

/* لندسکیپ کوتاه روی دسکتاپ و تبلت: عرض کارت ۲۲rem (path.js همین را فرض می‌کند) */
@media (max-height: 520px) and (min-width: 761px) {
  html.js:not(.no-gl) .scene:not(.hero) .panel { width: min(100%, 22rem); }
  html.js:not(.no-gl) [data-node="5"] .panel { padding: 16px 20px; }
  html.js:not(.no-gl) [data-node="5"] .me-photo { width: 48px; height: 48px; }
  html.js:not(.no-gl) [data-node="5"] .contact-head { gap: .75rem; margin-bottom: .4rem; }
  html.js:not(.no-gl) [data-node="5"] .contact-head h2 { font-size: 1.1rem; }
  html.js:not(.no-gl) [data-node="5"] .panel p { font-size: .86rem; line-height: 1.6; }
  html.js:not(.no-gl) [data-node="5"] .links { margin-top: .6rem; }
  html.js:not(.no-gl) [data-node="5"] .links a { padding: .3rem 0; }
}

/* ============ ۱۱. کاهش حرکت ============ */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html.js:not(.no-gl) .hero [data-in] { opacity: 1; }
}
