:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --primary-light: #ff6b7a;
  --accent: #ffb703;
  --accent-2: #fb8500;
  --bg: #fff8f8;
  --bg-alt: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(230, 57, 70, 0.14);
  --text: #241a1c;
  --text-soft: #5c4a4d;
  --text-muted: #8a7579;
  --shadow-sm: 0 2px 10px rgba(193, 18, 31, 0.06);
  --shadow-md: 0 10px 30px rgba(193, 18, 31, 0.1);
  --shadow-lg: 0 20px 50px rgba(193, 18, 31, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --header-h: 68px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --grad-primary: linear-gradient(135deg, #e63946 0%, #ff6b7a 45%, #ffb703 100%);
  --grad-soft: linear-gradient(135deg, rgba(230, 57, 70, 0.1), rgba(255, 183, 3, 0.12));
  --glass-blur: blur(18px) saturate(160%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14100f;
    --bg-alt: #1c1615;
    --card-bg: rgba(38, 28, 30, 0.62);
    --card-border: rgba(255, 107, 122, 0.16);
    --text: #f6ecec;
    --text-soft: #d6c4c6;
    --text-muted: #a89094;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
    --grad-soft: linear-gradient(135deg, rgba(230, 57, 70, 0.18), rgba(255, 183, 3, 0.14));
  }
}

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

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.78;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 8% 4%, rgba(230, 57, 70, 0.1), transparent 42%),
    radial-gradient(circle at 92% 12%, rgba(255, 183, 3, 0.12), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 107, 122, 0.08), transparent 50%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
  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,
a:focus-visible {
  color: var(--primary-dark);
}

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

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

li {
  margin-bottom: 0.45em;
}

li::marker {
  color: var(--primary);
}

p {
  margin: 0 0 1em;
}

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

h1 {
  font-size: clamp(1.7rem, 4.4vw, 2.9rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.4rem, 3.2vw, 2.1rem);
  position: relative;
  padding-left: 18px;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.16em;
  bottom: 0.16em;
  width: 6px;
  border-radius: 6px;
  background: var(--grad-primary);
  box-shadow: 0 0 14px rgba(230, 57, 70, 0.5);
}

h3 {
  font-size: clamp(1.08rem, 2.2vw, 1.32rem);
  margin-top: 1.4em;
  color: var(--text);
}

h4 {
  font-size: 1.05rem;
}

/* ============ Header ============ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}

header nav {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  flex-wrap: wrap;
}

header nav > div a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text);
  padding: 6px 0;
}

header nav > div a::before {
  content: "▶";
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  font-size: 0.72rem;
  color: #fff;
  border-radius: 10px;
  background: var(--grad-primary);
  box-shadow: 0 6px 16px rgba(230, 57, 70, 0.38);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

header nav > div a:hover::before {
  transform: rotate(-8deg) scale(1.08);
  box-shadow: 0 8px 22px rgba(230, 57, 70, 0.55);
}

header nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

header nav ul li {
  margin: 0;
}

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

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

header nav ul li a:hover,
header nav ul li a:focus-visible {
  color: var(--primary);
  background: rgba(230, 57, 70, 0.08);
  transform: translateY(-1px);
}

header nav ul li a:hover::after {
  width: 60%;
}

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

main > section {
  margin: 0 0 28px;
  padding: clamp(22px, 4vw, 40px);
  background: var(--card-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.7s var(--ease) both;
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease),
    border-color 0.4s var(--ease);
}

main > section::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.35),
    transparent 40%
  );
  opacity: 0.5;
}

@media (prefers-color-scheme: dark) {
  main > section::after {
    display: none;
  }
}

main > section:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(230, 57, 70, 0.28);
}

/* Hero section (first) */
main > section:first-of-type {
  margin-top: 28px;
  padding: clamp(30px, 6vw, 64px);
  background: var(--grad-primary);
  color: #fff;
  border: none;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

main > section:first-of-type::before {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  right: -140px;
  top: -180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 65%);
  animation: floatBlob 12s ease-in-out infinite;
  pointer-events: none;
}

