/* ═══════════════════ Font ═══════════════════ */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #05060f;
  --fg: #eef0ff;
  --fg-dim: rgba(238, 240, 255, .45);
  --accent: #ff4d5a;
  --line: rgba(238, 240, 255, .12);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { cursor: none; }
@media (pointer: coarse) { body { cursor: auto; } }
.is-touch button, .is-touch a, .is-touch .nav-link { cursor: pointer; }

::selection { background: var(--accent); color: #fff; }

/* ═══════════════════ Canvas ═══════════════════ */
#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ═══════════════════ Visual effects ═══════════════════ */
.vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 5, .55) 100%);
}

.grain {
  position: fixed; inset: -100px;
  pointer-events: none;
  z-index: 4;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  animation: grain 8s steps(10) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-30px, 20px); }
  40% { transform: translate(20px, -35px); }
  60% { transform: translate(-25px, -20px); }
  80% { transform: translate(30px, 25px); }
}

/* ═══════════════════ Loader ═══════════════════ */
#loader {
  position: fixed; inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .9s var(--ease), visibility .9s;
}
#loader.done { opacity: 0; visibility: hidden; }

.loader-inner { text-align: center; }

.loader-logo {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 4px;
  direction: ltr;
}
.loader-logo span { color: var(--accent); }

.loader-count {
  font-size: 84px;
  font-weight: 100;
  line-height: 1.2;
  margin: 18px 0 8px;
  font-variant-numeric: tabular-nums;
}

.loader-bar {
  width: 220px;
  height: 2px;
  margin: 0 auto 20px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .2s linear;
}

.loader-tag {
  font-size: 13px;
  color: var(--fg-dim);
  letter-spacing: 1px;
}

/* ═══════════════════ Header ═══════════════════ */
.header {
  position: fixed;
  top: 0; right: 0; left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 44px;
  opacity: 0;
  transform: translateY(-16px);
  transition: opacity 1s var(--ease) .3s, transform 1s var(--ease) .3s;
}
.is-ready .header { opacity: 1; transform: none; }

.logo {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 3px;
  color: var(--fg);
  text-decoration: none;
  direction: ltr;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.logo span { color: var(--accent); }
.logo em {
  font-style: normal;
  font-weight: 300;
  font-size: 12px;
  letter-spacing: 5px;
  color: var(--fg-dim);
  text-transform: uppercase;
}

.nav { display: flex; gap: 8px; }

.nav-link {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-dim);
  background: none;
  border: 1px solid transparent;
  border-radius: 99px;
  padding: 9px 18px;
  cursor: none;
  transition: color .3s, border-color .3s, background .3s;
}
.nav-link:hover { color: var(--fg); }
.nav-link.is-active {
  color: var(--fg);
  border-color: var(--line);
  background: rgba(238, 240, 255, .05);
}

/* ═══════════════════ Current project title ═══════════════════ */
.current-project {
  position: fixed;
  right: 44px;
  bottom: 48px;
  z-index: 15;
  display: flex;
  align-items: flex-end;
  gap: 20px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .9s var(--ease) .5s, transform .9s var(--ease) .5s;
  pointer-events: none;
}
.is-ready .current-project { opacity: 1; transform: none; }
.is-focused .current-project, .is-ended .current-project { opacity: 0; }

.cp-index {
  font-size: 64px;
  font-weight: 100;
  line-height: .9;
  color: transparent;
  -webkit-text-stroke: 1px rgba(238, 240, 255, .35);
}

.cp-category {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 6px;
}

.cp-title {
  font-size: clamp(22px, 3.2vw, 40px);
  font-weight: 800;
  line-height: 1.25;
  transition: opacity .3s;
}

/* ═══════════════════ Progress indicator ═══════════════════ */
.progress {
  position: fixed;
  left: 44px;
  bottom: 56px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 14px;
  direction: ltr;
  opacity: 0;
  transition: opacity .9s var(--ease) .6s;
}
.is-ready .progress { opacity: 1; }
.is-focused .progress { opacity: 0; }

