:root {
  --spade-red: #e63946;
  --spade-dark: #1a1a2e;
  --spade-darker: #12121f;
  --spade-purple: #6c5ce7;
  --spade-pink: #fd79a8;
  --spade-cyan: #00cec9;
  --spade-gold: #fdcb6e;
  --bg: #f4f5fa;
  --bg-elev: #ffffff;
  --text: #1f2430;
  --text-soft: #5a6273;
  --text-mute: #8b93a5;
  --border: rgba(26, 26, 46, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.55);
  --shadow-sm: 0 2px 10px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 10px 30px rgba(26, 26, 46, 0.1);
  --shadow-lg: 0 22px 60px rgba(26, 26, 46, 0.16);
  --grad-hero: linear-gradient(135deg, #1a1a2e 0%, #3a2a5e 42%, #6c5ce7 78%, #fd79a8 100%);
  --grad-accent: linear-gradient(120deg, #e63946, #6c5ce7 55%, #00cec9);
  --grad-card: linear-gradient(145deg, rgba(108, 92, 231, 0.08), rgba(253, 121, 168, 0.06));
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --header-h: 72px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #0d0d16;
  --bg-elev: #16162a;
  --text: #eef0f7;
  --text-soft: #b3b9cc;
  --text-mute: #7f879c;
  --border: rgba(255, 255, 255, 0.09);
  --glass-bg: rgba(24, 24, 42, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --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 22px 60px rgba(0, 0, 0, 0.6);
  --grad-card: linear-gradient(145deg, rgba(108, 92, 231, 0.16), rgba(253, 121, 168, 0.1));
}

*,
*::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", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.78;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(108, 92, 231, 0.14), transparent 62%),
    radial-gradient(760px 480px at 92% 4%, rgba(253, 121, 168, 0.12), transparent 60%),
    radial-gradient(680px 420px at 50% 100%, rgba(0, 206, 201, 0.08), transparent 60%);
  background-attachment: fixed;
  transition: background-color 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

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

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

a:hover {
  color: var(--spade-pink);
}

[data-theme="dark"] a {
  color: #a99cff;
}

[data-theme="dark"] a:hover {
  color: var(--spade-pink);
}

h1, h2, h3, h4 {
  line-height: 1.32;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0 0 0.7em;
  font-weight: 800;
}

h1 { font-size: clamp(1.65rem, 3.4vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 2rem); }
h3 { font-size: clamp(1.08rem, 1.8vw, 1.32rem); }

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

ul, ol { padding-left: 1.35em; color: var(--text-soft); }
li { margin-bottom: 0.5em; }

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

time {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--text-mute);
  background: var(--grad-card);
  border: 1px solid var(--border);
  padding: 2px 12px;
  border-radius: 999px;
  margin-bottom: 0.6em;
}

blockquote {
  margin: 0 0 1.2em;
  padding: 1.2em 1.5em;
  border-left: 4px solid transparent;
  border-image: var(--grad-accent) 1;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  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-soft);
  font-style: italic;
}

.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: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.12rem;
  color: var(--text);
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--grad-accent);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 6px 18px rgba(108, 92, 231, 0.4);
  transition: transform 0.4s var(--ease), box-shadow 0.4s ease;
}

.brand:hover .brand-logo {
  transform: rotate(-12deg) scale(1.08);
  box-shadow: 0 10px 26px rgba(230, 57, 70, 0.45);
}

.brand-name {
  background: linear-gradient(100deg, var(--spade-purple), var(--spade-pink));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

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

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

#main-nav a::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

#main-nav a:hover {
  color: var(--text);
  background: rgba(108, 92, 231, 0.08);
}

#main-nav a:hover::after {
  transform: scaleX(1);
}

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

#search-input {
  width: 168px;
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 999px;
  outline: none;
  transition: width 0.35s var(--ease), border-color 0.25s ease, box-shadow 0.25s ease;
}

[data-theme="dark"] #search-input {
  background: rgba(255, 255, 255, 0.07);
}

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

#search-input:focus {
  width: 210px;
  border-color: var(--spade-purple);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.16);
}

#site-search button {
  padding: 8px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
  background: var(--grad-accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease, filter 0.25s ease;
}

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

#theme-toggle,
#menu-toggle {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  color: var(--text);
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.25s ease;
}

#theme-toggle:hover,
#menu-toggle:hover {
  transform: translateY(-2px) rotate(8deg);
  background: rgba(253, 121, 168, 0.18);
}

#menu-toggle {
  display: none;
}

/* ===== Main layout ===== */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 22px 70px;
}

main > section,
main > aside {
  margin-bottom: 34px;
}

/* ===== Breadcrumb ===== */
.breadcrumb ol {
  list-style: none;
  margin: 0 0 22px;
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-mute);
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

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

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

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

/* ===== Hero ===== */
#hero {
  position: relative;
  padding: 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--grad-hero);
  box-shadow: var(--shadow-lg);
  color: #fff;
  isolation: isolate;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(520px 320px at 82% 12%, rgba(253, 121, 168, 0.5), transparent 62%),
    radial-gradient(460px 300px at 8% 92%, rgba(0, 206, 201, 0.36), transparent 60%);
  z-index: -1;
  animation: heroGlow 14s ease-in-out infinite alternate;
}