main > section:first-of-type::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  left: -100px;
  bottom: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent 68%);
  animation: floatBlob 16s ease-in-out infinite reverse;
  pointer-events: none;
}

main > section:first-of-type h1 {
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 1;
  max-width: 20ch;
}

main > section:first-of-type p {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(0.98rem, 1.6vw, 1.08rem);
  max-width: 68ch;
  margin-bottom: 0;
}

/* ============ Lists & content ============ */
section ul {
  list-style: none;
  padding-left: 0;
}

section ul li {
  position: relative;
  padding-left: 26px;
  color: var(--text-soft);
}

section ul li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.68em;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--grad-primary);
  transform: rotate(45deg);
  box-shadow: 0 0 8px rgba(230, 57, 70, 0.45);
}

section ol {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

section ol li {
  position: relative;
  padding-left: 44px;
  margin-bottom: 0.7em;
  color: var(--text-soft);
  counter-increment: step;
}

section ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.08em;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 0.85rem;
  font-weight: 800;
  color: #fff;
  background: var(--grad-primary);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.35);
}

/* ============ Articles ============ */
section article {
  position: relative;
  padding: 20px 22px;
  margin: 16px 0;
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

section article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 4px;
  background: var(--grad-primary);
  opacity: 0.9;
}

section article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(230, 57, 70, 0.3);
}

section article h3 {
  margin-top: 0;
  font-size: clamp(1.02rem, 2vw, 1.18rem);
}

section article h3 a {
  color: inherit;
}

section article h3 a:hover {
  color: var(--primary);
}

section article time {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(230, 57, 70, 0.09);
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

section article p {
  color: var(--text-soft);
  font-size: 0.96rem;
}

section article p:last-child {
  margin-bottom: 0;
}

section article a[href^="#article"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(230, 57, 70, 0.1);
  transition: background 0.3s var(--ease), gap 0.3s var(--ease),
    transform 0.3s var(--ease);
}

section article a[href^="#article"]::after {
  content: "→";
  transition: transform 0.3s var(--ease);
}

section article a[href^="#article"]:hover {
  background: rgba(230, 57, 70, 0.18);
  gap: 10px;
}

/* ============ Blockquote ============ */
blockquote {
  margin: 18px 0;
  padding: 20px 24px;
  background: var(--grad-soft);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  position: relative;
  box-shadow: var(--shadow-sm);
}

blockquote::before {
  content: "\201C";
  position: absolute;
  top: -6px;
  right: 18px;
  font-size: 4.2rem;
  line-height: 1;
  color: var(--primary);
  opacity: 0.18;
  font-family: Georgia, "Times New Roman", serif;
}

blockquote p {
  margin: 0 0 0.6em;
  color: var(--text-soft);
  font-style: italic;
  font-size: 0.98rem;
}

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

/* ============ FAQ ============ */
#faq h3 {
  padding: 14px 18px;
  margin: 14px 0 0;
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom: none;
  cursor: default;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

#faq h3:hover {
  background: rgba(230, 57, 70, 0.07);
  color: var(--primary);
}

#faq h3 + p {
  margin: 0 0 6px;
  padding: 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  color: var(--text-soft);
  font-size: 0.96rem;
}

/* ============ Contact / links ============ */
#contact ul li,
#links ul li,
#sitemap ul li {
  padding-left: 26px;
}

#links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-left: 0;
}

#links ul li {
  padding-left: 0;
  margin: 0;
}

#links ul li::before {
  display: none;
}

#links ul li a {
  display: inline-block;
  padding: 8px 18px;
  background: var(--bg-alt);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    background 0.3s var(--ease), color 0.3s var(--ease);
}

#links ul li a:hover {
  transform: translateY(-3px);
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(230, 57, 70, 0.35);
}

#sitemap ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px 20px;
}

#sitemap ul li a {
  font-weight: 600;
  color: var(--text-soft);
  transition: color 0.25s var(--ease), padding-left 0.25s var(--ease);
}

#sitemap ul li a:hover {
  color: var(--primary);
  padding-left: 4px;
}

