/* =========================================================================
   SHOWCASE — نمونه‌کارها، چرا ما، مجوزها، گالری، کاتالوگ و مقالات
   ========================================================================= */

/* ============================================================ نمونه‌کارها */
.portfolio {
  background: var(--ink-850);
  border-top: 1px solid var(--border);
}

.portfolio__filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* سربرگ با دوربین: آیکون + برچسب + خط در یک ردیف */
.shot-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

.shot-label .mono {
  white-space: nowrap;
}

/* کنارِ فیلترها: برچسب فضای باقی‌مانده را می‌گیرد تا خط کشیده شود */
.section__head--split > .shot-label {
  flex: 1;
  min-width: 0;
}

.shot-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, var(--border-accent), transparent);
  transform-origin: 100% 50%;
  transition: transform 1100ms var(--ease-out) 700ms;
}

.js .shot-rule {
  transform: scaleX(0);
}

.js .gcam.is-built ~ .shot-rule {
  transform: scaleX(1);
}

.chip {
  padding: 7px 15px;
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition:
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.chip.is-active {
  color: var(--accent-bright);
  border-color: var(--border-accent);
  background: var(--accent-wash);
}

/* کاشی‌ها همان .gal گالری‌اند (قاب، منظره‌یاب، نوردهی، فلاش) با متنِ پروژه
   روی تصویر؛ این‌جا فقط چیدمان و متن.

   چیدمانِ ثابت از روی جایگاه — data-slot را portfolio.js از روی کاشی‌های
   «نمایان» می‌دهد، پس با فیلتر هم حفره نمی‌ماند:
     a a b
     a a c      a = کاشیِ شاخص، بقیه هم‌اندازه
     d e f
   کمتر از شش کاشی (پس از فیلتر) → چیدمانِ آزاد: ستون‌های خالی جمع می‌شوند
   و کاشی‌های باقی‌مانده کلِ عرض را پر می‌کنند. */
.portfolio__grid {
  --row: clamp(200px, 18vw, 280px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: var(--row);
  gap: clamp(10px, 1.2vw, 18px);
}

.portfolio__grid[data-layout='bento'] {
  grid-template-rows: repeat(3, var(--row));
  grid-template-areas:
    'a a b'
    'a a c'
    'd e f';
}

.portfolio__grid[data-layout='free'] {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  grid-auto-rows: calc(var(--row) * 1.5);
}

.pf-tile[data-slot='a'] { grid-area: a; }
.pf-tile[data-slot='b'] { grid-area: b; }
.pf-tile[data-slot='c'] { grid-area: c; }
.pf-tile[data-slot='d'] { grid-area: d; }
.pf-tile[data-slot='e'] { grid-area: e; }
.pf-tile[data-slot='f'] { grid-area: f; }

.pf-tile.is-hidden {
  display: none;
}

/* متن روی تصویر است؛ سایه‌ی پایین پررنگ‌تر از گالری تا عنوان همیشه خوانا بماند */
.pf-tile::after {
  background: linear-gradient(to top, rgba(4, 9, 16, 0.94), rgba(4, 9, 16, 0.35) 55%, transparent 80%);
  opacity: 0.85;
}

.pf-tile__cat {
  position: absolute;
  z-index: 4;
  top: 12px;
  inset-inline-start: 12px;
  padding: 4px 10px;
  font-size: var(--fs-xs);
  color: var(--accent);
  background: rgba(4, 9, 16, 0.92);
  border: 1px solid var(--border-accent);
  border-radius: 999px;
}

/* شماره‌ی کاشی خودش ltr است، پس inset-inline-endاش هم به راست می‌رود و
   روی برچسبِ دسته می‌افتاد؛ این‌جا صریحاً به چپ */
.pf-tile .gal__idx {
  inset-inline-end: auto;
  left: 16px;
}

.pf-tile__body {
  position: absolute;
  z-index: 4;
  inset-inline: clamp(14px, 1.4vw, 22px);
  bottom: clamp(14px, 1.4vw, 20px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pf-tile__title {
  font-size: var(--fs-lg);
  color: var(--fg-100);
  text-shadow: 0 1px 12px rgba(2, 5, 10, 0.7);
}

.pf-tile[data-slot='a'] .pf-tile__title {
  font-size: var(--fs-xl);
}

.pf-tile__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--fg-300);
}

/* نتیجه‌ی پروژه در هاور باز می‌شود؛ روی لمس همیشه دیده می‌شود */
.pf-tile__result {
  max-height: 0;
  overflow: hidden;
  font-size: var(--fs-xs);
  line-height: 1.8;
  color: var(--fg-200);
  opacity: 0;
  transition:
    max-height var(--dur) var(--ease-out),
    opacity var(--dur) var(--ease-out);
}

.pf-tile:hover .pf-tile__result,
.pf-tile:focus-within .pf-tile__result {
  max-height: 5.4em;
  opacity: 1;
}

@media (hover: none) {
  .pf-tile__result {
    max-height: none;
    opacity: 1;
  }
}

/* ================================================================ چرا ما */
.why {
  background: var(--ink-900);
  overflow: hidden;
}

.why__inner {
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 5vw, 72px);
}

.why__top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(24px, 4vw, 56px);
  width: 100%;
}

