/* =============================================================
   心曜医疗 Heartshine Medical — v4 Design System
   "Clinical Aurora" — vitality green × precision blue, ECG motif
   ============================================================= */

:root {
  /* ---- Ink / dark base ---- */
  --ink-950: #04070f;
  --ink-900: #060c1c;
  --ink-850: #08122a;
  --ink-800: #0b1a3a;
  --ink-700: #102a56;

  /* ---- Brand blues ---- */
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-300: #93c5fd;

  /* ---- Signature aurora accents (from logo green→blue) ---- */
  --cyan-500: #06b6d4;
  --cyan-400: #22d3ee;
  --teal-500: #14b8a6;
  --green-500: #10b981;
  --green-400: #34d399;

  /* ---- Neutrals ---- */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-900: #0f172a;

  /* ---- Signature gradients ---- */
  --grad-brand: linear-gradient(135deg, #0d9488 0%, #0891b2 45%, #1d4ed8 100%);
  --grad-aurora: linear-gradient(115deg, #34d399 0%, #22d3ee 30%, #3b82f6 62%, #6366f1 100%);
  --grad-aurora-soft: linear-gradient(115deg, #10b981 0%, #06b6d4 40%, #2563eb 80%, #4f46e5 100%);
  --grad-ink: linear-gradient(160deg, #0b1a3a 0%, #060c1c 60%, #04070f 100%);

  /* ---- Effects ---- */
  --ring-glow: 0 0 0 1px rgba(56, 189, 248, 0.18);
  --shadow-glow: 0 20px 60px -20px rgba(37, 99, 235, 0.45);
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; }

/* ---- Selection ---- */
::selection { background: rgba(34, 211, 238, 0.28); color: #04070f; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: #eef2f7; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #22d3ee, #2563eb);
  border-radius: 20px; border: 2px solid #eef2f7;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #34d399, #06b6d4); }

/* ============ TYPOGRAPHY HELPERS ============ */
.font-mono { font-family: var(--font-mono); }
.tracking-mega { letter-spacing: 0.28em; }

.aurora-text {
  background: linear-gradient(115deg, #34d399, #22d3ee, #3b82f6, #818cf8, #34d399);
  background-size: 250% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: aurora-pan 6s linear infinite;
}
.brand-text {
  background: var(--grad-brand);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.text-glow-light {
  background: linear-gradient(135deg, #a7f3d0 0%, #ffffff 45%, #bae6fd 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
@keyframes aurora-pan { to { background-position: 250% center; } }

/* ============ BACKGROUNDS ============ */
.bg-ink { background: var(--grad-ink); }
.grid-bg {
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px);
  background-size: 54px 54px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 40%, transparent 100%);
}
.grid-bg-dark {
  background-image:
    linear-gradient(rgba(148, 197, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 197, 255, 0.07) 1px, transparent 1px);
  background-size: 54px 54px;
}
.dot-bg {
  background-image: radial-gradient(rgba(148, 197, 255, 0.16) 1px, transparent 1px);
  background-size: 26px 26px;
}
.mesh-light {
  background:
    radial-gradient(at 15% 20%, rgba(16, 185, 129, 0.10) 0, transparent 45%),
    radial-gradient(at 85% 10%, rgba(6, 182, 212, 0.12) 0, transparent 45%),
    radial-gradient(at 75% 80%, rgba(37, 99, 235, 0.10) 0, transparent 45%),
    radial-gradient(at 5% 75%, rgba(99, 102, 241, 0.08) 0, transparent 45%),
    #f6f9fc;
}

/* ---- drifting aurora blobs ---- */
.aurora-blob {
  position: absolute; border-radius: 50%;
  filter: blur(70px); opacity: 0.55; pointer-events: none;
  animation: blob-drift 18s ease-in-out infinite;
}
@keyframes blob-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.12); }
  66% { transform: translate(-30px, 25px) scale(0.94); }
}

/* ============ GLASS ============ */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.glass-dark {
  background: rgba(9, 19, 42, 0.55);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid rgba(148, 197, 255, 0.12);
}

/* ============ GRADIENT BORDER CARDS ============ */
.grad-border {
  position: relative; border-radius: 24px;
  background: #ffffff;
  background-clip: padding-box;
  border: 1px solid #e9eef5;
}
.grad-border::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(52,211,153,.55), rgba(34,211,238,.4), rgba(37,99,235,.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .5s ease;
}
.grad-border:hover::before { opacity: 1; }

/* glowing edge for dark cards */
.glow-card {
  position: relative;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .5s ease;
}
.glow-card::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; z-index: -1;
  background: var(--grad-aurora); opacity: 0; filter: blur(14px);
  transition: opacity .5s ease;
}
.glow-card:hover::after { opacity: .35; }

/* ============ LIFT / TILT ============ */
.lift { transition: transform .5s cubic-bezier(.2,.7,.2,1), box-shadow .5s ease; }
.lift:hover { transform: translateY(-10px); box-shadow: var(--shadow-glow); }

/* ============ BUTTONS ============ */
.btn-primary {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .95rem 1.7rem; border-radius: 999px; font-weight: 600;
  color: #fff; background: linear-gradient(120deg, #0891b2, #2563eb 60%, #4f46e5);
  box-shadow: 0 12px 30px -8px rgba(37, 99, 235, .55);
  transition: transform .3s ease, box-shadow .3s ease;
}
.btn-primary::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(120deg, #34d399, #06b6d4 55%, #3b82f6);
  opacity: 0; transition: opacity .35s ease;
}
.btn-primary span, .btn-primary i { position: relative; z-index: 1; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -8px rgba(6, 182, 212, .6); }
.btn-primary:hover::before { opacity: 1; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .95rem 1.6rem; border-radius: 999px; font-weight: 600;
  color: var(--slate-700); background: rgba(255,255,255,.7);
  border: 1px solid var(--slate-200);
  transition: all .3s ease;
}
.btn-ghost:hover { border-color: #22d3ee; color: #0e7490; background: #fff; transform: translateY(-2px); }

/* ============ CHIPS / BADGES ============ */
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .85rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; letter-spacing: .04em;
}
.chip-live {
  background: rgba(16,185,129,.14); color: #047857;
  border: 1px solid rgba(16,185,129,.30);
}
.chip-tech {
  background: rgba(6,182,212,.1); color: #0e7490;
  border: 1px solid rgba(6,182,212,.25);
}
.chip-dark {
  background: rgba(148,197,255,.1); color: #bae6fd;
  border: 1px solid rgba(148,197,255,.2);
}

/* pulsing status dot */
.pulse-dot { position: relative; display: inline-flex; height: 8px; width: 8px; }
.pulse-dot::before {
  content: ""; position: absolute; inset: 0; border-radius: 999px;
  background: currentColor; animation: ping 1.6s cubic-bezier(0,0,.2,1) infinite;
}
.pulse-dot::after {
  content: ""; position: relative; height: 8px; width: 8px; border-radius: 999px; background: currentColor;
}
@keyframes ping { 75%, 100% { transform: scale(2.4); opacity: 0; } }

/* ============ NAV LINK UNDERLINE ============ */
.nav-link { position: relative; }
.nav-link::after {
  content: ""; position: absolute; left: 0; bottom: -6px; height: 2px; width: 0;
  background: var(--grad-brand); border-radius: 2px; transition: width .35s ease;
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link.active { color: var(--blue-700); }

/* ============ ECG / HEARTBEAT ============ */
.ecg-path {
  stroke-dasharray: 1400; stroke-dashoffset: 1400;
  animation: ecg-draw 4.5s cubic-bezier(.7,0,.3,1) infinite;
}
@keyframes ecg-draw {
  0% { stroke-dashoffset: 1400; }
  55% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -1400; }
}
/* scanning sweep dot travelling along a track */
.scan-line {
  animation: scan-sweep 4s linear infinite;
}
@keyframes scan-sweep {
  0% { transform: translateX(-10%); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateX(110%); opacity: 0; }
}
.heartbeat { animation: heartbeat 1.5s ease-in-out infinite; }
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.18); }
  30% { transform: scale(1); }
  45% { transform: scale(1.1); }
}
.float { animation: float 7s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-16px); } }
.pulse-slow { animation: pulse-slow 5s cubic-bezier(.4,0,.6,1) infinite; }
@keyframes pulse-slow { 0%,100% { opacity: .5; } 50% { opacity: .9; } }
.spin-slow { animation: spin-slow 22s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }

