/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

:root {
  /* Color Palette */
  --color-bg-dark: #10112D;
  --color-bg-paper: #F5F0E5;
  --color-text-body: #151523;
  --color-brand: #1416EB;
  --color-accent: #89ED6E;
  
  /* Derived Colors for UI Elements */
  --color-border-subtle: rgba(21, 21, 35, 0.16);
  --color-white: #FFFFFF;
  
  /* Typography */
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  
  /* Spacing & Layout */
  --content-max: 960px;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --header-height: 72px;
  
  /* Shapes */
  --radius-card: 24px;
  --radius-btn: 999px;
  --radius-sm: 8px;
  
  /* Shadows */
  --card-shadow: none;
}

/* Dark Mode / Dark Surface Overrides */
.surface-dark {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
}
.surface-dark .brand-text {
  color: var(--color-accent);
}
.surface-dark .hl {
  color: var(--color-accent);
}

/* Paper Card Overrides inside Dark Surface */
.paper-card {
  background-color: var(--color-bg-paper);
  color: var(--color-text-body);
  border-radius: var(--radius-card);
  padding: var(--gap);
}
.paper-card .brand-text {
  color: var(--color-brand);
}
.paper-card .hl {
  color: var(--color-brand);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-main);
  line-height: 1.65;
  color: var(--color-text-body);
  background-color: var(--color-bg-paper);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

/* Typography Scale */
h1, h2, h3, h4 {
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: inherit;
}

h1 {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 1.25rem;
  text-wrap: balance;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  margin-bottom: 0.75rem;
  text-wrap: balance;
}

p {
  margin-bottom: 1rem;
  max-width: 38em;
  text-wrap: pretty;
}

.text-lead {
  font-size: clamp(1.1rem, 1.5vw, 1.25rem);
  opacity: 0.9;
  line-height: 1.6;
}

/* Components: Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 52px;
  padding: 0 2rem;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.2s ease, opacity 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 4px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}
.btn-primary:hover {
  background-color: #76d65b; /* Slightly darker accent */
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.surface-dark .btn-secondary {
  border-color: var(--color-bg-paper);
  color: var(--color-bg-paper);
}

/* Components: Cards */
.card {
  background-color: var(--color-bg-paper);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
}

/* Components: Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: var(--card-border);
  background-color: var(--color-bg-paper);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}
th, td {
  padding: 1rem var(--gap);
  text-align: left;
  border-bottom: var(--card-border);
}
th {
  font-weight: 600;
  background-color: rgba(21, 21, 35, 0.03);
}
tr:last-child td {
  border-bottom: none;
}

/* Components: FAQ */
.faq-item {
  border-bottom: var(--card-border);
}
.faq-item:last-child {
  border-bottom: none;
}
summary {
  padding: 1.25rem 0;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker {
  display: none;
}
summary::after {
  content: "+";
  font-size: 1.5rem;
  font-weight: 400;
  opacity: 0.5;
  transition: transform 0.2s;
}
details[open] summary::after {
  transform: rotate(45deg);
}
details p {
  padding-bottom: 1.5rem;
  color: rgba(21, 21, 35, 0.8);
}
.surface-dark details p {
  color: rgba(245, 240, 229, 0.8);
}

/* Components: Badge/Label */
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  color: var(--color-brand);
}
.surface-dark .badge {
  color: var(--color-accent);
}

/* 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);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
}

/* Header & Nav */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(245, 240, 229, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(21, 21, 35, 0.05);
  height: var(--header-height);
}
.surface-dark .header {
  background-color: rgba(16, 17, 45, 0.85);
  border-bottom-color: rgba(245, 240, 229, 0.1);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
}
.logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 2rem;
  align-items: center;
}
.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.nav-link:hover, .nav-link[aria-current="page"] {
  opacity: 1;
}
.header.surface-dark .container.nav-container .nav-links a.nav-link {
  color: var(--color-text-body);
}

/* Footer */
.footer {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
  padding: 4rem 0 2rem;
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 3rem;
  margin-bottom: 3rem;
}
.footer-col h4 {
  font-size: 1rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}
.footer-col a {
  display: block;
  opacity: 0.6;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  transition: opacity 0.2s;
}
.footer-col a:hover {
  opacity: 1;
}
.footer-bottom {
  border-top: 1px solid rgba(245, 240, 229, 0.1);
  padding-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  opacity: 0.5;
}

/* SVG Animation Classes */
.node-pulse {
  animation: nodePulse 4s infinite alternate ease-in-out;
}
.node-pulse-delay-1 { animation-delay: 0.5s; }
.node-pulse-delay-2 { animation-delay: 1.0s; }
.node-pulse-delay-3 { animation-delay: 1.5s; }

@keyframes nodePulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.bubble-float {
  animation: float 6s infinite ease-in-out;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.line-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: drawLine 3s linear infinite;
}
@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .hero-layout {
    flex-direction: column-reverse;
  }
  .hero-visual {
    width: 100%;
    margin-bottom: 2rem;
  }
  .nav-links {
    display: none; /* Simplified for mobile, ideally hamburger menu */
  }
  /* Add simple mobile menu trigger logic if needed, keeping it static for now per prompt constraints */
  .mobile-menu-btn {
    display: block;
  }
}
@media (min-width: 769px) {
  .mobile-menu-btn {
    display: none;
  }
}

/* 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;
  }
}
