/* ============================================================
   AgiBot Research — minimal sci-tech theme
   ============================================================ */

:root {
  --bg: #0a0e1a;
  --bg-soft: #0f1524;
  --card: #131a2b;
  --card-hover: #182034;
  --border: #222d44;
  --border-soft: #192136;
  --text: #eaeef7;
  --text-dim: #8592ab;
  --text-faint: #5a6683;
  --accent: #46e0d2;
  --accent-2: #7aa5ff;
  --accent-soft: rgba(70, 224, 210, 0.12);
  --grad-a: #46e0d2;
  --grad-b: #7aa5ff;
  --grid-line: rgba(130, 165, 220, 0.05);
  --glow: rgba(70, 224, 210, 0.12);
  --particle: rgba(150, 185, 235, 0.55);
  --glass: rgba(19, 26, 43, 0.72);
  --glass-edge: rgba(160, 190, 240, 0.12);
  --shadow: 0 20px 60px -30px rgba(0, 0, 0, 0.9);
  --max: 1120px;
  --radius: 18px;
}

[data-theme="light"] {
  --bg: #f4f2ec;
  --bg-soft: #ece9e1;
  --card: #fbfaf6;
  --card-hover: #f3f1ea;
  --border: #ddd8cc;
  --border-soft: #e6e2d8;
  --text: #171b22;
  --text-dim: #5c6373;
  --text-faint: #949aa8;
  --accent: #0f9f92;
  --accent-2: #3568d4;
  --accent-soft: rgba(15, 159, 146, 0.10);
  --grad-a: #0f9f92;
  --grad-b: #3568d4;
  --grid-line: rgba(60, 80, 120, 0.06);
  --glow: rgba(53, 104, 212, 0.08);
  --particle: rgba(70, 95, 140, 0.4);
  --glass: rgba(251, 250, 246, 0.78);
  --glass-edge: rgba(255, 255, 255, 0.6);
  --shadow: 0 24px 60px -34px rgba(40, 45, 60, 0.28);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "MiSans", -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background .4s ease, color .4s ease;
}

/* ---------- Ambient background ---------- */
.bg-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 78%);
}
.bg-glow {
  position: fixed; top: -20%; left: 50%; transform: translateX(-50%);
  width: 900px; height: 900px; z-index: 0; pointer-events: none;
  background: radial-gradient(circle, var(--glow) 0%, transparent 60%);
  filter: blur(20px);
}

main, .nav, .footer { position: relative; z-index: 1; }

section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 60px 32px;
  scroll-margin-top: 24px;
}

.section-label {
  display: flex; align-items: center; gap: 12px;
  font-family: "MiSans", -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 40px;
}
.section-label .idx { color: var(--accent); }

/* ---------- NAV (liquid glass) ---------- */
.nav {
  position: sticky; top: 14px; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  max-width: calc(var(--max) - 24px); margin: 14px auto 0;
  padding: 14px 24px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--glass-edge);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow: 0 6px 24px -14px rgba(0, 0, 0, 0.35);
}
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-logo { height: 22px; width: auto; display: block; }
/* logo.png = white wordmark (dark theme); logo2.png = dark wordmark (light theme) */
.brand-logo-light { display: none; }
[data-theme="light"] .brand-logo-dark { display: none; }
[data-theme="light"] .brand-logo-light { display: block; }
.brand-sep { width: 1px; height: 16px; background: var(--border); display: inline-block; position: relative; top: 2px; }
.brand-research {
  font-weight: 500; font-size: 15px; letter-spacing: .2px; color: var(--text-dim);
  line-height: 1; position: relative; top: 2px;
}

.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a {
  color: var(--text-dim); text-decoration: none; font-size: 14px;
  transition: color .2s ease;
}
.nav-links a:hover { color: var(--text); }

