/* =========================================================
   Design tokens
   Palette:  --bg #0a0e1a (deep space navy) · --bg-alt #10162a
             --accent (default violet, overridable via brand.json)
             --accent-2 #22d3ee (cyan, secondary signal color)
             --text #e7ebf5 · --muted #8b93ac · --danger #f2545b
   Type: Vazirmatn (display + body, Persian-native), 'JetBrains Mono' /
         ui-monospace for stats & technical data (addresses, ports, ids)
   Signature: animated node-grid background evoking a network/mesh of relays
   ========================================================= */

:root {
  --bg: #0a0e1a;
  --bg-alt: #10162a;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(255, 255, 255, 0.09);
  --accent: #7c3aed;
  --accent-2: #22d3ee;
  --text: #e7ebf5;
  --muted: #8b93ac;
  --danger: #f2545b;
  --online: #34d399;
  --offline: #6b7280;
  --radius: 16px;
  --font-display: 'Vazirmatn', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.75;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: inherit; }

/* ---------- Signature animated background ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(124, 58, 237, 0.16), transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(34, 211, 238, 0.12), transparent 45%),
    linear-gradient(var(--bg-alt), var(--bg));
}
.bg-blob {
  position: absolute;
  width: 46vw;
  height: 46vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
  pointer-events: none;
}
.bg-blob-1 {
  background: radial-gradient(circle, var(--accent), transparent 70%);
  top: -12%;
  left: -12%;
  animation: blob-float-1 22s ease-in-out infinite;
}
.bg-blob-2 {
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  bottom: -16%;
  right: -12%;
  animation: blob-float-2 26s ease-in-out infinite;
}
@keyframes blob-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8vw, 6vh) scale(1.15); }
}
@keyframes blob-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-6vw, -8vh) scale(1.1); }
}
.bg-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 75%);
  animation: drift 40s linear infinite;
}
@keyframes drift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 420px 420px, 420px 420px; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-grid::before { animation: none; }
}

/* ---------- Glass panels ---------- */
.glass {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10, 14, 26, 0.72);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--panel-border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-logo-wrap::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-2), var(--accent), var(--accent-2));
  filter: blur(7px);
  opacity: 0.8;
  animation: spin-logo-bg 4s linear infinite;
  z-index: 0;
}
@keyframes spin-logo-bg {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.brand-logo { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; }
.main-nav { display: flex; gap: 22px; font-size: 0.92rem; color: var(--muted); }
.main-nav a:hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  font-family: var(--font-display);
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  transition: transform 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #05060a; }
.btn-secondary { background: rgba(255,255,255,0.1); color: var(--text); }
.btn-outline { background: transparent; border: 1px solid var(--panel-border); color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid transparent; }
.btn-ghost:hover { color: var(--text); }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
  padding: 72px 20px 40px;
}
.hero-title-box {
  box-sizing: border-box;
  display: inline-block;
  max-width: 100%;
  padding: 18px 30px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(34, 211, 238, 0.18));
  border: 1px solid rgba(34, 211, 238, 0.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 0 40px rgba(124, 58, 237, 0.28), 0 0 14px rgba(34, 211, 238, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  margin: 0 0 20px;
  font-size: clamp(1.05rem, 5.2vw, 2.6rem);
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.01em;
  white-space: nowrap;
  animation: title-box-glow 4s ease-in-out infinite;
}
#typing-text {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.typing-cursor {
  color: var(--accent-2);
  font-weight: 300;
  animation: blink-cursor 1s step-start infinite;
}
@keyframes blink-cursor {
  50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .typing-cursor { animation: none; }
}
.accent { color: var(--accent-2); }
  border: 1px solid rgba(34,211,238,0.35);
  border-radius: 999px;
  padding: 5px 14px;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.25;
  margin: 0 0 18px;
  font-weight: 800;
}
.accent { color: var(--accent-2); }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 46ch; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.secondary-actions .btn { font-size: 0.82rem; padding: 9px 16px; }

.hero-actions-main {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 18px;
}
.hero-actions-main .btn-secondary {
  flex: 1 1 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  font-size: 0.92rem;
}
.secondary-actions .btn { font-size: 0.82rem; padding: 9px 16px; }

