/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

/* --- Variables & Reset --- */
:root {
  /* Colors */
  --color-bg-dark: #140E25;
  --color-bg-paper: #F7F5F3;
  --color-text-main: #191523;
  --color-brand: #5214EB;
  --color-accent: #C8ED6E;
  
  /* Derived Colors */
  --color-border: rgba(25, 21, 35, 0.16); /* 16% opacity of main text */
  --color-white: #FFFFFF;
  
  /* Spacing & Rhythm */
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  
  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --text-xs: clamp(0.75rem, 0.8rem, 0.85rem);
  --text-sm: clamp(0.875rem, 0.9rem, 1rem);
  --text-base: clamp(1rem, 1.05rem, 1.125rem);
  --text-lg: clamp(1.25rem, 1.5vw, 1.5rem);
  --text-xl: clamp(1.75rem, 2.5vw, 2.2rem);
  --text-hero: clamp(2.2rem, 5vw, 3.8rem);
  
  /* Components */
  --radius-card: 8px;
  --radius-btn: 6px;
  --card-border: 1px solid var(--color-border);
  --card-shadow: none;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg-paper);
  color: var(--color-text-main);
  line-height: 1.55;
  font-size: var(--text-base);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  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);
  position: relative;
}

.bg-dark {
  background-color: var(--color-bg-dark);
  color: var(--color-bg-paper);
}

.bg-paper {
  background-color: var(--color-bg-paper);
  color: var(--color-text-main);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

h1 {
  font-size: var(--text-hero);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: var(--gap);
}

h2 {
  font-size: var(--text-xl);
  margin-bottom: var(--gap);
}

h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--gap);
}

p {
  margin-bottom: var(--gap);
  max-width: 38em;
}

.hl {
  color: var(--color-brand);
}

.bg-dark .hl {
  color: var(--color-accent);
}

.subtitle {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-brand);
  display: block;
  margin-bottom: calc(var(--gap) / 2);
}

.bg-dark .subtitle {
  color: var(--color-accent);
}

/* --- Components --- */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 24px;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}

.btn-primary:hover {
  filter: brightness(0.95);
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--color-text-main);
  color: var(--color-text-main);
}

.bg-dark .btn-secondary {
  border-color: var(--color-bg-paper);
  color: var(--color-bg-paper);
}

/* Cards */
.card {
  background: var(--color-white);
  border: var(--card-border);
  border-radius: var(--radius-card);
  padding: var(--gap);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bg-dark .card {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Grid Systems */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: var(--gap);
}

/* Lists */
.check-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 6px;
  height: 6px;
  background-color: var(--color-brand);
  border-radius: 50%;
}

.bg-dark .check-list li::before {
  background-color: var(--color-accent);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin: var(--gap) 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  background-color: rgba(0,0,0,0.02);
  font-weight: 700;
}

tr:last-child td {
  border-bottom: none;
}

/* FAQ */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background: var(--color-white);
}

summary {
  padding: var(--gap);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2.5rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  position: absolute;
  right: var(--gap);
  top: 50%;
  transform: translateY(-50%);
  font-weight: 400;
  color: var(--color-brand);
}

details[open] summary::after {
  content: "-";
}

details p {
  padding: 0 var(--gap) var(--gap) var(--gap);
  margin-bottom: 0;
  color: #555;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(247, 245, 243, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 0;
}

.bg-dark .site-header {
  background-color: rgba(20, 14, 37, 0.9);
  border-bottom-color: rgba(255,255,255,0.1);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo img {
  height: 32px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  font-size: var(--text-sm);
}

.nav-link:hover {
  color: var(--color-brand);
}

.nav-link[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}

/* Footer */
.site-footer {
  background-color: var(--color-bg-dark);
  color: rgba(247, 245, 243, 0.6);
  padding: 64px 0 32px;
  font-size: var(--text-sm);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 48px;
}

.footer-col h4 {
  color: var(--color-white);
  margin-bottom: 16px;
  font-size: var(--text-base);
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col a:hover {
  color: var(--color-accent);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 0.8rem;
}

/* --- SVG Animations --- */
@keyframes float-up {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes float-delayed {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.anim-float {
  animation: float-up 6s ease-in-out infinite;
}

.anim-float-delayed {
  animation: float-delayed 5s ease-in-out infinite;
  animation-delay: 1s;
}

.anim-pulse {
  animation: pulse-opacity 3s ease-in-out infinite;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .anim-float, .anim-float-delayed, .anim-pulse {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
}

/* Mobile Nav Toggle (Hidden on Desktop) */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
}

@media (max-width: 768px) {
  .nav-links {
    display: none; 
  }
  .mobile-menu-btn {
    display: block;
  }
}
