/* ============================================================
   Knowell — Global Design System
   "极简科学风 + 结果导向可视化" / Tech-futuristic
   ============================================================ */

:root {
  /* Brand */
  --cyan: #00C6FF;
  --blue: #0072FF;
  --grad: linear-gradient(135deg, #00C6FF 0%, #0072FF 100%);
  --grad-soft: linear-gradient(135deg, rgba(0,198,255,.16), rgba(0,114,255,.16));

  /* Accents */
  --purple: #7928CA;
  --warn: #FF4D4F;
  --success: #52C41A;

  /* Navy / dark surfaces */
  --navy-900: #0A192F;
  --navy-850: #0d2138;
  --navy-800: #112240;
  --navy-700: #16304f;
  --navy-line: rgba(120, 190, 255, .14);

  /* Neutrals */
  --white: #FFFFFF;
  --ink-50: #F5F7FA;
  --ink-100: #EDF1F6;
  --ink-300: #C9D3E0;
  --ink-grey: #8C8C8C;
  --ink-700: #4A5468;
  --ink-900: #1A2233;
  --black: #000000;

  /* Radii */
  --r-card: 12px;
  --r-card-lg: 16px;
  --r-btn: 8px;
  --r-pill: 999px;

  /* Shadow */
  --sh-card: 0 4px 20px rgba(0,0,0,.08);
  --sh-card-hover: 0 8px 30px rgba(0,0,0,.12);
  --sh-glow: 0 8px 30px rgba(0,114,255,.35);

  /* Type */
  --sans: "Inter", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", "JetBrains Mono", ui-monospace, monospace;

  --nav-h: 76px;
  --maxw: 1240px;
}

/* ---------- Reset ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }
body {
  font-family: var(--sans);
  color: var(--ink-900);
  background: var(--white);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img, svg { display: block; max-width: 100%; }
ul { list-style: none; }
::selection { background: rgba(0,114,255,.22); }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }
.section { padding: 100px 0; position: relative; }
.section--tight { padding: 80px 0; }

.section-head { text-align: center; max-width: 760px; margin: 0 auto 64px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 13px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--blue); margin-bottom: 18px; display: inline-block;
}
.section--dark .eyebrow { color: var(--cyan); }
.section-title {
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 800; letter-spacing: -1px; line-height: 1.12;
}
.section-sub {
  margin-top: 16px; font-size: 19px; color: var(--ink-700);
  text-wrap: pretty;
}
.section--dark { background: var(--navy-900); color: var(--white); }
.section--dark .section-sub { color: var(--ink-300); }
.section--grey { background: var(--ink-50); }

.gtext {
  background: var(--grad); -webkit-background-clip: text;
  background-clip: text; color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; padding: 0 22px; border-radius: var(--r-btn);
  font-size: 15px; font-weight: 600; letter-spacing: .2px;
  transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .25s, background .25s, color .2s, border-color .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.96); }
.btn-primary {
  background: var(--grad); color: #fff;
  box-shadow: 0 6px 18px rgba(0,114,255,.32);
}
.btn-primary:hover { transform: scale(1.03) translateY(-1px); box-shadow: var(--sh-glow); }
.btn-ghost {
  background: #fff; color: var(--blue);
  border: 1.5px solid rgba(0,114,255,.5);
}
.btn-ghost:hover { border-color: var(--blue); background: rgba(0,114,255,.05); transform: translateY(-1px); }
.btn-outline-white {
  background: rgba(255,255,255,.06); color: #fff;
  border: 1.5px solid rgba(255,255,255,.55); backdrop-filter: blur(6px);
}
.btn-outline-white:hover { background: rgba(255,255,255,.14); transform: translateY(-1px); }
.btn-white { background: #fff; color: var(--blue); }
.btn-white:hover { transform: scale(1.03) translateY(-1px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.btn-lg { height: 54px; padding: 0 32px; font-size: 17px; }
.btn-block { width: 100%; }

/* ---------- Data card primitive ---------- */
.stat-num {
  font-family: var(--mono); font-weight: 700;
  letter-spacing: -1px; line-height: 1;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--ink-700); font-size: 15px; margin-top: 8px; }
.section--dark .stat-label { color: var(--ink-300); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.7,.3,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   NAVBAR
   ============================================================ */
.nav {
  position: fixed; inset: 0 0 auto 0; height: var(--nav-h); z-index: 9999;
  display: flex; align-items: center;
  background: rgba(10,25,47,.0);
  transition: background .3s, box-shadow .3s, backdrop-filter .3s;
}
.nav.scrolled {
  background: rgba(10,25,47,.82);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 1px 0 var(--navy-line);
}
.nav .wrap { display: flex; align-items: center; gap: 22px; max-width: 1320px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.logo-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--grad); display: grid; place-items: center;
  box-shadow: 0 4px 14px rgba(0,114,255,.4);
  position: relative; overflow: hidden;
}
.logo-mark svg { width: 22px; height: 22px; }
.brand-text { line-height: 1.05; color: #fff; }
.brand-text b { font-size: 20px; font-weight: 800; letter-spacing: -.5px; }
.brand-text span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 1.4px; color: var(--cyan); opacity: .9; }

