/*
  پوشه‌های شیشه‌ای صفحه‌ی نمونه‌کارها — همراه static/js/glass-folder.js.
  هندسه با px ثابت (۳۴۰×۲۷۲) نوشته شده و JS کل .gf-stage را scale می‌کند؛
  پس px این فایل «واحد پوشه» است نه پیکسل صفحه. برای همین left/right فیزیکی
  است نه منطقی: شکل پوشه در RTL قرینه نمی‌شود، فقط برچسب راست می‌نشیند.
*/

.gf-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-8) var(--space-12);
  align-items: end;
  justify-items: center;
  margin-block: var(--space-8) var(--space-16);
}

.gf-root {
  --gf-px: 0;
  --gf-py: 0;
  --gf-ease: cubic-bezier(.2, .8, .2, 1);
  --gf-spring: cubic-bezier(.34, 1.36, .5, 1);
  --gf-hinge: 0deg;
  --gf-lift: 42px;
  --gf-spread: 0px;
  --gf-fan: 0deg;
  --gf-stack: 15px;
  --gf-ink: var(--ink);
  --gf-ink-soft: rgba(15, 23, 32, .58);
  position: relative;
  width: min(340px, 100%);
  aspect-ratio: 340 / 326; /* تا JS ارتفاع را بدهد، جا رزرو است — CLS صفر */
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}
.gf-root:hover, .gf-root:focus-within { --gf-hinge: -11deg; --gf-lift: -34px; --gf-spread: 8px; --gf-fan: 1.4deg; --gf-stack: 10px; }
.gf-root[data-open] { --gf-hinge: -24deg; --gf-lift: -96px; --gf-spread: 40px; --gf-fan: 5deg; --gf-stack: 30px; }

.gf-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 340px;
  height: 272px;
  transform-origin: 0 0;
}
.gf-tilt {
  position: absolute;
  inset: 0;
  transform: perspective(1400px) rotateX(calc(var(--gf-py) * -3deg)) rotateY(calc(var(--gf-px) * 4deg));
  transition: transform .9s var(--gf-ease);
}

.gf-shadow {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -6px;
  height: 60px;
  border-radius: 40px;
  background: rgba(16, 18, 24, .34);
  filter: blur(22px);
  transform: translateX(calc(var(--gf-px) * -8px));
  transition: transform .9s var(--gf-ease), opacity .9s var(--gf-ease);
}

.gf-back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #f3f3f4 0%, #e3e3e6 100%);
}
.gf-art {
  position: absolute;
  left: -12px;
  top: -12px;
  width: 364px;
  height: 296px;
  max-width: none;
  opacity: 0;
  filter: blur(14px) saturate(.6);
  transform: translate(calc(var(--gf-px) * -7px), calc(var(--gf-py) * -6px)) scale(1.02);
  transition: transform 1.1s var(--gf-ease), opacity 1.2s var(--gf-ease), filter 1.2s var(--gf-ease);
}
.gf-art[data-ready] { opacity: 1; filter: none; }
.gf-back-sheen {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 22%),
    radial-gradient(120% 80% at 80% 0%, rgba(255, 255, 255, .16), rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}

.gf-rim {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  overflow: visible;
  pointer-events: none;
  fill: none;
}
.gf-back-rim { width: 340px; height: 272px; }
.gf-back-rim path { stroke: rgba(255, 255, 255, .45); stroke-width: 1; }