.why__head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  text-align: right;
  align-items: stretch;
  direction: rtl;
  flex: 1 1 540px;
  max-width: 820px;
  width: 100%;
}

.why__head .section-kicker {
  text-align: right;
  align-self: flex-start;
}

.why__head .section__lead,
.why__lead {
  font-size: var(--fs-base, 1.05rem);
  line-height: 2;
  color: var(--text-muted);
  max-width: 100%;
  text-align: right;
  direction: rtl;
}

.why__lead--secondary {
  font-size: var(--fs-sm, 0.95rem);
  line-height: 2;
  color: rgba(243, 239, 232, 0.65);
  max-width: 100%;
  text-align: right;
  direction: rtl;
}

.why__quote {
  margin: clamp(6px, 1vw, 14px) 0 0;
  padding: 0;
  padding-inline-start: clamp(14px, 1.8vw, 22px);
  border-inline-start: 3px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: right;
  direction: rtl;
}

.why__quote-line {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.7;
  color: var(--accent-bright);
  text-align: right;
  direction: rtl;
}

.why__quote-line--dim {
  font-weight: 400;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: right;
  direction: rtl;
}

/* ---- انیمیشن ورود ملایم */
.js [data-why-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.js [data-why-reveal].is-in {
  opacity: 1;
  transform: translateY(0);
}

/* ---- انیمیشن خطی پهپاد (جایگزین کامل انیمیشن مغز) */
.why__drone {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  flex: 0 0 clamp(160px, 20vw, 240px);
  width: clamp(160px, 20vw, 240px);
  max-width: 240px;
}

.why__drone::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 163, 46, 0.16) 0%, rgba(240, 163, 46, 0.03) 45%, transparent 70%);
  pointer-events: none;
  animation: drone-pulse 4s ease-in-out infinite;
}

.why-drone-svg {
  width: 100%;
  height: auto;
  overflow: visible;
  display: block;
  filter: drop-shadow(0 0 10px rgba(240, 163, 46, 0.35));
  transition: transform var(--dur-slow) var(--ease-out),
              filter var(--dur-slow) var(--ease-out);
}

.why__drone:hover .why-drone-svg {
  filter: drop-shadow(0 0 18px rgba(246, 186, 88, 0.55));
}

