/* ===== FONTS ===== */
@font-face {
  font-family: 'Alibaba';
  src: url('Alibaba-Regular.ttf') format('truetype');
  font-weight: 400;
}

@font-face {
  font-family: 'Alibaba';
  src: url('Alibaba-Light.ttf') format('truetype');
  font-weight: 300;
}

@font-face {
  font-family: 'Alibaba';
  src: url('Alibaba-Bold.ttf') format('truetype');
  font-weight: 700;
}

@font-face {
  font-family: 'Alibaba';
  src: url('Alibaba-Black.ttf') format('truetype');
  font-weight: 900;
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
}

:root {
  --bg: #111010;
  --bg-card: #1a1918;
  --bg-card2: #201f1e;
  --text-pri: #f0ede8;
  --text-sec: #8a857e;
  --text-hint: #4e4a46;
  --orange: #d4742a;
  --orange-dim: #9e4f18;
  --orange-glow: #ecb04e;
  --purple: #9662d4;
  --purple-dim: #5e31c8;
  --purple-soft: #c697ff;
  --border: rgba(255, 255, 255, 0.07);
  --border-mid: rgba(255, 255, 255, 0.12);
  --radius: 25px;
  --max-w: 430px;
  --fade-h: 100px;
  --top-offset: min(57vh, 520px);
}

html {
  scroll-behavior: smooth;
  touch-action: pan-x pan-y;
}

body {
  font-family: 'Alibaba', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-pri);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -ms-touch-action: pan-x pan-y;
  
}

img,
a {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

a,
a:focus,
a:active {
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

/* ===== MOBILE-FIRST CENTERING ===== */
body>* {
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* ===== BANNER ===== */

.banner {
  position: relative;
  width: 100%;
  max-width: var(--max-w);
}

.banner-img-layer {
  position: sticky;
  top: 0;
  width: 100%;
  height: min(100vh, 660px);
  overflow: hidden;
  z-index: 0;
  margin-bottom: calc(-1 * min(100vh, 660px));
  pointer-events: none;
}

.banner-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  will-change: transform, opacity;
  transform-origin: top center;
}

.banner-top-layer {
  position: relative;
  z-index: 10;
  margin-top: calc(var(--top-offset) - var(--fade-h) * 0.85);
}

.banner-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--fade-h);
  background: linear-gradient(to bottom,
      transparent 0%,
      rgba(17, 16, 16, 0.30) 28%,
      rgba(17, 16, 16, 0.72) 62%,
      var(--bg) 100%);
  pointer-events: none;
  z-index: 1;
}

.banner-content {
  margin-top: calc(-1 * var(--fade-h) * 0.30);
  padding: 0 24px 32px;
  position: relative;
  z-index: 2;
}

/* ===== NAME ===== */
.name-text {
  font-family: 'Alibaba', sans-serif;
  font-weight: 900;
  font-size: clamp(52px, 16vw, 72px);
  color: var(--text-pri);
  line-height: 1;
  margin-bottom: 28px;
  letter-spacing: -0.02em;
  direction: ltr;
  text-align: center !important;
  transition: opacity 0.4s ease;
  width: 100%;
}

/* ===== SOCIAL BUTTONS ===== */
.social-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  direction: ltr;
}

.social-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(7px) saturate(3);
  padding: 12px 8px;
  background: #1a1918ba;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-pri);
  text-decoration: none;
  font-size: 11px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
  user-select: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}


.social-btn:active {
  transform: scale(0.97);
}

.social-icon {
  width: 22px;
  height: 22px;
  color: var(--orange);
  flex-shrink: 0;
}

/* ===== MORE LINKS DROPDOWN ===== */
.more-links {
  background: #1a1918ba;
  backdrop-filter: blur(7px) saturate(3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.32s ease, opacity 0.22s ease;
  direction: rtl;
}

.more-links.open {
  max-height: 500px;
  opacity: 1;
}

.more-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  color: var(--text-pri);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.more-link-item:last-child {
  border-bottom: none;
}

.more-link-item:hover {
  background: var(--bg-card2);
}

.more-link-item svg {
  width: 18px;
  height: 18px;
  color: var(--purple);
  flex-shrink: 0;
}

/* ===== MAIN CONTENT ===== */
.main-content {
  padding: 0 24px;
  position: relative;
  z-index: 10;
  background: var(--bg);
}

/* ===== SECTIONS ===== */
.section {
  margin-bottom: 52px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 18px;
}

/* ===== BIO ===== */
.bio-text {
  font-size: 15px;
  color: var(--text-sec);
  font-weight: 300;
  line-height: 1.85;
  margin-bottom: 14px;
}

.bio-text:last-child {
  margin-bottom: 0;
}

/* ===== SKILLS ===== */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  direction: rtl;
}

.skill-tag {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-sec);
  font-weight: 400;
  transition: color 0.15s, border-color 0.15s;
}

