@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --bg: #08080b;
  --bg-elevated: #101014;
  --card: #131316;
  --border: rgba(255, 255, 255, 0.10);
  --text: #f4f4f6;
  --text-muted: #a1a1aa;
  --accent: #ff5b2e;
  --accent-2: #ffa14a;
  --cursor-color: #ffffff;
  --cursor-ring: rgba(255, 91, 46, 0.55);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
  --bg: #f5f4f2;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --border: rgba(15, 15, 20, 0.10);
  --text: #15151a;
  --text-muted: #55555f;
  --accent: #e0491f;
  --accent-2: #ff8a3d;
  --cursor-color: #15151a;
  --cursor-ring: rgba(224, 73, 31, 0.45);
  --shadow: 0 20px 50px rgba(20, 20, 30, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  transition: background .35s ease, color .35s ease;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

/* رفع باگ کلاسیک CSS: آیتم‌های grid/flex به‌صورت پیش‌فرض min-width:auto دارن،
   یعنی اگه یه تیکه متن غیرقابل‌شکستن داشته باشن، کل باکس عریض‌تر از صفحه می‌شه.
   با صفر کردن min-width، مرورگر مجبور می‌شه متن رو داخل عرض واقعی نگه داره. */
* { min-width: 0; }

img, svg, spline-viewer, video, canvas { max-width: 100%; }

h1, h2, h3, p, a, span, div, .tag, .meta, li {
  overflow-wrap: anywhere;
}

html[dir="ltr"], html[dir="ltr"] body { font-family: 'Inter', 'Vazirmatn', 'Segoe UI', sans-serif; }

body { min-height: 100vh; cursor: none; }
a, button, input, textarea, [role="button"] { cursor: none; }

@media (pointer: coarse) {
  body, a, button, input, textarea { cursor: auto; }
  #smooth-cursor { display: none !important; }
}

/* ---------- Smooth custom cursor ---------- */
#smooth-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--cursor-color);
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  mix-blend-mode: difference;
  will-change: transform;
}
#smooth-cursor::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1.5px solid var(--cursor-ring);
  transition: opacity .2s ease, transform .2s ease;
}
#smooth-cursor.is-active { transform: translate(-50%, -50%) scale(1.4); }

/* ---------- Layout basics ---------- */
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.container-page { min-height: 100vh; display: flex; flex-direction: column; }

.top-controls {
  position: fixed;
  top: 18px;
  inset-inline-end: 18px;
  z-index: 50;
  display: flex;
  gap: 10px;
}

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease;
}
.icon-btn:hover { transform: translateY(-2px); border-color: var(--accent); }

/* ---------- Landing hero ---------- */
.hero-card {
  position: relative;
  width: 100%;
  height: min(78vh, 640px);
  border-radius: 22px;
  border: 1px solid var(--border);
  background: radial-gradient(1200px 600px at 20% -10%, rgba(255,91,46,.15), transparent 60%),
              var(--bg-elevated);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-inner { display: flex; height: 100%; flex-direction: row; }
html[dir="rtl"] .hero-inner { flex-direction: row-reverse; }

.hero-text {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  z-index: 2;
  position: relative;
}

.hero-text .eyebrow {
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: .04em;
  margin-bottom: 14px;
}

.hero-text h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.25;
  margin: 0 0 16px 0;
  background: linear-gradient(90deg, #fff, #b8b8c2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
html[data-theme="light"] .hero-text h1 {
  background: linear-gradient(90deg, #15151a, #4a4a55);
  -webkit-background-clip: text;
  background-clip: text;
}
.hero-text h1 strong { color: var(--accent); font-weight: 700; -webkit-text-fill-color: var(--accent); }

.hero-text p {
  color: var(--text-muted);
  max-width: 440px;
  font-size: 15px;
  line-height: 1.8;
}

.hero-visual {
  flex: 1;
  position: relative;
  min-width: 0;
}
.hero-visual spline-viewer {
  width: 100%;
  height: 100%;
  display: block;
}

.hero-spotlight {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 30%), rgba(255,255,255,.12), transparent 70%);
  mix-blend-mode: soft-light;
}

@media (max-width: 820px) {
  .hero-card { height: auto; }
  .hero-inner,
  html[dir="rtl"] .hero-inner,
  html[dir="ltr"] .hero-inner {
    flex-direction: column;
  }
  /* روی موبایل ربات بالا، متن پایین */
  .hero-visual { order: 1; flex: none; width: 100%; height: 280px; min-width: 0; }
  .hero-text { order: 2; flex: none; padding: 10px 22px 26px; text-align: center; }
  .hero-text p { max-width: 100%; margin-inline: auto; }
}

@media (max-width: 480px) {
  .hero-visual { height: 220px; }
  .hero-text { padding: 22px 16px 6px; }
}

/* ---------- Landing bottom buttons ---------- */
.landing-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin: 28px 0 60px;
  flex-wrap: wrap;
}

