/* =========================================================
   RESET & GLOBAL
========================================================= */

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

html {
  scroll-behavior: smooth;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

body {
  min-height: 100vh;
  overflow-x: hidden;

  font-family: "Estedad", sans-serif;
  color: var(--text);
  background: var(--bg);

  transition:
    background 0.3s ease,
    color 0.3s ease;
}

/* =========================================================
   HIDE ALL SCROLLBARS
========================================================= */

* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* =========================================================
   GLOBAL ELEMENTS
========================================================= */

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}

a,
button,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* =========================================================
   REAL PAGE LOADER
========================================================= */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

.page-loader {
  position: absolute;

  /*
    دقیقاً زیر Header قرار می‌گیرد
  */
  inset-inline-start: 0;
  bottom: -2px;

  width: 0;
  height: 3px;

  background: var(--accent);

  z-index: 1001;

  opacity: 0;

  pointer-events: none;

  /*
    برای تغییرات کوچک نرم باشد،
    ولی سرعت توسط JS کنترل می‌شود.
  */
  transition:
    width 0.2s ease-out,
    opacity 0.2s ease;
  
  box-shadow:
    0 0 8px var(--accent),
    0 0 16px var(--accent);
}

.page-loader.loading {
  opacity: 1;
}

.page-loader.finished {
  width: 100% !important;
  opacity: 0;

  transition:
    width 0.15s ease-out,
    opacity 0.35s ease 0.15s;
}

/* =========================================================
   HEADER
========================================================= */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;

  height: 80px;
  padding-inline: 2rem;

  display: flex;
  align-items: center;
  justify-content: center;

  background: var(--header-bg);

  border-bottom: 1px solid var(--border);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  transition:
    background 0.3s ease,
    border-color 0.3s ease;
}

.logo {
  position: absolute;
  inset-inline-start: 2rem;

  color: var(--text);

  font-size: 1.2rem;
  font-weight: 800;

  user-select: none;
}

.controls {
  position: absolute;
  inset-inline-end: 2rem;

  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* =========================================================
   NAVIGATION
========================================================= */

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a {
  color: var(--text);

  transition:
    opacity 0.25s ease,
    color 0.25s ease;
}

/* =========================================================
   BUTTONS
========================================================= */

#language-btn,
#theme-btn,
#mobile-menu-btn {
  padding: 8px 14px;

  border: 1px solid var(--border);
  border-radius: 999px;

  color: var(--text);
  background: transparent;

  transition:
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

/* =========================================================
   HERO
========================================================= */

.hero {
  position: relative;

  min-height: calc(100vh - 80px);

  padding: 2rem;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.hero-bg {
  position: absolute;

  width: 700px;
  height: 700px;

  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);

  filter: blur(60px);

  pointer-events: none;

  animation:
    heroFloat 8s ease-in-out infinite,
    heroGlow 6s ease-in-out infinite alternate;
}

@keyframes heroFloat {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-30px) scale(1.04);
  }
}

@keyframes heroGlow {
  0% {
    opacity: 0.65;
  }

  100% {
    opacity: 1;
  }
}

.hero-content {
  position: relative;
  z-index: 2;

  width: 100%;
  max-width: 1100px;

  text-align: center;
}

/* =========================================================
   HERO TITLE
========================================================= */