/* ============ MARQUEE ============ */
.marquee {
  overflow: hidden;
  position: relative;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 80px, #000 calc(100% - 80px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 80px, #000 calc(100% - 80px), transparent);
}
.marquee-track {
  display: flex;
  gap: 1rem;
  width: fit-content;
  animation: marquee 40s linear infinite;
  will-change: transform;
}
/* 补位最后一个 gap，确保循环衔接无缝 */
.marquee-track::after {
  content: "";
  width: 1rem;
  flex-shrink: 0;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (max-width: 768px) {
  .marquee {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 40px, #000 calc(100% - 40px), transparent);
  }
  .marquee-track { animation-duration: 28s; }
}

/* ============ SCROLL REVEAL ============ */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .8s cubic-bezier(.2,.7,.2,1), transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal-1 { transition-delay: .08s; }
.reveal-2 { transition-delay: .16s; }
.reveal-3 { transition-delay: .24s; }
.reveal-4 { transition-delay: .32s; }
.reveal-5 { transition-delay: .40s; }

/* ============ SCROLL PROGRESS (heartbeat) ============ */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: linear-gradient(90deg, #34d399, #22d3ee, #3b82f6, #6366f1);
  z-index: 100; transition: width .1s linear;
  box-shadow: 0 0 12px rgba(34, 211, 238, .7);
}

/* ============ SHIMMER (for logos/skeleton accents) ============ */
.shimmer {
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  background-size: 200% 100%; animation: shimmer 3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* underline accent for section eyebrows */
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
}

/* number counter tabular */
.counter { font-variant-numeric: tabular-nums; font-family: var(--font-mono); }

/* ============ FOCUS VISIBLE (keyboard a11y) ============ */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible,
[data-accordion]:focus-visible, [data-copy]:focus-visible, [data-filter]:focus-visible {
  outline: 2px solid #0891b2;
  outline-offset: 3px;
  border-radius: 8px;
}
.btn-primary:focus-visible, .btn-ghost:focus-visible { outline-offset: 4px; }
/* dark sections: brighter focus ring */
.bg-ink :focus-visible, .glass-dark :focus-visible { outline-color: #22d3ee; }

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ============ HEADER / NAV ============ */
#navbar { transition: transform .4s ease; }
.nav-shell {
  transition: background .4s ease, box-shadow .4s ease, border-color .4s ease;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}
.nav-scrolled .nav-shell {
  box-shadow: 0 14px 40px -16px rgba(15, 42, 86, 0.35);
  border-color: rgba(226, 232, 240, 0.9);
}
#mobile-menu { overflow: hidden; transition: max-height .4s ease, opacity .3s ease; }
#mobile-menu.open { max-height: 420px; opacity: 1; }
#mobile-menu.hidden { max-height: 0; opacity: 0; }

/* ============ FAQ / accordion ============ */
[data-panel] { max-height: 0; overflow: hidden; transition: max-height .45s cubic-bezier(.4,0,.2,1); }
[data-accordion] .acc-icon { transition: transform .35s ease; }

/* ============ news filter tabs ============ */
.filter-tab { transition: all .3s ease; }
.filter-active {
  background: var(--grad-brand); color: #fff !important;
  box-shadow: 0 8px 20px -8px rgba(37, 99, 235, .5);
}

/* ============ TOC active ============ */
[data-toc] { transition: all .25s ease; }
.toc-active { color: var(--blue-700); font-weight: 600; }
.toc-active .toc-dot { background: var(--blue-600); transform: scale(1.5); }

/* ============ LOADER ============ */
.tw-loader {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(ellipse at 50% 40%, #0b1a3a 0%, #060c1c 70%, #04070f 100%);
  transition: opacity .6s ease;
}
.tw-loaded .tw-loader { opacity: 0; pointer-events: none; }
body.tw-loading > *:not(.tw-loader) { visibility: hidden; }
.tw-loader-ecg { width: 120px; height: 40px; }
.tw-loader-ecg path {
  stroke: url(#loaderGrad); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 300; stroke-dashoffset: 300; animation: ecg-draw 1.8s cubic-bezier(.7,0,.3,1) infinite;
}
.tw-loader-text { font-size: 12px; letter-spacing: .28em; color: #7dd3fc; text-transform: uppercase; }

/* ============ MOBILE ============ */
@media (max-width: 640px) {
  html, body { overflow-x: hidden; }
  .grid-bg, .grid-bg-dark { background-size: 34px 34px; }
  .dot-bg { background-size: 20px 20px; }
  .aurora-blob { filter: blur(50px); }
}
