:root {
  --primary: #6b46c1;
  --primary-light: #8b5cf6;
  --primary-dark: #4c1d95;
  --accent: #ec4899;
  --accent-light: #f472b6;
  --bg: #faf8ff;
  --bg-alt: #f3e8ff;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --text: #1e1b2e;
  --text-muted: #6b6580;
  --border: rgba(107, 70, 193, 0.14);
  --shadow-sm: 0 2px 8px rgba(76, 29, 149, 0.06);
  --shadow-md: 0 8px 28px rgba(76, 29, 149, 0.1);
  --shadow-lg: 0 20px 56px rgba(76, 29, 149, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --gradient-hero: linear-gradient(135deg, #6b46c1 0%, #8b5cf6 42%, #ec4899 100%);
  --gradient-soft: linear-gradient(160deg, #faf5ff 0%, #f3e8ff 55%, #fce7f3 100%);
  --gradient-btn: linear-gradient(135deg, #7c3aed 0%, #a855f7 55%, #ec4899 100%);
  --header-h: 76px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body.dark {
  --primary: #a78bfa;
  --primary-light: #c4b5fd;
  --primary-dark: #7c3aed;
  --accent: #f472b6;
  --accent-light: #f9a8d4;
  --bg: #0f0b1a;
  --bg-alt: #171029;
  --surface: #1b1330;
  --surface-glass: rgba(27, 19, 48, 0.72);
  --text: #ede9fe;
  --text-muted: #a79fc0;
  --border: rgba(167, 139, 250, 0.18);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 20px 56px rgba(0, 0, 0, 0.55);
  --gradient-hero: linear-gradient(135deg, #4c1d95 0%, #6d28d9 45%, #be185d 100%);
  --gradient-soft: linear-gradient(160deg, #140e24 0%, #1b1330 55%, #241335 100%);
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(circle at 12% 8%, rgba(139, 92, 246, 0.1), transparent 42%),
    radial-gradient(circle at 88% 24%, rgba(236, 72, 153, 0.08), transparent 40%);
  background-attachment: fixed;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  overflow-x: hidden;
}

body.dark {
  background-image: radial-gradient(circle at 12% 8%, rgba(139, 92, 246, 0.16), transparent 42%),
    radial-gradient(circle at 88% 24%, rgba(236, 72, 153, 0.12), transparent 40%);
}

::selection {
  background: var(--primary);
  color: #fff;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.6em;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.65rem, 4.2vw, 2.75rem);
  font-weight: 800;
  line-height: 1.28;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 2rem);
  position: relative;
  padding-bottom: 0.55em;
  margin-top: 0;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 4px;
  border-radius: 4px;
  background: var(--gradient-btn);
}

h3 {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  color: var(--primary-dark);
  margin-top: 1.6em;
}

body.dark h3 {
  color: var(--primary-light);
}

h4 {
  font-size: 1.05rem;
  color: var(--primary);
  margin-top: 1.3em;
}

p {
  margin: 0 0 1.1em;
  color: var(--text-muted);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

ul,
ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
  color: var(--text-muted);
}

li {
  margin-bottom: 0.4em;
}

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

strong {
  color: var(--text);
}

blockquote {
  margin: 1.2em 0;
  padding: 1.1em 1.4em;
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

blockquote:hover {
  transform: translateX(6px);
  box-shadow: var(--shadow-md);
}

blockquote p {
  margin: 0;
  color: var(--text);
  font-style: italic;
}

:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ============ Header ============ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.35s var(--ease), background 0.35s var(--ease);
}

#site-header.sticky {
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  min-height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  transition: transform 0.35s var(--ease);
}

.logo:hover {
  transform: scale(1.04);
  color: inherit;
}

.logo svg {
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(107, 70, 193, 0.35);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  background: var(--gradient-btn);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

nav[aria-label="主导航"] {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-menu li {
  margin: 0;
}

.nav-menu a {
  display: block;
  padding: 0.42rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  position: relative;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

.nav-menu a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient-btn);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease);
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
  transform: translateY(-1px);
}

.nav-menu a:hover::after {
  width: 60%;
}

#menu-toggle,
#theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 1.15rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}

#menu-toggle {
  display: none;
}

#menu-toggle:hover,
#theme-toggle:hover {
  transform: rotate(12deg) scale(1.08);
  box-shadow: var(--shadow-md);
  background: var(--bg-alt);
}

#theme-toggle {
  margin-left: auto;
}

#site-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

#site-search input[type="search"] {
  width: 180px;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: width 0.35s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

#site-search input[type="search"]::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

#site-search input[type="search"]:focus {
  width: 220px;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.16);
}

#site-search button {
  padding: 0.5rem 1.1rem;
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--gradient-btn);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), filter 0.25s var(--ease);
}

