/* ============================================================================
   توراکس‌نگار · چارچوب تشخیص تفسیرپذیر ناهنجاری‌های قفسه‌ی سینه
   شیوه‌نامه‌ی اصلی — تم تیره‌ی پزشکی (Teal)، چیدمان راست‌به‌چپ (RTL)
   ----------------------------------------------------------------------------
   ساختار: ۱) توکن‌ها  ۲) پایه و RTL  ۳) اجزای مشترک  ۴) نوار و بنر
            ۵) اسکنر (عنصر امضا)  ۶) ابزار تحلیل  ۷) نتایج و مقایسه
            ۸) معماری  ۹) درباره و فوتر  ۱۰) واکنش‌گرایی و دسترس‌پذیری
   ========================================================================== */

/* ----------------------------- ۱) توکن‌ها ------------------------------- */
:root {
  /* پس‌زمینه و سطوح */
  --bg: #0B1518;
  --bg-2: #0E1D21;
  --surface: #122A2F;
  --surface-2: #16343A;
  --border: #1F454C;
  --border-strong: #2C5E66;

  /* رنگ اصلی (Teal پزشکی) */
  --primary: #2A9D8F;
  --primary-deep: #1A7A6E;
  --primary-bright: #34E0C9;

  /* متن */
  --text: #E9F3F1;
  --text-muted: #9FBAB7;
  --text-faint: #6E8A88;

  /* وضعیت‌ها */
  --positive: #E76F51;   /* یافته‌ی مثبت */
  --positive-soft: #F4A261;
  --warn: #F4A261;
  --healthy: #2DD4BF;
  --glow: rgba(52, 224, 201, .35);

  /* فاصله و گردی */
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --r-pill: 999px;
  --maxw: 1160px;
  --gut: clamp(16px, 4vw, 40px);

  /* فونت‌ها */
  --font-body: 'Vazirmatn', 'DejaVu Sans', Tahoma, system-ui, sans-serif;
  --font-display: 'Noto Kufi Arabic', 'Vazirmatn', 'DejaVu Sans', Tahoma, sans-serif;
  --font-mono: 'JetBrains Mono', 'DejaVu Sans Mono', ui-monospace, monospace;

  --shadow: 0 18px 50px -24px rgba(0, 0, 0, .8);
  --shadow-soft: 0 10px 30px -18px rgba(0, 0, 0, .7);
}

/* ----------------------------- ۲) پایه و RTL ----------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* ویژگی hidden همیشه بر قواعدِ display نویسنده مقدم باشد */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  font-weight: 400;
  /* درخشش‌های ملایم پس‌زمینه */
  background-image:
    radial-gradient(900px 520px at 88% -8%, rgba(42, 157, 143, .16), transparent 60%),
    radial-gradient(760px 480px at -6% 12%, rgba(26, 122, 110, .14), transparent 58%);
  background-attachment: fixed;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; font-weight: 700; }

a { color: inherit; text-decoration: none; }

/* متن و اعداد لاتین نباید معکوس شوند */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}
.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  letter-spacing: .01em;
}
.mono { font-family: var(--font-mono); }

/* پرش سریع برای دسترس‌پذیری */
.skip-link {
  position: absolute;
  right: 16px;
  top: -60px;
  z-index: 100;
  background: var(--primary);
  color: #04110E;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  font-weight: 700;
  transition: top .2s ease;
}
.skip-link:focus { top: 16px; }

/* حلقه‌ی فوکوس یکدست */
:focus-visible {
  outline: 2px solid var(--primary-bright);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ----------------------------- ۳) اجزای مشترک ---------------------------- */
.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--primary-bright);
  background: rgba(52, 224, 201, .08);
  border: 1px solid rgba(52, 224, 201, .2);
  padding: 5px 14px;
  border-radius: var(--r-pill);
  margin-bottom: 18px;
}

.btn {
  --btn-bg: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--btn-bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease,
              background .2s ease, border-color .2s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: .92rem; }

.btn--primary {
  --btn-bg: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #04130F;
  box-shadow: 0 10px 26px -12px var(--glow);
}
.btn--primary:hover {
  box-shadow: 0 14px 34px -10px var(--glow);
  transform: translateY(-2px);
}
.btn--ghost {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, .015);
  color: var(--text);
}
.btn--ghost:hover {
  border-color: var(--primary);
  background: rgba(42, 157, 143, .1);
}
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

