:root {
  --primary: #8B4513;
  --primary-light: #A0522D;
  --primary-dark: #6B3410;
  --accent: #D4A574;
  --accent-light: #E8C9A0;
  --bg: #FDF8F3;
  --bg-alt: #F5EDE4;
  --bg-card: rgba(255, 255, 255, 0.72);
  --bg-glass: rgba(255, 255, 255, 0.55);
  --text: #2C1810;
  --text-secondary: #6B5B4F;
  --text-muted: #9B8B7F;
  --border: rgba(139, 69, 19, 0.12);
  --border-glass: rgba(255, 255, 255, 0.6);
  --shadow-sm: 0 2px 8px rgba(44, 24, 16, 0.06);
  --shadow-md: 0 8px 24px rgba(44, 24, 16, 0.08);
  --shadow-lg: 0 16px 48px rgba(44, 24, 16, 0.12);
  --shadow-glass: 0 8px 32px rgba(44, 24, 16, 0.1);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #D4A574;
    --primary-light: #E8C9A0;
    --primary-dark: #B8895A;
    --accent: #8B4513;
    --accent-light: #A0522D;
    --bg: #1A1210;
    --bg-alt: #231A16;
    --bg-card: rgba(35, 26, 22, 0.78);
    --bg-glass: rgba(35, 26, 22, 0.6);
    --text: #F0E6DC;
    --text-secondary: #C4B5A8;
    --text-muted: #8A7A6E;
    --border: rgba(212, 165, 116, 0.15);
    --border-glass: rgba(212, 165, 116, 0.2);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.35);
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(139, 69, 19, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 20%, rgba(212, 165, 116, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 70% 60% at 50% 100%, rgba(139, 69, 19, 0.04) 0%, transparent 60%);
  pointer-events: none;
  transition: opacity var(--transition);
}

@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(ellipse 80% 60% at 10% 0%, rgba(212, 165, 116, 0.05) 0%, transparent 60%),
      radial-gradient(ellipse 60% 50% at 90% 20%, rgba(212, 165, 116, 0.06) 0%, transparent 55%),
      radial-gradient(ellipse 70% 60% at 50% 100%, rgba(139, 69, 19, 0.08) 0%, transparent 60%);
  }
}

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

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

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

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

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

ul {
  list-style: none;
}

/* ===== HEADER ===== */
header[role="banner"] {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-glass);
  box-shadow: var(--shadow-sm);
  transition: background var(--transition), box-shadow var(--transition);
}

header[role="banner"] nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

header[role="banner"] nav > a {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.06em;
  white-space: nowrap;
  position: relative;
  padding: 4px 0;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity var(--transition);
}

header[role="banner"] nav > a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

header[role="banner"] nav > a:hover::after {
  transform: scaleX(1);
}

header[role="banner"] nav ul {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

header[role="banner"] nav ul li a {
  display: block;
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  position: relative;
  transition: color var(--transition), background var(--transition), transform var(--transition);
}

header[role="banner"] nav ul li a:hover {
  color: var(--primary);
  background: rgba(139, 69, 19, 0.06);
  transform: translateY(-1px);
}

@media (prefers-color-scheme: dark) {
  header[role="banner"] nav ul li a:hover {
    background: rgba(212, 165, 116, 0.1);
  }
}

/* ===== MAIN ===== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== SECTIONS ===== */
section {
  padding: 72px 0;
  position: relative;
}

section + section {
  border-top: 1px solid var(--border);
}

section h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 28px;
  position: relative;
  padding-bottom: 16px;
  letter-spacing: 0.02em;
}

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

section h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 600;
  color: var(--text);
  margin: 32px 0 12px;
  line-height: 1.5;
}

section h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  margin: 24px 0 8px;
}

section p {
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-size: 0.95rem;
  line-height: 1.85;
}

/* ===== HERO ===== */
#hero {
  padding: 80px 0 72px;
  position: relative;
  overflow: hidden;
}

#hero::before {
  content: "";
  position: absolute;
  inset: -40px -24px;
  z-index: -1;
  background: linear-gradient(135deg, rgba(139, 69, 19, 0.08) 0%, rgba(212, 165, 116, 0.12) 40%, rgba(139, 69, 19, 0.04) 100%);
  border-radius: var(--radius-xl);
  filter: blur(40px);
}

#hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: 24px;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#hero p {
  font-size: clamp(0.95rem, 1.8vw, 1.05rem);
  color: var(--text-secondary);
  line-height: 1.9;
  max-width: 800px;
}

/* ===== CARDS (glassmorphism) ===== */
#about,
#products,
#solutions,
#cases,
#news,
#faq,
#howto,
#contact {
  position: relative;
}

#about > p,
#about > h3,
#about > h3 + p,
#products > p,
#products > h3,
#products > h3 + p,
#solutions > p,
#solutions > h3,
#solutions > h3 + p,
#cases > h3,
#cases > h3 + p,
#cases > h3 ~ p,
#news > p,
#news > h3,
#news > h3 + p,
#faq > h3,
#faq > h3 + p,
#howto > h3,
#howto > h3 + p,
#howto > h4,
#howto > h4 + p,
#contact > p,
#contact > h3,
#contact > h3 + p {
  position: relative;
  z-index: 1;
}

/* ===== ARTICLES ===== */
#articles article {
  background: var(--bg-card);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 28px 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-glass);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

#articles article::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  border-radius: 0 4px 4px 0;
  opacity: 0;
  transition: opacity var(--transition);
}

#articles article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(139, 69, 19, 0.2);
}

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

#articles article h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.15rem;
}

#articles article h3 + p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 500;
}

#articles article p {
  margin-bottom: 12px;
}

#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  padding: 6px 16px;
  border: 1.5px solid var(--primary);
  border-radius: 100px;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