#site-search button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
  filter: brightness(1.06);
}

#site-search button:active {
  transform: translateY(0);
}

/* ============ Main layout ============ */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

main > section {
  margin: 2.5rem 0;
  padding: clamp(1.4rem, 3.5vw, 2.6rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease), border-color 0.4s var(--ease);
  animation: fadeUp 0.8s var(--ease) both;
}

main > section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--gradient-soft);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

body.dark main > section::before {
  opacity: 0.5;
}

main > section > * {
  position: relative;
  z-index: 1;
}

main > section:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(139, 92, 246, 0.28);
}

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

/* ============ Breadcrumb ============ */
.breadcrumb {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.85rem;
}

.breadcrumb ol {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.breadcrumb li {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-muted);
}

.breadcrumb li + li::before {
  content: "›";
  color: var(--primary-light);
  font-weight: 700;
  margin-right: 0.1rem;
}

.breadcrumb a {
  color: var(--primary);
  font-weight: 500;
}

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

/* ============ Hero ============ */
#hero {
  background: var(--gradient-hero);
  color: #fff;
  border: none;
  border-radius: var(--radius-xl);
  padding: clamp(1.8rem, 5vw, 3.4rem);
  margin-top: 1.5rem;
  box-shadow: 0 24px 64px rgba(107, 70, 193, 0.32);
  isolation: isolate;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.22), transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(236, 72, 153, 0.35), transparent 50%);
  opacity: 1;
  z-index: 0;
}

#hero::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 60%);
  transform: rotate(18deg);
  pointer-events: none;
  z-index: 0;
}

#hero h1 {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 1;
}

.hero-lead {
  max-width: 860px;
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.85;
  position: relative;
  z-index: 1;
}

/* Carousel */
.carousel {
  position: relative;
  margin: 1.8rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  background: rgba(255, 255, 255, 0.1);
  z-index: 1;
  min-height: 200px;
}

.carousel .slide {
  display: none;
  animation: slideFade 0.7s var(--ease);
}

.carousel .slide.active {
  display: block;
}

.carousel svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

@keyframes slideFade {
  from {
    opacity: 0;
    transform: scale(1.03);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-top: 1.6rem;
  position: relative;
  z-index: 1;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 0.75rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius-md);
  transition: transform 0.35s var(--ease), background 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.stat:hover {
  transform: translateY(-6px);
  background: rgba(255, 255, 255, 0.24);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
}

.stat .num {
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  letter-spacing: -0.02em;
}

.stat span:last-child {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.86);
  margin-top: 0.3rem;
}

/* ============ Articles ============ */
#articles article {
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.1rem;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}

#articles article:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(139, 92, 246, 0.35);
}

#articles article h3 {
  margin-top: 0;
  color: var(--text);
  transition: color 0.25s var(--ease);
}

#articles article:hover h3 {
  color: var(--primary);
}

#articles article p:first-of-type {
  font-size: 0.82rem;
  color: var(--primary-light);
  font-weight: 600;
  margin-bottom: 0.5em;
}

#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.12);
  transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}

#articles article a::after {
  content: "→";
  transition: transform 0.3s var(--ease);
}

#articles article a:hover {
  background: var(--gradient-btn);
  color: #fff;
  transform: translateX(3px);
}

#articles article a:hover::after {
  transform: translateX(4px);
}

/* ============ FAQ ============ */
#faq details {
  margin-bottom: 0.85rem;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
}

#faq details:hover {
  border-color: rgba(139, 92, 246, 0.35);
  box-shadow: var(--shadow-sm);
}

#faq details[open] {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  background: var(--surface);
}

#faq summary {
  position: relative;
  padding: 1rem 3rem 1rem 1.25rem;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
  border-radius: var(--radius-md);
}

#faq summary::-webkit-details-marker {
  display: none;
}

#faq summary::after {
  content: "+";
  position: absolute;
  right: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 400;
  color: #fff;
  background: var(--gradient-btn);
  border-radius: 50%;
  transition: transform 0.35s var(--ease), background 0.35s var(--ease);
}

#faq details[open] summary::after {
  content: "−";
  transform: translateY(-50%) rotate(180deg);
}

#faq summary:hover {
  color: var(--primary);
  background: rgba(139, 92, 246, 0.07);
}

#faq details > p {
  padding: 0 1.25rem 1.1rem;
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.8;
  animation: fadeUp 0.4s var(--ease);
}

/* ============ HowTo ============ */
#howto h4 {
  position: relative;
  padding-left: 1.6rem;
}

#howto h4::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gradient-btn);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.16);
}

/* ============ Contact ============ */
#contact p {
  padding: 0.55rem 0;
  border-bottom: 1px dashed var(--border);
  margin: 0;
}

