/* ============================================================
   深规院考察助手 · Premium Static Replica
   Design system — tokens, glassmorphism, theme, motion
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  /* Light theme (default) */
  --bg: #eef1f6;
  --bg-grad-1: #e8edfa;
  --bg-grad-2: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.5);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.14);
  --text: #0f172a;
  --text-soft: #475569;
  --text-mute: #94a3b8;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --accent-grad-soft: linear-gradient(135deg, rgba(99,102,241,0.16), rgba(6,182,212,0.16));
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 10px 30px -12px rgba(15, 23, 42, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, 0.28);
  --ring: rgba(99, 102, 241, 0.35);
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --glass-blur: 22px;
}

[data-theme="dark"] {
  --bg: #070b14;
  --bg-grad-1: #0b1222;
  --bg-grad-2: #05080f;
  --surface: rgba(20, 28, 46, 0.62);
  --surface-solid: #111827;
  --surface-2: rgba(30, 41, 64, 0.5);
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #e6edf7;
  --text-soft: #aab6c8;
  --text-mute: #6b7892;
  --accent: #818cf8;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #818cf8 0%, #22d3ee 100%);
  --accent-grad-soft: linear-gradient(135deg, rgba(129,140,248,0.18), rgba(34,211,238,0.16));
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --ring: rgba(129, 140, 248, 0.45);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 12% -10%, var(--bg-grad-1), transparent 60%),
    radial-gradient(1000px 700px at 100% 0%, var(--bg-grad-2), transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  transition: background-color .4s ease, color .4s ease;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: var(--accent-grad-soft); }

/* ---------- Layout ---------- */
.container { width: min(1180px, 92vw); margin-inline: auto; }
.section { padding: 4rem 0; }
.stack { display: flex; flex-direction: column; }

/* ---------- Top navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 1.25rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; letter-spacing: -.02em; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-grad); display: grid; place-items: center;
  color: #fff; font-size: 18px; box-shadow: var(--shadow-sm);
}
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--text-mute); letter-spacing: .04em; }
.nav-links { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav-links a {
  padding: .5rem .85rem; border-radius: 10px; font-size: 14px; font-weight: 600;
  color: var(--text-soft); transition: background .2s, color .2s;
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); }
.nav-links a.active { color: var(--accent); background: var(--accent-grad-soft); }

/* Theme toggle */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); display: grid; place-items: center;
  transition: transform .25s cubic-bezier(.16,1,.3,1), background .2s;
}
.theme-toggle:hover { transform: rotate(-18deg) scale(1.08); }
.theme-toggle svg { width: 18px; height: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.25rem; border-radius: 14px; font-weight: 700; font-size: 14px;
  border: 1px solid transparent; transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s, background .2s;
  will-change: transform;
}
.btn-primary { background: var(--accent-grad); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-2px) scale(1.02); box-shadow: var(--shadow-lg); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { transform: translateY(-2px); background: var(--surface-solid); }
.btn-soft { background: var(--accent-grad-soft); color: var(--accent); }
.btn-soft:hover { transform: translateY(-2px); }
.btn-danger { background: rgba(239,68,68,.12); color: var(--danger); border-color: rgba(239,68,68,.25); }
.btn-danger:hover { background: rgba(239,68,68,.2); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

/* Magnetic helper applied via JS */
.magnetic { transition: transform .2s cubic-bezier(.16,1,.3,1); }

/* ---------- Glass card ---------- */
.glass {
  background: var(--surface);
  backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-md);
}
.card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform .3s cubic-bezier(.16,1,.3,1), box-shadow .3s, border-color .3s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card h3 { margin: 0 0 .35rem; font-size: 1.05rem; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--text-soft); font-size: .9rem; }

/* ---------- Typography helpers ---------- */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.gradient-text {
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.lead { color: var(--text-soft); font-size: 1.05rem; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 6rem 0 4.5rem; }
.hero-grid {
  position: absolute; inset: 0; z-index: 0; opacity: .5;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 30%, transparent 75%);
}
.hero canvas { position: absolute; inset: 0; z-index: 0; }
.hero-inner { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.08; letter-spacing: -.03em; margin: .6rem 0 1rem; font-weight: 850; }
.hero p { max-width: 38rem; font-size: 1.1rem; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 1.8rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 2rem; }
.chip {
  font-size: 12.5px; font-weight: 600; padding: .35rem .8rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft);
}

