/* =========================================
   SafeW 全站共享样式
   ========================================= */

/* 1. 设计变量与基础重置 */
:root {
  /* 色板 */
  --color-dark: #231334;
  --color-paper: #F5F3F7;
  --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: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --line-body: 1.55;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background: var(--color-paper);
  color: var(--color-text);
  line-height: var(--line-body);
  font-size: 16px;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button, input {
  font: inherit;
  color: inherit;
}

/* 2. 布局容器与排版 */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
}

.section.paper-bg {
  background: var(--color-paper);
  border-bottom: 1px solid rgba(28, 21, 35, 0.15);
}

.section.dark-bg {
  background: var(--color-dark);
  color: var(--color-paper);
  border-bottom: none;
}

.section.dark-bg .hl {
  color: var(--color-accent);
}

.section.dark-bg .brand-tag {
  color: var(--color-accent);
}

.section.dark-bg .card-light-on-dark {
  background: var(--color-paper);
  color: var(--color-text);
  border-color: var(--color-text);
}

.section.dark-bg .card-light-on-dark .hl {
  color: var(--color-brand);
}

h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  word-break: break-all;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: 0.4em;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 0.6em;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  margin-bottom: 0.5em;
}

p {
  margin-bottom: 1em;
  max-width: 38em;
}

.hl {
  color: var(--color-brand);
  font-weight: 600;
}

.tag-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.25em 0.6em;
  border-radius: 6px;
  margin-bottom: 0.6em;
  background: rgba(125, 20, 235, 0.1);
  color: var(--color-brand);
}

.dark-bg .tag-label {
  background: rgba(237, 210, 110, 0.15);
  color: var(--color-accent);
}

.brand-tag {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.5em;
  display: block;
}

/* 3. 页头与导航 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 243, 247, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
  padding: 0.75rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
}

.logo-img {
  height: 32px;
  width: auto;
}

nav ul {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

nav a {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.4em 0;
  position: relative;
}

nav a:hover, nav a[aria-current="page"] {
  color: var(--color-brand);
}

nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-brand);
}

/* 4. 按钮组件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  height: 52px;
  padding: 0 1.5rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  border: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-dark);
  box-shadow: 0 4px 12px rgba(237, 210, 110, 0.3);
}

.btn-primary:hover {
  background: #e5c95a;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 2px solid var(--color-text);
}

.dark-bg .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn-icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

/* 5. 卡片与面板 */
.card {
  background: var(--color-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
}

.panel {
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.kanban-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

.kanban-col {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.kanban-header {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--color-brand);
  margin-bottom: 0.4rem;
  color: var(--color-brand);
}

.dark-bg .kanban-header {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* 6. 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.data-table th, .data-table td {
  padding: 0.8rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(28, 21, 35, 0.15);
}

.data-table th {
  font-weight: 600;
  background: rgba(125, 20, 235, 0.05);
}

.dark-bg .data-table th {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-paper);
}

.dark-bg .data-table td {
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--color-paper);
}

/* 7. FAQ 组件 */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background: var(--color-paper);
  overflow: hidden;
}

.dark-bg .faq-item {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.faq-item summary {
  padding: 1rem var(--gap);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item .faq-answer {
  padding: 0 var(--gap) 1rem;
  line-height: 1.6;
  color: inherit;
}

/* 8. SVG 动效系统 */
.svg-container {
  width: 100%;
  height: auto;
  max-width: 100%;
}

svg > [class*="-anim"],
svg > [class*="-draw"],
svg > [class*="-breathe"],
svg > [class*="-float"] {
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

@keyframes drawLine {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.star { animation: twinkle 4s ease-in-out infinite; }
.line-draw { pathLength: 1; stroke-dasharray: 1; stroke-dashoffset: 0; animation: drawLine 3.5s ease forwards; }
.float-anim { animation: float 6s ease-in-out infinite; }
.breathe-dot { animation: breathe 2.5s ease-in-out infinite; }
.slide-in { animation: slideIn 0.9s ease forwards; }

/* 9. 响应式与无障碍 */
@media (max-width: 768px) {
  .kanban-grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; }
  nav ul { gap: 1rem; }
  .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
  html { scroll-behavior: auto; }
}

a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 页脚 */
.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 2rem 0;
  text-align: center;
  font-size: 0.9rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.site-footer a {
  color: var(--color-accent);
  margin: 0 0.5rem;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
