:root {
  --bg: #f5f6fa;
  --bg-alt: #ffffff;
  --bg-soft: #eef0f6;
  --text: #1a1a2e;
  --text-soft: #4a4a5e;
  --text-mute: #7a7a8e;
  --primary: #e94560;
  --primary-dark: #c72945;
  --primary-soft: rgba(233, 69, 96, 0.12);
  --accent: #533483;
  --accent-soft: rgba(83, 52, 131, 0.1);
  --border: rgba(26, 26, 46, 0.1);
  --border-strong: rgba(26, 26, 46, 0.18);
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.55);
  --shadow-sm: 0 2px 8px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 8px 28px rgba(26, 26, 46, 0.1);
  --shadow-lg: 0 18px 48px rgba(26, 26, 46, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --gradient-hero: linear-gradient(135deg, #1a1a2e 0%, #533483 45%, #e94560 100%);
  --gradient-accent: linear-gradient(120deg, #e94560, #533483);
  --header-h: 68px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #0e0e1a;
  --bg-alt: #16162a;
  --bg-soft: #1c1c33;
  --text: #f0f1f7;
  --text-soft: #c2c4d4;
  --text-mute: #8b8da3;
  --primary: #ff5c78;
  --primary-dark: #e94560;
  --primary-soft: rgba(255, 92, 120, 0.16);
  --accent: #9b7cd6;
  --accent-soft: rgba(155, 124, 214, 0.16);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --glass-bg: rgba(22, 22, 42, 0.6);
  --glass-border: rgba(255, 255, 255, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
  --gradient-hero: linear-gradient(135deg, #0e0e1a 0%, #2c1d4d 45%, #8c2b40 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: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(233, 69, 96, 0.07), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(83, 52, 131, 0.08), transparent 46%);
  background-attachment: fixed;
  overflow-x: hidden;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

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

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

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

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

h1 { font-size: clamp(1.6rem, 1.15rem + 2.1vw, 2.7rem); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 2rem); }
h3 { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); }

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

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

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

li {
  margin-bottom: 0.4em;
}

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

blockquote p:last-child {
  margin-bottom: 0;
}

.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;
}

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

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

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

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 8px clamp(14px, 3vw, 28px);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(233, 69, 96, 0.35);
  transition: transform 0.4s var(--ease);
}

.brand:hover .brand-logo {
  transform: rotate(-8deg) scale(1.06);
}

.brand-name {
  font-size: 1.15rem;
  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;
}

#site-header nav {
  flex: 1 1 auto;
  min-width: 0;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 4px;
}

.nav-list li {
  margin: 0;
}

.nav-list a {
  display: inline-block;
  padding: 6px 11px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: var(--radius-pill);
  position: relative;
  transition: color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.nav-list 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 0.3s var(--ease);
}

.nav-list a:hover,
.nav-list a:focus-visible {
  color: var(--primary);
  background: var(--primary-soft);
}

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

.site-search {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}

.site-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

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

.site-search input::placeholder {
  color: var(--text-mute);
}

.site-search button {
  border: 0;
  cursor: pointer;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--gradient-accent);
  transition: filter 0.25s var(--ease), transform 0.25s var(--ease);
}

.site-search button:hover {
  filter: brightness(1.12);
}

.site-search button:active {
  transform: scale(0.96);
}

.theme-toggle {
  flex-shrink: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  transition: all 0.25s var(--ease);
}

.theme-toggle:hover {
  color: #fff;
  border-color: transparent;
  background: var(--gradient-accent);
  box-shadow: 0 6px 18px rgba(233, 69, 96, 0.35);
  transform: translateY(-1px);
}

/* ============ Main layout ============ */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 28px) 60px;
}

main > section,
main > nav.breadcrumb {
  margin-top: clamp(28px, 4vw, 52px);
}

main > section {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3.4vw, 40px);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.35s var(--ease);
  animation: fadeUp 0.7s var(--ease) both;
}

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

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

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

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

main > section > h3:first-of-type {
  margin-top: 1.2em;
}