.hero-title {
  margin-bottom: 1rem;

  font-size: clamp(2.8rem, 7vw, 6rem);
  font-weight: 900;
  line-height: 1.1;

  background: linear-gradient(90deg, var(--text), var(--accent));

  -webkit-background-clip: text;
  background-clip: text;

  -webkit-text-fill-color: transparent;

  animation: heroTitleIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes heroTitleIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   HERO TAGS
========================================================= */

.hero-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;

  gap: 0.75rem;

  margin-bottom: 2rem;

  color: var(--secondary);

  font-weight: 500;

  animation: heroFadeIn 0.8s 0.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-tags span:nth-child(even) {
  color: var(--accent);
}

@keyframes heroFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   ABOUT CARD
========================================================= */

.about-card {
  width: 100%;
  max-width: 760px;

  margin: 0 auto 2rem;
  padding: 1.5rem;

  border: 1px solid var(--border);
  border-radius: 24px;

  background: var(--card);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  text-align: start;

  animation: aboutCardIn 0.8s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;

  transition:
    border-color 0.3s ease,
    background 0.3s ease;
}

@keyframes aboutCardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =========================================================
   HERO DESCRIPTION
========================================================= */

.hero-description {
  position: relative;

  /*
    این ارتفاع فقط حالت بسته است.
    مقدار واقعی را JS هنگام باز شدن محاسبه می‌کند.
  */
  max-height: 120px;

  overflow: hidden;

  color: var(--secondary);

  font-size: 1.05rem;
  line-height: 2.2;

  white-space: pre-line;

  /*
    مهم:
    ارتفاع با JS کنترل می‌شود.
  */
  transition: max-height 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================
   DESCRIPTION GRADIENT
========================================================= */

.hero-description::after {
  content: "";

  position: absolute;

  inset-inline-start: 0;
  inset-inline-end: 0;
  bottom: 0;

  height: 65px;

  background: linear-gradient(to bottom, transparent 0%, var(--card) 100%);

  pointer-events: none;

  opacity: 1;

  transition: opacity 0.35s ease;
}

/*
  وقتی متن باز است:
  گرادیان کاملاً حذف می‌شود.
*/
.hero-description.expanded::after {
  opacity: 0;
}

/*
  در حالت expanded دیگر محدودیت بصری نداریم.
  مقدار واقعی max-height از JS می‌آید.
*/
.hero-description.expanded {
  overflow: hidden;
}

/* =========================================================
   HIGHLIGHT
========================================================= */

.highlight {
  color: var(--accent);
  font-weight: 700;
}

/* =========================================================
   READ MORE
========================================================= */

.read-more-btn {
  position: relative;

  margin-top: 1rem;

  color: var(--accent);

  font-weight: 700;

  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

/* =========================================================
   SOCIALS
========================================================= */

.socials {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;

  gap: 1rem;

  animation: heroFadeIn 0.8s 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.socials a {
  padding: 12px 20px;

  border: 1px solid var(--border);
  border-radius: 999px;

  transition:
    background 0.3s ease,
    color 0.3s ease,
    border-color 0.3s ease,
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* =========================================================
   LANGUAGE SELECTOR
========================================================= */

.language-selector {
  position: relative;
}

.language-menu {
  position: absolute;

  top: calc(100% + 10px);
  inset-inline-end: 0;

  z-index: 10000;

  width: 150px;
  max-height: 250px;

  display: none;

  overflow: auto;

  border: 1px solid var(--border);
  border-radius: 16px;

  background: var(--card);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);

  transform-origin: top;

  animation: menuIn 0.2s ease both;
}

.language-menu.active {
  display: block;
}

.language-menu button {
  width: 100%;
  padding: 12px;

  color: var(--text);

  text-align: center;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}

@keyframes menuIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =========================================================
   MOBILE MENU
========================================================= */

.mobile-menu-selector {
  position: relative;

  display: none;
}

#mobile-menu {
  position: absolute;

  top: calc(100% + 10px);
  inset-inline-end: 0;

  z-index: 10000;

  min-width: 170px;

  padding: 0.4rem;

  border: 1px solid var(--border);
  border-radius: 16px;

  background: var(--card);

  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

#mobile-menu a {
  display: block;

  width: 100%;

  padding: 12px;

  color: var(--text);

  text-align: center;

  border-radius: 10px;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}

/* =========================================================
   HOVER
========================================================= */

@media (hover: hover) {
  .nav a:hover {
    opacity: 0.6;
  }

  #language-btn:hover,
  #theme-btn:hover,
  #mobile-menu-btn:hover {
    color: var(--hover-text);
    background: var(--hover-bg);

    transform: translateY(-1px);
  }

  .socials a:hover {
    color: var(--hover-text);
    background: var(--hover-bg);

    border-color: var(--hover-bg);

    transform: translateY(-3px);
  }

  .language-menu button:hover,
  #mobile-menu a:hover {
    color: var(--hover-text);
    background: var(--hover-bg);
  }

  .read-more-btn:hover {
    opacity: 0.7;
    transform: translateY(-1px);
  }
}

/* =========================================================
   TABLET
========================================================= */

@media (max-width: 900px) {
  .header {
    padding-inline: 1.25rem;
  }

  .logo {
    inset-inline-start: 1.25rem;
  }

  .controls {
    inset-inline-end: 1.25rem;
  }

  .hero {
    padding-inline: 1.25rem;
  }

  .about-card {
    max-width: 720px;
  }
}

/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {
  .header {
    height: 70px;

    padding-inline: 1rem;
  }

  .logo {
    inset-inline-start: 1rem;

    font-size: 1rem;
  }

  .controls {
    inset-inline-end: 1rem;

    gap: 0.45rem;
  }

  .nav {
    display: none;
  }

  .mobile-menu-selector {
    display: block;
  }

  #language-btn,
  #theme-btn,
  #mobile-menu-btn {
    padding: 7px 10px;
  }

  .hero {
    min-height: calc(100vh - 70px);

    padding: 2rem 1rem 3rem;
  }

  .hero-content {
    width: 100%;
  }

  .hero-bg {
    width: 450px;
    height: 450px;

    filter: blur(50px);
  }

  .hero-title {
    margin-bottom: 0.85rem;

    font-size: clamp(2.8rem, 12vw, 4.5rem);

    line-height: 1.15;
  }

  .hero-tags {
    gap: 0.45rem;

    margin-bottom: 1.5rem;

    font-size: 0.85rem;
  }

  .about-card {
    margin-bottom: 1.5rem;

    padding: 1rem;

    border-radius: 20px;
  }

  .hero-description {
    max-height: 115px;

    font-size: 0.95rem;

    line-height: 2;
  }

  .hero-description::after {
    height: 55px;
  }

  .hero-description.expanded {
    max-height: none;
  }

  .read-more-btn {
    margin-top: 0.85rem;

    font-size: 0.9rem;
  }

  .socials {
    gap: 0.7rem;
  }

  .socials a {
    width: 100%;

    padding: 11px 16px;
  }

  #mobile-menu {
    min-width: 160px;
  }
}

/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 480px) {
  .header {
    padding-inline: 0.75rem;
  }

  .logo {
    inset-inline-start: 0.75rem;

    font-size: 0.9rem;
  }

  .controls {
    inset-inline-end: 0.75rem;

    gap: 0.35rem;
  }

  #language-btn,
  #theme-btn,
  #mobile-menu-btn {
    padding: 6px 9px;
  }

  .hero {
    padding: 1.5rem 0.75rem 2.5rem;
  }

  .hero-title {
    font-size: clamp(2.5rem, 13vw, 3.5rem);
  }

  .hero-tags {
    font-size: 0.8rem;
  }

  .about-card {
    padding: 0.9rem;

    border-radius: 18px;
  }

  .hero-description {
    font-size: 0.9rem;

    line-height: 1.95;
  }

  .socials a {
    padding: 10px 14px;
  }
}

/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}