/* ============ Footer ============ */
footer {
  max-width: var(--maxw);
  margin: 0 auto 40px;
  padding: 30px clamp(22px, 4vw, 40px);
  background: var(--card-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

footer p {
  margin: 0 0 0.5em;
  font-size: 0.88rem;
  color: var(--text-muted);
}

footer p:first-child {
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
}

footer p:last-child {
  margin-bottom: 0;
  font-size: 0.82rem;
}

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

@keyframes floatBlob {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-24px, 30px) scale(1.08);
  }
}

/* Staggered reveal via content-visibility for long pages */
main > section:nth-of-type(1) { animation-delay: 0.02s; }
main > section:nth-of-type(2) { animation-delay: 0.06s; }
main > section:nth-of-type(3) { animation-delay: 0.1s; }
main > section:nth-of-type(4) { animation-delay: 0.14s; }
main > section:nth-of-type(5) { animation-delay: 0.18s; }
main > section:nth-of-type(6) { animation-delay: 0.22s; }
main > section:nth-of-type(7) { animation-delay: 0.26s; }
main > section:nth-of-type(8) { animation-delay: 0.3s; }
main > section:nth-of-type(9) { animation-delay: 0.34s; }
main > section:nth-of-type(10) { animation-delay: 0.38s; }

/* Scroll-driven enhancements where supported */
@supports (animation-timeline: view()) {
  main > section {
    animation: fadeUp 0.7s var(--ease) both;
    animation-timeline: view();
    animation-range: entry 0% cover 22%;
  }
}

/* ============ Responsive ============ */
@media (max-width: 960px) {
  header nav {
    padding: 10px 16px;
    gap: 8px;
  }

  header nav ul {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  header nav ul::-webkit-scrollbar {
    display: none;
  }

  header nav ul li a {
    white-space: nowrap;
    font-size: 0.88rem;
    padding: 7px 11px;
  }

  main {
    padding: 0 14px 30px;
  }

  main > section {
    border-radius: var(--radius-md);
    margin-bottom: 20px;
  }

  main > section:first-of-type {
    margin-top: 18px;
    border-radius: var(--radius-lg);
  }

  main > section:first-of-type h1 {
    max-width: none;
  }

  h2 {
    padding-left: 15px;
  }

  h2::before {
    width: 5px;
  }

  footer {
    margin: 0 14px 30px;
    border-radius: var(--radius-md);
  }
}

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

  :root {
    --header-h: 60px;
  }

  header nav > div a {
    font-size: 1.12rem;
  }

  header nav > div a::before {
    width: 30px;
    height: 30px;
    font-size: 0.64rem;
  }

  main > section {
    padding: 20px 16px;
    border-radius: 14px;
  }

  main > section:first-of-type {
    padding: 26px 20px;
    border-radius: 18px;
  }

  section article {
    padding: 16px 16px 16px 20px;
  }

  section article::before {
    top: 14px;
    bottom: 14px;
    width: 3px;
  }

  blockquote {
    padding: 16px 18px;
  }

  #faq h3 {
    padding: 12px 14px;
    font-size: 1rem;
  }

  #faq h3 + p {
    padding: 13px 14px;
  }

  #sitemap ul {
    grid-template-columns: repeat(2, 1fr);
  }

  section ol li {
    padding-left: 40px;
  }

  section ol li::before {
    width: 27px;
    height: 27px;
    font-size: 0.78rem;
  }
}

@media (max-width: 360px) {
  main > section {
    padding: 16px 13px;
  }

  header nav ul li a {
    font-size: 0.82rem;
    padding: 6px 9px;
  }
}

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

::selection {
  background: rgba(230, 57, 70, 0.28);
  color: var(--text);
}

/* ============ Print ============ */
@media print {
  header,
  footer,
  #links,
  #sitemap {
    display: none;
  }

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

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

  main > section:first-of-type {
    background: #fff;
    color: #000;
  }

  main > section:first-of-type h1,
  main > section:first-of-type p {
    color: #000;
    text-shadow: none;
  }
}