/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

:root {
  /* Colors */
  --color-bg-dark: #13102D;
  --color-bg-paper: #D6D4ED;
  --color-text-main: #171523;
  --color-brand: #2714EB;
  --color-accent: #89ED6E;
  
  /* Derived Colors for Borders/Subtle UI */
  --border-color-light: rgba(23, 21, 35, 0.1);
  --border-color-dark: rgba(214, 212, 237, 0.2);
  
  /* Spacing & Layout */
  --content-max: 960px;
  --section-y: clamp(5rem, 10vw, 9rem);
  --gap: clamp(1.5rem, 3vw, 2.5rem);
  --radius-card: 24px;
  --radius-btn: 999px;
  --radius-sm: 8px;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --lh-tight: 1.1;
  --lh-body: 1.75;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--lh-body);
  color: var(--color-text-main);
  background-color: var(--color-bg-paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { padding-left: 0; list-style: none; }

/* Container */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* Typography Scale */
h1, h2, h3, h4 {
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
  margin-top: 0;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 1.5rem; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); margin-bottom: 0.75rem; }
p { margin-bottom: 1.5rem; max-width: 38em; }

/* Highlight Keyword */
.hl {
  color: var(--color-brand);
}
.dark-mode .hl {
  color: var(--color-accent);
}

/* Section Layout */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
}
.dark-section {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
}
.dark-section h2, .dark-section h3 { color: var(--color-bg-paper); }
.dark-section p { color: var(--color-bg-paper); }

/* Header & Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(214, 212, 237, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color-light);
}
.dark-section .site-header {
  background-color: rgba(19, 16, 45, 0.9);
  border-bottom-color: var(--border-color-dark);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-text-main);
}
.dark-section .brand { color: var(--color-bg-paper); }
.brand img { height: 32px; width: auto; }
.nav-links { display: flex; gap: 24px; }
.nav-link {
  font-weight: 600;
  font-size: 0.95rem;
  transition: opacity 0.2s;
}
.nav-link:hover { opacity: 0.7; }
.nav-link[aria-current="page"] {
  color: var(--color-brand);
  border-bottom: 2px solid var(--color-brand);
}
.dark-section .nav-link[aria-current="page"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 32px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}
.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(0.95);
}
.btn-secondary {
  border: 1px solid var(--color-text-main);
  color: var(--color-text-main);
  background: transparent;
}
.dark-section .btn-secondary {
  border-color: var(--color-bg-paper);
  color: var(--color-bg-paper);
}
.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--border-color-light);
  border-radius: var(--radius-card);
  padding: 24px;
  transition: transform 0.2s;
}
.card:hover { transform: translateY(-4px); }
.dark-section .card {
  background: rgba(255,255,255,0.05);
  border-color: var(--border-color-dark);
}

/* Forms & Inputs (Pure CSS Tabs) */
.tab-radio { display: none; }
.tab-nav { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.tab-label {
  padding: 8px 20px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-color-light);
  cursor: pointer;
  font-weight: 600;
  user-select: none;
  transition: all 0.2s;
}
.tab-panel { display: none; animation: fadeIn 0.4s ease; }
.tab-radio:checked + .tab-label {
  background-color: var(--color-brand);
  color: #fff;
  border-color: var(--color-brand);
}
.tab-radio[data-target]:checked ~ [data-panel] {
  display: block;
}

/* FAQ Details */
details {
  border-bottom: 1px solid var(--border-color-light);
  padding: 16px 0;
}
summary {
  font-weight: 700;
  cursor: pointer;
  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: 300; }
details[open] summary::after { content: '−'; }
details p { margin-top: 12px; margin-bottom: 0; }

/* Tables */
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}
th, td {
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid var(--border-color-light);
}
th { font-weight: 700; color: var(--color-brand); }
.dark-section th { color: var(--color-accent); }

/* SVG Animation Classes */
.anim-float {
  animation: float 6s ease-in-out infinite;
}
.anim-fade-up {
  animation: fadeUp 4s ease-in-out infinite alternate;
}
.anim-draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 4s linear infinite;
}
.anim-spin-slow {
  animation: spinSlow 20s linear infinite;
  transform-box: fill-box;
  transform-origin: center;
}

/* Keyframes */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes fadeUp {
  0% { transform: translateY(5px); opacity: 0.8; }
  100% { transform: translateY(-5px); opacity: 1; }
}
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 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;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; } /* Simplified for static demo */
  h1 { font-size: 2.5rem; }
  .hero-layout { flex-direction: column; }
}
