/* ═══════════════════════════════════════════════════════════
   Avaren Lab — Main Stylesheet
   Theme: Deep Space × Aurora × Holographic Sci-Fi
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg: #03060f;
  --bg2: #060a18;
  --accent1: #00d4ff;
  --accent2: #7b2fff;
  --accent3: #00ff9d;
  --text: #e8f0ff;
  --text-dim: #6b7a99;
  --glass-bg: rgba(3, 6, 15, 0.72);
  --glass-border: rgba(123, 47, 255, 0.18);
  --glass-border-hover: rgba(0, 212, 255, 0.38);
  --font-en: 'Space Grotesk', sans-serif;
  --font-cn: 'Noto Sans SC', sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-cn);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ── Background layers ──────────────────────────────────────── */
#canvas-bg {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none; width: 100%; height: 100%;
}

.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,212,255,0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.028) 1px, transparent 1px);
  background-size: 60px 60px;
}

.orb {
  position: fixed; border-radius: 50%; filter: blur(120px);
  pointer-events: none; z-index: 0; animation: orbFloat 18s ease-in-out infinite;
}
.orb-1 { width: 600px; height: 600px; background: rgba(123,47,255,0.09); top:-150px; right:-100px; }
.orb-2 { width: 500px; height: 500px; background: rgba(0,212,255,0.07); bottom:-100px; left:-100px; animation-delay:-9s; }

@keyframes orbFloat {
  0%,100% { transform: translate(0,0); }
  33% { transform: translate(30px,-40px); }
  66% { transform: translate(-20px,30px); }
}

/* ── Page transition (macOS window collapse) ────────────────── */
#page-transition {
  position: fixed; inset: 0; z-index: 9999;
  background: radial-gradient(ellipse at center, rgba(0,212,255,0.08), var(--bg));
  pointer-events: none;
  transform-origin: center center;
}

#page-transition.leaving {
  animation: pageLeave 0.55s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
#page-transition.entering {
  animation: pageEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes pageLeave {
  0%   { opacity: 0; transform: scale(1); }
  30%  { opacity: 0.6; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(0.04) translateY(60vh); border-radius: 50%; }
}
@keyframes pageEnter {
  0%   { opacity: 1; transform: scale(0.04) translateY(60vh); border-radius: 50%; }
  60%  { opacity: 0.4; transform: scale(1.02); border-radius: 0; }
  100% { opacity: 0; transform: scale(1); }
}

/* ── Navigation ─────────────────────────────────────────────── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; gap: 40px;
  padding: 0 48px; height: 68px;
  background: rgba(3, 6, 15, 0.82);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(123,47,255,0.12);
}

.nav-logo {
  font-family: var(--font-en); font-size: 16px; font-weight: 700;
  letter-spacing: 3px; color: var(--accent1);
  text-shadow: 0 0 20px rgba(0,212,255,0.5);
  transition: text-shadow 0.3s;
}
.nav-logo:hover { text-shadow: 0 0 35px rgba(0,212,255,0.9); }

.nav-links { display: flex; gap: 8px; margin-left: auto; }
.nav-links a {
  font-family: var(--font-en); font-size: 13px; font-weight: 500;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-dim); padding: 8px 16px; border-radius: 8px;
  transition: all 0.25s; position: relative;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  width: 0; height: 1.5px; background: var(--accent1); transition: width 0.3s;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text); background: rgba(0,212,255,0.06);
}
.nav-links a:hover::after, .nav-links a.active::after { width: 60%; }

.nav-status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-en); font-size: 10px; letter-spacing: 2px;
  color: var(--accent3); white-space: nowrap;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent3);
  box-shadow: 0 0 8px var(--accent3); animation: blink 2.5s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ── Page wrapper ───────────────────────────────────────────── */
.page { position: relative; z-index: 1; }

/* ── Hero section ───────────────────────────────────────────── */
.hero {
  display: grid; grid-template-columns: 1fr 500px;
  align-items: center; gap: 60px;
  min-height: 100vh; padding: 80px 60px 60px;
  max-width: 1360px; margin: 0 auto;
}

.hero-left { padding-top: 20px; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px; border-radius: 20px;
  background: rgba(0,212,255,0.06); border: 1px solid rgba(0,212,255,0.2);
  font-family: var(--font-en); font-size: 11px; letter-spacing: 2px;
  color: var(--accent1); margin-bottom: 28px; text-transform: uppercase;
}
.hero-badge .dot { width:6px;height:6px;border-radius:50%;background:var(--accent1);animation:blink 2s infinite; }