/* بخش‌ها */
.section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(56px, 9vw, 104px) var(--gut);
}
.section--alt {
  background:
    linear-gradient(180deg, transparent, rgba(18, 42, 47, .5) 12%,
                    rgba(18, 42, 47, .5) 88%, transparent);
  max-width: none;
  border-block: 1px solid var(--border);
}
.section--alt > * { max-width: var(--maxw); margin-inline: auto; }

.section__head { text-align: center; max-width: 640px; margin: 0 auto 42px; }
.section__head h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  margin-top: 4px;
}
.section__sub { color: var(--text-muted); margin-top: 12px; font-size: 1.02rem; }

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary-bright);
  box-shadow: 0 0 10px var(--primary-bright);
  display: inline-block;
  vertical-align: middle;
}

/* ----------------------------- ۴) نوار و بنر ----------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 21, 24, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px var(--gut);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 13px;
  color: var(--primary-bright);
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-strong);
  box-shadow: inset 0 0 18px rgba(52, 224, 201, .14);
}
.brand__text { display: flex; flex-direction: column; gap: 4px; line-height: 1; }
.brand__text strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.16rem;
  letter-spacing: -.01em;
}
.brand__text small {
  color: var(--text-faint);
  font-size: .68rem;
  letter-spacing: .12em;
  font-family: var(--font-mono);
}
.nav__links { display: none; gap: 6px; }
.nav__links a {
  color: var(--text-muted);
  padding: 8px 15px;
  border-radius: var(--r-pill);
  font-weight: 500;
  font-size: .95rem;
  transition: color .18s ease, background .18s ease;
}
.nav__links a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }

/* بنر */
.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) var(--gut) clamp(30px, 5vw, 56px);
}
.hero__grid {
  display: grid;
  gap: clamp(34px, 6vw, 64px);
  align-items: center;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.05rem, 6.5vw, 3.5rem);
  letter-spacing: -.02em;
  line-height: 1.16;
}
.hero__title em {
  font-style: normal;
  background: linear-gradient(120deg, var(--primary-bright), var(--primary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
}
.hero__lead {
  color: var(--text-muted);
  font-size: clamp(1.02rem, 2.4vw, 1.16rem);
  margin: 22px 0 30px;
  max-width: 46ch;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero__stats {
  list-style: none;
  display: flex;
  gap: clamp(20px, 5vw, 44px);
  margin: 40px 0 0;
  padding: 26px 0 0;
  border-top: 1px solid var(--border);
}
.hero__stats li { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.hero__stats .num {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 700;
  color: var(--text);
}
.hero__stats small { color: var(--text-faint); font-size: .82rem; }

/* ----------------------- ۵) اسکنر (عنصر امضا) --------------------------- */
.scanner { display: grid; gap: 14px; justify-items: stretch; }
.scanner__frame {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r-lg);
  background:
    radial-gradient(120% 120% at 50% 0%, rgba(42, 157, 143, .1), transparent 55%),
    linear-gradient(160deg, var(--surface-2), var(--bg-2));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), inset 0 0 60px rgba(0, 0, 0, .45);
  overflow: hidden;
  isolation: isolate;
}
.scanner__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(52, 224, 201, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(52, 224, 201, .07) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at 50% 45%, #000 55%, transparent 85%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 55%, transparent 85%);
}
.scanner__lungs {
  position: absolute;
  inset: 8% 12%;
  width: 76%;
  height: 84%;
  z-index: 2;
}
.scanner__lungs .lung {
  fill: rgba(52, 224, 201, .06);
  stroke: var(--primary-bright);
  stroke-width: 2.2;
  stroke-opacity: .55;
}
.scanner__lungs .ln { stroke: var(--primary-bright); stroke-opacity: .7; }
.scanner__lungs .ribs path {
  stroke: var(--primary);
  stroke-width: 2;
  stroke-opacity: .22;
  fill: none;
}

/* شکوفه‌های توجه */
.bloom {
  position: absolute;
  z-index: 3;
  width: 30%;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(2px);
  background: radial-gradient(circle,
              rgba(231, 111, 81, .85) 0%,
              rgba(244, 162, 97, .5) 32%,
              rgba(52, 224, 201, .25) 60%,
              transparent 72%);
  mix-blend-mode: screen;
  opacity: 0;
  animation: bloom 6s ease-in-out infinite;
}
.bloom--1 { top: 30%; right: 22%; animation-delay: .4s; }
.bloom--2 { top: 52%; left: 20%; width: 24%; animation-delay: 2.2s; }
.bloom--3 { top: 60%; right: 30%; width: 20%; animation-delay: 4s; }

@keyframes bloom {
  0%, 100% { opacity: 0; transform: scale(.6); }
  45%, 65% { opacity: .9; transform: scale(1); }
}

/* پرتو اسکن */
.scanner__beam {
  position: absolute;
  left: 0; right: 0;
  top: 0;
  height: 18%;
  z-index: 4;
  background: linear-gradient(180deg,
              transparent, rgba(52, 224, 201, .16) 60%, rgba(52, 224, 201, .5));
  border-bottom: 2px solid var(--primary-bright);
  box-shadow: 0 0 24px var(--glow);
  animation: scan 4.4s cubic-bezier(.55, 0, .45, 1) infinite;
}
@keyframes scan {
  0% { transform: translateY(-110%); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(560%); opacity: 0; }
}

.scanner__readout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: .78rem;
  color: var(--text-muted);
  padding: 0 6px;
  flex-wrap: wrap;
}
.scanner__readout .mono { color: var(--text-faint); font-size: .74rem; }

/* نوار حالت نمایشی */
.demo-ribbon {
  max-width: var(--maxw);
  margin: 8px auto 0;
  padding: 12px 18px;
  border-radius: var(--r);
  background: rgba(244, 162, 97, .1);
  border: 1px solid rgba(244, 162, 97, .34);
  color: #FAD9B8;
  font-size: .92rem;
  text-align: center;
  margin-inline: var(--gut);
}
.demo-ribbon strong { color: var(--warn); }
@media (min-width: 1224px) {
  .demo-ribbon { margin-inline: auto; }
}

/* ----------------------------- ۶) ابزار تحلیل ---------------------------- */
.uploader {
  max-width: 720px;
  margin: 0 auto;
}
.uploader__drop {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: clamp(32px, 6vw, 52px);
  text-align: center;
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background:
    radial-gradient(80% 120% at 50% 0%, rgba(42, 157, 143, .07), transparent 60%),
    var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.uploader__drop:hover,
.uploader__drop:focus-visible {
  border-color: var(--primary);
  background:
    radial-gradient(80% 120% at 50% 0%, rgba(42, 157, 143, .14), transparent 60%),
    var(--surface-2);
}
.uploader__drop.is-drag {
  border-color: var(--primary-bright);
  background: rgba(52, 224, 201, .1);
  transform: scale(1.01);
}
.uploader__icon { color: var(--primary-bright); }
.uploader__title { font-weight: 700; font-size: 1.08rem; margin: 4px 0 0; }
.uploader__hint { color: var(--text-faint); font-size: .9rem; margin: 0; }

.uploader__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  flex-wrap: wrap;
}
.uploader__name {
  flex: 1 1 160px;
  min-width: 0;
  color: var(--text-muted);
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: ltr;
  text-align: right;
}

/* وضعیت بارگذاری */
.loading {
  display: grid;
  place-items: center;
  gap: 16px;
  padding: 48px 16px;
  color: var(--text-muted);
}
.loading__scan {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid var(--border-strong);
  border-top-color: var(--primary-bright);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* هشدار */
.alert {
  max-width: 720px;
  margin: 18px auto 0;
  padding: 14px 18px;
  border-radius: var(--r);
  font-size: .95rem;
}
.alert--error {
  background: rgba(231, 111, 81, .12);
  border: 1px solid rgba(231, 111, 81, .42);
  color: #F6C3B4;
}

/* ----------------------------- ۷) نتایج --------------------------------- */
.results { margin-top: 40px; }
.results__grid {
  display: grid;
  gap: 22px;
}
.panel {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(18px, 3vw, 26px);
  box-shadow: var(--shadow-soft);
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.panel__head h3 {
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 700;
}
.panel__method { font-size: .82rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 7px; }
.panel__note { color: var(--text-faint); font-size: .82rem; margin: 14px 0 0; }

.panel__badge {
  font-size: .82rem;
  font-weight: 700;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.panel__badge[data-state="healthy"] {
  background: rgba(45, 212, 191, .14);
  border: 1px solid rgba(45, 212, 191, .4);
  color: var(--healthy);
}
.panel__badge[data-state="findings"] {
  background: rgba(231, 111, 81, .14);
  border: 1px solid rgba(231, 111, 81, .4);
  color: var(--positive);
}

/* فهرست یافته‌ها */
.findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.finding {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.finding__icon {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 50%;
}
.finding--pos .finding__icon { color: var(--positive); background: rgba(231, 111, 81, .16); }
.finding--neg .finding__icon { color: var(--text-faint); background: rgba(110, 138, 136, .14); }
.finding__main { min-width: 0; }
.finding__name { display: block; font-weight: 600; font-size: .98rem; }
.finding__en { display: block; color: var(--text-faint); font-size: .72rem; font-family: var(--font-mono); margin-top: 1px; }
.finding__meter {
  display: block;
  width: 100%;
  height: 6px;
  margin-top: 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .06);
  overflow: hidden;
}
.finding__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  width: 0;
  transition: width .9s cubic-bezier(.2, .8, .2, 1);
}
.finding--pos .finding__fill { background: linear-gradient(90deg, var(--positive-soft), var(--positive)); }
.finding--neg .finding__fill { background: linear-gradient(90deg, var(--primary-deep), var(--primary)); }
.finding__pct {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.04rem;
  min-width: 56px;
  text-align: left;
  direction: ltr;
}
.finding--pos .finding__pct { color: var(--positive); }
.finding--neg .finding__pct { color: var(--text-muted); }

/* کنترل انتخاب یافته */
.xai-controls {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.xai-controls__label { font-size: .9rem; color: var(--text-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .16s ease;
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border-color: transparent;
  color: #04130F;
}

/* حالت سالم */
.healthy-state {
  display: grid;
  place-items: center;
  gap: 12px;
  text-align: center;
  padding: 30px 16px;
  color: var(--text-muted);
}
.healthy-state__icon {
  display: grid; place-items: center;
  width: 60px; height: 60px;
  border-radius: 50%;
  color: var(--healthy);
  background: rgba(45, 212, 191, .12);
  border: 1px solid rgba(45, 212, 191, .35);
}

/* نمایشگر تصویر و اسلایدر مقایسه */
.viewer { display: grid; gap: 14px; justify-items: center; }
.viewer__caption { font-size: .9rem; color: var(--text-muted); text-align: center; }
.viewer__caption b { color: var(--text); }

.compare {
  position: relative;
  width: min(340px, 82vw);
  aspect-ratio: 5 / 6;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: #040C0E;
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
}
.compare__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.compare__base { z-index: 1; }
.compare__overlay {
  z-index: 2;
  /* فقط همین لایه برش می‌خورد؛ از سمت چپ تا مرزِ دستگیره (RTL-امن). مقدار با JS تنظیم می‌شود. */
  clip-path: inset(0 45% 0 0);
  will-change: clip-path;
}
.compare__range {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  direction: ltr; /* مقدار ۰ همیشه سمت چپ تا با موقعیت دستگیره هم‌خوان باشد */
}
.compare__handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 55%;
  z-index: 4;
  width: 2px;
  background: var(--primary-bright);
  box-shadow: 0 0 14px var(--glow);
  transform: translateX(-1px);
  pointer-events: none;
}
.compare__handle::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 30px; height: 30px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--primary-bright);
  border: 3px solid #04130F;
  box-shadow: 0 0 14px var(--glow);
}
.compare__tag {
  position: absolute;
  top: 10px;
  z-index: 6;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(4, 12, 14, .72);
  border: 1px solid var(--border-strong);
  color: var(--text);
  pointer-events: none;
}
.compare__tag--right { right: 10px; }
.compare__tag--left { left: 10px; color: var(--primary-bright); }

/* راهنمای رنگ نقشه (هم‌خوان با نقشه‌رنگ xai) */
.viewer__legend {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .78rem;
  color: var(--text-faint);
}
.legend-bar {
  width: 150px;
  height: 10px;
  border-radius: var(--r-pill);
  /* راست = کم‌توجه (سرد) ، چپ = پرتوجه (گرم) تا با برچسب‌های RTL هم‌خوان باشد */
  background: linear-gradient(90deg,
    #E76F51 0%, #F4A261 12%, #F4D35E 26%, #34E0C9 44%,
    #2A9D8F 60%, #1A7A6E 78%, #0E1B1E 100%);
  border: 1px solid var(--border);
}

.viewer-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  text-align: center;
  color: var(--text-faint);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .01);
}

.results__footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.results__hint { color: var(--text-faint); font-size: .86rem; }

/* ----------------------------- ۸) معماری -------------------------------- */
.arch { display: grid; gap: 30px; }
.arch__diagram {
  display: grid;
  gap: 12px;
  align-items: stretch;
}
.layer {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform .18s ease, border-color .18s ease;
}
.layer:hover { transform: translateX(-4px); border-color: var(--border-strong); }
.layer__bar { width: 7px; flex: none; background: linear-gradient(180deg, var(--primary-bright), var(--primary)); }
.layer__body { padding: 16px 18px; }
.layer__body h4 { font-size: 1.04rem; font-weight: 700; }
.layer__body h4 .ltr { color: var(--text-faint); font-weight: 500; font-size: .82rem; margin-right: 6px; font-family: var(--font-mono); }
.layer__body p { margin: 5px 0 0; color: var(--text-muted); font-size: .92rem; }

.arch__arrow {
  justify-self: center;
  width: 2px;
  height: 20px;
  background: linear-gradient(var(--border-strong), transparent);
  position: relative;
}
.arch__arrow::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--border-strong);
  border-bottom: 2px solid var(--border-strong);
  transform: translateX(-50%) rotate(45deg);
}