.why-drone-ln {
  fill: none;
  stroke: var(--accent-bright, #ffd183);
  stroke-width: 5.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.why-drone-fl {
  fill: var(--ink-900, #050b14);
}

.why-drone-thin {
  stroke-width: 2.6;
}

.why-drone-blade {
  fill: none;
  stroke: var(--accent-bright, #ffd183);
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.why-drone-blade--ghost {
  stroke: var(--accent, #f0a32e);
  opacity: 0.35;
}

.why-drone-accent-dot {
  fill: var(--accent, #f0a32e);
  stroke: var(--accent-bright, #ffd183);
  stroke-width: 1.5;
}

@keyframes drone-pulse {
  0%, 100% {
    opacity: 0.45;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.85;
    transform: scale(1.04);
  }
}

.why__list {
  counter-reset: why;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 1.6vw, 22px);
}

/* ---- کارت شیشه‌ای */
.why__item {
  counter-increment: why;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: clamp(22px, 2.2vw, 32px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(16, 32, 46, 0.5), rgba(5, 11, 20, 0.7));
  overflow: hidden;
  isolation: isolate;
  transition:
    border-color var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out);
}

.why__item:hover {
  border-color: var(--border-accent);
  transform: translateY(-5px);
  box-shadow: 0 20px 50px -20px rgba(240, 163, 46, 0.12),
              0 4px 16px -8px rgba(0, 0, 0, 0.6);
}

/* خط نوری sweep — مثل اسکن */
.why__item::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 209, 131, 0.06) 44%,
    rgba(255, 209, 131, 0.1) 50%,
    rgba(255, 209, 131, 0.06) 56%,
    transparent 62%
  );
  transform: translateX(-120%);
  transition: none;
  pointer-events: none;
}

.why__item:hover::before {
  transform: translateX(120%);
  transition: transform 800ms var(--ease-out);
}

/* لبه‌ی طلایی بالا */
.why__item::after {
  content: '';
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 2px;
  background: linear-gradient(to left, transparent, var(--accent-500) 50%, transparent);
  opacity: 0;
  transform: scaleX(0);
  transition:
    opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.why__item:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

/* شمارنده‌ی طلایی */
.why__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-accent);
  background: rgba(240, 163, 46, 0.08);
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.1em;
  color: var(--accent);
  flex-shrink: 0;
  transition:
    background var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out);
}

.why__item:hover .why__badge {
  background: rgba(240, 163, 46, 0.16);
  box-shadow: 0 0 18px rgba(240, 163, 46, 0.3);
  color: var(--accent-bright);
}

.why__item-title {
  font-size: var(--fs-lg);
  margin-bottom: 4px;
  transition: color var(--dur) var(--ease-out);
}

.why__item:hover .why__item-title {
  color: var(--accent-bright);
}

.why__item-text {
  font-size: var(--fs-sm);
  color: var(--text-subtle);
  line-height: 1.9;
}

/* ---- انیمیشن ورود */
.js .why__item[data-reveal] {
  opacity: 0;
  transform: translateY(40px) scale(0.95);
  transition:
    opacity 800ms cubic-bezier(0.22, 0.85, 0.32, 1),
    transform 800ms cubic-bezier(0.22, 0.85, 0.32, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

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

/* تأخیر پلکانی — هر کارت با فاصله ظاهر می‌شود */
.why__item:nth-child(1) { --reveal-delay: 0ms; }
.why__item:nth-child(2) { --reveal-delay: 100ms; }
.why__item:nth-child(3) { --reveal-delay: 200ms; }
.why__item:nth-child(4) { --reveal-delay: 280ms; }
.why__item:nth-child(5) { --reveal-delay: 360ms; }
.why__item:nth-child(6) { --reveal-delay: 440ms; }

/* ========================================================== مجوزها */
.credentials {
  background: var(--ink-850);
  border-top: 1px solid var(--border);
}

.credentials__strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: clamp(14px, 2vw, 28px);
  perspective: 1200px;
}

.cert {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: clamp(12px, 1.2vw, 18px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(18, 37, 56, 0.4), rgba(8, 17, 28, 0.6));
  transition:
    border-color var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out),
    box-shadow var(--dur) var(--ease-out);
  transform-style: preserve-3d;
}

.cert:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-card);
  transform: translateY(-4px) rotateX(4deg) rotateY(-4deg) scale(1.02);
}

.cert__media {
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--ink-950);
}

.cert__media img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  opacity: 0.82;
  transition: opacity var(--dur) var(--ease-out);
}

.cert:hover .cert__media img {
  opacity: 1;
}

.cert__title {
  font-size: var(--fs-sm);
  font-weight: 500;
}

.cert__issuer {
  font-size: var(--fs-xs);
  color: var(--fg-500);
}

/* =========================================================== گالری */
.gallery {
  background: var(--ink-900);
}

/* ---------------------------------------------- سربرگ: دوربینِ خطی
   روایت از انیمیشنِ مرجع: خط → چرخش → بدنه → لنز و منظره‌یاب → فلاش.
   js/lib/shutter.js فقط is-built و is-snap را می‌گذارد. چیدمانِ سربرگ
   (.shot-label / .shot-rule) در بالای همین فایل است. */