.skill-tag:hover {
  color: var(--purple-soft);
  border-color: rgba(150, 98, 212, 0.4);
}

/* ===== PROJECTS ===== */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  direction: rtl;
  transition: border-color 0.2s;
}

.project-card:hover {
  border-color: var(--border-mid);
}

/*
 * تغییر ۲: انیمیشن کارت‌های پروژه
 *
 * مشکل قبلی: کارت‌ها با display:none/block کنترل می‌شدند.
 * display:none قابل transition نیست — به همین دلیل انیمیشن نداشت.
 *
 * راه‌حل جدید:
 * - hidden-card دیگر display:none نمی‌گذارد، بلکه با ترکیب
 *   max-height:0 + opacity:0 + overflow:hidden + margin-top منفی
 *   کارت را "پنهان" می‌کند و فضای آن را حذف می‌کند
 * - این روش کاملاً با CSS transition سازگار است
 * - JS هم دیگر style.display را دستکاری نمی‌کند
 *
 * چرا max-height به جای height؟
 * چون height:auto قابل transition نیست، اما max-height هست.
 * مقدار 600px بیش از حداکثر ارتفاع واقعی هر کارت است.
 */

/* حالت پنهان: کارت collapse شده و نامرئی است */
.project-card.hidden-card {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  /* margin-top منفی فضای gap بین کارت‌ها را هم حذف می‌کند */
  margin-top: calc(-1 * 16px);
  /* pointer-events:none تا کاربر روی کارت پنهان کلیک نکند */
  pointer-events: none;
  /* transition برای حالت پنهان شدن (hide) — کمی سریع‌تر */
  transition:
    max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.28s cubic-bezier(0.4, 0, 1, 1),
    margin-top 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

/* حالت نمایش: کارت باز می‌شود */
.project-card.hidden-card.reveal {
  max-height: 600px;
  opacity: 1;
  overflow: visible;
  margin-top: 0;
  pointer-events: auto;
  /* transition برای حالت نمایش (show) — کمی کندتر و نرم‌تر */
  transition:
    max-height 0.45s cubic-bezier(0.0, 0, 0.2, 1),
    opacity 0.35s cubic-bezier(0.0, 0, 0.2, 1) 0.05s,
    margin-top 0.45s cubic-bezier(0.0, 0, 0.2, 1);
}

/* ===== SHOW MORE DIVIDER ===== */
.show-more-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  cursor: pointer;
  color: var(--text-hint);
  font-size: 13px;
  font-weight: 400;
  direction: rtl;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: color 0.2s;
}

.show-more-divider:hover {
  color: var(--orange);
}

.show-more-divider::before,
.show-more-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-mid);
}

/* ===== PROJECT CARD INTERNALS ===== */
.project-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.project-logo-wrap {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-card2);
}

.project-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.project-logo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--orange-dim);
}

.project-meta {
  flex: 1;
  min-width: 0;
}

.project-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-pri);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-status {
  font-size: 11px;
  font-weight: 400;
  padding: 2px 8px;
  border-radius: 6px;
}

.status-active {
  color: #ecb04e;
  background: rgba(236, 176, 78, 0.1);
}

.status-done {
  color: #7ec97e;
  background: rgba(126, 201, 126, 0.1);
}

.status-paused {
  color: var(--text-hint);
  background: rgba(255, 255, 255, 0.04);
}

.project-desc {
  font-size: 14px;
  color: var(--text-sec);
  font-weight: 300;
  line-height: 1.75;
  margin-bottom: 16px;
}

.project-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  text-align: center;
  background: #232221;
  border: none;
  border-radius: 14px;
  color: var(--text-pri);
  font-size: 14px;
  font-weight: 700;
  font-family: 'Alibaba', sans-serif;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.project-btn:hover {
  background: rgba(212, 116, 42, 0.15);
  color: var(--orange-glow);
}

.project-btn-arrow {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.8;
}

/* ===== FOOTER ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px 100px;
  text-align: center;
  direction: rtl;
  position: relative;
  z-index: 10;
  background: var(--bg);
}

.footer-text {
  font-size: 13px;
  color: var(--text-hint);
  margin-bottom: 6px;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-hint);
  direction: ltr;
}

/* ===== SCROLL TO TOP ===== */
.scroll-top {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  width: 44px;
  height: 44px;
  background: var(--bg-card2);
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-pri);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 100;
  right: auto;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.scroll-top:hover {
  background: var(--bg-card);
  border-color: var(--orange-dim);
  color: var(--orange);
}

.scroll-top svg {
  width: 18px;
  height: 18px;
}

/* ===== NAME ANIMATION ===== */
.name-text.fade-out {
  opacity: 0;
}

/* ===== DESKTOP ===== */
@media (min-width: 431px) {
  .scroll-top {
    left: calc(50% - 7px);
  }
}
