:root {
  --primary: #c8102e;
  --primary-dark: #9e0b23;
  --primary-light: #ff5c75;
  --primary-soft: rgba(200, 16, 46, 0.08);
  --accent: #ffb3c0;
  --gradient-hero: linear-gradient(135deg, #c8102e 0%, #7a0a1c 55%, #4a0d1a 100%);
  --gradient-card: linear-gradient(160deg, rgba(255, 255, 255, 0.9), rgba(255, 240, 243, 0.75));
  --bg: #fdf7f8;
  --bg-alt: #fff;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #fff;
  --glass-border: rgba(255, 255, 255, 0.55);
  --text: #241a1d;
  --text-soft: #5c4a50;
  --text-muted: #8a767c;
  --border: rgba(200, 16, 46, 0.14);
  --shadow-sm: 0 2px 10px rgba(122, 10, 28, 0.06);
  --shadow-md: 0 10px 30px rgba(122, 10, 28, 0.1);
  --shadow-lg: 0 20px 60px rgba(122, 10, 28, 0.16);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;
  --header-h: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --primary: #ff5c75;
  --primary-dark: #c8102e;
  --primary-light: #ff8a9c;
  --primary-soft: rgba(255, 92, 117, 0.12);
  --accent: #ffb3c0;
  --gradient-hero: linear-gradient(135deg, #3a0a14 0%, #1c060b 60%, #12050a 100%);
  --gradient-card: linear-gradient(160deg, rgba(44, 26, 32, 0.92), rgba(28, 16, 20, 0.85));
  --bg: #120a0d;
  --bg-alt: #1a0f13;
  --surface: rgba(38, 24, 29, 0.72);
  --surface-solid: #241519;
  --glass-border: rgba(255, 255, 255, 0.1);
  --text: #f6e9ec;
  --text-soft: #cdb8be;
  --text-muted: #9c868d;
  --border: rgba(255, 92, 117, 0.2);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --primary: #ff5c75;
    --primary-dark: #c8102e;
    --primary-light: #ff8a9c;
    --primary-soft: rgba(255, 92, 117, 0.12);
    --accent: #ffb3c0;
    --gradient-hero: linear-gradient(135deg, #3a0a14 0%, #1c060b 60%, #12050a 100%);
    --gradient-card: linear-gradient(160deg, rgba(44, 26, 32, 0.92), rgba(28, 16, 20, 0.85));
    --bg: #120a0d;
    --bg-alt: #1a0f13;
    --surface: rgba(38, 24, 29, 0.72);
    --surface-solid: #241519;
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #f6e9ec;
    --text-soft: #cdb8be;
    --text-muted: #9c868d;
    --border: rgba(255, 92, 117, 0.2);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
  }
}

*,
*::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(1200px 600px at 100% -10%, var(--primary-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(255, 179, 192, 0.18), transparent 55%);
  background-attachment: fixed;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  overflow-x: hidden;
}

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

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

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--primary-light);
  outline-offset: 2px;
  border-radius: 6px;
}

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

h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.4rem); }
h4 { font-size: 1.05rem; }

p {
  margin: 0 0 1em;
  color: var(--text-soft);
}

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

li {
  margin-bottom: 0.45em;
}

strong {
  color: var(--text);
  font-weight: 700;
}

blockquote {
  margin: 1em 0;
  padding: 1em 1.2em;
  border-left: 4px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
  font-style: italic;
}

blockquote p { margin: 0; }

time {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--primary-soft);
  padding: 0.1em 0.6em;
  border-radius: var(--radius-pill);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.45rem clamp(1rem, 4vw, 2.5rem);
  font-size: 0.78rem;
  color: #fff;
  background: var(--gradient-hero);
  letter-spacing: 0.02em;
}

.top-bar span {
  opacity: 0.92;
}

#main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  max-width: 1280px;
  margin: 0 auto;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.logo:hover {
  text-decoration: none;
  color: var(--primary);
}

.logo svg {
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(200, 16, 46, 0.35);
  transition: transform 0.4s var(--ease);
}

.logo:hover svg {
  transform: rotate(-6deg) scale(1.06);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
}

.nav-links a {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  text-decoration: none;
  position: relative;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

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

.nav-links a:hover {
  color: var(--primary);
  background: var(--primary-soft);
  text-decoration: none;
  transform: translateY(-1px);
}

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

.site-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 0 1 300px;
  min-width: 200px;
}

.site-search input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

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

