/* =========================================
   SafeW Global Styles & Design System
   ========================================= */

/* --- Design Tokens --- */
:root {
  /* Color Palette */
  --bg-dark: #13102D;
  --bg-paper: #D6D4ED;
  --text-body: #171523;
  --brand: #2714EB;
  --accent: #89ED6E;
  
  /* Derived UI Colors */
  --border-color: rgba(23, 21, 35, 0.16);
  --card-bg-light: #FFFFFF;
  
  /* Spacing & Layout */
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --content-max: 1120px;
  
  /* Radius & Shadows */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-shadow: none;
  
  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--text-body);
  background-color: var(--bg-paper);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.8;
}

/* --- 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);
  position: relative;
}

.bg-dark {
  background-color: var(--bg-dark);
  color: var(--bg-paper);
}

.bg-dark a {
  color: var(--accent);
}

.bg-paper {
  background-color: var(--bg-paper);
  color: var(--text-body);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 1rem;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
}

.text-accent {
  color: var(--accent);
}

.text-brand {
  color: var(--brand);
}

/* --- Components --- */

/* Badge / Eyebrow */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.bg-dark .badge {
  color: var(--accent);
}

.bg-paper .badge {
  color: var(--brand);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-btn);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--bg-dark);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(137, 237, 110, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-body);
  border: 1px solid var(--text-body);
}

.bg-dark .btn-secondary {
  color: var(--bg-paper);
  border: 1px solid var(--bg-paper);
}

.btn-secondary:hover {
  background-color: rgba(0,0,0,0.05);
}

.bg-dark .btn-secondary:hover {
  background-color: rgba(255,255,255,0.1);
}

.btn-icon {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
  stroke-width: 2;
}

/* Cards */
.card {
  background: var(--card-bg-light);
  border: var(--card-border, 1px solid rgba(23, 21, 35, 0.16));
  border-radius: var(--radius-card);
  padding: 2rem;
  box-shadow: var(--card-shadow);
}

/* Grid & Flex */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
}

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  text-align: left;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  background-color: rgba(0,0,0,0.03);
}

td:first-child {
  font-weight: 600;
  color: var(--text-body);
}

.bg-dark th, .bg-dark td {
  border-bottom-color: rgba(255,255,255,0.1);
}

.bg-dark td:first-child {
  color: var(--bg-paper);
}

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

details summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 0;
  font-weight: 600;
  font-size: 1.1rem;
  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: 300;
  transition: transform 0.2s;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details p {
  padding-top: 0.5rem;
  color: inherit;
  opacity: 0.9;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(214, 212, 237, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
}

.bg-dark header {
  background-color: rgba(19, 16, 45, 0.95);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: inherit;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-links a[aria-current="page"] {
  color: var(--brand);
  font-weight: 700;
}

.bg-dark .nav-links a[aria-current="page"] {
  color: var(--accent);
}

/* Footer */
footer {
  border-top: 1px solid var(--border-color);
  padding: 3rem 0;
  margin-top: auto;
  font-size: 0.9rem;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer-col a {
  display: block;
  margin-bottom: 0.5rem;
  text-decoration: none;
}

/* SVG Animation Helpers */
.svg-visual {
  width: 100%;
  height: auto;
  overflow: visible;
}

.float-slow {
  animation: float 6s ease-in-out infinite;
}

.float-fast {
  animation: float 4s ease-in-out infinite reverse;
}

.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 3s ease forwards;
}

.breathing {
  animation: breathe 2s ease-in-out infinite alternate;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  100% { stroke-dashoffset: 0; }
}

@keyframes breathe {
  0% { opacity: 0.6; transform: scale(0.98); }
  100% { opacity: 1; transform: scale(1); }
}

/* Accessibility & 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;
  }
}

/* Focus States */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.bg-dark :focus-visible {
  outline-color: var(--accent);
}

/* Responsive Tweaks */
@media (max-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .nav-links {
    display: none; /* Simplified for mobile, ideally a burger menu but keeping simple per constraints */
  }
  
  .mobile-menu-btn {
    display: block;
  }
}