.gcam {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  color: var(--accent-300);
  cursor: pointer;
  transition: opacity 240ms var(--ease-out), transform 250ms var(--ease-out), filter 250ms var(--ease-out);
  filter: drop-shadow(0 2px 10px rgba(240, 163, 46, 0.35));
  user-select: none;
  -webkit-user-select: none;
}

.gcam:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 16px rgba(240, 163, 46, 0.6));
}

.js .gcam:not(.is-built) {
  opacity: 0;
}

/* هاله‌ی فلاش پشتِ دوربین */
.gcam::before {
  content: '';
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  background: radial-gradient(circle at 69% 14%, rgba(255, 240, 200, 0.95) 0%, rgba(240, 163, 46, 0.5) 30%, transparent 65%);
  opacity: 0;
  pointer-events: none;
}

.gcam svg {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gcam svg * {
  transform-box: fill-box;
  transform-origin: center;
}

/* بدنه با خطوط تمیز و بدون شلوغی */
.gcam__body {
  vector-effect: non-scaling-stroke;
  stroke-width: 1.5px;
}

.gcam__strap,
.gcam__rays {
  stroke-dasharray: 1;
}

.gcam__glass {
  stroke-width: 1.2;
  opacity: 0.8;
}

.gcam__led {
  fill: currentColor;
  stroke: none;
}

.gcam__star {
  fill: #fff4dc;
  stroke: none;
  opacity: 0;
  transform-origin: 44px 9px;
  filter: drop-shadow(0 0 8px rgba(255, 209, 131, 0.9));
}

.gcam__rays {
  opacity: 0;
}

/* ---------------------------------------------------- ساختنِ ساده و شیک */
.gcam.is-built .gcam__body {
  animation: gcam-body 900ms cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

.gcam.is-built .gcam__strap {
  animation: gcam-draw 350ms var(--ease-out) 500ms both;
}

.gcam.is-built .gcam__lens {
  animation: gcam-pop 500ms cubic-bezier(0.34, 1.56, 0.64, 1) 550ms both;
}

.gcam.is-built .gcam__glass {
  animation: gcam-pop 450ms cubic-bezier(0.34, 1.56, 0.64, 1) 650ms both;
}

.gcam.is-built .gcam__led {
  animation: gcam-pop 350ms var(--ease-out) 700ms both;
}

.gcam.is-built .gcam__hump {
  animation: gcam-rise 380ms var(--ease-out) 550ms both;
}

.gcam.is-built .gcam__btn {
  animation: gcam-rise 350ms var(--ease-out) 620ms both;
}

/* ---------------------------------------------------- فلاش تمیز و بدون شلوغی */
.gcam.is-snap::before {
  animation: gcam-flash 700ms ease-out;
}

.gcam.is-snap .gcam__rig {
  animation: gcam-jolt 350ms var(--ease-out);
}

.gcam.is-snap .gcam__star {
  animation: gcam-star 600ms ease-out;
}

.gcam.is-snap .gcam__rays {
  animation: gcam-rays 500ms ease-out 40ms;
}

.gcam.is-built.is-snap .gcam__led {
  animation: gcam-led 500ms ease-out;
}

/* ======================================================== KEYFRAMES */

/* خط افقی تمیز باز می‌شود و با جهش ملایم به بدنه تبدیل می‌شود */
@keyframes gcam-body {
  0% {
    transform: scale(0.7, 0.04);
    opacity: 0.4;
  }
  40% {
    transform: scale(0.9, 0.25) rotate(-6deg);
    opacity: 0.9;
  }
  70% {
    transform: scale(1.04, 1.03) rotate(1.5deg);
    opacity: 1;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}

@keyframes gcam-draw {
  from {
    stroke-dashoffset: 1;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes gcam-pop {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  65% {
    opacity: 1;
    transform: scale(1.12);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes gcam-rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* شوک و لگد ظریف دوربین هنگام فلاش */
@keyframes gcam-jolt {
  0% {
    transform: scale(1);
  }
  20% {
    transform: scale(0.94);
  }
  55% {
    transform: scale(1.03);
  }
  100% {
    transform: scale(1);
  }
}

/* ستاره فلاش */
@keyframes gcam-star {
  0% {
    opacity: 0;
    transform: scale(0) rotate(-45deg);
  }
  30% {
    opacity: 1;
    transform: scale(1.35) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.3) rotate(45deg);
  }
}

/* پرتوهای نور فلاش */
@keyframes gcam-rays {
  0% {
    opacity: 0;
    stroke-dashoffset: 1;
  }
  30% {
    opacity: 1;
  }
  60% {
    opacity: 1;
    stroke-dashoffset: 0;
  }
  100% {
    opacity: 0;
    stroke-dashoffset: 0;
  }
}

/* چشمک فلاش ال‌ای‌دی */
@keyframes gcam-led {
  0%,
  100% {
    fill: currentColor;
  }
  25% {
    fill: #ffffff;
    filter: drop-shadow(0 0 10px #ffffff);
  }
}

/* فلاش نوری تمیز */
@keyframes gcam-flash {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  18% {
    opacity: 0.9;
    transform: scale(1.3);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

/* ------------------------------------------------------ کاشی‌ها
   چیدمانِ ثابت از روی جایگاه — ۱۲ خانه، بدون حفره:
     a a b c
     a a b d      a = بزرگ، b و d = ایستاده (تصاویرِ عمودی)
     e f g d
   ارتفاعِ ردیف‌ها یکی است و همه‌ی کاشی‌ها یک قاب و یک گردی دارند. */
.gallery__grid {
  --row: clamp(170px, 16vw, 250px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, var(--row));
  grid-auto-rows: var(--row);
  grid-template-areas:
    'a a b c'
    'a a b d'
    'e f g d';
  gap: clamp(10px, 1.2vw, 18px);
}

/* فقط در گالری — نمونه‌کارها هم .gal دارند ولی جایگاهشان از data-slot است */
.gallery__grid > .gal:nth-child(1) { grid-area: a; }
.gallery__grid > .gal:nth-child(2) { grid-area: b; }
.gallery__grid > .gal:nth-child(3) { grid-area: c; }
.gallery__grid > .gal:nth-child(4) { grid-area: d; }
.gallery__grid > .gal:nth-child(5) { grid-area: e; }
.gallery__grid > .gal:nth-child(6) { grid-area: f; }
.gallery__grid > .gal:nth-child(7) { grid-area: g; }

.gal {
  position: relative;
  margin: 0;              /* figure حاشیه‌ی پیش‌فرضِ ۴۰px دارد؛ کاشی را از خانه‌اش کوچک‌تر می‌کرد */
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--ink-800);
  transition: border-color var(--dur) var(--ease-out);
}

.gal:hover {
  border-color: var(--border-accent);
}

.gal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.34) brightness(0.55);
  /* transform مالِ پارالاکس است؛ بزرگ‌نماییِ هاور با scale جدا */
  transform: scale(1.1) translate3d(0, var(--par, 0px), 0);
  scale: 1;
  transition:
    filter var(--dur-slow) var(--ease-out),
    scale 1200ms var(--ease-out);
  will-change: transform;
}

.gal:hover img {
  filter: saturate(0.7) brightness(0.78);
  scale: 1.05;
}

/* سایه‌ی پایین برای خوانایی — کمی همیشه، کامل در هاور */
.gal::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(4, 9, 16, 0.88), transparent 50%);
  opacity: 0.5;
  transition: opacity var(--dur) var(--ease-out);
  pointer-events: none;
}

.gal:hover::after,
.gal:focus-within::after {
  opacity: 1;
}

/* نورِ طلاییِ زیرِ نشانگر */
.gal__light {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(
    340px circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 209, 131, 0.2),
    transparent 60%
  );
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity var(--dur) var(--ease-out);
  pointer-events: none;
}

.gal:hover .gal__light {
  opacity: 1;
}

/* گوشه‌های منظره‌یاب — همان زبانِ دوربینِ سربرگ */
.gal__frame {
  --c: rgba(255, 209, 131, 0.8);
  --l: 16px;
  position: absolute;
  inset: 16px;
  z-index: 3;
  background:
    linear-gradient(var(--c) 0 0) 0 0 / var(--l) 1.5px,
    linear-gradient(var(--c) 0 0) 0 0 / 1.5px var(--l),
    linear-gradient(var(--c) 0 0) 100% 0 / var(--l) 1.5px,
    linear-gradient(var(--c) 0 0) 100% 0 / 1.5px var(--l),
    linear-gradient(var(--c) 0 0) 0 100% / var(--l) 1.5px,
    linear-gradient(var(--c) 0 0) 0 100% / 1.5px var(--l),
    linear-gradient(var(--c) 0 0) 100% 100% / var(--l) 1.5px,
    linear-gradient(var(--c) 0 0) 100% 100% / 1.5px var(--l);
  background-repeat: no-repeat;
  opacity: 0;
  transition:
    inset 520ms var(--ease-out),
    opacity 380ms var(--ease-out);
  pointer-events: none;
}

.gal:hover .gal__frame,
.gal:focus-within .gal__frame {
  inset: 11px;
  opacity: 1;
}

.gal__idx {
  position: absolute;
  z-index: 4;
  top: 13px;
  inset-inline-end: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  direction: ltr;
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--fg-300);
  opacity: 0.75;
  transition:
    color var(--dur) var(--ease-out),
    opacity var(--dur) var(--ease-out);
}

.gal__idx::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-500);
  box-shadow: 0 0 6px rgba(240, 163, 46, 0.8);
}

