/* =========================================
   SafeW Global Styles & Design Tokens
   ========================================= */

:root {
  /* Color Palette */
  --color-dark-bg: #1B1231;
  --color-paper-bg: #F4F3F7;
  --color-body-text: #191523;
  --color-brand: #5214EB;
  --color-accent: #9977EE;

  /* Layout & Spacing */
  --radius-card: 24px;
  --radius-btn: 999px;
  --card-border: 2px solid var(--color-body-text);
  --card-shadow: 4px 4px 0 var(--color-body-text);
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;

  /* Typography */
  --font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --line-height-base: 1.65;
  --line-height-tight: 1.25;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-paper-bg);
  color: var(--color-body-text);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap);
  padding-right: var(--gap);
}

/* Eyebrows */
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-brand);
  margin-bottom: 0.5em;
}

.section-hero .eyebrow {
  color: var(--color-accent);
}

/* Headings */
h1, h2, h3 {
  line-height: var(--line-height-tight);
  font-weight: 700;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin-bottom: 0.5em;
  color: var(--color-paper-bg);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 0.5em;
  color: var(--color-body-text);
}

h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5em;
  color: var(--color-body-text);
}

.section-hero h2 {
  color: var(--color-paper-bg);
}

/* Sections */
.section {
  padding-top: var(--section-y);
  padding-bottom: var(--section-y);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.section:last-child {
  border-bottom: none;
}

.section-hero {
  background-color: var(--color-dark-bg);
  padding-top: calc(var(--section-y) * 1.5);
  padding-bottom: calc(var(--section-y) * 1.5);
  position: relative;
  overflow: hidden;
}

.section-paper {
  background-color: var(--color-paper-bg);
}

/* Hero Layout */
.hero-content {
  margin-bottom: var(--gap);
}

.hero-sub {
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  color: rgba(244, 243, 247, 0.85);
  margin-bottom: 1.5em;
  max-width: 600px;
}

.hero-facts {
  font-size: 0.9rem;
  color: rgba(244, 243, 247, 0.6);
  margin-top: 1em;
}

.hero-visual {
  margin-top: var(--gap);
}

@media (min-width: 768px) {
  .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    align-items: center;
  }
  
  .hero-content {
    margin-bottom: 0;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 32px;
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  text-align: center;
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
  border: none;
}

.btn-primary:hover {
  background-color: #8663E0;
  transform: translateY(-2px);
}

.btn-primary:focus-visible {
  outline: 3px solid var(--color-paper-bg);
  outline-offset: 3px;
}

.btn-secondary {
  background-color: transparent;
  color: var(--color-body-text);
  border: 2px solid var(--color-body-text);
}

.btn-secondary:hover {
  background-color: rgba(25, 21, 35, 0.05);
  transform: translateY(-2px);
}

.btn-secondary:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 3px;
}

/* Cards */
.card {
  background-color: var(--color-paper-bg);
  border: var(--card-border);
  border-radius: var(--radius-card);
  box-shadow: var(--card-shadow);
  padding: var(--gap);
}

/* User Grid */
.user-grid {
  display: grid;
  gap: var(--gap);
  margin-top: var(--gap);
}

@media (min-width: 768px) {
  .user-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.user-card {
  background-color: #fff;
  border: 1px solid rgba(25, 21, 35, 0.1);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

.user-card h3 {
  color: var(--color-brand);
}

/* Feature List */
.feature-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-top: var(--gap);
}

.feature-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--gap);
  align-items: start;
}

.feature-icon {
  width: 60px;
  height: 60px;
  background-color: rgba(82, 20, 235, 0.1);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-brand);
}

.feature-icon svg {
  width: 32px;
  height: 32px;
}

.feature-content h3 {
  margin-bottom: 0.25em;
}

/* Deep Dive */
.deep-dive {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-top: var(--gap);
}

.deep-dive-item {
  background-color: #fff;
  border: 1px solid rgba(25, 21, 35, 0.1);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

.deep-dive-item h3 {
  color: var(--color-brand);
  margin-bottom: 0.5em;
}

/* Steps */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-top: var(--gap);
}

.step-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--gap);
  align-items: start;
}

.step-number {
  width: 60px;
  height: 60px;
  background-color: var(--color-accent);
  color: var(--color-dark-bg);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
}

.step-content h3 {
  margin-bottom: 0.25em;
}

/* News Grid */
.news-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin-top: var(--gap);
}

