/* =========================================
   SafeW Global Styles & Design System
   ========================================= */

:root {
  /* --- Color Palette --- */
  --color-dark: #231334;       /* Deep Purple Background */
  --color-paper: #F5F3F7;      /* Light Paper Background */
  --color-text: #1C1523;       /* Main Text on Light */
  --color-brand: #7D14EB;      /* Brand Accent (Links, Highlights) */
  --color-amber: #EDD26E;      /* Emphasis Accent (Buttons, Dark Highlights) */
  
  /* --- Tokens --- */
  --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: 960px;
  
  /* Typography */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-main);
  background-color: var(--color-paper);
  color: var(--color-text);
  line-height: 1.55;
  font-size: 16px;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { padding-left: 0; list-style: none; }

/* --- Layout Utilities --- */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}

/* --- Surface Colors --- */
.dark-surface {
  background-color: var(--color-dark);
  color: var(--color-paper);
}
.light-paper {
  background-color: var(--color-paper);
  color: var(--color-text);
}

/* Text Color Overrides based on Surface */
.dark-surface .text-highlight { color: var(--color-amber); }
.light-paper .text-highlight { color: var(--color-brand); }

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 0;
  margin-bottom: 0.5em;
}

h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); text-wrap: balance; }
h2 { 
  font-size: clamp(1.6rem, 3vw, 2.4rem); 
  margin-bottom: 1.5rem;
  position: relative;
  padding-left: 1rem;
}
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

p { margin-bottom: 1rem; max-width: 38em; }

/* Eyebrow Label */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.light-paper .eyebrow { color: var(--color-brand); }
.dark-surface .eyebrow { color: var(--color-amber); }

/* --- Components: Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  border: none;
}
.btn:focus-visible {
  outline: 3px solid var(--color-amber);
  outline-offset: 2px;
}
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background-color: var(--color-amber);
  color: var(--color-dark);
}
.btn-primary:hover {
  filter: brightness(0.95);
  box-shadow: 0 4px 12px rgba(237, 210, 110, 0.4);
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--color-text);
  color: var(--color-text);
}
.dark-surface .btn-secondary {
  border-color: var(--color-paper);
  color: var(--color-paper);
}
.btn-secondary:hover {
  background-color: rgba(125, 20, 235, 0.1);
}
.dark-surface .btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* --- Components: Cards --- */
.card {
  background-color: var(--color-paper);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  transition: transform 0.2s ease;
}
.card:hover { transform: translate(-2px, -2px); }

/* --- Components: Tables --- */
.table-wrapper {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-paper);
}
th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
}
th {
  font-weight: 700;
  background-color: rgba(125, 20, 235, 0.05);
}
.dark-surface th { background-color: rgba(255, 255, 255, 0.05); }

/* --- Components: FAQ --- */
.faq-item {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background: var(--color-paper);
}
.faq-item summary {
  padding: 1.25rem;
  cursor: pointer;
  font-weight: 700;
  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: 300; }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 1.25rem 1.25rem; margin-bottom: 0; }

/* --- Header & Nav --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-paper);
  border-bottom: 1px solid rgba(28, 21, 35, 0.1);
  padding: 0.75rem 0;
}
.dark-surface.site-header {
  background-color: var(--color-dark);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.25rem;
}
.brand-logo img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-link { font-weight: 600; font-size: 0.95rem; opacity: 0.8; transition: opacity 0.2s; }
.nav-link:hover, .nav-link[aria-current="page"] { opacity: 1; text-decoration: underline; text-underline-offset: 4px; }

/* --- Footer --- */
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid rgba(28, 21, 35, 0.1);
  font-size: 0.9rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
}
.footer-col h4 { margin-bottom: 1rem; font-size: 1rem; }
.footer-col a { display: block; margin-bottom: 0.5rem; opacity: 0.7; }
.footer-col a:hover { opacity: 1; }

/* --- SVG Animations --- */
@keyframes draw-line {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes float-up {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes rotate-pair {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.anim-draw {
  path {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: draw-line 3s ease-in-out infinite alternate;
  }
}
.anim-float {
  animation: float-up 4s ease-in-out infinite;
}
.anim-pulse {
  animation: pulse-opacity 2s ease-in-out infinite;
}
.anim-rotate {
  animation: rotate-pair 10s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Responsive Tweaks */
@media (max-width: 768px) {
  .hero-layout { flex-direction: column-reverse; }
  .scenario-grid { grid-template-columns: 1fr; }
  .steps-container { flex-direction: column; }
  .step-item { margin-bottom: 1.5rem; }
  h1 { font-size: 2.2rem; }
}

/* 兜底：裁掉横向溢出 */
body > * {
  overflow-x: clip;
}
/* factory-contrast-width */
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1c1523 !important;
    -webkit-text-fill-color: #1c1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1c1523 !important;
    -webkit-text-fill-color: #1c1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1c1523 !important;
    -webkit-text-fill-color: #1c1523 !important;
  }
}
@media (min-width: 1440px) {
  [data-fc-1440="ink"] {
    color: #1c1523 !important;
    -webkit-text-fill-color: #1c1523 !important;
  }
}
