:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: rgba(30, 30, 50, 0.65);
  --bg-glass: rgba(255, 255, 255, 0.06);
  --bg-glass-strong: rgba(255, 255, 255, 0.1);
  --text-primary: #f0f0f8;
  --text-secondary: #b0b0c8;
  --text-muted: #8080a0;
  --accent: #7c5cff;
  --accent-2: #ff5c8a;
  --accent-3: #5cc8ff;
  --gradient-banner: linear-gradient(135deg, #1a1a2e 0%, #2d1b4e 40%, #4a1f5c 70%, #6b2a5e 100%);
  --gradient-accent: linear-gradient(135deg, #7c5cff 0%, #ff5c8a 100%);
  --gradient-accent-2: linear-gradient(135deg, #5cc8ff 0%, #7c5cff 100%);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(124, 92, 255, 0.35);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 16px 48px rgba(124, 92, 255, 0.25);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --blur-glass: blur(18px) saturate(160%);
  --transition-base: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --max-width: 1180px;
  --header-height: 68px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 20px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-stack);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.75;
  font-size: 16px;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(124, 92, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255, 92, 138, 0.08), transparent),
    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(92, 200, 255, 0.06), transparent),
    var(--bg-primary);
  pointer-events: none;
}

::selection {
  background: rgba(124, 92, 255, 0.4);
  color: #fff;
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #7c5cff, #ff5c8a);
  border-radius: 10px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #8f73ff, #ff7a9f);
}

a {
  color: var(--accent-3);
  text-decoration: none;
  transition: color var(--transition-base), opacity var(--transition-base);
}

a:hover {
  color: var(--accent-2);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

ul,
ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============ HEADER / NAV ============ */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(15, 15, 26, 0.72);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

header nav {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

header nav > a {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform var(--transition-base), filter var(--transition-base);
}

header nav > a:hover {
  transform: scale(1.04);
  filter: brightness(1.2);
}

header nav ul {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.2vw, 18px);
  flex-wrap: wrap;
  justify-content: flex-end;
}

header nav ul li a {
  display: inline-block;
  padding: 8px 14px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  position: relative;
  transition: color var(--transition-base), background var(--transition-base), transform var(--transition-base);
}

header nav ul li a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 0;
  height: 2px;
  background: var(--gradient-accent);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width var(--transition-base);
}

header nav ul li a:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
  transform: translateY(-1px);
}

header nav ul li a:hover::after {
  width: 60%;
}

/* ============ MAIN LAYOUT ============ */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px) 80px;
}

section {
  padding: clamp(40px, 7vw, 80px) 0;
  position: relative;
}

section:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-subtle), transparent);
}

/* ============ HERO / HOME ============ */
#home {
  margin-top: clamp(20px, 4vw, 40px);
  padding: clamp(48px, 10vw, 120px) clamp(24px, 6vw, 72px);
  border-radius: var(--radius-xl);
  background: var(--gradient-banner);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  isolation: isolate;
}

#home::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(124, 92, 255, 0.45), transparent 45%),
    radial-gradient(circle at 85% 30%, rgba(255, 92, 138, 0.35), transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(92, 200, 255, 0.25), transparent 50%);
  z-index: -1;
  animation: heroGlow 12s ease-in-out infinite alternate;
}

#home::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.06) 50%, transparent 70%);
  transform: rotate(15deg);
  pointer-events: none;
  animation: heroShine 8s ease-in-out infinite;
}

@keyframes heroGlow {
  0% { opacity: 0.8; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.08); }
}

@keyframes heroShine {
  0%, 100% { transform: translateX(0) rotate(15deg); opacity: 0.6; }
  50% { transform: translateX(-30%) rotate(15deg); opacity: 1; }
}

#home h1 {
  font-size: clamp(1.6rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 24px;
  background: linear-gradient(120deg, #ffffff 0%, #d4c8ff 50%, #ffc8d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: 0 2px 30px rgba(124, 92, 255, 0.3);
  animation: fadeUp 0.9s var(--transition-smooth) both;
}

#home p {
  font-size: clamp(0.95rem, 1.6vw, 1.12rem);
  color: rgba(240, 240, 248, 0.82);
  max-width: 780px;
  line-height: 1.9;
  animation: fadeUp 0.9s 0.15s var(--transition-smooth) both;
}

/* ============ HEADINGS ============ */
h2 {
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 28px;
  position: relative;
  padding-left: 18px;
  letter-spacing: -0.01em;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.15em;
  width: 5px;
  border-radius: 4px;
  background: var(--gradient-accent);
  box-shadow: 0 0 16px var(--border-glow);
}

h3 {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 700;
  line-height: 1.5;
  margin: 28px 0 12px;
  color: var(--text-primary);
  transition: color var(--transition-base);
}

