/* =========================================
   SafeW 全局共享样式 (style.css)
   ========================================= */

/* --- 设计 Token 与变量 --- */
:root {
  /* 配色 */
  --color-dark: #19102D;
  --color-paper: #FCFCFD;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #D66EED;

  /* 圆角 */
  --radius-card: 0;
  --radius-btn: 0;

  /* 卡片边界与阴影 */
  --card-border: 2px solid var(--color-text);
  --card-shadow: 4px 4px 0 var(--color-text);

  /* 节奏与密度 */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --line-height: 1.75;

  /* 内容最大宽度 */
  --content-max: 960px;

  /* 字体 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
}

/* --- 基础重置与排版 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-paper);
  -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 {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* 面色管理 */
.dark-section {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.dark-section .hl {
  color: var(--color-accent);
}
.dark-section a:not(.btn) {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.dark-section .section-label {
  color: var(--color-accent);
}
.dark-section .card-light {
  background-color: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
}
.dark-section .card-light .hl {
  color: var(--color-brand);
}
.dark-section .card-light a {
  color: var(--color-brand);
}

.card-light {
  background-color: var(--color-paper);
  color: var(--color-text);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
}

/* --- 标题与眉标 --- */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.75rem;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1.25rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.hl {
  color: var(--color-brand);
}

/* --- 按钮组件 --- */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  height: 48px;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: 2px solid var(--color-accent);
}
.btn-primary:hover {
  background-color: #c55ae0;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}
.dark-section .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}
.btn-secondary:hover {
  background-color: rgba(0,0,0,0.05);
  transform: translateY(-2px);
}
.dark-section .btn-secondary:hover {
  background-color: rgba(255,255,255,0.08);
}

/* --- 卡片与网格 --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-icon {
  width: 28px;
  height: 28px;
  stroke: var(--color-brand);
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.dark-section .card-icon {
  stroke: var(--color-accent);
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  margin-top: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid currentColor;
}

th {
  font-weight: 700;
  opacity: 0.8;
}

/* --- FAQ (Details/Summary) --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

details {
  border: var(--card-border);
  background-color: var(--color-paper);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  box-shadow: 3px 3px 0 var(--color-text);
}

summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

details[open] summary::before {
  transform: rotate(135deg);
}

details p {
  margin-top: 0.75rem;
  margin-bottom: 0;
  padding-left: 1.5rem;
  border-left: 2px solid currentColor;
  opacity: 0.85;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(252, 252, 253, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 0.75rem 0;
}

.dark-section .site-header {
  background-color: rgba(25, 16, 45, 0.95);
  border-bottom-color: rgba(255,255,255,0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.brand-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  opacity: 1;
}

.nav-links a[aria-current="page"] {
  color: var(--color-brand);
}

.dark-section .nav-links a[aria-current="page"] {
  color: var(--color-accent);
}

@media (max-width: 768px) {
  .nav-links { display: none; }
}

.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(0,0,0,0.08);
  font-size: 0.9rem;
  opacity: 0.8;
}
.dark-section .site-footer {
  border-top-color: rgba(255,255,255,0.08);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-nav a {
  opacity: 0.7;
  transition: opacity 0.2s;
}
.footer-nav a:hover { opacity: 1; }

/* --- SVG 动效系统 --- */
.svg-visual {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* 呼吸浮动 */
@keyframes float-breathe {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* 依次浮现 */
@keyframes fade-in-up {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* 描边绘制 */
@keyframes draw-stroke {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 连线流动 */
@keyframes flow-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

/* 应用类 */
.anim-float {
  animation: float-breathe 6s ease-in-out infinite;
}
.anim-float-delayed {
  animation: float-breathe 6s ease-in-out infinite 2s;
}
.anim-fade-in {
  animation: fade-in-up 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.anim-draw {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-stroke 2s ease forwards;
}
.anim-flow {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: flow-line 3s linear infinite;
}

/* 减少动态效果支持 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .anim-float, .anim-float-delayed, .anim-fade-in, .anim-draw, .anim-flow {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* 工具类 */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.gap-lg { gap: var(--gap); }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
@media (min-width: 768px) {
  .flex-row-desktop { flex-direction: row !important; }
  .items-center-desktop { align-items: center !important; }
}