.gal:hover .gal__idx {
  color: var(--accent-bright);
  opacity: 1;
}

.gal__caption {
  position: absolute;
  z-index: 4;
  inset-inline: 18px;
  bottom: 16px;
  font-size: var(--fs-xs);
  color: var(--fg-100);
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.gal:hover .gal__caption,
.gal:focus-within .gal__caption {
  opacity: 1;
  transform: none;
}

/* لمسی: هاور نیست، پس توضیح همیشه دیده شود */
@media (hover: none) {
  .gal__caption {
    opacity: 1;
    transform: none;
  }
}

/* لایه‌ی فلاش */
.gal::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  background: radial-gradient(
    circle at 50% 42%,
    rgba(255, 246, 228, 0.95),
    rgba(255, 209, 131, 0.5) 38%,
    rgba(240, 163, 46, 0) 74%
  );
  mix-blend-mode: screen;
  opacity: 0;
  pointer-events: none;
}

/* ----------------------------------------------- «نوردهی»: ورودِ کاشی
   مثلِ بدنه‌ی دوربین از یک خط باز می‌شود، فلاش می‌خورد و عکس از حالتِ
   سوخته به رنگِ نهایی ظاهر می‌شود. is-done پس از پایان گذاشته می‌شود تا
   فلاش‌های بعدی این انیمیشن را دوباره راه نیندازند. */