#contact p:last-of-type {
  border-bottom: none;
}

#contact h3 + p {
  margin-top: 0.5rem;
}

/* ============ Sitemap & Links ============ */
#sitemap ul,
#links ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

#sitemap li,
#links li {
  margin: 0;
}

#sitemap a,
#links a {
  display: inline-block;
  padding: 0.45rem 1.05rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

#sitemap a:hover,
#links a:hover {
  transform: translateY(-3px);
  background: var(--gradient-btn);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.32);
}

/* ============ Footer ============ */
footer {
  margin-top: 3rem;
  padding: 2.6rem 1.25rem 1.6rem;
  background: var(--gradient-soft);
  border-top: 1px solid var(--border);
  position: relative;
}

footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-btn);
}

footer > section {
  max-width: 1280px;
  margin: 0 auto 1.8rem;
  padding: 1.4rem 1.6rem;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.35s var(--ease);
}

footer > section:hover {
  box-shadow: var(--shadow-md);
}

footer h2 {
  font-size: 1.15rem;
  padding-bottom: 0.4em;
}

footer h2::after {
  width: 44px;
  height: 3px;
}

footer h3 {
  font-size: 1rem;
  margin-top: 1.1em;
}

footer p {
  font-size: 0.9rem;
  margin-bottom: 0.6em;
}

.copyright {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.2rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ============ Back to top ============ */
#back-to-top {
  position: fixed;
  right: 1.4rem;
  bottom: 1.6rem;
  z-index: 999;
  display: none;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: var(--gradient-btn);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.45);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), filter 0.3s var(--ease);
  animation: popIn 0.35s var(--ease);
}

#back-to-top:hover {
  transform: translateY(-5px) scale(1.08);
  box-shadow: 0 16px 36px rgba(236, 72, 153, 0.5);
  filter: brightness(1.08);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============ Responsive ============ */
@media (max-width: 1080px) {
  .header-inner {
    gap: 0.7rem;
  }

  #site-search input[type="search"] {
    width: 150px;
  }

  #site-search input[type="search"]:focus {
    width: 180px;
  }

  .nav-menu a {
    padding: 0.4rem 0.55rem;
    font-size: 0.86rem;
  }
}

@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
  }

  #menu-toggle {
    display: inline-flex;
    order: 2;
  }

  .logo {
    order: 1;
  }

  #theme-toggle {
    order: 3;
    margin-left: 0;
  }

  #site-search {
    order: 4;
    width: 100%;
    margin-top: 0.4rem;
  }

  #site-search input[type="search"],
  #site-search input[type="search"]:focus {
    flex: 1;
    width: auto;
  }

  nav[aria-label="主导航"] {
    order: 5;
    flex-basis: 100%;
  }

  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.45s var(--ease), opacity 0.35s var(--ease), padding 0.35s var(--ease);
    padding: 0;
  }

  .nav-menu.open {
    max-height: 640px;
    opacity: 1;
    padding: 0.5rem 0 0.3rem;
  }

  .nav-menu a {
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
  }

  .nav-menu a::after {
    display: none;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  main {
    padding: 0 0.85rem 2.2rem;
  }

  main > section {
    margin: 1.6rem 0;
    padding: 1.2rem 1.05rem;
    border-radius: var(--radius-lg);
  }

  #hero {
    padding: 1.4rem 1.1rem;
    border-radius: var(--radius-lg);
  }

  .hero-lead {
    font-size: 0.92rem;
    line-height: 1.75;
  }

  .carousel svg {
    height: 160px;
  }

  .stats {
    gap: 0.65rem;
  }

  .stat {
    padding: 0.85rem 0.5rem;
  }

  .stat span:last-child {
    font-size: 0.74rem;
  }

  #articles article {
    padding: 1.05rem 1.1rem;
  }

  #faq summary {
    padding: 0.85rem 2.7rem 0.85rem 1rem;
    font-size: 0.92rem;
  }

  #faq details > p {
    padding: 0 1rem 1rem;
    font-size: 0.88rem;
  }

  footer {
    padding: 1.8rem 0.85rem 1.2rem;
  }

  footer > section {
    padding: 1.1rem 1.1rem;
  }

  #back-to-top {
    right: 0.9rem;
    bottom: 1rem;
    width: 44px;
    height: 44px;
  }

  h2::after {
    width: 48px;
    height: 3px;
  }
}

@media (max-width: 380px) {
  .stats {
    grid-template-columns: 1fr;
  }

  .logo-text {
    font-size: 1.05rem;
  }
}

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

@media print {
  #site-header,
  #back-to-top,
  #site-search,
  .carousel {
    display: none !important;
  }

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

  main > section {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}