.hero-left h1 {
  font-size: clamp(36px, 4.5vw, 64px); font-weight: 700; line-height: 1.15;
  margin-bottom: 24px;
}
.hero-left h1 .line1 { display: block; color: var(--text); }
.hero-left h1 .line2 {
  display: block;
  background: linear-gradient(135deg, var(--accent1) 0%, var(--accent2) 60%, var(--accent3) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  min-height: 1.2em;
}
.hero-left h1 .line2::after { content: '|'; -webkit-text-fill-color: var(--accent1); animation: blink 1s infinite; }

.hero-left p {
  font-size: 16px; color: var(--text-dim); line-height: 1.9;
  max-width: 520px; margin-bottom: 40px;
}

.hero-btns { display: flex; gap: 16px; flex-wrap: wrap; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 32px; border-radius: 12px; font-weight: 600; font-size: 15px;
  background: linear-gradient(135deg, var(--accent2), var(--accent1));
  color: #fff; transition: all 0.3s; box-shadow: 0 0 30px rgba(123,47,255,0.3);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 0 50px rgba(123,47,255,0.55); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; border-radius: 12px; font-weight: 500; font-size: 15px;
  background: rgba(0,212,255,0.06); border: 1px solid rgba(0,212,255,0.28);
  color: var(--accent1); transition: all 0.3s;
}
.btn-secondary:hover { background: rgba(0,212,255,0.14); border-color: var(--accent1); transform: translateY(-2px); }

/* ── Three.js container ─────────────────────────────────────── */
#three-container {
  position: relative; width: 460px; height: 540px;
  margin: 0 auto;
}
#three-canvas { display: block; }

.holo-panel {
  position: absolute; background: rgba(3,6,15,0.75);
  border: 1px solid rgba(0,212,255,0.25); border-radius: 10px;
  padding: 10px 16px; backdrop-filter: blur(16px);
  font-family: var(--font-en); pointer-events: none;
  animation: panelFloat 4s ease-in-out infinite;
}
.holo-panel .pt { font-size: 9px; letter-spacing: 2px; color: var(--text-dim); text-transform: uppercase; margin-bottom: 4px; }
.holo-panel .pv { font-size: 14px; font-weight: 700; color: var(--accent1); }
.panel-l { left: -20px; top: 30%; animation-delay: 0s; }
.panel-r { right: -20px; top: 22%; animation-delay: 1.3s; }
.panel-b { left: 50%; transform: translateX(-50%); bottom: 20px; animation-delay: 0.7s; }

@keyframes panelFloat { 0%,100%{transform:translateY(0) translateX(var(--tx,0))} 50%{transform:translateY(-8px) translateX(var(--tx,0))} }
.panel-b { --tx: -50%; }

/* ── Section common ─────────────────────────────────────────── */
.section { padding: 80px 60px; max-width: 1360px; margin: 0 auto; }

.section-label {
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-en); font-size: 11px; letter-spacing: 3px;
  text-transform: uppercase; color: var(--accent1); margin-bottom: 16px;
}
.section-label::before { content: ''; width: 40px; height: 1px; background: var(--accent1); }

.section-title {
  font-size: clamp(24px, 3vw, 40px); font-weight: 700; margin-bottom: 48px;
}

.divider {
  height: 1px; max-width: 1200px; margin: 0 auto;
  background: linear-gradient(90deg, transparent, rgba(123,47,255,0.25), rgba(0,212,255,0.2), transparent);
}

