/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

:root {
  /* Colors */
  --color-dark-bg: #1B1231;
  --color-paper-bg: #DBD4ED;
  --color-body-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* Typography */
  --font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --text-base: 16px;
  --line-height: 1.75;
  --heading-weight: 500;
  --h1-size: clamp(2.6rem, 6.4vw, 5rem);
  --h2-size: clamp(1.8rem, 3.5vw, 2.8rem);
  --h3-size: clamp(1.4rem, 2.2vw, 1.8rem);

  /* Spacing & Layout */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  --header-height: 72px;

  /* Components */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 0;
  --card-shadow: none;
  --btn-height: 52px;
  --border-radius: 16px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  line-height: var(--line-height);
  color: var(--color-body-text);
  background-color: var(--color-paper-bg);
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* =========================================
   Layout Utilities
   ========================================= */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
  align-items: center;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--gap);
}

.section-padding {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

.text-center { text-align: center; }
.mt-gap { margin-top: var(--gap); }

/* =========================================
   Header & Navigation
   ========================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background-color: rgba(219, 212, 237, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.site-header.scrolled {
  background-color: rgba(219, 212, 237, 0.95);
  box-shadow: 0 1px 0 rgba(25, 21, 35, 0.08);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.brand img {
  width: 32px;
  height: 32px;
}

.nav-links {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-body-text);
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  opacity: 1;
  color: var(--color-brand);
}

.nav-links a[aria-current="page"] {
  font-weight: 700;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: var(--btn-height);
  padding: 0 28px;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  border: none;
  outline: none;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-body-text);
  border: 1.5px solid var(--color-body-text);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(25, 21, 35, 0.05);
}

/* Dark mode buttons override handled by parent class */
.dark-surface .btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
}
.dark-surface .btn-secondary {
  color: var(--color-paper-bg);
  border-color: var(--color-paper-bg);
}
.dark-surface .btn-secondary:hover {
  background-color: rgba(219, 212, 237, 0.1);
}

/* =========================================
   Typography & Headings
   ========================================= */
.section-label {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
  color: var(--color-brand);
}

.dark-surface .section-label {
  color: var(--color-accent);
}

h1 {
  font-size: var(--h1-size);
  font-weight: var(--heading-weight);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

h2 {
  font-size: var(--h2-size);
  font-weight: var(--heading-weight);
  line-height: 1.2;
  margin-bottom: 32px;
}

h3 {
  font-size: var(--h3-size);
  font-weight: var(--heading-weight);
  line-height: 1.25;
  margin-bottom: 16px;
}

p {
  margin-bottom: 1.5em;
  max-width: 38em;
}

.hl {
  color: var(--color-brand);
}

.dark-surface .hl {
  color: var(--color-accent);
}

/* =========================================
   Cards & Panels
   ========================================= */
.card {
  background-color: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-card);
  padding: 32px;
  /* No borders, no shadows as per spec */
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}

.dark-surface .card {
  background-color: rgba(255, 255, 255, 0.08);
}

.visual-panel {
  background-color: var(--color-dark-bg);
  border-radius: var(--radius-card);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

/* =========================================
   Feature List & Steps
   ========================================= */
.feature-list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-brand);
}

.dark-surface .feature-list li::before {
  background-color: var(--color-accent);
}

.step-item {
  display: flex;
  gap: 20px;
  margin-bottom: 32px;
}

.step-number {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
  font-weight: 700;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* =========================================
   FAQ (Details/Summary)
   ========================================= */
.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  margin-bottom: 0;
}

.faq-item summary {
  padding: 20px 0;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  margin-top: 12px;
  margin-bottom: 24px;
  color: rgba(25, 21, 35, 0.85);
}

.dark-surface .faq-item {
  border-color: rgba(219, 212, 237, 0.15);
}

.dark-surface .faq-item p {
  color: rgba(219, 212, 237, 0.85);
}

/* =========================================
   Table
   ========================================= */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.dark-surface th,
.dark-surface td {
  border-bottom-color: rgba(219, 212, 237, 0.15);
}

th {
  font-weight: 600;
  color: var(--color-brand);
}

.dark-surface th {
  color: var(--color-accent);
}

td:first-child {
  font-weight: 600;
  color: var(--color-body-text);
}

.dark-surface td:first-child {
  color: var(--color-paper-bg);
}

/* =========================================
   Footer
   ========================================= */
.site-footer {
  background-color: var(--color-dark-bg);
  color: var(--color-paper-bg);
  padding: 64px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
  margin-bottom: 48px;
}

.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--color-accent);
}

.footer-col ul li {
  margin-bottom: 12px;
}

.footer-col a {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.footer-col a:hover {
  opacity: 1;
}

.footer-bottom {
  border-top: 1px solid rgba(219, 212, 237, 0.15);
  padding-top: 32px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* =========================================
   SVG Animations
   ========================================= */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes dash-flow {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes rotate-slow {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.draw-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 1.5s ease forwards;
}

.float-anim {
  animation: float 4s ease-in-out infinite;
}

.breathe-anim {
  animation: breathe 3s ease-in-out infinite;
}

.flow-path {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: dash-flow 2s linear infinite;
}

.rotate-anim {
  transform-box: fill-box;
  transform-origin: center;
  animation: rotate-slow 20s linear infinite;
}

/* Reduced Motion */
@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-path, .flow-path {
    animation: none;
    stroke-dashoffset: 0;
  }
  .float-anim, .breathe-anim, .rotate-anim {
    animation: none;
    transform: none;
  }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .nav-links {
    display: none; /* Simplified for this output, typically hamburger menu */
  }
  
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .visual-panel {
    order: -1; /* Move visual above text on mobile if needed, or keep natural flow */
    aspect-ratio: 16/9;
  }
  
  h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
}