.pill-btn {
  padding: 14px 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: var(--shadow);
}
.pill-btn:hover { transform: translateY(-3px); border-color: var(--accent); }
.pill-btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; border: none; }

/* ---------- Resume page ---------- */
.resume-header {
  padding: 70px 0 30px;
  text-align: center;
}
.resume-header h1 { font-size: clamp(26px, 4vw, 38px); margin: 0 0 6px; }
.resume-header .subtitle { color: var(--accent); font-weight: 600; margin-bottom: 14px; }
.resume-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 14px;
}
/* LTR fields (phone, email) inside an RTL page must be isolated, or the
   bidi algorithm re-orders their space-separated groups on screen. */
.ltr-text {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.section {
  padding: 34px 0;
  border-top: 1px solid var(--border);
}
.section h2 {
  font-size: 20px;
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section h2::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--accent);
  display: inline-block;
}

.summary-text { color: var(--text-muted); line-height: 1.9; max-width: 760px; }

.skill-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 30px; }
.skill-group { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.skill-group h3 { margin: 0 0 10px; font-size: 14px; color: var(--text-muted); font-weight: 600; }
.skill-group .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--bg-elevated);
}

.card-list { display: grid; gap: 14px; }
.item-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
}
.item-card h3 { margin: 0 0 4px; font-size: 16px; }
.item-card .meta { color: var(--accent); font-size: 13px; margin-bottom: 6px; }
.item-card p { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.8; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Skills sphere ---------- */
.sphere-wrap {
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
  margin-bottom: 10px;
  overflow: hidden; /* keeps rotating tags from widening the page on narrow screens */
}
#skills-sphere {
  position: relative;
  width: 260px;
  height: 260px;
  transform-style: preserve-3d;
}
.sphere-tag {
  position: absolute;
  top: 50%; left: 50%;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  transform-style: preserve-3d;
  backface-visibility: visible;
  user-select: none;
}

@media (max-width: 480px) {
  .sphere-wrap { height: 280px; }
  #skills-sphere { width: 170px; height: 170px; }
  .sphere-tag { font-size: 11px; padding: 4px 9px; }
}

/* ---------- Contact / border-beam ---------- */
.contact-card {
  position: relative;
  border-radius: 18px;
  padding: 2px;
  overflow: hidden;
  background: var(--card);
}
@property --beam-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
.contact-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  padding: 2px;
  background: conic-gradient(from var(--beam-angle), transparent 0%, var(--accent) 12%, var(--accent-2) 20%, transparent 32%, transparent 100%);
  animation: beam-rotate 4.5s linear infinite;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
@keyframes beam-rotate {
  from { --beam-angle: 0deg; }
  to { --beam-angle: 360deg; }
}

.contact-inner {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  padding: 30px;
}

.contact-form { display: grid; gap: 16px; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-muted); }
.field-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .2s ease;
}
.field-input:focus { border-color: var(--accent); }
.field-textarea { resize: vertical; min-height: 90px; }

.submit-btn {
  justify-self: start;
  padding: 12px 28px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.success-msg {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(60, 200, 120, .12);
  border: 1px solid rgba(60, 200, 120, .35);
  color: #2fbf71;
  font-size: 14px;
}

.errorlist { color: #ff6b6b; font-size: 12px; margin: 2px 0 0; padding: 0; list-style: none; }

.footer-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 30px 0 50px;
}
.footer-note a { color: var(--accent); text-decoration: none; }
