/* ─── Reset ──────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ─── Custom Cursor ──────────────────────────────────── */
body.has-custom-cursor,
body.has-custom-cursor * {
  cursor: none !important;
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  will-change: transform;
}

.cursor__ring {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(200, 184, 160, 0.55);
  border-radius: 50%;
  top: -16px;
  left: -16px;
  transition: transform 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.cursor__dot {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--accent);
  border-radius: 50%;
  top: -1.5px;
  left: -1.5px;
}

/* 4 crosshair lines */
.cursor__line {
  position: absolute;
  background: rgba(200, 184, 160, 0.35);
}

.cursor__line--v {
  width: 1px;
  height: 7px;
  left: -0.5px;
}
.cursor__line--v.top    { top:  -20px; }
.cursor__line--v.bottom { top:   13px; }

.cursor__line--h {
  height: 1px;
  width: 7px;
  top: -0.5px;
}
.cursor__line--h.left  { left: -20px; }
.cursor__line--h.right { left:  13px; }

/* ── hover state (over links / buttons) */
body.cursor-hover .cursor__ring {
  transform: scale(1.55);
  border-color: rgba(200, 184, 160, 0.9);
}
body.cursor-hover .cursor__line {
  background: rgba(200, 184, 160, 0.6);
}

/* ── click state */
body.cursor-click .cursor__ring {
  transform: scale(0.6);
  border-color: rgba(200, 184, 160, 1);
  transition: transform 0.08s ease;
}

/* ── idle: fade out crosshair lines after a moment */
.cursor.is-idle .cursor__line {
  opacity: 0;
  transition: opacity 0.4s ease;
}
.cursor.is-idle .cursor__ring {
  border-color: rgba(200, 184, 160, 0.25);
}

/* ─── Tokens ─────────────────────────────────────────── */
:root {
  --bg:           #080808;
  --frame-border: rgba(255, 255, 255, 0.09);
  --grid-line:    rgba(255, 255, 255, 0.045);
  --text-bright:  #e2ddd6;
  --text-mid:     #6b6560;
  --text-dim:     #302d2a;
  --accent:       #c8b8a0;
  --font:         'Space Mono', 'Courier New', Courier, monospace;
  --font-display: 'Bebas Neue', Impact, sans-serif;
  --font-fa:      'Vazirmatn', Tahoma, sans-serif;
  --pad:          clamp(24px, 3.5vw, 48px);
  --grid-sz:      clamp(40px, 5vw, 72px);
}

html {
  color-scheme: dark;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text-bright);
  font-family: var(--font);
  height: 100%;
  min-height: 100svh;
  overflow: hidden;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ─── Noise Canvas ───────────────────────────────────── */
.noise-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
  opacity: 0.038;
  mix-blend-mode: screen;
}

/* ─── Grid ───────────────────────────────────────────── */
.grid-overlay {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-sz) var(--grid-sz);
  pointer-events: none;
  z-index: 0;
}

/* ─── Scanlines ──────────────────────────────────────── */
.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* ─── Page Frame ─────────────────────────────────────── */
.page-frame {
  position: relative;
  width: 100%;
  height: 100svh;
  border: 1px solid var(--frame-border);
  display: grid;
  grid-template-rows: 1fr auto;
  z-index: 10;
  outline: 1px solid transparent;
}

/* inner shadow vignette */
.page-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 120px 20px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 5;
}

/* ─── Corners ────────────────────────────────────────── */
.corner {
  position: absolute;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  color: var(--text-mid);
  z-index: 20;
  line-height: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.corner--tl { top: var(--pad); inset-inline-start: var(--pad); align-items: flex-start; }
.corner--tr { top: var(--pad); inset-inline-end: var(--pad);   align-items: flex-end; }
.corner--br { bottom: var(--pad); inset-inline-end: var(--pad); align-items: flex-end; }

.coord {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: var(--text-mid);
  opacity: 0.7;
}

.directory-label {
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--text-mid);
}

/* ─── Language Toggle ────────────────────────────────── */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-mid);
  font-family: var(--font);
  font-size: 0.5rem;
  letter-spacing: 0.2em;
  padding: 4px 8px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
  line-height: 1;
  margin-top: 2px;
}

.lang-toggle:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--text-bright);
}

.lang-toggle:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.4);
  outline-offset: 3px;
}

/* ─── RTL / FA Mode ──────────────────────────────────── */
/* Positions auto-flip via inset-inline-* + dir="rtl" on <html>.
   Only font and spacing overrides needed here.               */