.arch__notes {
  display: grid;
  gap: 14px;
}
.note {
  padding: 18px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.note__k {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .92rem;
  color: var(--primary-bright);
  margin-bottom: 6px;
}
.note p { margin: 0; color: var(--text-muted); font-size: .92rem; }

/* ----------------------------- ۹) درباره و فوتر -------------------------- */
.about {
  display: grid;
  gap: 22px;
  max-width: 860px;
  margin: 0 auto;
}
.spec {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface);
}
.spec > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.spec > div:last-child { border-bottom: none; }
.spec dt { color: var(--text-muted); font-weight: 600; }
.spec dd { margin: 0; font-weight: 700; color: var(--text); }

.disclaimer {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 18px 20px;
  border-radius: var(--r);
  background: rgba(231, 111, 81, .09);
  border: 1px solid rgba(231, 111, 81, .32);
}
.disclaimer__icon { color: var(--warn); flex: none; margin-top: 2px; }
.disclaimer p { margin: 0; color: #F4D4C8; font-size: .95rem; }
.disclaimer strong { color: var(--warn); }

.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 40px var(--gut) 30px;
}
.footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  gap: 22px;
}
.footer__brand { display: grid; gap: 6px; }
.footer__brand strong { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; }
.footer__brand span { color: var(--text-faint); font-size: .9rem; }
.footer__tech { display: flex; flex-wrap: wrap; gap: 8px; }
.footer__tech .mono {
  font-size: .74rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: var(--r-pill);
}
.footer__legal {
  max-width: var(--maxw);
  margin: 26px auto 0;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: .82rem;
  text-align: center;
}