.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- HERO ---------- */
.hero {
  position: relative; overflow: hidden; text-align: left;
  padding-top: 80px; padding-bottom: 40px;
}
.hero-flow {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  width: 100%; height: 100%;
  mask-image: linear-gradient(90deg, transparent 0%, #000 30%, #000 100%);
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 30%, #000 100%);
}
.hero-inner { position: relative; z-index: 1; }

.hero-title {
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 500; line-height: 1.05; letter-spacing: -2px;
  max-width: 24ch; margin-bottom: 32px;
}
.grad {
  background: linear-gradient(100deg, var(--grad-a), var(--grad-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 40px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 10px; font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer; transition: all .2s ease;
  border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #04120f; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -12px var(--accent); }
.btn-ghost { border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.mission-text {
  font-size: clamp(19px, 2.3vw, 26px); font-weight: 330;
  line-height: 1.5; max-width: 68ch;
  color: var(--text-dim); letter-spacing: -0.2px;
}
.mission-text em { font-style: normal; color: var(--accent); font-weight: 500; }

/* ---------- RESEARCH GRID (horizontal scroll) ---------- */
.research { position: relative; }
.research::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0;
  width: 56px; pointer-events: none; z-index: 2;
  background: linear-gradient(90deg, transparent, var(--bg));
}
.research-grid {
  display: flex; gap: 20px;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity;
  padding-bottom: 14px; /* room for scrollbar */
  scrollbar-width: thin;
}
.research-grid::-webkit-scrollbar { height: 8px; }
.research-grid::-webkit-scrollbar-thumb {
  background: var(--border); border-radius: 999px;
}
.research-grid::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.rcard {
  position: relative; display: flex; flex-direction: column;
  flex: 0 0 clamp(280px, 32%, 360px); scroll-snap-align: start;
  border: 1px solid var(--glass-edge); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: var(--text);
  background: var(--glass);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow: 0 6px 24px -16px rgba(0, 0, 0, 0.4);
  transition: transform .28s ease, border-color .28s ease, box-shadow .28s ease;
}
.rcard-cover {
  position: relative; height: 150px;
  background-size: cover; background-position: center;
  border-bottom: 1px solid var(--glass-edge);
}
.rcard:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: var(--shadow); }
.rcard-body {
  position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column;
  padding: 20px 22px 22px;
}
.rcard-venue {
  font-family: "MiSans", -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 11px;
  color: var(--accent); letter-spacing: .5px; display: block; margin-bottom: 8px;
}
.rcard h3 { font-size: 18px; font-weight: 520; letter-spacing: -0.3px; margin-bottom: 8px; }
.rcard p { font-size: 14px; color: var(--text-dim); line-height: 1.55; }
.rcard-foot {
  display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 18px;
}
.rcard-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: "MiSans", -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 12px;
  color: var(--accent); text-decoration: none;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent-soft);
  transition: background .2s ease, color .2s ease, transform .15s ease;
}
.rcard-link:hover { background: var(--accent); color: var(--bg); transform: translateY(-1px); }
.rcard-link-ico { font-size: 11px; }

/* dot indicators under the horizontal card rail */
.research-dots {
  display: flex; justify-content: center; gap: 10px; margin-top: 22px;
}
.research-dots .dot {
  width: 8px; height: 8px; border-radius: 50%; padding: 0;
  border: none; cursor: pointer;
  background: var(--border);
  transition: background .2s ease, transform .2s ease, width .2s ease;
}
.research-dots .dot:hover { background: var(--text-dim); }
.research-dots .dot.active {
  background: var(--accent); width: 22px; border-radius: 999px;
}

/* ---------- JOIN ---------- */
.join { padding-bottom: 120px; }
.join-inner {
  border: 1px solid var(--glass-edge); border-radius: var(--radius);
  background:
    radial-gradient(circle at 20% 0%, var(--accent-soft), transparent 55%),
    var(--glass);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow: 0 6px 24px -16px rgba(0, 0, 0, 0.4);
  padding: 60px 48px; text-align: center;
}
.join-inner h2 { font-size: clamp(26px, 4vw, 40px); font-weight: 520; letter-spacing: -0.8px; margin-bottom: 14px; }
.join-inner p { color: var(--text-dim); max-width: none; margin: 0 auto 28px; }
.join-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- FOOTER ---------- */
.footer {
  max-width: var(--max); margin: 0 auto;
  padding: 40px 32px 64px;
  border-top: 1px solid var(--border-soft);
  display: flex; flex-wrap: wrap; align-items: center; gap: 20px;
  justify-content: space-between;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 520; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--text-dim); text-decoration: none; font-size: 14px; transition: color .2s ease; }
.footer-links a:hover { color: var(--accent); }

/* ---------- reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 620px) {
  section { padding: 70px 20px; }
  .nav { padding: 14px 20px; }
  .nav-links { gap: 16px; }
  .nav-links a { display: none; }
  .footer { flex-direction: column; align-items: flex-start; }
}