.btn-copy-sub {
  font-family: var(--font-display);
  border: none;
  cursor: pointer;
  border-radius: 999px;
  flex: 1 1 210px;
  padding: 14px 22px;
  font-size: 0.98rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #052e1a;
  background: linear-gradient(135deg, #4ade80, #22d3ee);
  box-shadow: 0 0 26px rgba(74, 222, 128, 0.45), 0 0 6px rgba(74, 222, 128, 0.6);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-copy-sub:hover { transform: translateY(-2px); box-shadow: 0 0 34px rgba(74, 222, 128, 0.6); }
.btn-copy-sub:active { transform: translateY(0); }
.btn-copy-sub-icon { font-size: 1.15rem; }
.platform-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 10px;
  max-width: 420px;
  margin-bottom: 12px;
}
.platform-card {
  font-family: var(--font-display);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(18px);
  cursor: pointer;
  color: var(--text);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.platform-card:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.platform-emoji { font-size: 1.8rem; line-height: 1; }
.platform-label { font-size: 0.85rem; font-weight: 700; }

.modal.modal-wide { max-width: 420px; width: 100%; text-align: right; }
.platform-apps-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; max-height: 60vh; overflow-y: auto; }
.platform-app-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-align: right;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.platform-app-item:hover { border-color: var(--accent-2); background: rgba(255, 255, 255, 0.08); }
.platform-app-emoji { font-size: 1.15rem; }

.modal-back {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  cursor: pointer;
}
.modal-back:hover { color: var(--text); }
.app-detail-download {
  display: block;
  text-align: center;
  margin: 16px 0;
  text-decoration: none;
}
.app-detail-steps-title { font-size: 0.95rem; margin: 18px 0 10px; color: var(--accent-2); }
.app-detail-steps {
  margin: 0;
  padding-right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.7;
  text-align: right;
}
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  z-index: 0;
}
.stat-bg {
  position: absolute;
  inset: -45%;
  z-index: -1;
  filter: blur(22px);
  opacity: 0.3;
  border-radius: 50%;
  animation: stat-pulse 4.5s ease-in-out infinite;
}
@keyframes stat-pulse {
  0%, 100% { transform: scale(1); opacity: 0.22; }
  50% { transform: scale(1.3); opacity: 0.42; }
}
@media (prefers-reduced-motion: reduce) {
  .stat-bg { animation: none; }
}
.stat-violet .stat-bg { background: radial-gradient(circle, #7c3aed, transparent 70%); }
.stat-green .stat-bg { background: radial-gradient(circle, #34d399, transparent 70%); animation-delay: 0.4s; }
.stat-cyan .stat-bg { background: radial-gradient(circle, #22d3ee, transparent 70%); animation-delay: 0.8s; }
.stat-amber .stat-bg { background: radial-gradient(circle, #fbbf24, transparent 70%); animation-delay: 1.2s; }
.stat-pink .stat-bg { background: radial-gradient(circle, #f472b6, transparent 70%); animation-delay: 1.6s; }
.stat-blue .stat-bg { background: radial-gradient(circle, #60a5fa, transparent 70%); animation-delay: 2s; }
.stat-value { font-family: var(--font-mono); font-size: 1.6rem; font-weight: 700; color: var(--text); position: relative; z-index: 1; }
.stat-label { font-size: 0.78rem; color: var(--muted); position: relative; z-index: 1; }

/* ---------- Sections ---------- */
.section { padding: 50px 20px; }
.section-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 22px; }
.muted { color: var(--muted); }

.protocol-bars { display: flex; flex-direction: column; gap: 10px; }
.protocol-bar-row { display: grid; grid-template-columns: 120px 1fr 60px; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 0.85rem; }
.protocol-bar-track { height: 8px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
.protocol-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; }

/* ---------- Toolbar / filters ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  margin-bottom: 22px;
}
.toolbar input, .toolbar select {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--font-display);
  font-size: 0.88rem;
}
.toolbar input { flex: 1 1 220px; }
.toolbar select { flex: 1 1 150px; }

/* ---------- Server list ---------- */
.server-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.server-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.server-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.server-name { font-weight: 700; font-size: 0.95rem; }
.server-proto { font-family: var(--font-mono); font-size: 0.72rem; color: var(--accent-2); text-transform: uppercase; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.status-online { background: var(--online); box-shadow: 0 0 8px var(--online); }
.status-offline { background: var(--offline); }
.server-meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 8px 14px; }
.badge { display: inline-block; font-size: 0.68rem; padding: 2px 8px; border-radius: 999px; font-family: var(--font-mono); }
.badge-secure { background: rgba(52,211,153,0.15); color: var(--online); }
.badge-insecure { background: rgba(242,84,91,0.15); color: var(--danger); }
.server-actions { display: flex; gap: 8px; margin-top: 4px; }
.empty-state { color: var(--muted); text-align: center; padding: 30px; }

/* ---------- Howto / FAQ ---------- */
.howto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; }
.card { padding: 20px; }
.card h3 { margin-top: 0; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }
.faq-list details { padding: 16px 18px; }
.faq-list summary { cursor: pointer; font-weight: 700; }
.faq-list p { color: var(--muted); margin-bottom: 0; }

/* ---------- Warning box ---------- */
.warning-box { padding: 28px; border-color: rgba(242,84,91,0.35); }
.warning-box h2 { margin-top: 0; color: var(--danger); font-size: 1.2rem; }
.warning-box ul { color: var(--muted); columns: 2; margin-top: 14px; }
.warning-box li { margin-bottom: 6px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--panel-border); padding: 26px 20px; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.footer-links { display: flex; gap: 16px; }

/* ---------- Modal / QR ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,6,10,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal-overlay[hidden] { display: none; }
.modal { padding: 28px; text-align: center; position: relative; max-width: 320px; }
.modal-close { position: absolute; top: 12px; left: 12px; background: transparent; border: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
#qr-code-container { display: flex; justify-content: center; margin: 18px 0; background: #fff; padding: 12px; border-radius: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700; z-index: 200;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .main-nav { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 100px; }
  .warning-box ul { columns: 1; }
}

/* ---------- Focus visibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
                                                               }
