:root {
  --brand-red: #C0392B;
  --brand-red-dark: #96281B;
  --brand-yellow: #F5B041;
  --brand-cream: #FDF2E9;
  --brand-ink: #1F1A17;
  --brand-ink-soft: #4A3F38;
  --brand-line: rgba(192, 57, 43, 0.16);
  --bg: #FFFBF7;
  --bg-alt: #FDF2E9;
  --surface: #FFFFFF;
  --surface-glass: rgba(255, 255, 255, 0.66);
  --surface-glass-strong: rgba(255, 255, 255, 0.86);
  --text: #2A211C;
  --text-soft: #5C4F47;
  --text-muted: #857469;
  --accent: #C0392B;
  --accent-soft: rgba(192, 57, 43, 0.1);
  --accent-2: #E67E22;
  --grad-hero: linear-gradient(135deg, #C0392B 0%, #E67E22 55%, #F5B041 100%);
  --grad-soft: linear-gradient(135deg, rgba(192, 57, 43, 0.08), rgba(245, 176, 65, 0.14));
  --shadow-sm: 0 2px 8px rgba(80, 40, 20, 0.07);
  --shadow-md: 0 8px 28px rgba(80, 40, 20, 0.1);
  --shadow-lg: 0 18px 48px rgba(80, 40, 20, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --header-h: 72px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Songti SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
}

html[data-theme="dark"] {
  --brand-cream: #241C18;
  --bg: #14100E;
  --bg-alt: #1B1512;
  --surface: #1E1815;
  --surface-glass: rgba(30, 24, 21, 0.62);
  --surface-glass-strong: rgba(30, 24, 21, 0.86);
  --text: #F3EAE3;
  --text-soft: #CBBBB0;
  --text-muted: #9C8B80;
  --brand-ink: #F3EAE3;
  --brand-ink-soft: #CBBBB0;
  --brand-line: rgba(245, 176, 65, 0.22);
  --accent: #F5B041;
  --accent-soft: rgba(245, 176, 65, 0.14);
  --accent-2: #E67E22;
  --grad-hero: linear-gradient(135deg, #7E2318 0%, #A6471B 55%, #C98A2E 100%);
  --grad-soft: linear-gradient(135deg, rgba(245, 176, 65, 0.1), rgba(192, 57, 43, 0.14));
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 48px 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-sans);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(245, 176, 65, 0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(192, 57, 43, 0.1), transparent 55%);
  background-attachment: fixed;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
  overflow-x: hidden;
}

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

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

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.35;
  color: var(--text);
  letter-spacing: 0.01em;
}

h1 { font-size: clamp(1.7rem, 3.6vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.95rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.4rem); }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

ul, ol { padding-left: 1.35em; }

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

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

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

.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-glass);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--brand-line);
  transition: background 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

#site-header.scrolled {
  box-shadow: var(--shadow-md);
  background: var(--surface-glass-strong);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

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

.logo svg {
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease);
}

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

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

#main-nav {
  flex: 1 1 auto;
}

#main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

#main-nav a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-soft);
  position: relative;
  transition: color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
}

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

#main-nav a:hover,
#main-nav a:focus-visible {
  color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

#main-nav a:hover::after { width: 60%; }

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

#site-search {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-pill);
  border: 1px solid var(--brand-line);
  background: var(--surface-glass);
  overflow: hidden;
  transition: box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

#site-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

#search-input {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--text);
  width: 180px;
  font-family: inherit;
  outline: none;
}

#search-input::placeholder { color: var(--text-muted); }

#site-search button {
  border: 0;
  cursor: pointer;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
  background: var(--grad-hero);
  transition: filter 0.25s var(--ease);
}

#site-search button:hover { filter: brightness(1.08); }

#theme-toggle,
#menu-toggle {
  border: 1px solid var(--brand-line);
  background: var(--surface-glass);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease), border-color 0.3s var(--ease);
}

#theme-toggle:hover,
#menu-toggle:hover {
  transform: translateY(-2px) rotate(8deg);
  background: var(--accent-soft);
  border-color: var(--accent);
}

#menu-toggle { display: none; }

/* ============ Main container ============ */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 40px;
}

main > section,
#breadcrumb,
#toc {
  margin-top: 48px;
  animation: rise-in 0.7s var(--ease) both;
}

main > section {
  background: var(--surface);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 44px);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}

main > section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--grad-hero);
  opacity: 0.85;
}

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

main > section h2 {
  margin-top: 0;
  padding-bottom: 14px;
  position: relative;
}

main > section h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 4px;
  border-radius: 4px;
  background: var(--grad-hero);
}

main > section h3 {
  margin-top: 1.6em;
  color: var(--accent);
}

main > section p {
  color: var(--text-soft);
}

/* ============ Hero ============ */
#hero {
  margin-top: 32px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 32px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 32px);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

#hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 520px;
  height: 520px;
  background: var(--grad-hero);
  opacity: 0.09;
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
}

#hero::after {
  content: "";
  position: absolute;
  inset: auto auto -30% -15%;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(245, 176, 65, 0.22), transparent 70%);
  pointer-events: none;
}

/* Carousel */
.carousel {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-alt);
  box-shadow: var(--shadow-md);
  aspect-ratio: 800 / 420;
  min-height: 240px;
  z-index: 1;
}

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  transition: opacity 0.7s var(--ease), transform 0.9s var(--ease), visibility 0.7s;
}

.slide.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.slide > svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slide-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px 20px 20px;
  background: linear-gradient(to top, rgba(20, 10, 5, 0.82), rgba(20, 10, 5, 0.35) 60%, transparent);
  color: #fff;
}

.slide-caption h2 {
  margin: 0 0 6px;
  font-size: clamp(1rem, 1.9vw, 1.3rem);
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.slide-caption p {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.6;
}

.carousel-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  pointer-events: none;
}

.carousel-controls button {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}

.carousel-controls button:hover {
  background: rgba(255, 255, 255, 0.42);
  transform: scale(1.1);
}

.carousel-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 3;
}

.carousel-dots .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: width 0.3s var(--ease), background 0.3s var(--ease);
}

.carousel-dots .dot.active {
  width: 24px;
  border-radius: var(--radius-pill);
  background: var(--brand-yellow);
}

/* Hero text */
.hero-text {
  position: relative;
  z-index: 1;
}

.hero-text h1 {
  margin: 0 0 14px;
  background: var(--grad-hero);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-text .lead {
  font-size: 1.02rem;
  color: var(--text-soft);
}

.hero-text p {
  color: var(--text-soft);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 24px 0;
}

.stat {
  text-align: center;
  padding: 14px 8px;
  border-radius: var(--radius-md);
  background: var(--grad-soft);
  border: 1px solid var(--brand-line);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.stat:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat .num {
  display: block;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 800;
  font-family: var(--font-serif);
  color: var(--accent);
  line-height: 1.15;
}

.stat .label {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 8px 0 0;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 26px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.95rem;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), filter 0.3s var(--ease);
}

.btn-primary {
  color: #fff;
  background: var(--grad-hero);
  box-shadow: 0 8px 20px rgba(192, 57, 43, 0.3);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  color: #fff;
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(192, 57, 43, 0.4);
  filter: brightness(1.05);
}

.btn-secondary {
  color: var(--accent);
  background: var(--surface-glass);
  border: 1.5px solid var(--accent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  color: #fff;
  background: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* ============ Breadcrumb ============ */
#breadcrumb {
  margin-top: 28px;
  font-size: 0.88rem;
}

#breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-pill);
  width: fit-content;
  max-width: 100%;
}

#breadcrumb li + li::before {
  content: "›";
  margin-right: 6px;
  color: var(--text-muted);
}

#breadcrumb a { color: var(--text-soft); }
#breadcrumb a:hover { color: var(--accent); }
#breadcrumb [aria-current="page"] { color: var(--accent); font-weight: 700; }

/* ============ TOC ============ */
#toc {
  background: var(--surface-glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  padding: 24px clamp(18px, 3vw, 32px);
  box-shadow: var(--shadow-sm);
}

#toc h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  color: var(--accent);
}

#toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

#toc a {
  display: block;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid transparent;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease), background 0.25s var(--ease);
}

#toc a:hover,
#toc a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(4px);
}

/* ============ Section text ============ */
section p + h3 { margin-top: 1.8em; }

section blockquote {
  margin: 18px 0;
  padding: 18px 22px;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--grad-soft);
  position: relative;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

section blockquote:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

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

/* ============ News list ============ */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.news-list li {
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--brand-line);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}

.news-list li:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.news-list h3 {
  margin: 0 0 6px;
  font-size: 1.08rem;
  color: var(--text);
}

.news-list time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.news-list p {
  margin: 6px 0 10px;
  font-size: 0.92rem;
}

.news-list a {
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.news-list a::after {
  content: "→";
  transition: transform 0.3s var(--ease);
}

.news-list a:hover::after { transform: translateX(4px); }

/* ============ Articles ============ */
#articles > article {
  padding: 22px 24px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--brand-line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}

#articles > article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--grad-hero);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

#articles > article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

#articles > article:hover::before { opacity: 1; }

#articles article h3 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 1.12rem;
}

#articles article time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

#articles article p {
  margin: 8px 0 12px;
  font-size: 0.93rem;
}

#articles article > a {
  font-weight: 700;
  font-size: 0.88rem;
}

/* ============ FAQ ============ */
#faq details {
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  margin-bottom: 12px;
  overflow: hidden;
  transition: box-shadow 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.35s var(--ease);
}

#faq details:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

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

#faq summary {
  cursor: pointer;
  padding: 16px 48px 16px 20px;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text);
  position: relative;
  list-style: none;
  transition: color 0.25s var(--ease);
  user-select: none;
}

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