/* ── Cards grid ─────────────────────────────────────────────── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }

.card {
  display: block; padding: 28px; border-radius: 18px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px); transition: all 0.35s;
  cursor: pointer; position: relative; overflow: hidden;
  --mx: 50%; --my: 50%;
}
.card::before {
  content: ''; position: absolute; inset: 0; border-radius: 18px;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(0,212,255,0.07), transparent 60%);
  opacity: 0; transition: opacity 0.3s;
}
.card:hover { border-color: var(--glass-border-hover); box-shadow: 0 0 60px rgba(0,212,255,0.08), 0 20px 40px rgba(0,0,0,0.3); }
.card:hover::before { opacity: 1; }
.card h3 { font-size: 17px; font-weight: 700; margin: 14px 0 10px; line-height: 1.4; }
.card p { font-size: 13px; color: var(--text-dim); line-height: 1.8; }
.card-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; font-size: 12px; color: var(--text-dim); font-family: var(--font-en); }
.card-arrow { color: var(--accent1); font-size: 16px; transition: transform 0.3s; }
.card:hover .card-arrow { transform: translateX(5px); }

/* ── Tags ───────────────────────────────────────────────────── */
.card-tag {
  display: inline-block; padding: 3px 10px; border-radius: 5px;
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase;
  font-family: var(--font-en);
}
.tag-ai  { background: rgba(123,47,255,0.15); border: 1px solid rgba(123,47,255,0.35); color: #b07fff; }
.tag-ml  { background: rgba(0,212,255,0.10); border: 1px solid rgba(0,212,255,0.30); color: var(--accent1); }
.tag-dev { background: rgba(0,255,157,0.08); border: 1px solid rgba(0,255,157,0.28); color: var(--accent3); }
.tag-note{ background: rgba(255,180,0,0.08); border: 1px solid rgba(255,180,0,0.28); color: #ffb400; }

/* ── AI section ─────────────────────────────────────────────── */
.ai-section-bg { background: rgba(123,47,255,0.03); border-top: 1px solid rgba(123,47,255,0.1); border-bottom: 1px solid rgba(123,47,255,0.1); }
.ai-section-inner { padding: 80px 60px; max-width: 1360px; margin: 0 auto; }

.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }

.ai-card {
  padding: 28px; border-radius: 18px;
  background: rgba(3,6,15,0.8); border: 1px solid rgba(123,47,255,0.2);
  backdrop-filter: blur(20px); transition: all 0.35s;
  --mx: 50%; --my: 50%; position: relative; overflow: hidden;
}
.ai-card::before {
  content: ''; position: absolute; inset: 0; border-radius: 18px;
  background: radial-gradient(circle at var(--mx) var(--my), rgba(123,47,255,0.08), transparent 60%);
  opacity: 0; transition: opacity 0.3s;
}
.ai-card:hover { border-color: rgba(123,47,255,0.5); box-shadow: 0 0 50px rgba(123,47,255,0.1), 0 20px 40px rgba(0,0,0,0.3); transform: translateY(-4px); }
.ai-card:hover::before { opacity: 1; }
.ai-icon-wrap { font-size: 32px; margin-bottom: 16px; }
.ai-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.ai-card p { font-size: 13px; color: var(--text-dim); line-height: 1.8; margin-bottom: 24px; }
.btn-launch {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: rgba(123,47,255,0.18); border: 1px solid rgba(123,47,255,0.4);
  color: #b07fff; transition: all 0.3s;
}
.btn-launch:hover { background: rgba(123,47,255,0.35); box-shadow: 0 0 20px rgba(123,47,255,0.3); }

/* ── Donate section ─────────────────────────────────────────── */
.donate-section { padding: 80px 60px; text-align: center; max-width: 1360px; margin: 0 auto; }
.donate-title { font-size: clamp(24px, 3vw, 40px); font-weight: 700; margin-bottom: 16px; }
.donate-desc { font-size: 15px; color: var(--text-dim); max-width: 500px; margin: 0 auto 48px; line-height: 1.8; }
.donate-cards { display: flex; justify-content: center; gap: 32px; flex-wrap: wrap; }
.donate-card {
  padding: 32px; border-radius: 20px; width: 240px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  backdrop-filter: blur(20px); transition: all 0.35s; text-align: center;
}
.donate-card:hover { border-color: var(--glass-border-hover); transform: translateY(-4px); box-shadow: 0 0 50px rgba(0,212,255,0.08); }
.donate-card-icon { font-size: 28px; margin-bottom: 10px; }
.donate-card-label { font-family: var(--font-en); font-size: 11px; letter-spacing: 2px; color: var(--accent1); text-transform: uppercase; margin-bottom: 20px; }
.donate-qr { width: 160px; height: 160px; border-radius: 12px; margin: 0 auto 14px; object-fit: cover; border: 2px solid rgba(0,212,255,0.2); }
.donate-hint { font-size: 12px; color: var(--text-dim); }

/* ── Blog page ──────────────────────────────────────────────── */
.blog-hero { padding: 140px 60px 60px; max-width: 1360px; margin: 0 auto; }
.blog-hero h1 { font-size: clamp(32px, 4vw, 56px); font-weight: 700; margin-bottom: 16px; }
.blog-hero p { font-size: 16px; color: var(--text-dim); max-width: 600px; line-height: 1.9; }

.blog-filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 40px; }
.filter-btn {
  padding: 8px 20px; border-radius: 20px; font-size: 12px; font-weight: 500;
  font-family: var(--font-en); letter-spacing: 1px; cursor: pointer;
  background: rgba(0,212,255,0.04); border: 1px solid rgba(0,212,255,0.15);
  color: var(--text-dim); transition: all 0.25s;
}
.filter-btn:hover, .filter-btn.active {
  background: rgba(0,212,255,0.12); border-color: rgba(0,212,255,0.4); color: var(--accent1);
}

