/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

:root {
  /* Color Palette */
  --bg-dark: #121531;
  --bg-paper: #E8E9EA;
  --text-body: #151723;
  --brand-color: #142CEB;
  --accent-color: #ED7D6E;
  
  /* Derived UI Colors */
  --card-bg-light: #F4F5F6;
  --card-bg-dark: #1A1D3A;
  --border-subtle: rgba(21, 23, 35, 0.08);
  --border-subtle-dark: rgba(232, 233, 234, 0.1);

  /* Sizing & Spacing */
  --radius-card: 24px;
  --radius-btn: 999px;
  --radius-sm: 8px;
  
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  
  /* Typography */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --lh-tight: 1.2;
  --lh-normal: 1.65;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background-color: var(--bg-paper);
  color: var(--text-body);
  line-height: var(--lh-normal);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* Layout Containers */
.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);
}

/* Typography */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--brand-color);
}

.dark-surface .badge { color: var(--accent-color); }

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  line-height: var(--lh-tight);
  margin-bottom: 1.25rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: var(--lh-tight);
  margin-bottom: 0.75rem;
}

p { margin-bottom: 1rem; max-width: 38em; }

.highlight { color: var(--brand-color); }
.dark-surface .highlight { color: var(--accent-color); }

/* Components: Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent-color);
  color: var(--bg-dark);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(237, 125, 110, 0.3);
}

.btn-secondary {
  background: transparent;
  border: 2px solid var(--text-body);
  color: var(--text-body);
}
.dark-surface .btn-secondary {
  border-color: var(--bg-paper);
  color: var(--bg-paper);
}
.btn-secondary:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.btn:focus-visible {
  outline: 3px solid var(--accent-color);
  outline-offset: 4px;
}

/* Components: Cards */
.card {
  background: var(--card-bg-light);
  border-radius: var(--radius-card);
  padding: var(--gap);
  border: var(--card-border, 0);
  box-shadow: var(--card-shadow, none);
  transition: transform 0.2s ease;
}
.dark-surface .card {
  background: var(--card-bg-dark);
  border-color: var(--border-subtle-dark);
}
.card:hover { transform: translateY(-4px); }

/* Components: Tables */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1px solid var(--border-subtle);
}
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
th {
  background: var(--card-bg-light);
  font-weight: 700;
  color: var(--text-body);
}
.dark-surface table { background: var(--card-bg-dark); border-color: var(--border-subtle-dark); }
.dark-surface th { background: rgba(255,255,255,0.05); color: var(--bg-paper); }
.dark-surface td { border-color: var(--border-subtle-dark); color: var(--bg-paper); }

/* Components: FAQ */
.faq-item {
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}
.dark-surface .faq-item { border-color: var(--border-subtle-dark); }

details summary {
  padding: 16px 0;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(45deg); }
details p {
  padding-bottom: 16px;
  color: var(--text-body);
  max-width: 38em;
}
.dark-surface details p { color: var(--bg-paper); }

/* Components: Timeline (Quick Start) */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--brand-color);
}
.dark-surface .timeline { border-color: var(--accent-color); }
.timeline-step {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 1.5rem;
}
.timeline-step::before {
  content: attr(data-num);
  position: absolute;
  left: -2.55rem;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--accent-color);
  color: var(--bg-dark);
  font-weight: 800;
  font-size: 1rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Header & Footer */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(232, 233, 234, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 0;
}
.dark-surface.site-header { background: rgba(18, 21, 49, 0.9); border-color: var(--border-subtle-dark); }

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 24px;
}
.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 0;
  position: relative;
}
.nav-links a:hover, .nav-links a[aria-current="page"] {
  color: var(--brand-color);
}
.dark-surface .nav-links a:hover, .dark-surface .nav-links a[aria-current="page"] {
  color: var(--accent-color);
}

.site-footer {
  background: var(--bg-dark);
  color: var(--bg-paper);
  padding: 64px 0 32px;
  border-top: 1px solid var(--border-subtle-dark);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 48px;
}
.footer-col h4 {
  color: var(--accent-color);
  margin-bottom: 16px;
  font-size: 1rem;
}
.footer-col ul li { margin-bottom: 10px; }
.footer-col a:hover { text-decoration: underline; }
.footer-bottom {
  border-top: 1px solid var(--border-subtle-dark);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.7;
}

/* SVG Animation Utilities */
.svg-container {
  width: 100%;
  height: auto;
  overflow: visible;
}
svg { overflow: visible; }

/* Draw Line Animation */
@keyframes draw-line {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}
.draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: draw-line 3s ease-in-out infinite alternate;
}

/* Float Animation */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.float-anim { animation: float 4s ease-in-out infinite; }

/* Pulse Breathing */
@keyframes breathe {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.05); }
}
.breathe { animation: breathe 2.5s ease-in-out infinite; }

/* Flowing Dots */
@keyframes flow-dot {
  0% { offset-distance: 0%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}
.flow-dot {
  offset-path: url(#flow-path);
  offset-rotate: 0deg;
  animation: flow-dot 5s linear infinite;
}
.flow-dot:nth-child(2) { animation-delay: 1.5s; }
.flow-dot:nth-child(3) { animation-delay: 3s; }

/* 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, .float-anim, .breathe, .flow-dot {
    animation: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; } /* Simplified for mobile, relies on CTA */
  .grid-3 { grid-template-columns: 1fr; }
  .hero-layout { flex-direction: column; text-align: center; }
  .hero-layout > div:first-child { order: 1; }
  .hero-layout > div:last-child { order: 2; margin-top: 2rem; }
  p { margin-left: auto; margin-right: auto; }
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
@media (max-width: 768px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