h3:hover {
  color: #c8b8ff;
}

p {
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-size: clamp(0.92rem, 1.4vw, 1rem);
  line-height: 1.85;
}

/* ============ CARDS (sections content) ============ */
#about,
#products,
#solutions,
#cases,
#news,
#articles,
#howto,
#faq,
#knowledge,
#contact,
#sitemap,
#links,
#legal {
  scroll-margin-top: calc(var(--header-height) + 24px);
}

#about p,
#products p,
#solutions p,
#cases p,
#howto p,
#knowledge p,
#contact p,
#legal p {
  max-width: 860px;
}

/* News & Articles cards */
#news article,
#articles article {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 32px);
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth);
  animation: fadeUp 0.7s var(--transition-smooth) both;
}

#news article::before,
#articles article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-accent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

#news article:hover,
#articles article:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-glow);
}

#news article:hover::before,
#articles article:hover::before {
  opacity: 1;
}

#news article h3,
#articles article h3 {
  margin-top: 0;
  color: var(--text-primary);
}

#news article p:first-of-type,
#articles article p:first-of-type {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

#articles article a {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-3);
  padding: 6px 16px;
  border: 1px solid rgba(92, 200, 255, 0.3);
  border-radius: 999px;
  transition: all var(--transition-base);
}

#articles article a:hover {
  background: var(--gradient-accent-2);
  color: #fff;
  border-color: transparent;
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(92, 200, 255, 0.3);
}

/* ============ HOWTO ============ */
#howto ol {
  counter-reset: step-counter;
  margin: 16px 0 24px;
  padding: 0;
}

#howto ol li {
  counter-increment: step-counter;
  position: relative;
  padding: 16px 20px 16px 64px;
  margin-bottom: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: background var(--transition-base), transform var(--transition-base), border-color var(--transition-base);
}

#howto ol li::before {
  content: counter(step-counter);
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  color: #fff;
  background: var(--gradient-accent);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(124, 92, 255, 0.4);
}

#howto ol li:hover {
  background: var(--bg-glass-strong);
  transform: translateX(6px);
  border-color: var(--border-glow);
}

/* ============ FAQ ============ */
#faq h3 {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 16px 20px 16px 48px;
  margin: 16px 0 0;
  position: relative;
  cursor: default;
  transition: background var(--transition-base), border-color var(--transition-base);
}

#faq h3::before {
  content: "Q";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: #fff;
  background: var(--gradient-accent);
  border-radius: 50%;
}

#faq h3:hover {
  background: var(--bg-glass-strong);
  border-color: var(--border-glow);
}

#faq h3 + p {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 4px 20px 18px 48px;
  margin: 0 0 4px;
  position: relative;
}

#faq h3 + p::before {
  content: "A";
  position: absolute;
  left: 16px;
  top: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--accent-3);
  background: rgba(92, 200, 255, 0.12);
  border: 1px solid rgba(92, 200, 255, 0.3);
  border-radius: 50%;
}

/* ============ CONTACT ============ */
#contact {
  background: var(--bg-card);
  backdrop-filter: var(--blur-glass);
  -webkit-backdrop-filter: var(--blur-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: clamp(28px, 5vw, 56px);
  margin: clamp(24px, 4vw, 48px) 0;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

#contact::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 50%;
  height: 150%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.18), transparent 70%);
  pointer-events: none;
}

#contact p {
  position: relative;
  z-index: 1;
}

#contact p:last-child {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 500;
}

/* ============ SITEMAP / LINKS ============ */
#sitemap ul,
#links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

#sitemap ul li a,
#links ul li a {
  display: inline-block;
  padding: 10px 22px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

#sitemap ul li a:hover,
#links ul li a:hover {
  background: var(--gradient-accent);
  color: #fff;
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35);
}

/* ============ LEGAL ============ */
#legal {
  font-size: 0.88rem;
}

#legal h2 {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  margin-top: 28px;
  margin-bottom: 14px;
}

#legal p:last-child {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

/* ============ FOOTER ============ */
footer {
  background: linear-gradient(180deg, rgba(15, 15, 26, 0) 0%, rgba(26, 26, 46, 0.9) 100%);
  border-top: 1px solid var(--border-subtle);
  padding: clamp(32px, 5vw, 56px) clamp(16px, 4vw, 40px);
  text-align: center;
}

footer p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

