/* ===== Kinetic Navigation - Fullscreen Animated Header ===== */

:root {
  --kn-primary: #9823cf;
  --kn-dark: #131313;
  --kn-dark-2: #1a1a2e;
  --kn-dark-3: #16213e;
  --kn-text: #333;
  --kn-container: 1400px;
  --kn-padding: 2em;
  --kn-cubic: cubic-bezier(0.65, 0.05, 0, 1);
}

/* --- Header Bar --- */
.kn-header-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 1.2em 0;
  background: transparent;
}

.kn-header {
  width: 100%;
}

.kn-container {
  max-width: var(--kn-container);
  margin: 0 auto;
  padding: 0 var(--kn-padding);
}

.kn-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* --- Logo --- */
.kn-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.kn-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.kn-logo-text {
  font-family: "Dana", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--kn-primary);
  letter-spacing: -0.3px;
}

/* --- Right Side: Icons + Menu Button --- */
.kn-right {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.kn-icons {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.kn-icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  text-decoration: none;
  color: #ffffff;
  font-size: 1.2rem;
  background: #12082a;
  transition: background 0.3s ease, transform 0.3s ease;
  position: relative;
}

.kn-icon-link:hover {
  background: #1a0d35;
  transform: scale(1.08);
}

.kn-icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.kn-icon-link:active {
  transform: scale(0.95);
}

.kn-icon-link .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  color: var(--kn-primary);
  font-size: 1rem;
  font-weight: 900;
  font-family: "Dana", sans-serif;
  line-height: 1;
}

/* --- Menu Toggle Button --- */
.kn-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  width: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(152, 35, 207, 0.08);
  cursor: pointer;
  color: inherit;
  padding: 0;
  transition: background 0.3s ease, width 0.4s var(--kn-cubic), border-radius 0.4s var(--kn-cubic);
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.kn-menu-btn:hover {
  background: rgba(152, 35, 207, 0.15);
  width: 120px;
  border-radius: 24px;
  justify-content: center;
  padding: 0 16px;
}

[dir="rtl"] .kn-menu-btn:hover {
  padding: 0 16px;
}

.kn-menu-btn.open {
  width: 48px;
  border-radius: 50%;
  padding: 0;
}

.kn-menu-btn-label {
  font-family: "Dana", sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--kn-text);
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 0.3s ease 0.05s, max-width 0.35s var(--kn-cubic);
  pointer-events: none;
  white-space: nowrap;
}

.kn-menu-btn:hover .kn-menu-btn-label {
  opacity: 1;
  max-width: 60px;
}

.kn-menu-btn.open .kn-menu-btn-label {
  opacity: 0;
  max-width: 0;
}

/* --- Hamburger Icon --- */
.kn-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.kn-hamburger-line {
  display: block;
  height: 2px;
  background: var(--kn-text);
  border-radius: 2px;
  transition: transform 0.4s var(--kn-cubic), opacity 0.3s ease, width 0.4s var(--kn-cubic);
  transform-origin: center;
}

.kn-hamburger-line.line-1 {
  width: 100%;
}

.kn-hamburger-line.line-2 {
  width: 70%;
}

.kn-hamburger-line.line-3 {
  width: 50%;
}

/* Hover: lines grow to full width and center */
.kn-menu-btn:hover .kn-hamburger-line.line-1 {
  width: 100%;
}

.kn-menu-btn:hover .kn-hamburger-line.line-2 {
  width: 100%;
}

.kn-menu-btn:hover .kn-hamburger-line.line-3 {
  width: 100%;
}

/* Open state overrides hover */
.kn-menu-btn.open:hover .kn-hamburger-line.line-2 {
  opacity: 0;
  transform: translateX(10px);
}

.kn-menu-btn.open:hover .kn-hamburger-line.line-1,
.kn-menu-btn.open:hover .kn-hamburger-line.line-3 {
  width: 100%;
}

/* Hamburger → X animation */
.kn-menu-btn.open .kn-hamburger-line.line-1 {
  width: 100%;
  transform: translateY(7px) rotate(45deg);
}

.kn-menu-btn.open .kn-hamburger-line.line-2 {
  opacity: 0;
  transform: translateX(10px);
}

.kn-menu-btn.open .kn-hamburger-line.line-3 {
  width: 100%;
  transform: translateY(-7px) rotate(-45deg);
}