@keyframes heroGlow {
  from { opacity: 0.7; transform: scale(1); }
  to { opacity: 1; transform: scale(1.08); }
}

.hero-slider {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
}

#hero .slide {
  grid-area: 1 / 1;
  padding: 52px 44px 40px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease), visibility 0.7s;
  pointer-events: none;
}

#hero .slide:first-child {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  position: relative;
}

#hero .slide h1,
#hero .slide h2 {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.25);
}

#hero .slide h1 {
  font-size: clamp(1.6rem, 3.6vw, 2.55rem);
  margin-bottom: 0.65em;
}

#hero .slide p {
  color: rgba(255, 255, 255, 0.86);
  max-width: 78ch;
  font-size: clamp(0.92rem, 1.4vw, 1.02rem);
}

#hero .slide p:last-of-type {
  margin-bottom: 1.4em;
}

.btn-primary {
  display: inline-block;
  padding: 13px 30px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff !important;
  background: linear-gradient(120deg, var(--spade-red), var(--spade-pink));
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(230, 57, 70, 0.42);
  transition: transform 0.3s var(--ease), box-shadow 0.3s ease, filter 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 18px 42px rgba(253, 121, 168, 0.55);
  filter: brightness(1.08);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.14);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero-stats .stat {
  padding: 22px 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  transition: background 0.3s ease, transform 0.3s var(--ease);
}

.hero-stats .stat:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-3px);
}

.hero-stats .counter {
  display: block;
  font-size: clamp(1.3rem, 2.6vw, 1.85rem);
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.01em;
  background: linear-gradient(100deg, #fff, var(--spade-gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-stats .stat span {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.74);
}

/* ===== Anchor nav ===== */
#anchor-nav {
  padding: 22px 24px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

#anchor-nav h2 {
  font-size: 1rem;
  margin-bottom: 0.9em;
  display: flex;
  align-items: center;
  gap: 8px;
}

#anchor-nav h2::before {
  content: "";
  width: 6px;
  height: 18px;
  border-radius: 4px;
  background: var(--grad-accent);
}

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

#anchor-nav a {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.84rem;
  color: var(--text-soft);
  background: rgba(108, 92, 231, 0.07);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.28s var(--ease);
}

#anchor-nav a:hover {
  color: #fff;
  background: var(--grad-accent);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(108, 92, 231, 0.32);
}

/* ===== Generic sections ===== */
main > section {
  padding: 32px 30px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.4s ease, transform 0.4s var(--ease), background 0.4s ease;
}

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

main > section > h2 {
  position: relative;
  padding-bottom: 0.5em;
  margin-bottom: 1.1em;
}

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

main > section > h3 {
  margin-top: 1.6em;
  padding-left: 14px;
  border-left: 4px solid var(--spade-purple);
  border-radius: 2px;
}

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

/* ===== Cards within sections ===== */
#news article,
#articles article {
  position: relative;
  padding: 22px 24px;
  margin-bottom: 16px;
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s ease, border-color 0.3s ease;
  overflow: hidden;
}

#news article::before,
#articles article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--grad-accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.35s var(--ease);
}

#news article:hover,
#articles article:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(108, 92, 231, 0.28);
}

#news article:hover::before,
#articles article:hover::before {
  transform: scaleY(1);
}

#news article h3,
#articles article h3 {
  margin: 0 0 0.35em;
  padding-left: 0;
  border-left: none;
  font-size: 1.06rem;
}

#news article p,
#articles article p {
  font-size: 0.92rem;
  margin-bottom: 0.7em;
}

#news article a,
#articles article a {
  display: inline-block;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: 999px;
  background: rgba(108, 92, 231, 0.1);
  transition: all 0.28s var(--ease);
}

#news article a:hover,
#articles article a:hover {
  color: #fff;
  background: var(--grad-accent);
  transform: translateX(4px);
}

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

#faq details:hover {
  border-color: rgba(108, 92, 231, 0.3);
  box-shadow: var(--shadow-sm);
}

#faq details[open] {
  box-shadow: var(--shadow-md);
  border-color: rgba(108, 92, 231, 0.4);
}

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

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

#faq summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--spade-purple);
  background: rgba(108, 92, 231, 0.12);
  border-radius: 50%;
  transition: transform 0.35s var(--ease), background 0.3s ease, color 0.3s ease;
}

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

#faq summary:hover {
  background: rgba(108, 92, 231, 0.06);
}

#faq details p {
  margin: 0;
  padding: 0 20px 18px;
  font-size: 0.92rem;
  animation: fadeSlide 0.4s var(--ease);
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

/* ===== HowTo lists ===== */
#howto ul,
#howto ol {
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 22px 18px 40px;
}

#howto ol li::marker {
  color: var(--spade-purple);
  font-weight: 700;
}