.site-search input[type="search"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.site-search button {
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--gradient-hero);
  border: none;
  border-radius: var(--radius-pill);
  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(-1px);
  box-shadow: 0 8px 20px rgba(200, 16, 46, 0.3);
  filter: brightness(1.08);
}

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

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0.5rem clamp(1rem, 4vw, 2.5rem) 0.7rem;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumb li {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.breadcrumb li + li::before {
  content: "›";
  margin: 0 0.45rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.breadcrumb a {
  color: var(--text-soft);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
  color: var(--primary);
  font-weight: 600;
}

/* ============ MAIN LAYOUT ============ */
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem;
}

main > section {
  margin: 2.5rem 0;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: var(--gradient-card);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  animation: riseIn 0.7s var(--ease) both;
  animation-timeline: view();
  animation-range: entry 0% cover 28%;
}

@supports not (animation-timeline: view()) {
  main > section {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

main > section::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--primary-soft), transparent 70%);
  pointer-events: none;
  border-radius: 50%;
}

main > section > h2 {
  position: relative;
  padding-bottom: 0.55rem;
  margin-bottom: 1.25rem;
}

main > section > h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

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

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

/* ============ HERO ============ */
#hero {
  margin-top: 1.75rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: var(--gradient-hero);
  border: none;
  color: #fff;
  isolation: isolate;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 300px at 85% 10%, rgba(255, 179, 192, 0.28), transparent 65%),
    radial-gradient(500px 320px at 5% 90%, rgba(255, 214, 220, 0.18), transparent 60%);
  z-index: -1;
  pointer-events: none;
}

#hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, 0.06) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: shimmer 8s linear infinite;
  pointer-events: none;
  z-index: -1;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

#hero h1 {
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
  margin-bottom: 0.75rem;
}

#hero .hero-lead {
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  max-width: 900px;
  margin-bottom: 1.75rem;
}

.hero-banner {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.18);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
}

.hero-banner:hover {
  transform: translateY(-4px) scale(1.005);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.4);
}

.hero-banner svg {
  width: 100%;
  height: auto;
  display: block;
}

.banner-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
}

.banner-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: background 0.3s var(--ease), transform 0.3s var(--ease);
}

.banner-dots span:first-child {
  background: #fff;
  transform: scale(1.2);
}

.hero-banner:hover .banner-dots span {
  background: rgba(255, 255, 255, 0.7);
}

.hero-banner:hover .banner-dots span:first-child {
  background: #fff;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
}

.hero-stats li {
  margin: 0;
  padding: 1rem 0.75rem;
  text-align: center;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.1);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  transition: transform 0.35s var(--ease), background 0.35s var(--ease);
}

.hero-stats li:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.18);
}

.hero-stats strong {
  display: block;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 0.15rem;
  letter-spacing: -0.01em;
}

/* ============ TOC ============ */
#toc {
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--surface);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin: 2.5rem 0;
  animation: fadeUp 0.7s var(--ease) both;
}

#toc h2 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--border);
}

#toc ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}

#toc li {
  margin: 0;
  counter-increment: toc;
}

#toc a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-soft);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  text-decoration: none;
  transition: all 0.25s var(--ease);
}

#toc a::before {
  content: counter(toc);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  transition: all 0.25s var(--ease);
}

#toc a:hover {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(200, 16, 46, 0.25);
  text-decoration: none;
}

#toc a:hover::before {
  color: var(--primary);
  background: #fff;
}

/* ============ ARTICLES IN SECTIONS ============ */
main article {
  margin-bottom: 1.5rem;
}

main article:last-child {
  margin-bottom: 0;
}

main article h3 {
  margin-top: 1.5rem;
  padding-left: 0.75rem;
  border-left: 4px solid var(--primary);
  border-radius: 2px;
}

main article:first-of-type h3:first-child,
main article > h3:first-child {
  margin-top: 0;
}

main article h4 {
  margin-top: 1.25rem;
  color: var(--primary);
}

#articles > article {
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  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: var(--primary);
}

#articles > article h3 {
  margin-top: 0;
  border-left: none;
  padding-left: 0;
  font-size: 1.1rem;
}

#articles > article a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  transition: all 0.25s var(--ease);
}

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

#articles > article a:hover {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
}

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

/* ============ FAQ ============ */
.faq-list {
  display: grid;
  gap: 0.75rem;
}

.faq-list details {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}

.faq-list details:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.faq-list details[open] {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.faq-list 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);
}

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

.faq-list 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: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  transition: transform 0.35s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease);
}

.faq-list details[open] summary {
  color: var(--primary);
  background: var(--primary-soft);
}

.faq-list details[open] summary::after {
  content: "−";
  transform: translateY(-50%) rotate(180deg);
  background: var(--primary);
  color: #fff;
}

.faq-list details p {
  margin: 0;
  padding: 0.25rem 1.25rem 1.25rem;
  font-size: 0.94rem;
  color: var(--text-soft);
  animation: fadeUp 0.4s var(--ease) both;
}

/* ============ CONTACT ============ */
#contact ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.6rem;
}

#contact ul li {
  margin: 0;
  padding: 0.7rem 1rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

#contact ul li:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* ============ FOOTER ============ */
#site-footer {
  margin-top: 3rem;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 4vw, 2.5rem) 2rem;
  background: linear-gradient(180deg, var(--bg-alt) 0%, var(--surface-solid) 100%);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