.progress-num {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.progress-num.dim { color: var(--fg-dim); }

.progress-track {
  width: 120px;
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
}

/* ═══════════════════ Dot navigation ═══════════════════ */
.dots {
  position: fixed;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  transition: opacity .9s var(--ease) .7s;
}
.is-ready .dots { opacity: 1; }
.is-focused .dots { opacity: 0; pointer-events: none; }

.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(238, 240, 255, .35);
  background: transparent;
  cursor: none;
  padding: 0;
  transition: background .3s, border-color .3s, transform .3s;
}
.dot:hover { border-color: var(--fg); transform: scale(1.3); }
.dot.is-active {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.2);
}

/* ═══════════════════ Scroll hint ═══════════════════ */
.scroll-hint {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--fg-dim);
  opacity: 0;
  transition: opacity .8s var(--ease) 1.2s;
  pointer-events: none;
}
.is-ready .scroll-hint { opacity: 1; }
.is-ready.has-scrolled .scroll-hint { opacity: 0; transition-delay: 0s; }

.mouse {
  width: 22px; height: 34px;
  border: 1.5px solid rgba(238, 240, 255, .4);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}
.wheel {
  width: 3px; height: 7px;
  border-radius: 3px;
  background: var(--accent);
  animation: wheel 1.6s ease-in-out infinite;
}
@keyframes wheel {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ═══════════════════ Detail panel ═══════════════════ */
.detail {
  position: fixed;
  top: 0; bottom: 0; right: 0;
  width: min(480px, 92vw);
  z-index: 30;
  background: linear-gradient(210deg, rgba(13, 16, 38, .92), rgba(5, 6, 15, .96));
  backdrop-filter: blur(18px);
  border-left: 1px solid var(--line);
  transform: translateX(105%);
  transition: transform .8s var(--ease);
  display: flex;
  align-items: center;
}
.is-focused .detail { transform: translateX(0); }

.detail-body { padding: 60px 52px; width: 100%; }

.detail-close {
  position: absolute;
  top: 26px;
  left: 26px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(238, 240, 255, .04);
  color: var(--fg);
  font-size: 15px;
  cursor: none;
  transition: background .3s, transform .3s;
}
.detail-close:hover { background: var(--accent); transform: rotate(90deg); }

.detail-chip, .modal-chip {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 99px;
  padding: 6px 14px;
  margin-bottom: 20px;
}

.detail-title {
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 6px;
}

.detail-year {
  font-size: 13px;
  color: var(--fg-dim);
  margin-bottom: 22px;
}

.detail-desc {
  font-size: 15px;
  line-height: 2.1;
  color: rgba(238, 240, 255, .75);
  margin-bottom: 26px;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 34px;
}
.detail-tags span {
  font-size: 12px;
  color: var(--fg-dim);
  background: rgba(238, 240, 255, .06);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  direction: ltr;
}

.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  background: var(--accent);
  border-radius: 99px;
  padding: 14px 28px;
  cursor: none;
  transition: transform .3s var(--ease), box-shadow .3s;
}
.detail-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 45%, transparent);
}

/* ═══════════════════ Ending call to action ═══════════════════ */
.cta {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .7s var(--ease);
}
.is-ended .cta { opacity: 1; pointer-events: auto; }

.cta-small {
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--fg-dim);
  margin-bottom: 14px;
}

.cta-title {
  font-size: clamp(38px, 7vw, 84px);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 34px;
}
.cta-title span { color: var(--accent); }

.cta-btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 99px;
  padding: 18px 46px;
  cursor: none;
  transition: transform .3s var(--ease), box-shadow .3s;
}
.cta-btn:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 18px 50px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* ═══════════════════ Modal ═══════════════════ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(3, 4, 10, .6);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s var(--ease), visibility .5s;
}
.modal.is-open { opacity: 1; visibility: visible; }

.modal-card {
  position: relative;
  width: min(560px, 92vw);
  background: linear-gradient(210deg, rgba(16, 20, 46, .95), rgba(7, 8, 20, .98));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 48px 44px;
  transform: translateY(30px) scale(.96);
  transition: transform .5s var(--ease);
}
.modal.is-open .modal-card { transform: none; }

.modal-close {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: none;
  color: var(--fg);
  font-size: 14px;
  cursor: none;
  transition: background .3s, transform .3s;
}
.modal-close:hover { background: var(--accent); transform: rotate(90deg); }

.modal-card h3 {
  font-size: 26px;
  font-weight: 900;
  margin-bottom: 16px;
}

