/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 设计变量 */
:root {
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --color-paper-alt: #ECE9F2;
  --color-text: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  
  --radius-card: 20px;
  --radius-btn: 12px;
  
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);
  
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  
  --content-max: 1120px;
  
  --font-main: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

/* 基础重置与排版 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  color: var(--color-text);
  background-color: var(--color-paper);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* 布局容器 */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gap);
}

.section {
  padding-block: var(--section-y);
}

.bg-paper { background-color: var(--color-paper); }
.bg-paper-alt { background-color: var(--color-paper-alt); }
.bg-dark { background-color: var(--color-dark); color: var(--color-paper); }

/* 排版层级 */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.25;
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  margin-bottom: var(--gap);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: calc(var(--gap) * 1.5);
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  margin-bottom: calc(var(--gap) * 0.8);
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

hl, .hl {
  font-weight: 700;
}

.bg-paper .hl { color: var(--color-brand); }
.bg-dark .hl { color: var(--color-accent); }
.bg-dark .hl span { color: var(--color-accent); }

/* 眉标 */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: calc(var(--gap) * 0.6);
}

.bg-paper .section-label { color: var(--color-brand); }
.bg-dark .section-label { color: var(--color-accent); }

.section-label::before {
  content: "";
  display: inline-block;
  width: 1.2em;
  height: 2px;
  background: currentColor;
}

/* 按钮组件 */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin-top: var(--gap);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  height: 52px;
  padding: 0 24px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}

.bg-dark .btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

.bg-dark .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* 卡片组件 */
.card {
  background: #fff;
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: calc(var(--gap) * 1.5);
}

.bg-dark .card {
  background: var(--color-paper);
  border-color: var(--color-paper);
  box-shadow: 4px 4px 0 var(--color-paper);
  color: var(--color-text);
}

.grid-cards {
  display: grid;
  gap: var(--gap);
}

@media (min-width: 768px) {
  .grid-cards.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-cards.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 表格组件 */
.table-wrapper {
  overflow-x: auto;
  margin-top: var(--gap);
  border: var(--card-border);
  border-radius: var(--radius-card);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
}

th {
  font-weight: 700;
  background: var(--color-paper-alt);
}

td:first-child {
  font-weight: 600;
  width: 40%;
}

tr:last-child th, tr:last-child td {
  border-bottom: none;
}

/* FAQ 组件 */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.faq-item summary {
  padding: 16px 20px;
  background: #fff;
  border: var(--card-border);
  border-radius: var(--radius-card);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; content: ""; }

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item[open] summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: var(--color-paper-alt);
}

.faq-item p {
  padding: 16px 20px;
  background: #fff;
  border: var(--card-border);
  border-top: none;
  border-bottom-left-radius: var(--radius-card);
  border-bottom-right-radius: var(--radius-card);
  margin: 0;
  font-size: 0.95rem;
}

/* 页头页脚 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 243, 247, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(28, 21, 35, 0.08);
  padding-block: 12px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-area img {
  height: 28px;
  width: auto;
}

.main-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.main-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 0;
  position: relative;
}

.main-nav a[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

.main-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-brand);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.main-nav a:hover::after,
.main-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding-block: 48px;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-links a {
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

.footer-copy {
  opacity: 0.6;
  font-size: 0.8rem;
}

/* SVG 动效基类 */
.svg-panel {
  width: 100%;
  height: auto;
  overflow: visible;
}

.star {
  animation: twinkle 4s ease-in-out infinite;
}

.star:nth-child(odd) { animation-delay: 0.5s; }
.star:nth-child(even) { animation-delay: 1.2s; }

.line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 8s ease-in-out infinite;
}

.bubble {
  animation: floatBubble 6s ease-in-out infinite;
}

.panel {
  animation: slidePanel 10s ease-in-out infinite;
}

.input-dots circle {
  animation: breathDot 2.4s ease-in-out infinite;
}

.input-dots circle:nth-child(2) { animation-delay: 0.2s; }
.input-dots circle:nth-child(3) { animation-delay: 0.4s; }

/* Keyframes */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes drawLine {
  0%, 100% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
}

@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes slidePanel {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-4px); }
}

@keyframes breathDot {
  0%, 100% { opacity: 0.3; r: 2; }
  50% { opacity: 1; r: 3.5; }
}

/* 响应式适配 */
@media (max-width: 768px) {
  .main-nav { display: none; }
  .mobile-menu-btn { display: block; }
  .hero-layout { flex-direction: column; }
  .split-row { flex-direction: column; }
  .split-row.reverse-mobile { flex-direction: column; }
  .split-row > div { width: 100% !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