#articles article a::after {
  content: "→";
  transition: transform var(--transition);
  font-size: 1rem;
}

#articles article a:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(139, 69, 19, 0.3);
}

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

/* ===== FAQ ===== */
#faq h3 {
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 20px 24px 8px;
  margin: 16px 0 0;
  box-shadow: var(--shadow-glass);
  font-size: 1rem;
  cursor: default;
  transition: background var(--transition), border-color var(--transition);
  position: relative;
}

#faq h3::before {
  content: "Q";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 6px;
  margin-right: 10px;
  vertical-align: middle;
  font-family: var(--font-main);
}

#faq h3 + p {
  background: var(--bg-card);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--border-glass);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 8px 24px 20px;
  margin: 0 0 12px;
  box-shadow: var(--shadow-glass);
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.8;
  transition: background var(--transition), border-color var(--transition);
}

/* ===== HOWTO ===== */
#howto h4 {
  padding-left: 0;
  position: relative;
}

#howto h4::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  margin-right: 10px;
  vertical-align: middle;
}

#howto h4 + p {
  padding-left: 18px;
  border-left: 2px solid var(--border);
  margin-left: 3px;
}

/* ===== CONTACT ===== */
#contact p {
  font-size: 0.95rem;
}

#contact h3 {
  margin-top: 28px;
}

/* ===== SITEMAP & LINKS ===== */
#sitemap ul,
#links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

#sitemap ul li a,
#links ul li a {
  display: inline-block;
  padding: 8px 18px;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

#sitemap ul li a:hover,
#links ul li a:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 69, 19, 0.25);
}

/* ===== FOOTER ===== */
footer[role="contentinfo"] {
  margin-top: 40px;
  padding: 56px 24px 40px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  transition: background var(--transition);
}

footer[role="contentinfo"] {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding-left: 48px;
  padding-right: 48px;
}

footer[role="contentinfo"] h2 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  margin-top: 28px;
  padding-bottom: 0;
}

footer[role="contentinfo"] h2:first-child {
  margin-top: 0;
}

footer[role="contentinfo"] p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 6px;
}

footer[role="contentinfo"] > p:last-child {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== SCROLL ANIMATION ===== */
@media (prefers-reduced-motion: no-preference) {
  section {
    animation: fadeInUp 0.7s ease-out both;
    animation-timeline: view();
    animation-range: entry 0% entry 30%;
  }

  #hero {
    animation: heroFade 0.9s ease-out both;
  }

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

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

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  header[role="banner"] nav {
    padding: 0 20px;
  }

  header[role="banner"] nav ul li a {
    padding: 7px 10px;
    font-size: 0.825rem;
  }

  main {
    padding: 0 20px;
  }

  section {
    padding: 56px 0;
  }
}

@media (max-width: 860px) {
  header[role="banner"] nav {
    flex-direction: column;
    height: auto;
    padding: 14px 16px;
    gap: 10px;
  }

  header[role="banner"] nav ul {
    justify-content: center;
    gap: 2px;
  }

  header[role="banner"] nav ul li a {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  #hero {
    padding: 56px 0 48px;
  }

  #hero::before {
    inset: -20px -16px;
    border-radius: var(--radius-lg);
    filter: blur(30px);
  }

  section {
    padding: 48px 0;
  }

  #articles article {
    padding: 22px 24px;
  }

  #faq h3 {
    padding: 16px 18px 6px;
    font-size: 0.95rem;
  }

  #faq h3 + p {
    padding: 6px 18px 16px;
    font-size: 0.875rem;
  }

  footer[role="contentinfo"] {
    padding: 40px 24px 32px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

@media (max-width: 600px) {
  html {
    font-size: 15px;
  }

  header[role="banner"] nav {
    padding: 10px 12px;
  }

  header[role="banner"] nav > a {
    font-size: 1.15rem;
  }

  header[role="banner"] nav ul {
    gap: 0;
  }

  header[role="banner"] nav ul li a {
    padding: 5px 8px;
    font-size: 0.75rem;
  }

  main {
    padding: 0 14px;
  }

  #hero {
    padding: 40px 0 36px;
  }

  #hero h1 {
    font-size: 1.5rem;
  }

  #hero p {
    font-size: 0.9rem;
    line-height: 1.8;
  }

  section {
    padding: 40px 0;
  }

  section h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
  }

  section h3 {
    font-size: 1.05rem;
    margin-top: 24px;
  }

  #articles article {
    padding: 18px 18px;
    border-radius: var(--radius-sm);
  }

  #articles article h3 {
    font-size: 1rem;
  }

  #faq h3 {
    padding: 14px 14px 4px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  #faq h3::before {
    width: 20px;
    height: 20px;
    font-size: 0.6rem;
    margin-right: 8px;
  }

  #faq h3 + p {
    padding: 4px 14px 14px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  }

  #sitemap ul,
  #links ul {
    gap: 8px;
  }

  #sitemap ul li a,
  #links ul li a {
    padding: 6px 14px;
    font-size: 0.8rem;
  }

  footer[role="contentinfo"] {
    padding: 32px 16px 24px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  footer[role="contentinfo"] h2 {
    font-size: 0.95rem;
  }

  footer[role="contentinfo"] p {
    font-size: 0.8rem;
  }
}

@media (max-width: 380px) {
  header[role="banner"] nav ul li a {
    padding: 4px 6px;
    font-size: 0.7rem;
  }

  #hero h1 {
    font-size: 1.3rem;
  }

  section h2 {
    font-size: 1.15rem;
  }
}

/* ===== PRINT ===== */
@media print {
  header[role="banner"],
  footer[role="contentinfo"] {
    display: none;
  }

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

  section {
    padding: 20px 0;
    break-inside: avoid;
  }

  #articles article {
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
  }
}