/* ===== Contact / address ===== */
#contact address {
  font-style: normal;
  padding: 22px 24px;
  background: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

#contact address p {
  margin: 0 0 0.55em;
  font-size: 0.94rem;
}

#contact address p:last-child {
  margin-bottom: 0;
}

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

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

#sitemap a:hover,
#links a:hover {
  color: #fff;
  background: var(--grad-accent);
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(108, 92, 231, 0.3);
}

/* ===== Footer ===== */
#site-footer {
  position: relative;
  margin-top: 20px;
  padding: 46px 22px 34px;
  background: var(--spade-dark);
  background-image:
    radial-gradient(620px 300px at 12% 0%, rgba(108, 92, 231, 0.28), transparent 62%),
    radial-gradient(560px 280px at 88% 10%, rgba(230, 57, 70, 0.22), transparent 60%);
  color: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}

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

.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  text-align: center;
}

#site-footer p {
  margin: 0 0 0.6em;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.7);
}

#site-footer nav ul {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
}

#site-footer nav a {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.72);
  position: relative;
  transition: color 0.25s ease;
}

#site-footer nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

#site-footer nav a:hover {
  color: #fff;
}

#site-footer nav a:hover::after {
  transform: scaleX(1);
}

/* ===== Back to top ===== */
#back-to-top {
  position: fixed;
  right: 22px;
  bottom: 26px;
  z-index: 900;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  background: var(--grad-accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(108, 92, 231, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.35s ease, transform 0.35s var(--ease), visibility 0.35s, box-shadow 0.3s ease;
}

#back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

#back-to-top:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 18px 38px rgba(230, 57, 70, 0.5);
}

/* ===== Scroll reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

main > section:nth-child(even) {
  scroll-margin-top: calc(var(--header-h) + 16px);
}

/* ===== Focus states ===== */
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.55);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ===== Responsive ===== */
@media (max-width: 1080px) {
  #main-nav a {
    padding: 7px 8px;
    font-size: 0.85rem;
  }
  #search-input {
    width: 140px;
  }
  #search-input:focus {
    width: 170px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 64px;
  }

  .header-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 10px;
  }

  #menu-toggle {
    display: grid;
    order: 3;
    margin-left: auto;
  }

  #theme-toggle {
    order: 2;
  }

  #site-search {
    order: 4;
    flex: 1 1 100%;
  }

  #search-input {
    width: 100%;
    flex: 1;
  }

  #search-input:focus {
    width: 100%;
  }

  #main-nav {
    order: 5;
    flex: 1 1 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.45s var(--ease), opacity 0.35s ease;
  }

  #main-nav.open {
    max-height: 520px;
    opacity: 1;
  }

  #main-nav ul {
    flex-direction: column;
    gap: 2px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--border);
  }

  #main-nav a {
    display: block;
    padding: 11px 14px;
    font-size: 0.94rem;
    border-radius: 10px;
  }

  #main-nav a::after {
    display: none;
  }

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

  #hero .slide {
    padding: 38px 26px 30px;
  }

  main > section {
    padding: 26px 22px;
  }
}

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

  main {
    padding: 18px 14px 56px;
  }

  main > section,
  main > aside {
    margin-bottom: 22px;
  }

  #hero {
    border-radius: var(--radius-md);
  }

  #hero .slide {
    padding: 30px 20px 26px;
  }

  #hero .slide p {
    font-size: 0.9rem;
  }

  .hero-stats .stat {
    padding: 16px 10px;
  }

  .hero-stats .stat span {
    font-size: 0.72rem;
  }

  main > section {
    padding: 22px 18px;
    border-radius: var(--radius-md);
  }

  main > section > h3 {
    padding-left: 10px;
    border-left-width: 3px;
  }

  #anchor-nav {
    padding: 18px 16px;
  }

  #anchor-nav a {
    font-size: 0.8rem;
    padding: 5px 12px;
  }

  #news article,
  #articles article {
    padding: 18px 18px;
  }

  #faq summary {
    padding: 14px 46px 14px 16px;
    font-size: 0.9rem;
  }

  #faq details p {
    padding: 0 16px 16px;
    font-size: 0.88rem;
  }

  #contact address {
    padding: 18px 18px;
  }

  #sitemap ul,
  #links ul {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }

  blockquote {
    padding: 16px 18px;
  }

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

  #back-to-top {
    right: 14px;
    bottom: 18px;
    width: 42px;
    height: 42px;
  }

  #site-footer {
    padding: 34px 16px 28px;
  }

  #site-footer nav ul {
    gap: 8px 16px;
  }
}

/* ===== Reduced 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;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ===== Print ===== */
@media print {
  #site-header,
  #anchor-nav,
  #back-to-top,
  #site-footer,
  .breadcrumb,
  .hero-stats {
    display: none !important;
  }
  body {
    background: #fff;
    color: #000;
  }
  main > section {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
  #hero {
    background: #fff;
    color: #000;
    box-shadow: none;
  }
  #hero .slide h1,
  #hero .slide p {
    color: #000;
    text-shadow: none;
  }
}