[lang="fa"] .hero-title {
  font-family: var(--font-fa);
  font-size: clamp(1.6rem, 4.5vw, 3.5rem);
  letter-spacing: 0.04em;
}

[lang="fa"] .hero-title::before {
  font-family: var(--font-fa);
}

[lang="fa"] .hero-meta {
  font-family: var(--font-fa);
  letter-spacing: 0;
}

[lang="fa"] .meta-item {
  font-family: var(--font-fa);
}

[lang="fa"] .footer__line,
[lang="fa"] .footer__value {
  font-family: var(--font-fa);
  letter-spacing: 0;
}

[lang="fa"] .footer__label {
  font-family: var(--font-fa);
  letter-spacing: 0;
}

[lang="fa"] .btn-enter {
  font-family: var(--font-fa);
  letter-spacing: 0.05em;
}

[lang="fa"] .nav__link {
  font-family: var(--font-fa);
  letter-spacing: 0.05em;
}

[lang="fa"] .directory-label {
  font-family: var(--font-fa);
  letter-spacing: 0.1em;
}

/* ─── Navigation ─────────────────────────────────────── */
.nav {
  position: absolute;
  top: calc(var(--pad) + 28px);
  inset-inline-end: var(--pad);
  z-index: 20;
}

.nav__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.nav__link {
  display: inline-block;
  text-decoration: none;
  color: var(--text-mid);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  position: relative;
  padding: 2px 0;
  transition:
    color          230ms cubic-bezier(0.4, 0, 0.2, 1),
    opacity        230ms cubic-bezier(0.4, 0, 0.2, 1),
    letter-spacing 230ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: 0;
  inset-inline-end: 0;
  width: 0;
  height: 1px;
  background: var(--text-bright);
  transition: width 230ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav__link:hover,
.nav__link:focus-visible {
  color: var(--text-bright);
  letter-spacing: 0.36em;
  outline: none;
}

.nav__link:hover::after,
.nav__link:focus-visible::after {
  width: 100%;
}

/* ─── Hero ───────────────────────────────────────────── */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2vh, 22px);
  padding: var(--pad);
  z-index: 10;
}

/* ─── Profile ────────────────────────────────────────── */
.profile-wrapper {
  position: relative;
  width: clamp(180px, 24vw, 260px);
  height: clamp(180px, 24vw, 260px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-ring {
  position: absolute;
  inset: 0;
}

.ring-svg {
  width: 100%;
  height: 100%;
  animation: ring-spin 40s linear infinite;
  transform-origin: center;
}

.profile-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.frame-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--text-mid);
  border-style: solid;
  opacity: 0.5;
}

.frame-corner--tl { top: 0;  left: 0;  border-width: 1px 0 0 1px; }
.frame-corner--tr { top: 0;  right: 0; border-width: 1px 1px 0 0; }
.frame-corner--bl { bottom: 0; left: 0;  border-width: 0 0 1px 1px; }
.frame-corner--br { bottom: 0; right: 0; border-width: 0 1px 1px 0; }

.profile-circle {
  position: relative;
  width: clamp(140px, 18vw, 210px);
  height: clamp(140px, 18vw, 210px);
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: grayscale(100%) contrast(1.05) brightness(0.9);
  transition: filter 0.6s ease;
}

.profile-wrapper:hover .profile-img {
  filter: grayscale(60%) contrast(1.1) brightness(0.95);
}

.profile-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 40%, rgba(0,0,0,0.5) 100%);
  pointer-events: none;
}

/* Status dot */
.status-dot {
  position: absolute;
  bottom: 18px;
  right: 18px;
  width: 10px;
  height: 10px;
  z-index: 5;
}

.status-dot::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #4caf50;
  opacity: 0.9;
}

.status-dot__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(76, 175, 80, 0.4);
  animation: pulse-ring 2s ease-out infinite;
}

/* ─── Divider ────────────────────────────────────────── */
.hero-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  width: clamp(160px, 22vw, 280px);
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--text-mid), transparent);
  opacity: 0.5;
}

.divider-diamond {
  font-size: 0.4rem;
  color: var(--text-mid);
  opacity: 0.5;
  line-height: 1;
}

/* ─── Title ──────────────────────────────────────────── */
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.5vw, 4.2rem);
  font-weight: 400;
  letter-spacing: clamp(0.18em, 0.4vw, 0.32em);
  color: var(--text-bright);
  text-align: center;
  text-wrap: balance;
  line-height: 1;
  position: relative;
}

