/* ========================================
   SafeW — Global Styles
   ======================================== */

/* === Design Tokens === */
:root {
  /* Colors */
  --color-dark: #240F29;
  --color-paper: #F6F3F7;
  --color-body: #201523;
  --color-brand: #A711CF;
  --color-accent: #ED6E73;

  /* Card & Panel */
  --radius-card: 0;
  --radius-btn: 0;
  --card-border: 2px solid var(--color-body);
  --card-shadow: 4px 4px 0 var(--color-body);

  /* Spacing */
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 1280px;

  /* Typography */
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--color-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-brand);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: color-mix(in srgb, var(--color-brand) 80%, black);
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

ul, ol {
  list-style: none;
}

/* === Dark Surface Mixin === */
.dark-surface {
  background-color: var(--color-dark);
  color: var(--color-paper);
}

.dark-surface a {
  color: var(--color-accent);
}

.dark-surface a:hover {
  color: color-mix(in srgb, var(--color-accent) 80%, white);
}

.light-card {
  background-color: var(--color-paper);
  color: var(--color-body);
}

.light-card a {
  color: var(--color-brand);
}

.light-card a:hover {
  color: color-mix(in srgb, var(--color-brand) 80%, black);
}

/* === Container === */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  border-bottom-color: rgba(32, 21, 35, 0.12);
  box-shadow: 0 1px 0 rgba(32, 21, 35, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand img {
  width: 32px;
  height: 32px;
}

.brand-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-body);
  letter-spacing: 0.02em;
}

.dark-surface .brand-name {
  color: var(--color-paper);
}

.nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-body);
  padding: 4px 0;
  position: relative;
}

.dark-surface .nav a {
  color: var(--color-paper);
}

.nav a[aria-current="page"] {
  color: var(--color-accent);
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-accent);
}

/* === Buttons === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0 24px;
  height: 48px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  background-color: color-mix(in srgb, var(--color-accent) 90%, black);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--color-body);
  border: 2px solid var(--color-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0 24px;
  height: 48px;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.dark-surface .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.dark-surface .btn-secondary:hover {
  color: var(--color-dark);
  background-color: var(--color-paper);
}

.btn-secondary:hover {
  transform: translateY(-1px);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* === Footer === */
.site-footer {
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding: 48px var(--gap) 32px;
}

.footer-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-paper);
  font-size: 0.85rem;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  opacity: 1;
}

.footer-copy {
  font-size: 0.8rem;
  opacity: 0.6;
}

/* === Section Base === */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.paper-surface .section-label {
  color: var(--color-brand);
}

.dark-surface .section-label {
  color: var(--color-accent);
}

.section h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.dark-surface .section h2 {
  color: var(--color-paper);
}

.section h2 .hl {
  color: var(--color-brand);
}

.dark-surface .section h2 .hl {
  color: var(--color-accent);
}

.section-intro {
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 65ch;
  margin-bottom: 32px;
  color: var(--color-body);
}

.dark-surface .section-intro {
  color: var(--color-paper);
  opacity: 0.9;
}

/* === Hero === */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background-color: var(--color-dark);
  color: var(--color-paper);
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  position: relative;
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
}

.hero-content {
  max-width: 600px;
}

.hero .section-label {
  color: var(--color-accent);
}

.hero h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero h1 .hl {
  color: var(--color-accent);
}

.hero-desc {
  font-size: 1.1rem;
  line-height: 1.7;
  max-width: 55ch;
  margin-bottom: 32px;
  opacity: 0.9;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.hero-fact {
  font-size: 0.85rem;
  opacity: 0.6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-svg-wrap {
  width: 100%;
  max-width: 560px;
  margin-left: auto;
}

/* === Cards === */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translate(-1px, -1px);
}

.dark-surface .card {
  background-color: var(--color-paper);
  color: var(--color-body);
}

.card-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
  stroke: var(--color-brand);
}

.dark-surface .card-icon {
  stroke: var(--color-brand);
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.3;
}

.card p {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--color-body);
}

/* === Feature Grid === */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}

.feature-group-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-brand);
  color: var(--color-body);
}

.dark-surface .feature-group-title {
  color: var(--color-paper);
  border-bottom-color: var(--color-accent);
}

/* === Timeline Steps === */
.timeline {
  position: relative;
  padding-left: 48px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--color-brand);
}

.timeline-step {
  position: relative;
  margin-bottom: 32px;
}

.timeline-step:last-child {
  margin-bottom: 0;
}