.gallery__grid.is-armed .gal:not(.is-exposed),
.portfolio__grid.is-armed .gal:not(.is-exposed) {
  opacity: 0;
}

/* مدت‌ها هم‌گام با EXPOSE_MS در js/lib/shutter.js (ظهور سریع و شارپ در ۶۰۰ms) */
.gal.is-exposed:not(.is-done) {
  animation: gal-open 420ms cubic-bezier(0.25, 0.8, 0.2, 1) var(--d, 0ms) backwards;
}

.gal.is-exposed:not(.is-done) img {
  animation: gal-develop 520ms var(--ease-out) var(--d, 0ms) backwards;
}

.gal.is-exposed:not(.is-done)::before {
  animation: gal-flash 380ms ease-out calc(var(--d, 0ms) + 40ms) backwards;
}

.gal.is-exposed:not(.is-done) .gal__frame {
  animation: gal-focus 450ms var(--ease-out) calc(var(--d, 0ms) + 120ms) backwards;
}

.gal.is-exposed:not(.is-done) .gal__idx {
  animation: gal-type 320ms steps(7, end) calc(var(--d, 0ms) + 160ms) backwards;
}

/* فلاشِ گاه‌به‌گاه روی کاشیِ ظاهرشده */
.gal.is-flash::before {
  animation: gal-flash-idle 900ms ease-out;
}

.gal.is-flash img {
  animation: gal-blink 900ms ease-out;
}

/* فیلتر (reshoot): کاشی به همان خطی برمی‌گردد که از آن باز شده بود.
   is-exposed در انتخابگر است تا بر انیمیشنِ ورودِ نیمه‌تمام غلبه کند.
   مدت هم‌گام با CLOSE_MS در js/lib/shutter.js */
.gal.is-exposed.is-closing {
  animation: gal-close 240ms cubic-bezier(0.5, 0, 0.75, 0) forwards;
  pointer-events: none;
}