/* ---------- Filter bar ---------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: 1rem; margin-bottom: 1.5rem; }
.filter-bar .grow { flex: 1 1 200px; }
.select, .input {
  width: 100%; padding: .6rem .8rem; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-solid); color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.select:focus, .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.field-label { font-size: 12px; font-weight: 700; color: var(--text-mute); margin-bottom: .35rem; display: block; letter-spacing: .03em; }

/* Theme pills */
.pill-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.pill {
  font-size: 13px; font-weight: 600; padding: .4rem .9rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-soft);
  transition: all .2s;
}
.pill:hover { border-color: var(--border-strong); color: var(--text); }
.pill.active { background: var(--accent-grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-sm); }

/* ---------- Project grid ---------- */
.grid { display: grid; gap: 1.25rem; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.project-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.project-thumb { height: 140px; position: relative; }
.project-thumb svg { width: 100%; height: 100%; display: block; }
.project-body { padding: 1.1rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.tag-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag { font-size: 11px; font-weight: 700; padding: .2rem .55rem; border-radius: 7px; background: var(--accent-grad-soft); color: var(--accent); }
.meta-row { display: flex; gap: 1rem; font-size: .8rem; color: var(--text-mute); }
.project-actions { display: flex; gap: .5rem; margin-top: auto; padding-top: .5rem; }
.project-actions .btn { flex: 1; justify-content: center; padding: .55rem; }

/* ---------- My Plan ---------- */
.plan-list { display: flex; flex-direction: column; gap: .7rem; }
.plan-item {
  display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border-radius: 16px;
  background: var(--surface-solid); border: 1px solid var(--border); cursor: grab;
  transition: box-shadow .2s, border-color .2s, transform .15s;
}
.plan-item:hover { box-shadow: var(--shadow-md); }
.plan-item.dragging { opacity: .5; cursor: grabbing; }
.plan-item.drop-target { border-color: var(--accent); }
.plan-index {
  width: 30px; height: 30px; flex: none; border-radius: 9px; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; background: var(--accent-grad-soft); color: var(--accent);
}
.plan-item .grow { flex: 1; min-width: 0; }
.route-card { border-left: 3px solid var(--accent); padding: .6rem .9rem; margin: .5rem 0; border-radius: 0 12px 12px 0; background: var(--surface-2); font-size: .88rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.stat { padding: 1.1rem; border-radius: 18px; background: var(--surface-solid); border: 1px solid var(--border); }
.stat .num { font-size: 1.7rem; font-weight: 850; letter-spacing: -.02em; }
.stat .lbl { font-size: 12.5px; color: var(--text-mute); font-weight: 600; }

/* ---------- Import ---------- */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 18px; padding: 2rem; text-align: center;
  background: var(--surface-2); transition: border-color .2s, background .2s;
}
.dropzone:focus-within { border-color: var(--accent); background: var(--accent-grad-soft); }
textarea.input { min-height: 180px; resize: vertical; font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; }
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: var(--accent-grad); width: 0; transition: width .3s ease; }

/* ---------- Misc ---------- */
.row { display: flex; gap: 1rem; align-items: center; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--text-mute); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-mute); }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 100; padding: .8rem 1.2rem; border-radius: 14px; background: var(--surface-solid);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); opacity: 0; transition: all .35s cubic-bezier(.16,1,.3,1);
  font-weight: 600; font-size: 14px; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.divider { height: 1px; background: var(--border); border: 0; margin: 1.5rem 0; }
.kbd { font-family: ui-monospace, monospace; font-size: 12px; padding: .1rem .4rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s cubic-bezier(.16,1,.3,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Spinner ---------- */
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-cols-3, .grid-cols-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .nav-links a { padding: .5rem .55rem; font-size: 13px; }
  .brand small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