/* ---- برگه‌ها ---------------------------------------------------------------- */
.gf-files {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  /* هیچ‌چیز از ته جیب بیرون نمی‌زند، هرقدر هم دسته بلند باشد */
  clip-path: inset(-400px -400px 10px -400px);
}
.gf-sheet-slot { display: contents; }
.gf-sheet {
  all: unset;
  box-sizing: border-box;
  position: absolute;
  left: 34px;
  top: 96px;
  width: 272px;
  height: 184px;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  pointer-events: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f2f2f0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .9),
    0 0 0 .5px rgba(0, 0, 0, .1),
    0 10px 26px -8px rgba(10, 12, 20, .28);
  transform-origin: 50% 100%;
  transform:
    translate(calc(var(--gf-jx, 0px) + var(--gf-slot, 0) * var(--gf-spread)), calc(var(--gf-lift) + var(--gf-depth, 0) * var(--gf-stack) * -1))
    rotate(calc(var(--gf-jr, 0deg) + var(--gf-slot, 0) * var(--gf-fan)));
  transition:
    transform .75s var(--gf-spring) calc(var(--gf-depth, 0) * 40ms),
    box-shadow .4s var(--gf-ease),
    translate .9s var(--gf-ease),
    opacity .9s var(--gf-ease);
}
.gf-sheet--empty { cursor: default; }
.gf-sheet--art { background: #1a1a1d; }
.gf-root[data-open] a.gf-sheet:hover,
.gf-root[data-open] a.gf-sheet:focus-visible {
  transform:
    translate(calc(var(--gf-jx, 0px) + var(--gf-slot, 0) * var(--gf-spread)), calc(var(--gf-lift) + var(--gf-depth, 0) * var(--gf-stack) * -1 - 18px))
    rotate(calc(var(--gf-slot, 0) * var(--gf-fan) * .6));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), 0 0 0 .5px rgba(0, 0, 0, .1), 0 22px 40px -12px rgba(10, 12, 20, .42);
  transition-delay: 0s;
}
.gf-sheet:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gf-sheet-art,
.gf-sheet-art picture,
.gf-sheet-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gf-sheet--art::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, 0) 38%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2);
  pointer-events: none;
}
.gf-sheet-head {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 11px;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  white-space: nowrap;
}
.gf-sheet-name {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 500;
  color: #18181b;
}
.gf-sheet-meta {
  flex: none;
  font-size: 11px;
  color: rgba(24, 24, 27, .5);
}
.gf-sheet--art .gf-sheet-name { color: #fafafa; }
.gf-sheet--art .gf-sheet-meta { color: rgba(250, 250, 250, .72); }
.gf-lines {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 40px;
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* خط‌های متن از راست شروع می‌شوند */
  gap: 9px;
}
.gf-lines i {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: rgba(24, 24, 27, .08);
}
.gf-lines i:nth-child(1) { width: 86%; height: 9px; margin-bottom: 4px; background: rgba(24, 24, 27, .14); }
.gf-lines i:nth-child(2) { width: 92%; }
.gf-lines i:nth-child(3) { width: 64%; }
.gf-lines i:nth-child(4) { width: 88%; }
.gf-lines i:nth-child(5) { width: 42%; }

/* ---- شیشه‌ی جلو --------------------------------------------------------------- */
.gf-front {
  position: absolute;
  left: 0;
  top: 74px;
  width: 340px;
  height: 198px;
  z-index: 10;
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  backdrop-filter: blur(22px) saturate(1.5);
  transform-origin: 50% 100%;
  transform: perspective(760px) rotateX(var(--gf-hinge));
  transition: transform .8s var(--gf-spring), translate 1s var(--gf-ease), opacity 1s var(--gf-ease);
}
.gf-tint {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .16) 0%, rgba(255, 255, 255, .5) 42%, rgba(252, 252, 252, .93) 100%);
}
.gf-spec {
  position: absolute;
  inset: 0;
  background: radial-gradient(260px 200px at calc(50% + var(--gf-px) * 46%) calc(30% + var(--gf-py) * 40%), rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 70%);
  mix-blend-mode: soft-light;
  opacity: .9;
  pointer-events: none;
}
.gf-front-rim { width: 340px; height: 198px; }
.gf-front-rim path { stroke-width: 2.4; transition: stroke-width .3s var(--gf-ease); }

.gf-hit {
  all: unset;
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: pointer;
}
.gf-hit:focus-visible ~ .gf-label .gf-title { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 6px; }
.gf-front:has(.gf-hit:focus-visible) .gf-front-rim path { stroke-width: 5; }

.gf-label {
  position: absolute;
  right: 28px;
  bottom: 30px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 220px;
  pointer-events: none;
  color: var(--gf-ink);
}
.gf-title {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gf-meta {
  font-size: 13px;
  color: var(--gf-ink-soft);
  white-space: nowrap;
}

/* ---- کلید «همه‌ی نمونه‌کارهای این پوشه» ---------------------------------------- */
.gf-key {
  box-sizing: border-box;
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 12;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  background: radial-gradient(120% 90% at 50% 0%, #3a3a3f 0%, #121214 55%, #050506 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .22),
    inset 0 -3px 8px rgba(0, 0, 0, .7),
    0 0 0 1px rgba(0, 0, 0, .75),
    0 14px 22px -8px rgba(0, 0, 0, .55),
    0 3px 6px -2px rgba(0, 0, 0, .35);
  transition: transform .35s var(--gf-spring), background .35s var(--gf-ease), opacity .6s var(--gf-ease) .7s, scale .7s var(--gf-spring) .7s;
}
.gf-key:hover { transform: translateY(-2px); background: radial-gradient(120% 90% at 50% 0%, #e0602f 0%, var(--accent) 60%, #8f2e10 100%); }
.gf-key:active { transform: scale(.93); transition-duration: .12s; }
.gf-key:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.gf-glyph { width: 24px; height: 24px; transform: scaleX(-1); } /* فلش به سمت چپ در RTL */

/* ---- ورود: پوشه خودش را سر هم می‌کند ------------------------------------------- */
/* فقط وقتی JS هست؛ بدون JS پوشه‌ها همان اول کامل دیده می‌شوند */
html.js .gf-root:not([data-entered]) .gf-back,
html.js .gf-root:not([data-entered]) .gf-back-rim { translate: 0 22px; opacity: 0; }
html.js .gf-root:not([data-entered]) .gf-sheet { translate: 0 -120px; opacity: 0; }
html.js .gf-root:not([data-entered]) .gf-front { translate: 0 46px; opacity: 0; }
html.js .gf-root:not([data-entered]) .gf-key { opacity: 0; scale: .6; }
html.js .gf-root:not([data-entered]) .gf-shadow { opacity: 0; }
.gf-back, .gf-back-rim { transition: translate 1s var(--gf-ease), opacity .9s var(--gf-ease); }
.gf-root[data-entered] .gf-sheet { transition-delay: calc(var(--gf-depth, 0) * 40ms), 0s, calc(.18s + var(--gf-depth, 0) * 90ms), calc(.18s + var(--gf-depth, 0) * 90ms); }
.gf-root[data-entered] .gf-front { transition-delay: 0s, .42s, .42s; }

@media (prefers-reduced-motion: reduce) {
  .gf-root *, .gf-root *::before, .gf-root *::after {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    animation: none !important;
  }
  .gf-tilt { transform: none; }
}
