/* =========================================
   SafeW Global Styles & Design System
   ========================================= */

/* --- Design Tokens --- */
:root {
  /* Colors */
  --color-dark: #21163C;
  --color-paper: #E9E8EA;
  --color-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #ED926E;
  
  /* Derived Colors */
  --color-border: rgba(25, 21, 35, 0.16); /* Text color at 16% opacity */
  --color-bg-card: #FFFFFF;
  --color-bg-dark-card: #2D214F;
  --color-hover-text: #3b0dbd;

  /* Typography */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: "Inter", var(--font-sans);
  
  /* Spacing & Sizing */
  --radius-card: 20px;
  --radius-btn: 12px;
  --section-y: clamp(2.5rem, 5vw, 4rem);
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  --content-max: 1120px;
  
  /* Borders & Shadows */
  --card-border: 1px solid var(--color-border);
  --card-shadow: none;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background-color: var(--color-paper);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--color-text);
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.5rem);
  margin-bottom: 1.5rem;
}

h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 1.5rem;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  max-width: 70ch;
}

strong {
  font-weight: 700;
}

/* Utility Classes */
.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);
}

.text-hl {
  color: var(--color-brand);
}

.dark-section .text-hl {
  color: var(--color-accent);
}

.dark-section h1, 
.dark-section h2, 
.dark-section h3, 
.dark-section p, 
.dark-section li {
  color: var(--color-paper);
}

/* --- Components: Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark);
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
}

.btn-secondary {
  background: transparent;
  border: 1px solid currentColor;
  color: var(--color-text);
}

.dark-section .btn-secondary {
  color: var(--color-paper);
  border-color: var(--color-paper);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  background-color: rgba(0,0,0,0.05);
}

.dark-section .btn-secondary:hover {
  background-color: rgba(255,255,255,0.1);
}

/* --- Components: Cards --- */
.card {
  background: var(--color-bg-card);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.dark-section .card {
  background: var(--color-bg-dark-card);
  border-color: rgba(255,255,255,0.1);
}

/* --- Components: Badges --- */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 12px;
  border-radius: 99px;
  margin-bottom: 1rem;
  text-transform: uppercase;
}

.badge-brand {
  color: var(--color-brand);
  background: rgba(82, 20, 235, 0.1);
}

.dark-section .badge {
  color: var(--color-accent);
  background: rgba(237, 146, 110, 0.15);
}

/* --- Components: Tables --- */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: var(--card-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-card);
  min-width: 500px;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: 700;
  background: rgba(0,0,0,0.02);
}

.dark-section table {
  background: var(--color-bg-dark-card);
}

.dark-section th, 
.dark-section td {
  border-color: rgba(255,255,255,0.1);
}

/* --- Components: Details/Summary (FAQ) --- */
details {
  border: var(--card-border);
  border-radius: var(--radius-card);
  margin-bottom: var(--gap);
  background: var(--color-bg-card);
  overflow: hidden;
}

.dark-section details {
  background: var(--color-bg-dark-card);
  border-color: rgba(255,255,255,0.1);
}

summary {
  padding: 1.25rem;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  position: relative;
  padding-right: 3rem;
  display: flex;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--color-brand);
}

.dark-section summary::after {
  color: var(--color-accent);
}

details[open] summary::after {
  content: '−';
}

details[open] summary {
  border-bottom: 1px solid var(--color-border);
}

.dark-section details[open] summary {
  border-color: rgba(255,255,255,0.1);
}

details .answer {
  padding: 1.25rem;
  color: var(--color-text);
  opacity: 0.9;
}

.dark-section details .answer {
  color: var(--color-paper);
}

/* --- Layout: Grid & Flex --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: var(--gap);
}

.grid-3 {
  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 & Footer --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 0;
}

.dark-section.site-header {
  background: rgba(33, 22, 60, 0.9);
  border-color: rgba(255,255,255,0.1);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--color-text);
}

.dark-section .logo {
  color: var(--color-paper);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
  padding: 0.25rem 0;
}

.nav-link[aria-current="page"] {
  color: var(--color-brand);
}

.dark-section .nav-link[aria-current="page"] {
  color: var(--color-accent);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.2s ease;
}

.nav-link:hover::after {
  width: 100%;
}

.site-footer {
  background: var(--color-dark);
  color: var(--color-paper);
  padding: 4rem 0 2rem;
  margin-top: var(--section-y);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-col h4 {
  color: var(--color-paper);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.footer-col ul li {
  margin-bottom: 0.5rem;
}

.footer-col a {
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-col a:hover {
  opacity: 1;
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 2rem;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.6;
}

/* --- Hero Specific --- */
.hero-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  min-height: 80vh;
}

.hero-content {
  max-width: 600px;
}

.hero-svg-wrapper {
  position: relative;
  background: var(--color-dark);
  border-radius: var(--radius-card);
  padding: 2rem;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

/* --- Timeline Specific --- */
.timeline {
  position: relative;
  padding-left: 2rem;
  border-left: 2px solid var(--color-border);
}

.dark-section .timeline {
  border-color: rgba(255,255,255,0.2);
}

.timeline-item {
  position: relative;
  margin-bottom: 2.5rem;
  padding-left: 1.5rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2.6rem;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  background: var(--color-accent);
  border-radius: 50%;
  border: 3px solid var(--color-paper);
  z-index: 1;
}

.dark-section .timeline-item::before {
  border-color: var(--color-dark);
}

.timeline-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-brand);
  margin-bottom: 0.25rem;
  display: block;
}

.dark-section .timeline-time {
  color: var(--color-accent);
}

/* --- Step List Specific --- */
.step-list {
  counter-reset: step;
  list-style: none;
}

.step-list li {
  position: relative;
  padding-left: 3.5rem;
  margin-bottom: 1.5rem;
}

.step-list li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--color-accent);
  color: var(--color-dark);
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.dark-section .step-list li::before {
  background: var(--color-accent);
  color: var(--color-dark);
}

/* --- SVG Animation Keyframes --- */
/* Direction: Geometric rotation and merging */

@keyframes float-rotate {
  0%, 100% { transform: rotate(0deg) translate(0, 0); }
  50% { transform: rotate(4deg) translate(5px, -5px); }
}

@keyframes float-reverse {
  0%, 100% { transform: rotate(0deg) translate(0, 0); }
  50% { transform: rotate(-3deg) translate(-5px, 5px); }
}

@keyframes pulse-opacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes dash-flow {
  to { stroke-dashoffset: -20; }
}

.anim-float-1 { animation: float-rotate 8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-float-2 { animation: float-reverse 10s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anim-pulse { animation: pulse-opacity 4s ease-in-out infinite; }
.anim-dash { animation: dash-flow 2s linear infinite; }

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  
  .hero-content {
    order: 1;
    text-align: center;
    margin: 0 auto;
  }

  .hero-svg-wrapper {
    order: 2;
    aspect-ratio: 16/9;
  }

  .nav-links {
    display: none; /* Simplified for mobile, ideally a burger menu but keeping it simple for static */
  }
  
  /* Mobile Menu Fallback: Show links vertically if needed, but sticking to desktop nav for simplicity as per constraints */
  .header-inner {
    justify-content: space-between;
  }
  
  h1 { font-size: 2.5rem; }
}