@media (min-width: 768px) {
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .news-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.news-card {
  background-color: #fff;
  border: 1px solid rgba(25, 21, 35, 0.1);
  border-radius: var(--radius-card);
  padding: var(--gap);
  display: flex;
  flex-direction: column;
}

.news-card time {
  font-size: 0.85rem;
  color: var(--color-brand);
  margin-bottom: 0.5em;
  font-weight: 700;
}

.news-card p {
  margin-top: auto;
  font-size: 0.95rem;
  color: rgba(25, 21, 35, 0.8);
}

/* Table */
.platform-table-wrapper {
  overflow-x: auto;
  margin-top: var(--gap);
  border: 1px solid rgba(25, 21, 35, 0.1);
  border-radius: var(--radius-card);
}

.platform-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

.platform-table th, .platform-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.platform-table th {
  background-color: rgba(82, 20, 235, 0.05);
  color: var(--color-brand);
  font-weight: 700;
}

.platform-table tr:last-child td {
  border-bottom: none;
}

.table-caption {
  margin-top: 0.5em;
  font-size: 0.9rem;
  color: rgba(25, 21, 35, 0.6);
}

/* Trust Grid */
.trust-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  margin-top: var(--gap);
}

@media (min-width: 768px) {
  .trust-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.trust-item {
  background-color: #fff;
  border: 1px solid rgba(25, 21, 35, 0.1);
  border-radius: var(--radius-card);
  padding: var(--gap);
}

.trust-item h3 {
  color: var(--color-brand);
  margin-bottom: 0.5em;
}

/* FAQ */
.faq-list {
  margin-top: var(--gap);
}

.faq-item {
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.faq-item summary {
  padding: 1rem 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.1rem;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  color: var(--color-brand);
}

.faq-item[open] summary::after {
  content: "-";
}

.faq-item p {
  padding-bottom: 1rem;
  color: rgba(25, 21, 35, 0.8);
  line-height: 1.7;
}

/* Navigation */
.sidebar-nav {
  position: fixed;
  left: 0;
  top: 0;
  width: 240px;
  height: 100vh;
  background-color: var(--color-dark-bg);
  padding: 2rem 1.5rem;
  z-index: 100;
  display: none;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  color: var(--color-paper-bg);
  font-weight: 700;
  font-size: 1.25rem;
}

.sidebar-brand img {
  width: 40px;
  height: 40px;
}

.sidebar-nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-nav a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: rgba(244, 243, 247, 0.7);
  font-size: 0.9rem;
  transition: background-color 0.2s, color 0.2s;
}

.sidebar-nav a:hover, .sidebar-nav a[aria-current="page"] {
  background-color: rgba(244, 243, 247, 0.1);
  color: var(--color-paper-bg);
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 90;
  background-color: var(--color-paper-bg);
  border-bottom: 1px solid rgba(25, 21, 35, 0.1);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--color-body-text);
}

.top-nav-brand img {
  width: 32px;
  height: 32px;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--color-body-text);
}

.hamburger svg {
  width: 24px;
  height: 24px;
}

.main-wrapper {
  margin-left: 0;
  transition: margin-left 0.3s ease;
}

.site-footer {
  background-color: var(--color-dark-bg);
  color: rgba(244, 243, 247, 0.6);
  padding: 3rem 0;
  text-align: center;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--color-paper-bg);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--color-accent);
}

/* Responsive */
@media (min-width: 1024px) {
  .sidebar-nav {
    display: block;
  }

  .top-nav {
    display: none;
  }

  .main-wrapper {
    margin-left: 240px;
  }
}

/* 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;
  }
}

/* =========================================
   SVG Animations
   ========================================= */

/* Grid Nodes Pulse */
@keyframes grid-pulse {
  0%, 100% { opacity: 0.2; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.node {
  animation: grid-pulse 4s infinite ease-in-out;
}

.node-1 { animation-delay: 0.0s; }
.node-2 { animation-delay: 0.2s; }
.node-3 { animation-delay: 0.4s; }
.node-4 { animation-delay: 0.6s; }
.node-5 { animation-delay: 0.8s; }
.node-6 { animation-delay: 1.0s; }
.node-7 { animation-delay: 1.2s; }
.node-8 { animation-delay: 1.4s; }
.node-9 { animation-delay: 1.6s; }
.node-10 { animation-delay: 1.8s; }
.node-11 { animation-delay: 2.0s; }
.node-12 { animation-delay: 2.2s; }

/* Bubble Float */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.bubble-anim-1, .bubble-anim-2, .bubble-anim-3 {
  animation: float 6s infinite ease-in-out;
}

.bubble-anim-1 { animation-delay: 0s; }
.bubble-anim-2 { animation-delay: 1s; }
.bubble-anim-3 { animation-delay: 2s; }

/* Input Pulse */
@keyframes input-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

.input-pulse {
  animation: input-pulse 2s infinite ease-in-out;
}

/* Phone Float */
.phone-float {
  animation: float 8s infinite ease-in-out;
}

.msg-bubble-phone {
  animation: float 5s infinite ease-in-out;
  animation-delay: 0.5s;
}

/* Draw Line */
@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

.draw-line {
  pathLength: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw-line 3s infinite ease-in-out;
}

/* Slide In */
@keyframes slide-in {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

.slide-in {
  animation: slide-in 1s ease-out forwards;
}