#site-footer section h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
  display: inline-block;
}

#site-footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
}

#site-footer ul li {
  margin: 0;
}

#site-footer ul a {
  font-size: 0.88rem;
  color: var(--text-soft);
  text-decoration: none;
  position: relative;
  transition: color 0.25s var(--ease), padding-left 0.25s var(--ease);
}

#site-footer ul a::before {
  content: "›";
  position: absolute;
  left: -2px;
  opacity: 0;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  transform: translateX(-4px);
  color: var(--primary);
}

#site-footer ul a:hover {
  color: var(--primary);
  padding-left: 0.85rem;
  text-decoration: none;
}

#site-footer ul a:hover::before {
  opacity: 1;
  transform: translateX(0);
}

#site-footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ============ FLOATING BUTTONS ============ */
#back-to-top,
#theme-toggle,
#menu-toggle {
  position: fixed;
  z-index: 200;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease), opacity 0.3s var(--ease);
}

#back-to-top {
  right: 1.25rem;
  bottom: 1.25rem;
  padding: 0.7rem 1.1rem;
  color: #fff;
  background: var(--gradient-hero);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
}

#back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

#theme-toggle {
  right: 1.25rem;
  bottom: 4.5rem;
  padding: 0.7rem 1.1rem;
  color: var(--text);
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

#theme-toggle:hover {
  transform: translateY(-3px);
  color: var(--primary);
  box-shadow: var(--shadow-md);
}

#menu-toggle {
  display: none;
  right: 1.25rem;
  bottom: 7.75rem;
  padding: 0.7rem 1.1rem;
  color: #fff;
  background: var(--primary);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
}

#menu-toggle:hover {
  transform: translateY(-3px);
}

#menu-toggle[aria-expanded="true"] {
  background: var(--primary-dark);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  #main-nav {
    gap: 0.6rem 1rem;
  }

  .nav-links {
    order: 3;
    flex-basis: 100%;
    gap: 0.2rem 0.25rem;
  }

  .nav-links a {
    font-size: 0.84rem;
    padding: 0.35rem 0.65rem;
  }

  .site-search {
    flex: 1 1 100%;
    order: 2;
  }

  .top-bar {
    font-size: 0.72rem;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 640px) {
  :root {
    --radius-lg: 20px;
    --radius: 14px;
  }

  body {
    font-size: 15px;
    line-height: 1.7;
  }

  #main-nav {
    padding: 0.6rem 1rem;
    gap: 0.5rem 0.75rem;
  }

  .logo {
    font-size: 1.05rem;
  }

  .logo svg {
    width: 34px;
    height: 34px;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem 0;
    border-top: 1px dashed var(--border);
    margin-top: 0.25rem;
  }

  .nav-links.is-open {
    display: flex;
    animation: fadeUp 0.3s var(--ease) both;
  }

  .nav-links a {
    display: block;
    padding: 0.6rem 0.9rem;
    font-size: 0.92rem;
  }

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

  #menu-toggle {
    display: block;
  }

  #theme-toggle {
    bottom: 4.25rem;
  }

  #back-to-top {
    bottom: 1rem;
    right: 1rem;
    padding: 0.6rem 0.95rem;
    font-size: 0.78rem;
  }

  #theme-toggle {
    right: 1rem;
    padding: 0.6rem 0.95rem;
    font-size: 0.78rem;
  }

  #menu-toggle {
    right: 1rem;
    bottom: 7.5rem;
    padding: 0.6rem 0.95rem;
    font-size: 0.78rem;
  }

  main {
    padding: 0 0.85rem 2rem;
  }

  main > section {
    margin: 1.5rem 0;
    padding: 1.15rem;
  }

  #hero {
    margin-top: 1rem;
    padding: 1.25rem;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.55rem;
    margin-top: 1.25rem;
  }

  .hero-stats li {
    padding: 0.75rem 0.5rem;
    font-size: 0.74rem;
  }

  #toc {
    padding: 1.1rem;
    margin: 1.5rem 0;
  }

  #toc ol {
    gap: 0.4rem;
  }

  #toc a {
    font-size: 0.78rem;
    padding: 0.35rem 0.75rem;
  }

  #contact ul {
    grid-template-columns: 1fr;
  }

  #site-footer {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem 1rem 1.5rem;
  }

  .faq-list summary {
    padding: 0.85rem 2.75rem 0.85rem 1rem;
    font-size: 0.92rem;
  }

  blockquote {
    padding: 0.85rem 1rem;
  }
}

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

  .site-search {
    flex-wrap: wrap;
  }

  .site-search button {
    flex: 1 1 100%;
  }
}

/* ============ ACCESSIBILITY / MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  main > section {
    opacity: 1;
    transform: none;
  }
}

@media print {
  #site-header,
  #back-to-top,
  #theme-toggle,
  #menu-toggle,
  #toc {
    display: none !important;
  }

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

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