@keyframes gal-close {
  from {
    clip-path: inset(0 0 0 0 round var(--radius));
  }
  to {
    opacity: 0.6;
    clip-path: inset(49.4% 8% 49.4% 8% round 2px);
  }
}

@keyframes gal-open {
  0% {
    opacity: 1;
    clip-path: inset(36% 4% 36% 4% round 4px);
    transform: rotate(-1.5deg) scale(0.97);
  }
  45% {
    clip-path: inset(14% 1% 14% 1% round 6px);
    transform: rotate(0.5deg) scale(0.99);
  }
  100% {
    opacity: 1;
    clip-path: inset(0 0 0 0 round var(--radius));
    transform: none;
  }
}

@keyframes gal-develop {
  0% {
    filter: saturate(0.18) brightness(1.6) contrast(0.85);
  }
  35% {
    filter: saturate(0.26) brightness(1.15) contrast(0.95);
  }
  100% {
    filter: saturate(0.34) brightness(0.55);
  }
}

@keyframes gal-flash {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

@keyframes gal-flash-idle {
  0% {
    opacity: 0;
  }
  14% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
  }
}

@keyframes gal-blink {
  0%,
  100% {
    filter: saturate(0.34) brightness(0.55);
  }
  14% {
    filter: saturate(0.1) brightness(1.45);
  }
}

@keyframes gal-focus {
  0% {
    opacity: 0;
    inset: 30px;
  }
  35% {
    opacity: 1;
    inset: 11px;
  }
  100% {
    opacity: 0;
    inset: 16px;
  }
}

@keyframes gal-type {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gcam *,
  .gcam::before,
  .gal,
  .gal *,
  .gal::before,
  .why__drone::before {
    animation: none !important;
  }
}

/* ========================================================= کاتالوگ */
.catalog {
  background: var(--ink-850);
  border-top: 1px solid var(--border);
}

.catalog__inner {
  display: grid;
  grid-template-columns: minmax(200px, 0.55fr) 1fr;
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}

.catalog__cover {
  position: relative;
  perspective: 1000px;
  max-width: 320px;
  justify-self: center;
}

.catalog__cover img {
  width: 100%;
  border-radius: 3px 8px 8px 3px;
  box-shadow: var(--shadow-lift);
  transform: rotateY(calc(var(--tilt-y, -12) * 1deg)) rotateX(calc(var(--tilt-x, 4) * 1deg));
  transition: transform var(--dur-slow) var(--ease-out);
}

.catalog__cover:hover img {
  transform: rotateY(-4deg) rotateX(2deg) scale(1.02);
}

/* عطف کتاب */
.catalog__spine {
  position: absolute;
  inset-block: 3%;
  inset-inline-end: 0;
  width: 10px;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.55), transparent);
  border-radius: 3px;
  pointer-events: none;
}

.catalog__body {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  align-items: flex-start;
}

.catalog__actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-2);
}

/* ========================================================== مقالات */
.articles {
  background: var(--ink-900);
}

.articles__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: clamp(18px, 2.4vw, 34px);
}

.art-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
  transition: border-color var(--dur) var(--ease-out);
}

.art-card:hover {
  border-bottom-color: var(--border-accent);
}

.art-card__media {
  overflow: hidden;
  border-radius: var(--radius);
  aspect-ratio: 16 / 10;
}

.art-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.36) brightness(0.56);
  transition:
    transform var(--dur-slow) var(--ease-out),
    filter var(--dur-slow) var(--ease-out);
}

.art-card:hover .art-card__media img {
  transform: scale(1.05);
  filter: saturate(0.6) brightness(0.7);
}

.art-card__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
}

.art-card__cat {
  color: var(--accent);
}

.art-card__date {
  color: var(--fg-500);
}

.art-card__title {
  font-size: var(--fs-lg);
  transition: color var(--dur-fast) var(--ease-out);
}

.art-card:hover .art-card__title {
  color: var(--accent-bright);
}

/* پیوند کششی: کل کارت با یک پیوندِ نام‌دار قابل کلیک می‌شود */
.art-card__title a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.art-card__title a:focus-visible::after {
  outline: 2px solid var(--accent-400);
  outline-offset: 4px;
}

.art-card__excerpt {
  font-size: var(--fs-sm);
  color: var(--text-subtle);
}