.step-number {
  position: absolute;
  left: -48px;
  top: 0;
  width: 32px;
  height: 32px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.step-desc {
  font-size: 0.95rem;
  line-height: 1.65;
  opacity: 0.85;
}

/* === Tip List === */
.tip-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tip-item {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.tip-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.tip-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.tip-content p {
  font-size: 0.9rem;
  line-height: 1.65;
  opacity: 0.85;
}

/* === FAQ === */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.faq-item {
  border-bottom: 1px solid rgba(32, 21, 35, 0.12);
}

.dark-surface .faq-item {
  border-bottom-color: rgba(246, 243, 247, 0.15);
}

.faq-item summary {
  padding: 16px 0;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::before {
  transform: rotate(45deg);
}

.faq-item .faq-answer {
  padding: 0 0 16px 20px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-body);
}

.dark-surface .faq-item .faq-answer {
  color: var(--color-paper);
}

/* === Scenarios === */
.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.scenario-card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 28px;
}

.dark-surface .scenario-card {
  background-color: var(--color-paper);
  color: var(--color-body);
}

.scenario-card h4 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.scenario-card ol {
  padding-left: 20px;
  counter-reset: scenario-counter;
}

.scenario-card ol li {
  counter-increment: scenario-counter;
  padding: 6px 0;
  font-size: 0.95rem;
  line-height: 1.65;
  position: relative;
  padding-left: 24px;
}

.scenario-card ol li::before {
  content: counter(scenario-counter);
  position: absolute;
  left: 0;
  top: 6px;
  width: 18px;
  height: 18px;
  background-color: var(--color-accent);
  color: var(--color-dark);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scenario-result {
  margin-top: 12px;
  padding: 10px 14px;
  background-color: rgba(167, 17, 207, 0.08);
  border-left: 3px solid var(--color-brand);
  font-size: 0.9rem;
  line-height: 1.6;
}

.dark-surface .scenario-result {
  background-color: rgba(237, 110, 115, 0.1);
  border-left-color: var(--color-accent);
}

/* === Table === */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(32, 21, 35, 0.12);
}

.data-table th {
  font-weight: 700;
  background-color: rgba(32, 21, 35, 0.04);
}

.dark-surface .data-table th {
  background-color: rgba(246, 243, 247, 0.06);
  color: var(--color-paper);
}

.dark-surface .data-table td {
  color: var(--color-paper);
  border-bottom-color: rgba(246, 243, 247, 0.1);
}

.data-table td a {
  word-break: break-all;
}

/* === News Cards === */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--gap);
}

.news-card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  padding: 24px;
  transition: transform 0.2s ease;
}

.news-card:hover {
  transform: translate(-1px, -1px);
}

.dark-surface .news-card {
  background-color: var(--color-paper);
  color: var(--color-body);
}

.news-card time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-brand);
  display: block;
  margin-bottom: 8px;
}

.news-card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
  line-height: 1.4;
}

.news-card p {
  font-size: 0.9rem;
  line-height: 1.65;
  opacity: 0.85;
}

/* === Two Column Layout === */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: start;
}

/* === Visual Panel === */
.visual-panel {
  background-color: var(--color-dark);
  border-radius: 0;
  padding: 24px;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel svg {
  width: 100%;
  height: auto;
  max-width: 480px;
}

/* === CTA Section === */
.cta-section {
  background-color: var(--color-dark);
  padding: var(--section-y) 0;
  text-align: center;
}

.cta-section h2 {
  color: var(--color-paper);
}

.cta-section .section-intro {
  color: var(--color-paper);
  opacity: 0.85;
  margin-left: auto;
  margin-right: auto;
}

.cta-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* === SVG Animations === */
@keyframes float-card {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

@keyframes float-card-alt {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-5px); }
  100% { transform: translateY(0px); }
}

@keyframes pulse-dots {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

@keyframes slide-in-right {
  0% { transform: translateX(30px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes blink-cursor {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes badge-pop {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.anim-float-1 {
  animation: float-card 6s ease-in-out infinite;
}

.anim-float-2 {
  animation: float-card-alt 7s ease-in-out infinite 1s;
}

.anim-float-3 {
  animation: float-card 5.5s ease-in-out infinite 0.5s;
}

.anim-pulse {
  animation: pulse-dots 2s ease-in-out infinite;
}

.anim-slide-in {
  animation: slide-in-right 0.8s ease-out forwards;
}

.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-flow 3s ease-in-out infinite;
}

.anim-blink {
  animation: blink-cursor 1.2s step-end infinite;
}

.anim-badge {
  animation: badge-pop 4s ease-in-out infinite;
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .anim-float-1,
  .anim-float-2,
  .anim-float-3,
  .anim-pulse,
  .anim-slide-in,
  .anim-draw,
  .anim-blink,
  .anim-badge {
    animation: none !important;
  }
}

/* === Responsive === */
@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-svg-wrap {
    order: -1;
    max-width: 400px;
    margin: 0 auto;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .nav {
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .header-inner {
    height: 56px;
  }

  .nav a:not(.nav-cta) {
    display: none;
  }

  .hero h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

/* === Utility === */
.text-center {
  text-align: center;
}

.mt-gap {
  margin-top: var(--gap);
}

.mb-gap {
  margin-bottom: var(--gap);
}

.max-w-65 {
  max-width: 65ch;
}

.max-w-55 {
  max-width: 55ch;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* === Icon SVG === */
.icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

.icon-lg {
  width: 28px;
  height: 28px;
}

/* === Badge === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  background-color: var(--color-accent);
  color: var(--color-dark);
}

/* === Notice Box === */
.notice-box {
  padding: 16px 20px;
  border-left: 3px solid var(--color-brand);
  background-color: rgba(167, 17, 207, 0.06);
  margin: 16px 0;
  font-size: 0.9rem;
  line-height: 1.65;
}

.dark-surface .notice-box {
  border-left-color: var(--color-accent);
  background-color: rgba(237, 110, 115, 0.08);
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-paper);
}

::-webkit-scrollbar-thumb {
  background: rgba(32, 21, 35, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(32, 21, 35, 0.35);
}