/* ============ Hero ============ */
#hero {
  position: relative;
  margin-top: clamp(18px, 3vw, 32px);
  padding: clamp(28px, 5vw, 64px);
  background: var(--gradient-hero);
  border: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.22), transparent 38%),
    radial-gradient(circle at 8% 92%, rgba(233, 69, 96, 0.35), transparent 45%);
  pointer-events: none;
}

#hero::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: -1;
  animation: floatSlow 14s ease-in-out infinite;
}

.hero-inner {
  max-width: 880px;
}

#hero h1 {
  color: #fff;
  margin-top: 0;
  margin-bottom: 0.55em;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.35);
}

.hero-lead {
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(0.95rem, 0.9rem + 0.35vw, 1.08rem);
  line-height: 1.85;
  margin-bottom: 1.6em;
}

.hero-lead strong {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  padding: 0 6px;
  border-radius: 6px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: clamp(24px, 4vw, 40px);
}

.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 12px 28px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.3s var(--ease), color 0.3s var(--ease);
}

.btn-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 8px 22px rgba(233, 69, 96, 0.45);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  color: #fff;
  background: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(233, 69, 96, 0.55);
}

.btn-secondary {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.24);
  transform: translateY(-3px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.25);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 20px);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: transform 0.35s var(--ease), background-color 0.35s var(--ease);
}

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

.stat-num {
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2.1rem);
  font-weight: 800;
  line-height: 1.15;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.02em;
}

/* ============ Breadcrumb ============ */
.breadcrumb ol {
  list-style: none;
  margin: 0;
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.breadcrumb li {
  margin: 0;
  color: var(--text-mute);
}

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

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

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

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

/* ============ Articles ============ */
#articles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(14px, 2vw, 22px);
}

#articles > h2 {
  grid-column: 1 / -1;
}

#articles > article {
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 2.4vw, 26px);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease), background-color 0.35s var(--ease);
}

#articles > article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease);
}

#articles > article:hover {
  transform: translateY(-6px);
  background: var(--bg-alt);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

#articles > article:hover::before {
  transform: scaleX(1);
}

#articles > article h3 {
  margin-top: 0;
  margin-bottom: 0.5em;
  font-size: 1.08rem;
  line-height: 1.45;
  transition: color 0.3s var(--ease);
}

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

#articles > article p {
  font-size: 0.92rem;
  line-height: 1.8;
  margin-bottom: 1.1em;
}

#articles > article .meta {
  font-size: 0.78rem;
  color: var(--text-mute);
  margin-bottom: 0.9em;
  padding-bottom: 0.7em;
  border-bottom: 1px dashed var(--border);
}

#articles > article > a {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--primary-soft);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}

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

/* ============ FAQ ============ */
#faq details {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  padding: 4px 18px;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.3s var(--ease);
}

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

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

#faq summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 34px 14px 0;
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--text);
  position: relative;
  transition: color 0.25s var(--ease);
}

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

#faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  line-height: 24px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 400;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  transition: transform 0.35s var(--ease), background-color 0.3s var(--ease), color 0.3s var(--ease);
}

#faq details[open] summary {
  color: var(--primary);
}

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

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

#faq details p {
  margin: 0 0 14px;
  padding-top: 2px;
  font-size: 0.93rem;
  line-height: 1.85;
  animation: fadeUp 0.4s var(--ease) both;
}

/* ============ Sitemap / Links lists ============ */
#sitemap ul,
#links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

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

#sitemap a,
#links a {
  display: block;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text-soft);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
  transition: all 0.28s var(--ease);
}

#sitemap a::before,
#links a::before {
  content: "→";
  margin-right: 8px;
  color: var(--primary);
  opacity: 0.6;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
  display: inline-block;
}

#sitemap a:hover,
#links a:hover {
  color: var(--primary);
  background: var(--bg-alt);
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

#sitemap a:hover::before,
#links a:hover::before {
  opacity: 1;
  transform: translateX(2px);
}

/* ============ Contact / Notice ============ */
#contact p {
  padding-left: 26px;
  position: relative;
}

#contact p::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient-accent);
}

#notice {
  background: linear-gradient(135deg, var(--accent-soft), var(--primary-soft));
  border-color: var(--border-strong);
}

#notice p {
  color: var(--text-soft);
}

