/* =========================================
   SafeW 全站共享样式 (style.css)
   ========================================= */

/* --- 设计变量与基础重置 --- */
:root {
  /* 色板 */
  --color-bg-dark: #251943;
  --color-bg-paper: #DBD4ED;
  --color-text-body: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED6E89;

  /* 结构性约束 */
  --radius-card: 0;
  --radius-btn: 0;
  --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: 1280px;

  /* 排版 */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --lh-tight: 1.1;
  --lh-normal: 1.55;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-normal);
  color: var(--color-text-body);
  background-color: var(--color-bg-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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-block: var(--section-y);
  position: relative;
}

/* 纵向主线交错布局 */
.timeline-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap) calc(var(--gap) * 2);
  align-items: center;
}

@media (max-width: 768px) {
  .timeline-row {
    grid-template-columns: 1fr;
  }
  .visual-panel {
    order: -1; /* 视觉面板在文字上方 */
  }
}

/* --- 文本排版 --- */
.breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

/* 纸面取色：眉标用品牌色 */
.breadcrumb span {
  color: var(--color-brand);
}

/* 深色面取色：眉标用强调色 */
.dark-mode .breadcrumb span {
  color: var(--color-accent);
}

h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
  color: var(--color-text-body);
}

.dark-mode h1, 
.dark-mode h2, 
.dark-mode h3, 
.dark-mode h4 {
  color: #ffffff;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: var(--gap);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

/* 关键词高亮 */
.hl {
  color: var(--color-brand);
}

.dark-mode .hl {
  color: var(--color-accent);
}

/* --- 按钮组件 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  height: 52px;
  padding: 0 2rem;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid var(--color-text-body);
  color: var(--color-text-body);
}

.dark-mode .btn-secondary {
  border-color: var(--color-bg-paper);
  color: var(--color-bg-paper);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}

.dark-mode .btn-secondary:hover {
  filter: brightness(1.1);
}

.btn:focus-visible, .btn-outline:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

/* --- 卡片与面板 --- */
.card {
  background-color: var(--color-bg-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px -12px rgba(25, 21, 35, 0.4);
}

.visual-panel {
  background-color: var(--color-bg-dark);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  width: 100%;
}

/* 视觉面板内的 SVG 样式 */
.visual-panel svg {
  width: 100%;
  height: auto;
  max-width: 600px;
}

/* --- 表格 --- */
.table-wrapper {
  overflow-x: auto;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.dark-mode th, 
.dark-mode td {
  border-bottom: 1px solid rgba(219, 212, 237, 0.15);
}

th {
  font-weight: 700;
  background-color: rgba(25, 21, 35, 0.03);
}

.dark-mode th {
  background-color: rgba(219, 212, 237, 0.05);
}

/* --- FAQ --- */
details {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 1rem 0;
}

.dark-mode details {
  border-bottom: 1px solid rgba(219, 212, 237, 0.15);
}

summary {
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: color 0.2s ease;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--color-brand);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.dark-mode summary::before {
  background-color: var(--color-accent);
}

details[open] summary::before {
  transform: rotate(135deg);
}

details p {
  margin-top: 0.75rem;
  color: var(--color-text-body);
}

.dark-mode details p {
  color: var(--color-bg-paper);
}

/* --- 页头与页脚 --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-bg-paper);
  border-bottom: 1px solid rgba(25, 21, 35, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dark-mode .header {
  background-color: var(--color-bg-dark);
  border-bottom: 1px solid rgba(219, 212, 237, 0.1);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo img {
  height: auto;
  max-height: 32px;
  width: auto;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--color-brand);
}

.dark-mode .nav-links a:hover {
  color: var(--color-accent);
}

.nav-links a[aria-current="page"] {
  color: var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
}

.dark-mode .nav-links a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.footer {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
  padding: 4rem 0 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  color: var(--color-bg-paper);
  margin-bottom: 1rem;
  font-size: 1rem;
}

.footer-col ul li {
  margin-bottom: 0.5rem;
}

.footer-col ul li a {
  color: var(--color-bg-paper);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.footer-col ul li a:hover {
  opacity: 1;
}

.footer-bottom {
  border-top: 1px solid rgba(219, 212, 237, 0.15);
  padding-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* --- SVG 动效 --- */
@keyframes draw-stroke {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-stroke 4s ease forwards;
}

.float {
  animation: float 6s ease-in-out infinite;
}

.breathe {
  animation: breathe 4s ease-in-out 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;
  }
  .draw, .float, .breathe {
    animation: none !important;
  }
}
/* factory-contrast-width */
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #191523 !important;
    -webkit-text-fill-color: #191523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #191523 !important;
    -webkit-text-fill-color: #191523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #191523 !important;
    -webkit-text-fill-color: #191523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #191523 !important;
    -webkit-text-fill-color: #191523 !important;
  }
}