footer p:last-child {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(28px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

section {
  animation: fadeIn 0.8s var(--transition-smooth) both;
}

#about { animation-delay: 0.05s; }
#products { animation-delay: 0.1s; }
#solutions { animation-delay: 0.15s; }
#cases { animation-delay: 0.2s; }
#news { animation-delay: 0.25s; }
#articles { animation-delay: 0.3s; }
#howto { animation-delay: 0.35s; }
#faq { animation-delay: 0.4s; }
#knowledge { animation-delay: 0.45s; }
#contact { animation-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  header {
    height: auto;
    min-height: var(--header-height);
    padding: 12px clamp(16px, 4vw, 40px);
  }

  header nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  header nav ul {
    width: 100%;
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  header nav ul::-webkit-scrollbar {
    display: none;
  }

  header nav ul li a {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 7px 12px;
  }

  html {
    scroll-padding-top: 130px;
  }

  section {
    scroll-margin-top: 130px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  #home {
    padding: 40px 24px;
    border-radius: var(--radius-lg);
  }

  h2 {
    padding-left: 14px;
  }

  h2::before {
    width: 4px;
  }

  #news article,
  #articles article {
    padding: 20px 18px;
    border-radius: var(--radius-md);
  }

  #howto ol li {
    padding: 14px 16px 14px 56px;
  }

  #howto ol li::before {
    left: 12px;
    width: 30px;
    height: 30px;
  }

  #faq h3 {
    padding: 14px 16px 14px 44px;
    font-size: 0.98rem;
  }

  #faq h3::before {
    left: 12px;
    width: 22px;
    height: 22px;
  }

  #faq h3 + p {
    padding: 4px 16px 16px 44px;
  }

  #faq h3 + p::before {
    left: 12px;
    width: 22px;
    height: 22px;
  }

  #contact {
    padding: 24px 20px;
    border-radius: var(--radius-lg);
  }

  #sitemap ul,
  #links ul {
    gap: 8px;
  }

  #sitemap ul li a,
  #links ul li a {
    padding: 8px 16px;
    font-size: 0.82rem;
  }
}

@media (max-width: 400px) {
  header nav ul li a {
    font-size: 0.8rem;
    padding: 6px 10px;
  }

  #home h1 {
    font-size: 1.45rem;
  }
}

/* ============ LIGHT MODE SUPPORT ============ */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #f4f4fa;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.72);
    --bg-glass: rgba(255, 255, 255, 0.55);
    --bg-glass-strong: rgba(255, 255, 255, 0.85);
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a68;
    --text-muted: #8888a0;
    --border-subtle: rgba(26, 26, 46, 0.08);
    --border-glow: rgba(124, 92, 255, 0.25);
    --shadow-card: 0 8px 32px rgba(26, 26, 46, 0.08);
    --shadow-hover: 0 16px 48px rgba(124, 92, 255, 0.18);
  }

  body::before {
    background:
      radial-gradient(ellipse 80% 50% at 20% 0%, rgba(124, 92, 255, 0.08), transparent),
      radial-gradient(ellipse 60% 40% at 80% 20%, rgba(255, 92, 138, 0.05), transparent),
      radial-gradient(ellipse 70% 60% at 50% 100%, rgba(92, 200, 255, 0.05), transparent),
      var(--bg-primary);
  }

  header {
    background: rgba(244, 244, 250, 0.78);
    box-shadow: 0 4px 30px rgba(26, 26, 46, 0.06);
  }

  #home {
    background: linear-gradient(135deg, #e8e4ff 0%, #f0e0ff 40%, #ffe0ec 70%, #e0f0ff 100%);
    box-shadow: 0 8px 40px rgba(124, 92, 255, 0.15);
  }

  #home h1 {
    background: linear-gradient(120deg, #2d1b4e 0%, #5a3fa8 50%, #c04070 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: none;
  }

  #home p {
    color: #4a4a68;
  }

  #home::before {
    opacity: 0.35;
  }

  footer {
    background: linear-gradient(180deg, rgba(244, 244, 250, 0) 0%, rgba(232, 228, 255, 0.8) 100%);
  }

  #articles article a {
    color: #5a3fa8;
    border-color: rgba(124, 92, 255, 0.3);
  }

  #faq h3 + p::before {
    color: #2a7ab8;
    background: rgba(92, 200, 255, 0.15);
    border-color: rgba(92, 200, 255, 0.4);
  }

  a {
    color: #5a3fa8;
  }

  a:hover {
    color: #c04070;
  }
}

/* ============ PRINT ============ */
@media print {
  header,
  footer,
  #sitemap,
  #links {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  body::before,
  #home::before,
  #home::after,
  #contact::before,
  h2::before {
    display: none;
  }

  section {
    animation: none;
    page-break-inside: avoid;
  }

  #home {
    background: none;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  #home h1 {
    -webkit-text-fill-color: #000;
    color: #000;
    background: none;
  }

  #news article,
  #articles article,
  #contact {
    background: none;
    border: 1px solid #ccc;
    box-shadow: none;
  }
}