/* ============ Footer ============ */
#site-footer {
  margin-top: 40px;
  background: var(--gradient-hero);
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  overflow: hidden;
}

#site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 15% 0%, rgba(233, 69, 96, 0.28), transparent 45%);
  pointer-events: none;
}

.footer-inner {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(32px, 5vw, 56px) clamp(14px, 3vw, 28px) 28px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(20px, 3vw, 36px);
}

.footer-col h3 {
  color: #fff;
  font-size: 1rem;
  margin: 0 0 0.8em;
  padding-bottom: 10px;
  position: relative;
}

.footer-col h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 34px;
  height: 3px;
  border-radius: 3px;
  background: var(--primary);
}

.footer-col p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  line-height: 1.8;
  margin: 0;
}

.footer-bottom {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 28px) 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  text-align: center;
}

.footer-bottom p {
  margin: 4px 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.62);
}

/* ============ Back to top ============ */
#back-to-top {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 90;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 12px 18px;
  color: #fff;
  background: var(--gradient-accent);
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 26px rgba(233, 69, 96, 0.45);
  opacity: 0.92;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), opacity 0.3s var(--ease);
}

#back-to-top:hover {
  transform: translateY(-4px) scale(1.04);
  opacity: 1;
  box-shadow: 0 16px 34px rgba(233, 69, 96, 0.6);
}

#back-to-top:active {
  transform: translateY(-1px) scale(0.98);
}

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

@keyframes floatSlow {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-24px, 26px) scale(1.06);
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 var(--primary-soft);
  }
  50% {
    box-shadow: 0 0 0 8px transparent;
  }
}

main > section:nth-of-type(1) { animation-delay: 0.04s; }
main > section:nth-of-type(2) { animation-delay: 0.08s; }
main > section:nth-of-type(3) { animation-delay: 0.12s; }
main > section:nth-of-type(4) { animation-delay: 0.16s; }
main > section:nth-of-type(5) { animation-delay: 0.2s; }

@supports (animation-timeline: view()) {
  main > section,
  #articles > article {
    animation: fadeUp linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
  }
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .header-inner {
    gap: 10px 14px;
  }

  .site-search input {
    width: 150px;
  }

  .nav-list a {
    padding: 6px 9px;
    font-size: 0.86rem;
  }
}

@media (max-width: 860px) {
  .header-inner {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #site-header nav {
    order: 4;
    flex-basis: 100%;
  }

  .nav-list {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .nav-list li {
    flex-shrink: 0;
  }

  .site-search {
    margin-left: auto;
  }

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

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

  .header-inner {
    gap: 8px 10px;
  }

  .brand-name {
    font-size: 1rem;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }

  .site-search {
    order: 3;
    flex: 1 1 auto;
  }

  .site-search input {
    width: 100%;
    flex: 1 1 auto;
  }

  .theme-toggle {
    order: 2;
    padding: 8px 12px;
    font-size: 0.78rem;
  }

  #hero {
    padding: 26px 20px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-primary,
  .btn-secondary {
    text-align: center;
  }

  .hero-stats {
    gap: 10px;
  }

  .stat {
    padding: 12px;
  }

  #articles {
    grid-template-columns: 1fr;
  }

  #sitemap ul,
  #links ul {
    grid-template-columns: 1fr;
  }

  .breadcrumb ol {
    font-size: 0.8rem;
    padding: 8px 14px;
  }

  #back-to-top {
    padding: 10px 14px;
    font-size: 0.76rem;
  }
}

@media (max-width: 380px) {
  .brand-name {
    display: none;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }
}

/* ============ 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;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: rgba(26, 26, 46, 0.35);
    --text-soft: #2a2a3e;
  }

  #site-header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--bg-alt);
  }
}

@media print {
  #site-header,
  #back-to-top,
  .site-search,
  .theme-toggle,
  .hero-actions,
  #site-footer {
    display: none !important;
  }

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

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

  #hero {
    background: #fff;
  }

  #hero h1,
  .hero-lead,
  .hero-lead strong,
  .stat-num,
  .stat-label {
    color: #000 !important;
    text-shadow: none;
  }
}