/* ----------------------- ۱۰) واکنش‌گرایی و دسترس‌پذیری ------------------- */
@media (min-width: 600px) {
  .results__grid { gap: 26px; }
  .arch__notes { grid-template-columns: repeat(3, 1fr); }
  .footer__inner { grid-template-columns: 1fr auto; align-items: center; }
  .footer__tech { justify-content: flex-end; }
}

@media (min-width: 880px) {
  .nav__links { display: inline-flex; }
  .hero__grid { grid-template-columns: 1.05fr .95fr; }
  .results__grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .scanner__frame { aspect-ratio: 4 / 5; }
}

/* احترام به ترجیح کاهش حرکت */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .scanner__beam { display: none; }
  .bloom { opacity: .55; transform: scale(1); }
  .finding__fill { transition: none; }
}

/* ----------------------- ۱۰) پرداختِ بصری و ظاهرشدنِ روان ---------------- */
/* ظاهرشدنِ نرمِ بخش‌ها هنگام اسکرول (به‌صورت progressive enhancement با JS فعال می‌شود) */
.reveal { opacity: 0; transform: translateY(18px);
  transition: opacity .55s ease, transform .55s cubic-bezier(.2, .7, .2, 1); }
.reveal.is-visible { opacity: 1; transform: none; }

/* کارتِ پدیدآورنده در بخش «درباره» */
.author {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
}
.author__mark {
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  flex: none;
  border-radius: 16px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.55rem;
  color: var(--bg);
  background: linear-gradient(150deg, var(--primary-bright), var(--primary-deep));
  box-shadow: 0 6px 20px rgba(42, 157, 143, .32);
}
.author__mark svg { width: 30px; height: 30px; }
.author__body { display: flex; flex-direction: column; gap: 3px; }
.author__role {
  font-family: var(--font-mono);
  font-size: .72rem; letter-spacing: .14em;
  color: var(--primary-bright);
}
.author__name { font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; color: var(--text); }
.author__meta { color: var(--text-muted); font-size: .9rem; }

/* ردیف‌های مشخصات و یادداشت‌ها کمی زنده‌تر */
.spec > div { transition: background .18s ease; }
.spec > div:hover { background: rgba(52, 224, 201, .05); }
.note { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.note:hover { transform: translateY(-3px); border-color: var(--border-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .28); }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.is-visible { opacity: 1 !important; transform: none !important; transition: none !important; }
  .note:hover, .spec > div:hover { transform: none; }
}