.nav-menu { display: flex; align-items: center; gap: 2px; margin: 0 auto; }
.nav-menu a {
  color: rgba(255,255,255,.78); font-size: 14.5px; font-weight: 500; white-space: nowrap;
  padding: 8px 13px; border-radius: 9px; transition: color .2s; position: relative;
}
.nav-menu a:hover { color: #fff; }
.nav-menu a.active { color: #fff; }
.nav-menu a::after {
  content: ""; position: absolute; left: 50%; bottom: 4px; width: 0; height: 2px;
  background: var(--grad); border-radius: 2px; transform: translateX(-50%);
  transition: width .25s cubic-bezier(.2,.7,.3,1);
}
.nav-menu a:hover::after { width: 16px; }
.nav-menu a.active::after { width: calc(100% - 30px); }

.nav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.lang { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 6px; color: rgba(255,255,255,.82);
  font-size: 14px; padding: 8px 11px; border-radius: 9px; transition: background .2s, color .2s;
  border: 1px solid transparent;
}
.lang-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.lang.open .lang-btn { background: rgba(255,255,255,.07); border-color: var(--navy-line); }
.lang-btn svg { width: 14px; height: 14px; transition: transform .2s; }
.lang.open .lang-btn svg { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 150px;
  background: #fff; border-radius: 12px; box-shadow: var(--sh-card-hover);
  padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all .2s; z-index: 50;
}
.lang.open .lang-menu { opacity: 1; visibility: visible; transform: none; }
.lang-menu button {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: 8px; font-size: 14px; color: var(--ink-900); transition: background .15s;
}
.lang-menu button:hover { background: var(--ink-50); }
.lang-menu button.sel { color: var(--blue); font-weight: 600; }

.nav-app {
  height: 40px; padding: 0 15px; border-radius: 9px;
  border: 1px solid var(--navy-line); color: rgba(255,255,255,.9); font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  background: rgba(255,255,255,.04); transition: background .2s, transform .2s, border-color .2s;
}
.nav-app svg { width: 17px; height: 17px; opacity: .9; }
.nav-app:hover { background: rgba(0,198,255,.12); border-color: rgba(0,198,255,.5); color: #fff; transform: translateY(-1px); }
.nav-cta {
  height: 40px; padding: 0 20px; border-radius: 9px; background: var(--grad); color: #fff;
  font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,114,255,.4); transition: transform .2s, box-shadow .2s;
}
.nav-cta:hover { transform: translateY(-1px) scale(1.02); box-shadow: var(--sh-glow); }
.nav-login {
  color: rgba(255,255,255,.82); font-size: 14px; font-weight: 600; padding: 8px 6px; border-radius: 8px;
  transition: color .2s; white-space: nowrap; position: relative; margin-left: 6px;
}
.nav-login::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 1px; height: 18px; background: var(--navy-line);
}
.nav-login:hover { color: var(--cyan); }

/* logged-in avatar (replaces nav-login when a session exists) */
.nav-user { position: relative; flex-shrink: 0; }
.nav-user-btn { display: flex; align-items: center; }
.nav-ava { width: 38px; height: 38px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; color: #fff; font-family: var(--mono); font-weight: 700; font-size: 15px; box-shadow: 0 4px 14px rgba(0,114,255,.4); border: 2px solid transparent; transition: border-color .2s; }
.nav-user-btn:hover .nav-ava { border-color: rgba(0,198,255,.6); }
.nav-ava.sm { width: 40px; height: 40px; border-radius: 12px; box-shadow: none; }
.nav-user-dd { position: absolute; top: calc(100% + 10px); right: 0; min-width: 230px; background: #fff; border-radius: 14px; box-shadow: var(--sh-card-hover); padding: 8px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: all .2s; z-index: 60; }
.nav-user.open .nav-user-dd { opacity: 1; visibility: visible; transform: none; }
.nav-user-info { display: flex; align-items: center; gap: 12px; padding: 10px 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--ink-100); }
.nav-user-info b { display: block; font-size: 14.5px; font-weight: 700; color: var(--ink-900); }
.nav-user-info span { font-size: 12px; color: var(--ink-grey); font-family: var(--mono); word-break: break-all; }
.nav-user-dd a, .nav-user-dd button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border-radius: 9px; font-size: 14px; color: var(--ink-900); transition: background .15s; text-align: left; }
.nav-user-dd a:hover, .nav-user-dd button:hover { background: var(--ink-50); }
.nav-user-dd a svg, .nav-user-dd button svg { width: 16px; height: 16px; color: var(--ink-700); }
.nav-user-dd .dd-sep { height: 1px; background: var(--ink-100); margin: 6px 4px; }
.nav-user-dd button[data-nav-logout] { color: var(--warn); }
.nav-user-dd button[data-nav-logout] svg { color: var(--warn); }

.burger { display: none; width: 44px; height: 44px; border-radius: 10px; color: #fff; }
.burger svg { width: 24px; height: 24px; margin: auto; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { background: var(--navy-900); color: rgba(255,255,255,.7); padding: 72px 0 28px; position: relative; }
.footer-top {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr; gap: 40px;
  padding-bottom: 48px; border-bottom: 1px solid var(--navy-line);
}
.footer .brand-text b, .footer .brand-text span { color: #fff; }
.footer-intro { margin-top: 18px; font-size: 14px; max-width: 280px; line-height: 1.7; }
.footer-emergency {
  margin-top: 22px; display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,77,79,.12); border: 1px solid rgba(255,77,79,.35);
  color: #ffb4b5; padding: 10px 14px; border-radius: 10px; font-size: 13px; font-family: var(--mono);
}
.footer-col h4 { color: #fff; font-size: 14px; font-weight: 700; margin-bottom: 18px; letter-spacing: .3px; }
.footer-col a { display: block; font-size: 14px; padding: 7px 0; transition: color .2s; }
.footer-col a:hover { color: var(--cyan); }
.app-badges { display: flex; flex-direction: column; gap: 10px; margin-top: 2px; }
.app-badge {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--navy-line); background: rgba(255,255,255,.03); transition: border-color .2s, background .2s;
}
.app-badge:hover { border-color: rgba(0,198,255,.5); background: rgba(0,198,255,.06); }
.app-badge svg { width: 22px; height: 22px; flex-shrink: 0; }
.app-badge div { line-height: 1.1; }
.app-badge small { font-size: 10px; opacity: .65; }
.app-badge b { color: #fff; font-size: 14px; font-weight: 600; }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  padding-top: 26px; font-size: 13px;
}
.footer-legal { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.footer-legal a:hover { color: var(--cyan); }
.footer-social { display: flex; align-items: center; gap: 10px; }
.footer-social a {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--navy-line);
  display: grid; place-items: center; transition: all .2s;
}
.footer-social a:hover { border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); }
.footer-social svg { width: 18px; height: 18px; }

/* ============================================================
   FLOATING: emergency + mobile book
   ============================================================ */
.emergency-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 9000;
  display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 20px 0 16px;
  background: var(--warn); color: #fff; border-radius: var(--r-pill);
  box-shadow: 0 10px 30px rgba(255,77,79,.45); font-weight: 700; font-size: 15px;
  transition: transform .2s, box-shadow .2s;
}
.emergency-fab:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 14px 36px rgba(255,77,79,.55); }
.emergency-fab .ring { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.22); display: grid; place-items: center; }
.emergency-fab svg { width: 16px; height: 16px; }
.emergency-fab::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--r-pill);
  border: 2px solid var(--warn); animation: fabPulse 2s ease-out infinite;
}
@keyframes fabPulse { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center;
  background: rgba(5,14,28,.78); backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; padding: 24px;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  width: min(560px, 100%); background: var(--navy-850); color: #fff;
  border: 1px solid var(--navy-line); border-radius: 20px; overflow: hidden;
  transform: translateY(16px) scale(.98); transition: transform .35s cubic-bezier(.2,.7,.3,1);
  box-shadow: 0 40px 90px rgba(0,0,0,.6);
}
.modal-overlay.open .modal { transform: none; }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 10px;
  background: rgba(255,255,255,.08); color: #fff; display: grid; place-items: center; z-index: 5; transition: background .2s;
}
.modal-close:hover { background: rgba(255,255,255,.18); }
.modal-close svg { width: 18px; height: 18px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 80px);
  background: var(--navy-800); color: #fff; padding: 14px 22px; border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.4); border: 1px solid var(--navy-line);
  font-size: 14px; z-index: 11000; opacity: 0; transition: all .35s cubic-bezier(.2,.7,.3,1);
  display: flex; align-items: center; gap: 10px;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast svg { width: 18px; height: 18px; color: var(--cyan); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
}
/* Progressive nav collapse to keep everything on one line */
@media (max-width: 1280px) { .nav-app { display: none; } }
@media (max-width: 1180px) { .nav-login { display: none; } }
@media (max-width: 1100px) { .lang { display: none; } }
@media (max-width: 1040px) {
  .nav-menu, .nav-app, .nav-login, .nav-user, .lang { display: none; }
  .burger { display: grid; }
}
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .section { padding: 72px 0; }
  .footer-top { grid-template-columns: 1fr; gap: 30px; }
}