/* ── About page ─────────────────────────────────────────────── */
.about-hero {
  display: grid; grid-template-columns: 200px 1fr; gap: 60px; align-items: start;
  padding: 140px 60px 60px; max-width: 1100px; margin: 0 auto;
}
.about-avatar-wrap { position: sticky; top: 90px; }
.about-avatar {
  width: 160px; height: 160px; border-radius: 28px;
  background: linear-gradient(135deg, rgba(123,47,255,0.3), rgba(0,212,255,0.2));
  border: 1px solid rgba(123,47,255,0.4); display: flex; align-items: center; justify-content: center;
  font-size: 72px; box-shadow: 0 0 60px rgba(123,47,255,0.2);
}
.about-content h1 { font-size: clamp(28px, 4vw, 52px); font-weight: 700; margin-bottom: 8px; }
.about-content .subtitle { font-family: var(--font-en); font-size: 13px; letter-spacing: 2px; color: var(--accent1); text-transform: uppercase; margin-bottom: 24px; }
.about-content p { font-size: 15px; color: var(--text-dim); line-height: 1.9; margin-bottom: 16px; max-width: 600px; }
.tech-stack { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.tech-tag {
  padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 500;
  font-family: var(--font-en); background: rgba(0,212,255,0.06);
  border: 1px solid rgba(0,212,255,0.2); color: var(--accent1);
  transition: all 0.25s;
}
.tech-tag:hover { background: rgba(0,212,255,0.14); border-color: var(--accent1); }

/* ── Article page ───────────────────────────────────────────── */
.article-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-en); font-size: 13px; color: var(--text-dim);
  margin-bottom: 40px; transition: color 0.2s;
}
.article-back:hover { color: var(--accent1); }
.article-header h1 { font-size: clamp(24px, 3.5vw, 44px); font-weight: 700; line-height: 1.25; margin-bottom: 20px; }
.article-meta { display: flex; gap: 20px; font-family: var(--font-en); font-size: 12px; color: var(--text-dim); letter-spacing: 0.5px; margin-bottom: 32px; flex-wrap: wrap; }
.article-divider { height: 1px; background: linear-gradient(90deg, rgba(0,212,255,0.3), transparent); margin-bottom: 40px; }

.article-body { font-size: 15px; line-height: 1.9; color: #c8d4f0; }
.article-body h2 { font-size: 22px; font-weight: 700; margin: 48px 0 16px; color: var(--text); padding-bottom: 10px; border-bottom: 1px solid rgba(0,212,255,0.15); }
.article-body h3 { font-size: 18px; font-weight: 600; margin: 32px 0 12px; color: var(--text); }
.article-body p { margin-bottom: 18px; }
.article-body ul, .article-body ol { margin: 16px 0 20px 24px; }
.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }
.article-body li { margin-bottom: 8px; }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body blockquote {
  border-left: 3px solid var(--accent1); padding: 16px 20px; margin: 28px 0;
  background: rgba(0,212,255,0.04); border-radius: 0 10px 10px 0;
  color: var(--text-dim); font-style: italic;
}
.article-body pre {
  border-radius: 12px; margin: 24px 0; overflow-x: auto;
  border: 1px solid rgba(123,47,255,0.2); font-family: 'JetBrains Mono', monospace;
}
.article-body code:not(pre code) {
  background: rgba(0,212,255,0.08); border: 1px solid rgba(0,212,255,0.18);
  padding: 2px 7px; border-radius: 4px; font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em; color: var(--accent1);
}

/* TOC */
.toc-wrap {
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 24px; backdrop-filter: blur(20px);
}
.toc-title { font-family: var(--font-en); font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 16px; }
.toc-list li { margin-bottom: 8px; }
.toc-list a { font-size: 13px; color: var(--text-dim); transition: color 0.2s; display: block; padding: 2px 0; border-left: 2px solid transparent; padding-left: 10px; }
.toc-list a:hover, .toc-list a.active { color: var(--accent1); border-left-color: var(--accent1); }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  padding: 32px 60px; border-top: 1px solid rgba(123,47,255,0.1);
}
.footer-logo { font-family: var(--font-en); font-size: 13px; font-weight: 700; letter-spacing: 3px; color: var(--accent1); }
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 13px; color: var(--text-dim); transition: color 0.2s; }
.footer-links a:hover { color: var(--accent1); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; padding: 100px 40px 60px; }
  .hero-right { display: flex; justify-content: center; }
  #three-container { width: 380px; height: 440px; }
  #three-canvas { width: 380px !important; height: 440px !important; }
}

@media (max-width: 768px) {
  nav { padding: 0 20px; gap: 16px; }
  .nav-status { display: none; }
  .hero { padding: 90px 24px 40px; gap: 40px; }
  .hero-left h1 { font-size: 32px; }
  .section, .ai-section-inner, .donate-section, .blog-hero { padding: 60px 24px; }
  .about-hero { grid-template-columns: 1fr; padding: 100px 24px 40px; }
  .about-avatar-wrap { position: static; }
  footer { padding: 24px; flex-direction: column; text-align: center; }
  #three-container { width: 320px; height: 380px; }
  #three-canvas { width: 320px !important; height: 380px !important; }
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(123,47,255,0.35); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(123,47,255,0.6); }

/* ── Selection ──────────────────────────────────────────────── */
::selection { background: rgba(0,212,255,0.25); color: var(--text); }
