/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* --- 设计变量 --- */
:root {
  /* 配色层 */
  --bg-dark: #140E25;
  --bg-paper: #F5F0E5;
  --text-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;

  /* 结构参数 */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 0;
  --card-shadow: 0 10px 28px -14px rgba(25, 21, 35, 0.3);
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;

  /* 字体与排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
  --line-height-tight: 1.2;
  --line-height-base: 1.55;
  --line-height-loose: 1.7;
}

/* --- 基础重置 --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--line-height-base);
  color: var(--text-body);
  background-color: var(--bg-paper);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

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: var(--section-y) 0;
  position: relative;
}

.section--dark {
  background-color: var(--bg-dark);
  color: var(--bg-paper);
}

.section--paper {
  background-color: var(--bg-paper);
  color: var(--text-body);
}

.grid-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

@media (min-width: 768px) {
  .grid-split {
    grid-template-columns: 1fr 1fr;
    align-items: center;
  }
}

/* --- 排版系统 --- */
.label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--color-brand);
}

.section--dark .label {
  color: var(--color-accent);
}

h1, h2, h3 {
  font-weight: 700;
  line-height: var(--line-height-tight);
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin-bottom: 1rem;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 0.8rem;
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.6rem;
}

p {
  max-width: 38em;
  line-height: var(--line-height-loose);
  margin-bottom: 1rem;
}

.hl {
  color: var(--color-brand);
}

.section--dark .hl {
  color: var(--color-accent);
}

/* --- 按钮组件 --- */
.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, box-shadow 0.2s ease;
  border: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--bg-dark);
}

.btn--primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn--secondary {
  background: transparent;
  border: 1px solid var(--text-body);
  color: var(--text-body);
}

.section--dark .btn--secondary {
  border-color: var(--bg-paper);
  color: var(--bg-paper);
}

.btn--secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(0,0,0,0.05);
}

.section--dark .btn--secondary:hover {
  background-color: rgba(255,255,255,0.08);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* --- 卡片与面板 --- */
.card {
  background: var(--bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  transition: box-shadow 0.3s ease;
}

.section--dark .card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: none;
}

.card:hover {
  box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.4);
}

.panel {
  background: var(--bg-dark);
  border-radius: 16px;
  padding: 2rem;
  overflow: hidden;
  position: relative;
}

/* --- 表格组件 --- */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-card);
  border: 1px solid rgba(25, 21, 35, 0.15);
}

.table-wrapper th, .table-wrapper td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}

.table-wrapper th {
  background: rgba(25, 21, 35, 0.03);
  font-weight: 700;
  width: 35%;
}

.table-wrapper tr:last-child th,
.table-wrapper tr:last-child td {
  border-bottom: none;
}

/* --- 定义列表 (功能项) --- */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.dl-item dt {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dl-item dd {
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(25, 21, 35, 0.8);
}

/* --- 流程条 --- */
.flow-bar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (min-width: 640px) {
  .flow-bar {
    flex-direction: row;
    align-items: stretch;
  }
}

.flow-node {
  flex: 1;
  background: rgba(25, 21, 35, 0.04);
  border-radius: var(--radius-card);
  padding: 1.2rem;
  position: relative;
  border-left: 3px solid var(--color-brand);
}

.flow-arrow {
  display: none;
  color: var(--color-brand);
  font-size: 1.5rem;
  align-self: center;
}

@media (min-width: 640px) {
  .flow-arrow {
    display: block;
    margin: 0 -0.5rem;
    z-index: 1;
  }
}

/* --- FAQ --- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.faq-item {
  border: 1px solid rgba(25, 21, 35, 0.12);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.faq-item summary {
  padding: 1rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  padding: 0 1.2rem 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(25, 21, 35, 0.85);
  border-top: 1px solid rgba(25, 21, 35, 0.08);
  margin-top: 0;
}

/* --- 页头与页脚 --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 240, 229, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(25, 21, 35, 0.08);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: none;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
}

.nav-link {
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}

.nav-link[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

.site-footer {
  background: var(--bg-dark);
  color: rgba(245, 240, 229, 0.7);
  padding: 3rem 0 2rem;
  font-size: 0.9rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col h4 {
  color: var(--bg-paper);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-bottom {
  border-top: 1px solid rgba(245, 240, 229, 0.1);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(245, 240, 229, 0.4);
}

/* --- SVG 容器规范 --- */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* --- SVG 动效关键帧 --- */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes draw {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes slideIn {
  0% { transform: translateX(-20px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

.anim-float { animation: float 4s ease-in-out infinite; }
.anim-float-delay { animation: float 4.5s ease-in-out infinite 1s; }
.anim-breathe { animation: breathe 6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
.anim-draw { animation: draw 3s ease forwards; }
.anim-slide { animation: slideIn 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

/* --- 减少动态效果 --- */
@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-delay, .anim-breathe, .anim-draw, .anim-slide {
    animation: none;
    opacity: 1;
    transform: none;
  }
}
