/* ==========================================================================
   NEXYNUS MAIN SITE — NEW FRONTEND STYLESHEET
   Dark green theme · Emerald #10B981 · Lime #84CC16 · Vazirmatn + JetBrains Mono
   ========================================================================== */

:root {
  --bg: #080C0C; --bg-2: #0D1515; --surface: #111A1A; --surface-2: #182626;
  --border: rgba(16, 185, 129, 0.15); --border-strong: rgba(16, 185, 129, 0.4);
  --accent: #10B981; --accent-2: #059669; --accent-3: #84CC16; --accent-glow: #10B981;
  --accent-teal: #5EEAD4;
  --fg: #F0F5F0; --muted: #6B8076;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: 'Vazirmatn', sans-serif; overflow-x: hidden;
  position: relative;
}
.font-mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- Background ---------- */
/* Static background replacing the old flying-shapes canvas: soft green glow
   blobs + faint grid (previous look restored). Zero animation → zero GPU
   cost while scrolling. */
.nx-bg-ambient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 85% -5%, rgba(16, 185, 129, 0.10), transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(94, 234, 212, 0.07), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(132, 204, 22, 0.05), transparent 45%);
}
.nx-bg-ambient::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(16, 185, 129, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.045) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 85%);
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 85%);
}
.bg-grid {
  background-image: linear-gradient(rgba(16, 185, 129, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 0;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

/* ---------- Text effects ---------- */
.text-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.text-glow { text-shadow: 0 0 30px rgba(16, 185, 129, 0.8), 0 0 60px rgba(16, 185, 129, 0.4); }

/* ---------- Logo ---------- */
.gear-logo { animation: spin 10s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- Nav ---------- */
.nav-link { position: relative; font-size: 14px; font-weight: 500; color: rgba(240, 240, 245, 0.75); transition: color 0.3s; text-decoration: none; }
.nav-link::after { content: ''; position: absolute; bottom: -6px; right: 0; width: 0; height: 2px; background: var(--accent); transition: width 0.3s ease; box-shadow: 0 0 8px var(--accent); }
.nav-link:hover { color: var(--fg); }
.nav-link:hover::after { width: 100%; }

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700;
  padding: 12px 24px; border-radius: 8px; transition: all 0.3s; position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none;
  cursor: pointer; font-family: inherit; font-size: 14px; text-decoration: none;
}
.btn-primary::before {
  content: ''; position: absolute; top: 0; right: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent); transition: right 0.5s;
}
.btn-primary:hover::before { right: 100%; }
.btn-primary:hover { box-shadow: 0 0 20px rgba(16, 185, 129, 0.5), 0 0 40px rgba(16, 185, 129, 0.2); transform: translateY(-2px); }
.btn-secondary {
  background: transparent; color: var(--fg); font-weight: 500; padding: 12px 24px; border-radius: 8px;
  border: 1px solid var(--border-strong); transition: all 0.3s; cursor: pointer; font-family: inherit;
  font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn-secondary:hover { background: rgba(16, 185, 129, 0.1); border-color: var(--accent); box-shadow: 0 0 15px rgba(16, 185, 129, 0.2); }

/* ---------- Section tag ---------- */
.section-tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid rgba(94, 234, 212, 0.4);
  border-radius: 100px; font-size: 11px; color: var(--accent-teal); font-family: 'JetBrains Mono', monospace;
  background: rgba(94, 234, 212, 0.05); letter-spacing: 1px;
}
.section-tag::before {
  content: ''; width: 6px; height: 6px; background: var(--accent-teal); border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite; box-shadow: 0 0 8px var(--accent-teal);
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.3; transform: scale(0.7); } }

/* ---------- Cards ---------- */
.feature-card, .card-hover {
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
}
.feature-card::before, .card-hover::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle 250px at var(--mx, 50%) var(--my, 50%), rgba(16, 185, 129, 0.15), transparent 70%);
  opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 1;
}
.feature-card:hover::before, .card-hover:hover::before { opacity: 1; }
.feature-card:hover, .card-hover:hover {
  border-color: var(--accent) !important; transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5), 0 0 20px rgba(16, 185, 129, 0.1);
}
.feature-card { padding: 32px; }
.feature-card:hover .feature-icon { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; transform: scale(1.1) rotate(-5deg); }
.feature-icon {
  width: 60px; height: 60px; border-radius: 14px; background: rgba(16, 185, 129, 0.1);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
  color: var(--accent); margin-bottom: 24px; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card-hover:hover .card-img { transform: scale(1.1); filter: grayscale(0%) contrast(1.1); }
.card-img { transition: transform 0.6s ease, filter 0.6s ease; filter: grayscale(30%); }

/* ---------- STL Library purple window (explore.nexynus.com preview) ------
   Deliberately purple inside an otherwise green page: the frame marks the
   library as "another world" so users feel the subdomain switch coming. */
.lib-window {
  position: relative;
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 28px;
  padding: 3rem 1.5rem;
  background:
    radial-gradient(circle at 85% 0%, rgba(217, 70, 239, 0.10), transparent 55%),
    radial-gradient(circle at 10% 100%, rgba(34, 211, 238, 0.07), transparent 55%),
    linear-gradient(160deg, #110d1f 0%, #0a0813 100%);
  overflow: hidden;
}
@media (min-width: 640px) { .lib-window { padding: 3.5rem 2.5rem; } }
/* Full-bleed SOLID band behind the section — EXACTLY the USER FEEDBACK
   treatment: flat opaque --bg-2 (#0D1515) + the same faint 48px green grid
   at 30% opacity (bg-grid + opacity-30). No translucency, no purple. */
.lib-window-backdrop {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 100vw;
  height: 100%;
  background: var(--bg-2);
  pointer-events: none;
  z-index: -1;
}
.lib-window-backdrop::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(16, 185, 129, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.3;
}
.lib-window::before {
  content: '';
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(168, 85, 247, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(168, 85, 247, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
/* Purple mouse-follow glow inside the window (same technique as .card-hover,
   driven by moveCardLight setting --mx/--my on .lib-window) */
.lib-window::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle 300px at var(--mx, 50%) var(--my, 50%), rgba(217, 70, 239, 0.10), transparent 70%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 0;
}
.lib-window:hover::after { opacity: 1; }
.lib-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle 250px at var(--mx, 50%) var(--my, 50%), rgba(217, 70, 239, 0.14), transparent 70%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  z-index: 2;
}
.lib-card:hover::before { opacity: 1; }
.lib-card {
  position: relative; z-index: 1;
  background: rgba(22, 16, 40, 0.65);
  border: 1px solid rgba(168, 85, 247, 0.22);
  border-radius: 16px;
  transition: border-color .3s, transform .3s, box-shadow .3s;
  color: var(--fg);
}
.lib-card:hover {
  border-color: #d946ef;
  transform: translateY(-6px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 18px rgba(217, 70, 239, 0.12);
}
.lib-card-img {
  width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1;
  transition: transform .5s ease, filter .5s ease; filter: grayscale(25%);
}
.lib-card:hover .lib-card-img { transform: scale(1.07); filter: grayscale(0%) brightness(1.08); }

/* ---------- Blog cover fallback (no image set) ---------- */
.blog-cover-fallback {
  background:
    radial-gradient(circle at 20% 20%, rgba(16, 185, 129, 0.14), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(132, 204, 22, 0.1), transparent 60%),
    linear-gradient(160deg, var(--surface-2) 0%, var(--bg-2) 100%);
  position: relative;
}
.blog-cover-fallback::before {
  content: '';
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(16, 185, 129, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 185, 129, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}
.blog-cover-fallback > * { position: relative; z-index: 1; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(50px); transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ---------- Ticker (زنده هوشمند با سرعت ثابت) ---------- */
/* Constant-speed marquee. ticker.js builds 2 identical halves (one half
   ≥1.5x viewport) and sets duration = halfWidth / 70px/s. Keyframes
   translateX(-50% → 0): content moves LEFT→RIGHT, wraps seamlessly. */
.ticker-container {
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  direction: ltr; /* چپ‌چین برای محاسبه دقیق مرورگر */
}
.ticker-track {
  display: flex;
  width: max-content;
  padding: 12px 0;
  will-change: transform;
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 4rem; /* فاصله بین آیتم‌ها */
  font-family: inherit;
  font-size: 12px;
  color: var(--fg);
  direction: rtl; /* متن‌ها راست‌چین می‌شن */
}
.ticker-item i { font-size: 8px; }
@keyframes ticker-ltr {
  0%   { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation-duration: 90s; }
}

/* ---------- Terminal ---------- */
.terminal-cursor::after { content: '▍'; animation: blink 1s steps(1) infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Glitch ---------- */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.glitch::before { left: 2px; text-shadow: -1px 0 var(--accent); clip: rect(24px, 550px, 90px, 0); animation: glitch-anim-2 3s infinite linear alternate-reverse; }
.glitch::after { left: -2px; text-shadow: -1px 0 var(--accent-3); clip: rect(85px, 550px, 140px, 0); animation: glitch-anim 2.5s infinite linear alternate-reverse; }
@keyframes glitch-anim {
  0% { clip: rect(11px, 9999px, 80px, 0); } 20% { clip: rect(40px, 9999px, 20px, 0); }
  40% { clip: rect(15px, 9999px, 60px, 0); } 60% { clip: rect(85px, 9999px, 30px, 0); }
  80% { clip: rect(120px, 9999px, 10px, 0); } 100% { clip: rect(50px, 9999px, 90px, 0); }
}
@keyframes glitch-anim-2 {
  0% { clip: rect(65px, 9999px, 100px, 0); } 20% { clip: rect(20px, 9999px, 5px, 0); }
  40% { clip: rect(90px, 9999px, 70px, 0); } 60% { clip: rect(10px, 9999px, 30px, 0); }
  80% { clip: rect(55px, 9999px, 95px, 0); } 100% { clip: rect(1px, 9999px, 50px, 0); }
}

/* ---------- Hero ---------- */
#hero-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; display: block; }
.hero-text-box { position: relative; isolation: isolate; overflow: visible; }
.hero-text-box::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, rgba(8, 8, 12, 0.85) 0%, rgba(8, 8, 12, 0) 70%);
  z-index: -1; filter: blur(20px); pointer-events: none;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* ---------- FAQ ---------- */
.faq-item { transition: all 0.3s; }
.faq-item:hover { border-color: var(--border-strong); }
.faq-btn { background: none; border: none; width: 100%; text-align: right; cursor: pointer; font-family: inherit; color: var(--fg); }
.faq-icon { transition: transform 0.3s ease; }
.faq-item.active .faq-icon { transform: rotate(180deg); color: var(--accent); }
.faq-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; }
.faq-item.active .faq-content { max-height: 200px; padding-top: 0; padding-bottom: 20px; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 5px; border: 2px solid var(--bg); }

/* ==========================================================================
   ARTICLE PAGE (post.php) — new frontend typography
   ========================================================================== */
.article-content { line-height: 1.8; font-size: 16px; color: #d1d5db; }
.article-content p { margin-bottom: 1.5rem; }
.article-content h2 { font-size: 1.5rem; font-weight: 700; color: var(--fg); margin-top: 2.5rem; margin-bottom: 1rem; }
.article-content .article-main-title {
  font-size: 1.9rem; font-weight: 800; color: var(--fg); margin: 0 0 1.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-3) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.article-content h3 { font-size: 1.2rem; font-weight: 600; color: var(--accent-3); margin-top: 2rem; margin-bottom: 1rem; }
.article-content ul { list-style: disc; padding-right: 1.5rem; margin-bottom: 1.5rem; }
.article-content ul li { margin-bottom: 0.5rem; }
.article-content blockquote {
  border-right: 4px solid var(--accent); padding: 1rem 1.5rem; margin: 2rem 0;
  background: var(--surface); border-radius: 8px; font-style: italic; color: var(--fg);
}
.article-content img { border-radius: 12px; display: block; margin: 2rem auto; max-width: 100%; }
.article-content figure { margin: 2rem auto; text-align: center; }
.article-content figure img { margin: 0 auto; }
.article-content figcaption {
  text-align: center; font-size: 0.8rem; color: var(--muted); font-family: 'JetBrains Mono', monospace;
  margin-top: 0.6rem;
}
.article-content .article-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: 2rem 0; }
.article-content .article-hero img { margin: 0; border-radius: 16px; }
.article-content .article-gallery img { margin: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.article-content .video-embed { position: relative; padding-top: 56.25%; margin: 2rem 0; border-radius: 12px; overflow: hidden; background: #000; }
.article-content .video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.article-content .color-bold { font-weight: 800; }
.article-content .color-red { color: var(--accent); }
.article-content .color-yellow { color: var(--accent-3); }
.article-content .color-orange { color: var(--accent-teal); }
.article-content .color-purple { color: #5EEAD4; }
.article-content .color-blue { color: #3AA0FF; }
.article-content .color-green { color: #34D399; }
.article-content .color-white { color: #FFFFFF; }
.article-content .color-black { color: #0B0B0B; }
.article-featured-wrap {
  aspect-ratio: 16/9; border-radius: 16px; overflow: hidden; margin-bottom: 2.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.1);
}
.article-featured-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ==========================================================================
   403 / 404 PAGES
   ========================================================================== */
.shield-container { position: relative; width: 120px; height: 140px; margin: 0 auto 40px; z-index: 2; }
@media (min-width: 640px) { .shield-container { width: 160px; height: 180px; margin-bottom: 60px; } }
.shield {
  position: absolute; inset: 0; background: linear-gradient(135deg, var(--accent), #0D4A33);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  animation: pulse-shield 2s infinite ease-in-out; box-shadow: 0 0 30px var(--accent);
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
@keyframes pulse-shield {
  0%, 100% { transform: scale(1); box-shadow: 0 0 30px var(--accent); }
  50% { transform: scale(1.05); box-shadow: 0 0 50px var(--accent); }
}
.lock-icon { font-size: 48px; color: #fff; filter: drop-shadow(0 0 10px rgba(0,0,0,0.5)); }
@media (min-width: 640px) { .lock-icon { font-size: 64px; } }
.shield-rings {
  position: absolute; inset: -20px; border: 2px solid var(--accent);
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  animation: ring-expand 2s infinite ease-out; opacity: 0; z-index: 1;
}
.shield-rings:nth-child(2) { animation-delay: 0.5s; }
@keyframes ring-expand { 0% { transform: scale(0.8); opacity: 0.8; } 100% { transform: scale(1.4); opacity: 0; } }
.radar-scanner {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); border-radius: 50%; pointer-events: none;
}
.scanner-line {
  position: absolute; top: 50%; left: 50%; width: 200%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-3), transparent);
  transform-origin: left center; animation: scan 3s infinite linear;
}
@keyframes scan { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.error-canvas { width: 100%; max-width: 800px; height: 400px; display: block; margin: 0 auto; }