.modal-card p {
  font-size: 15px;
  line-height: 2.1;
  color: rgba(238, 240, 255, .72);
}

.modal-stats {
  display: flex;
  gap: 16px;
  margin-top: 30px;
}
.modal-stats > div {
  flex: 1;
  text-align: center;
  background: rgba(238, 240, 255, .04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 10px;
}
.modal-stats b {
  display: block;
  font-size: 26px;
  font-weight: 900;
  color: var(--accent);
}
.modal-stats span { font-size: 12px; color: var(--fg-dim); }

.contact-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}
.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  background: rgba(238, 240, 255, .04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
  cursor: none;
  transition: border-color .3s, background .3s, transform .3s;
}
.contact-row:hover {
  border-color: var(--accent);
  background: rgba(255, 77, 90, .07);
  transform: translateX(-4px);
}
.contact-label { font-size: 14px; font-weight: 700; color: var(--fg); }
.contact-value { font-size: 13px; color: var(--fg-dim); }

/* ═══════════════════ Music button ═══════════════════ */
.music-btn {
  position: fixed;
  left: 32px;
  bottom: 132px;
  z-index: 25;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(238, 240, 255, .05);
  backdrop-filter: blur(8px);
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .8s var(--ease) .8s, transform .8s var(--ease) .8s,
              background .3s, border-color .3s, color .3s;
}
.is-ready .music-btn { opacity: 1; transform: none; }
.is-focused .music-btn { opacity: 0; pointer-events: none; }

.music-btn:hover {
  border-color: var(--accent);
  color: var(--fg);
  background: rgba(255, 77, 90, .08);
}

.music-bars {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.music-bars i {
  display: block;
  width: 3px;
  height: 6px;
  border-radius: 2px;
  background: var(--accent);
  animation: musicBar 0.9s ease-in-out infinite;
}
.music-bars i:nth-child(2) { animation-delay: .2s; }
.music-bars i:nth-child(3) { animation-delay: .4s; }
@keyframes musicBar {
  0%, 100% { height: 5px; }
  50% { height: 15px; }
}

.music-btn.is-playing .music-icon-on { opacity: 0; }
.music-btn.is-playing .music-bars { display: flex; }
.music-btn.is-playing { border-color: var(--accent); color: var(--fg); }

@media (max-width: 720px) {
  .music-btn { left: 20px; bottom: auto; top: 84px; width: 40px; height: 40px; }
}

/* ═══════════════════ Custom cursor ═══════════════════ */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 90;
  pointer-events: none;
  border-radius: 50%;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  box-shadow: 0 0 12px 2px var(--accent);
  transform: translate(-50%, -50%);
  transition: box-shadow .3s;
}
.cursor-ring {
  width: 38px; height: 38px;
  border: 1.5px solid rgba(238, 240, 255, .35);
  transform: translate(-50%, -50%);
  transition: width .3s var(--ease), height .3s var(--ease), border-color .3s, background .3s, box-shadow .3s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cursor-ring.is-hover {
  width: 74px; height: 74px;
  border-color: var(--accent);
  background: rgba(255, 77, 90, .1);
  box-shadow: 0 0 30px 4px color-mix(in srgb, var(--accent) 45%, transparent);
}
.cursor-ring span {
  font-size: 10px;
  letter-spacing: 1px;
  color: #fff;
  opacity: 0;
  transition: opacity .3s;
}
.cursor-ring.is-hover span { opacity: 1; }
@media (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}
.is-touch .cursor-dot, .is-touch .cursor-ring { display: none !important; }
.is-touch, .is-touch body { cursor: auto; }

/* ═══════════════════ Mobile ═══════════════════ */
@media (max-width: 720px) {
  .header { padding: 20px 20px; }
  .logo em { display: none; }
  .nav-link { padding: 8px 12px; font-size: 13px; }
  .current-project { right: 20px; bottom: 90px; gap: 12px; }
  .cp-index { font-size: 44px; }
  .progress { left: 20px; bottom: 40px; }
  .progress-track { width: 70px; }
  .dots { display: none; }
  .detail-body { padding: 80px 30px 40px; }
  .modal-card { padding: 40px 26px; }
  .modal-stats { flex-direction: row; gap: 8px; }
}