[dir="rtl"] .kn-menu-btn.open:hover .kn-hamburger-line.line-2 {
  transform: translateX(-10px);
}

/* --- Fullscreen Menu Overlay --- */
.kn-fullscreen-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  z-index: 9999;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.kn-fullscreen-menu.is-open {
  visibility: visible;
  pointer-events: auto;
  opacity: 1;
}

.kn-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.kn-menu-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  z-index: 1;
  border-radius: 50px 0 0 50px;
  overflow: hidden;
}

/* --- Menu Background Layers --- */
.kn-menu-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.kn-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--kn-dark);
  z-index: 0;
}

.kn-backdrop.first {
  background: var(--kn-dark-2);
}

.kn-backdrop.second {
  background: var(--kn-dark-3);
}

/* --- Ambient Background Shapes --- */
.kn-shapes {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.kn-shape {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.kn-shape.active {
  opacity: 1;
  visibility: visible;
}

/* --- Menu Content --- */
.kn-close-btn {
  position: absolute;
  top: 1.5em;
  left: 1.5em;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.kn-close-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg);
}

[dir="rtl"] .kn-close-btn {
  left: auto;
  right: 1.5em;
}

.kn-menu-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.kn-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2em;
}

.kn-menu-item {
  overflow: hidden;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.kn-nav-link {
  display: block;
  position: relative;
  padding: 0.5em 0.4em;
  text-decoration: none;
  color: #fff;
  font-size: clamp(1.5rem, 3.5vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-family: "Dana", sans-serif;
  overflow: hidden;
  text-align: center;
}

[dir="rtl"] .kn-nav-link {
  text-align: center;
}

.kn-nav-link-text {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0.15em 0.3em;
  transition: color 0.3s ease;
  display: inline-block;
}

.kn-nav-link-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--kn-primary);
  transform: translateY(100%);
  transition: transform 0.4s var(--kn-cubic);
  border-radius: 12px;
}

[dir="rtl"] .kn-nav-link-bg {
  transform: translateY(-100%);
}

[dir="rtl"] .kn-nav-link-bg {
  left: auto;
  right: 0;
}

.kn-nav-link:hover .kn-nav-link-bg {
  transform: translateY(0);
}

.kn-nav-link:hover .kn-nav-link-text {
  color: #fff;
}

/* --- User Info in Menu --- */
.kn-menu-user {
  position: absolute;
  bottom: 3em;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 3;
}

.kn-menu-user a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-family: "Dana", sans-serif;
  font-size: 0.875rem;
  transition: color 0.3s ease;
}

.kn-menu-user a:hover {
  color: #fff;
}

/* --- Mobile Adjustments --- */
@media (max-width: 768px) {
  .kn-header-wrapper {
    padding: 1em 0;
  }

  .kn-logo-text {
    font-size: 1.2rem;
  }

  .kn-logo-img {
    width: 36px;
    height: 36px;
  }

  .kn-nav-link {
    font-size: clamp(1.5rem, 8vw, 2.5rem);
  }

  .kn-container {
    padding: 0 1.2em;
  }

  .kn-icon-link,
  .kn-menu-btn {
    width: 42px;
    height: 42px;
  }

  .kn-icon-img {
    width: 18px;
    height: 18px;
  }

  .kn-menu-content {
    width: 100%;
  }
}

/* --- Laptop Adjustments --- */
@media (min-width: 769px) and (max-width: 1200px) {
  .kn-nav-link {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
  }

  .kn-menu-item {
    max-width: 360px;
  }
}

/* --- Large Laptop (17 inch / 1920px) Adjustments --- */
@media (min-width: 1201px) and (max-width: 1600px) {
  /* کمی کوچکتر کردن دکمه‌های منو همبرگری فقط در سایز لپتاب 17 اینچ */
  .kn-icon-link,
  .kn-menu-btn,
  .kn-close-btn {
    width: 42px;
    height: 42px;
  }

  .kn-icon-img {
    width: 19px;
    height: 19px;
  }

  .kn-hamburger {
    width: 19px;
    height: 19px;
    gap: 4px;
  }

  .kn-menu-btn:hover {
    width: 108px;
  }

  .kn-nav-link {
    font-size: clamp(1.6rem, 2.8vw, 2.2rem);
  }

  .kn-menu-item {
    max-width: 360px;
  }
}

@media (max-width: 480px) {
  .kn-menu-btn {
    width: 42px;
    height: 42px;
  }
}