.hero-title::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--accent);
  clip-path: inset(0 100% 0 0);
  animation: title-reveal 1.0s cubic-bezier(0.77, 0, 0.175, 1) 0.2s forwards;
}

/* ─── Meta ───────────────────────────────────────────── */
.hero-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--text-mid);
  opacity: 0;
  animation: fade-up 0.8s ease 0.9s forwards;
}

.meta-sep {
  opacity: 0.35;
  font-size: 0.45rem;
}

.meta-heart {
  display: inline-block;
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1;
  animation: heartbeat 1.2s ease-in-out infinite;
  transform-origin: center;
}

@keyframes heartbeat {
  0%   { transform: scale(1); }
  14%  { transform: scale(1.35); }
  28%  { transform: scale(1); }
  42%  { transform: scale(1.25); }
  56%  { transform: scale(1); }
  100% { transform: scale(1); }
}

/* ─── Footer ─────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: var(--pad);
  padding-top: 0;
  z-index: 10;
}

.footer__line {
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  color: var(--text-mid);
  line-height: 1.8;
}

.footer__label {
  color: var(--text-bright);
  opacity: 0.75;
}

/* ─── Enter Button ───────────────────────────────────── */
.btn-enter {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 28px;
  background: #ffffff;
  border: 1px solid #ffffff;
  color: #080808;
  text-decoration: none;
  font-family: var(--font);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  position: relative;
  overflow: hidden;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  opacity: 0;
  animation: fade-up 0.8s ease 1.1s forwards;
}

.btn-enter:hover {
  background: #e2ddd6;
  border-color: #e2ddd6;
  color: #080808;
}

.btn-enter:active {
  background: #c8b8a0;
  border-color: #c8b8a0;
}

.btn-enter:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 4px;
}

/* scan shimmer on hover */
.btn-enter__scan {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.55),
    transparent
  );
  transition: left 0s;
}

.btn-enter:hover .btn-enter__scan {
  left: 160%;
  transition: left 0.5s ease;
}

.btn-enter__arrow {
  font-size: 1rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.22s ease;
}

.btn-enter:hover .btn-enter__arrow {
  transform: translate(2px, -2px);
}

/* ─── Animations ─────────────────────────────────────── */
@keyframes ring-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes pulse-ring {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(2.5); opacity: 0; }
}

@keyframes title-reveal {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0% 0 0); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes glitch {
  0%   { clip-path: inset(0 0 95% 0); transform: translate(-2px, 0); }
  10%  { clip-path: inset(30% 0 50% 0); transform: translate(2px, 0); }
  20%  { clip-path: inset(60% 0 20% 0); transform: translate(-1px, 0); }
  30%  { clip-path: inset(80% 0 5% 0);  transform: translate(1px, 0); }
  40%  { clip-path: inset(10% 0 75% 0); transform: translate(-2px, 0); }
  50%  { clip-path: inset(50% 0 30% 0); transform: translate(2px, 0); }
  60%  { clip-path: inset(5% 0 85% 0);  transform: translate(-1px, 0); }
  70%  { clip-path: inset(70% 0 15% 0); transform: translate(1px, 0); }
  80%  { clip-path: inset(25% 0 60% 0); transform: translate(-2px, 0); }
  90%  { clip-path: inset(90% 0 2% 0);  transform: translate(2px, 0); }
  100% { clip-path: inset(0 0 95% 0);   transform: translate(0, 0); }
}

/* ─── Reduced Motion ─────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ring-svg            { animation: none; }
  .status-dot__pulse   { animation: none; }
  .meta-heart          { animation: none; }
  .hero-title::before  { animation: none; clip-path: inset(0 0% 0 0); }
  .hero-meta           { animation: none; opacity: 1; }
  .btn-enter           { animation: none; opacity: 1; }
  .btn-enter__scan     { display: none; }
  .btn-enter__arrow,
  .profile-img,
  .nav__link,
  .btn-enter           { transition: none; }
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  body { overflow: auto; }

  .page-frame { height: auto; min-height: 100svh; }

  .nav {
    top: auto;
    bottom: auto;
    right: var(--pad);
    top: calc(var(--pad) + 22px);
  }

  .nav__link { font-size: 0.5rem; letter-spacing: 0.2em; }

  .hero-meta {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 12px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
}