#faq summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--accent);
  transition: transform 0.3s var(--ease);
  line-height: 1;
}

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

#faq summary:hover { color: var(--accent); }

#faq details p {
  margin: 0;
  padding: 0 20px 18px;
  font-size: 0.93rem;
  color: var(--text-soft);
  animation: fade-in 0.4s var(--ease);
}

/* ============ HowTo ============ */
#howto h4 {
  color: var(--accent-2);
  margin-top: 1.4em;
  padding-left: 14px;
  border-left: 3px solid var(--accent-2);
  line-height: 1.4;
}

#howto h3 {
  display: inline-block;
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  font-size: 1.02rem;
  margin-top: 1.6em;
}

/* ============ Contact ============ */
#contact h3 {
  margin-top: 1.5em;
}

#contact ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

#contact ul li a {
  display: block;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  border: 1px solid var(--brand-line);
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}

#contact ul li a:hover,
#contact ul li a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-3px);
}

/* ============ Footer ============ */
#site-footer {
  margin-top: 64px;
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
  border-top: 1px solid var(--brand-line);
  position: relative;
}

#site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--grad-hero);
}

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 48px 20px 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
}

.footer-col h2 {
  font-size: 1.1rem;
  margin: 0 0 14px;
  color: var(--accent);
  position: relative;
  padding-bottom: 10px;
}

.footer-col h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 36px;
  height: 3px;
  border-radius: 3px;
  background: var(--grad-hero);
}

.footer-col p {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin: 0 0 8px;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.footer-col ul a {
  color: var(--text-soft);
  font-size: 0.9rem;
  display: inline-block;
  transition: transform 0.25s var(--ease), color 0.25s var(--ease);
}

.footer-col ul a:hover,
.footer-col ul a:focus-visible {
  color: var(--accent);
  transform: translateX(4px);
}

#copyright,
#privacy,
#disclaimer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 20px;
  border-top: 1px dashed var(--brand-line);
}

#copyright h3,
#privacy h3,
#disclaimer h3 {
  font-size: 0.95rem;
  margin: 0 0 6px;
  color: var(--text);
}

#copyright p,
#privacy p,
#disclaimer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.footer-bottom {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--brand-line);
}

/* ============ Back to top ============ */
#back-to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 90;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: var(--grad-hero);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), visibility 0.35s, box-shadow 0.35s var(--ease);
}

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

#back-to-top:hover,
#back-to-top:focus-visible {
  transform: translateY(-4px) scale(1.06);
  box-shadow: var(--shadow-lg);
}

/* ============ Animations ============ */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@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;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  #hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .carousel {
    aspect-ratio: 16 / 9;
  }
  #search-input { width: 150px; }
}

@media (max-width: 860px) {
  .header-inner {
    gap: 10px;
  }
  #menu-toggle { display: inline-flex; }
  #main-nav {
    order: 5;
    flex-basis: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s var(--ease);
  }
  #main-nav.open {
    max-height: 480px;
  }
  #main-nav ul {
    flex-direction: column;
    gap: 2px;
    padding: 8px 0 12px;
  }
  #main-nav a {
    display: block;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
  }
  #main-nav a::after { display: none; }
  .header-tools { margin-left: auto; }
  #site-search { display: none; }
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
}

@media (max-width: 640px) {
  body { font-size: 15px; }
  .header-inner { padding: 8px 14px; }
  .logo-text { font-size: 1rem; }
  main { padding: 0 14px 32px; }
  #hero {
    margin-top: 20px;
    padding: 16px;
    border-radius: var(--radius-md);
  }
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .carousel { min-height: 200px; }
  .slide-caption { padding: 14px 14px 26px; }
  .carousel-controls button {
    width: 32px;
    height: 32px;
    font-size: 1.15rem;
  }
  main > section {
    padding: 20px 16px;
    border-radius: var(--radius-md);
    margin-top: 32px;
  }
  #toc ul { grid-template-columns: 1fr; }
  #contact ul { grid-template-columns: 1fr 1fr; }
  .footer-inner {
    grid-template-columns: 1fr;
    padding: 36px 16px 16px;
  }
  #back-to-top {
    right: 14px;
    bottom: 16px;
    width: 42px;
    height: 42px;
  }
  .btn-primary,
  .btn-secondary {
    flex: 1 1 100%;
    justify-content: center;
  }
}

@media (max-width: 400px) {
  .hero-stats { grid-template-columns: 1fr 1fr; }
  #contact ul { grid-template-columns: 1fr; }
  .logo svg { width: 34px; height: 34px; }
}

/* ============ Print ============ */
@media print {
  #site-header,
  #back-to-top,
  .carousel-controls,
  .carousel-dots,
  #toc,
  .header-tools {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  main > section {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  a { color: #000; text-decoration: underline; }
}