/* =========================================
   SafeW Global Styles & Design System
   ========================================= */

:root {
  /* === Color Palette === */
  --color-bg-dark: #231334;
  --color-paper: #E9E8EA;
  --color-text-body: #1C1523;
  --color-brand: #7D14EB;
  --color-accent: #EDD26E;
  
  /* Derived / Functional Colors */
  --color-text-on-dark: #E9E8EA;
  --color-text-on-paper: #1C1523;
  
  /* === Spacing & Layout === */
  --radius-card: 20px;
  --radius-btn: 12px;
  --card-border: 0;
  --card-shadow: none;
  --section-y: clamp(3.5rem, 7vw, 6rem);
  --gap: clamp(1rem, 2vw, 1.75rem);
  --content-max: 960px;
  
  /* === Typography === */
  --font-weight-title: 500;
  --line-height-title: 1.15;
  --line-height-body: 1.65;
  
  /* === Focus Ring === */
  --focus-ring: 2px solid var(--color-brand);
}

/* Dark Theme Overrides */
.theme-dark {
  --color-bg: var(--color-bg-dark);
  --color-text: var(--color-text-on-dark);
  --color-hl: var(--color-accent);
  --color-link: var(--color-accent);
  --color-badge: var(--color-accent);
}

/* Paper Theme Overrides (Default) */
.theme-paper {
  --color-bg: var(--color-paper);
  --color-text: var(--color-text-body);
  --color-hl: var(--color-brand);
  --color-link: var(--color-brand);
  --color-badge: var(--color-brand);
}

/* Card inside Dark Theme reverts to paper colors */
.card-light-in-dark {
  background-color: var(--color-paper);
  color: var(--color-text-body);
  border-radius: var(--radius-card);
  padding: var(--gap);
  border: var(--card-border);
  box-shadow: var(--card-shadow);
}
.card-light-in-dark .hl { color: var(--color-brand); }
.card-light-in-dark a { color: var(--color-brand); }

/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: var(--line-height-body);
  color: var(--color-text-body);
  background-color: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: opacity 0.2s ease;
}
a:hover { opacity: 0.85; }
a:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/* === Layout Container === */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(233, 232, 234, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 16px 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text-body);
}
.brand-logo img {
  height: 32px;
  width: auto;
}
.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}
.nav-links a {
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--color-text-body);
}
.nav-links a[aria-current="page"] {
  color: var(--color-brand);
  font-weight: 700;
}
@media (max-width: 640px) {
  .nav-links { display: none; }
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  height: 48px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  border: none;
  text-decoration: none;
}
.btn:hover {
  transform: translateY(-1px);
  opacity: 1;
}
.btn:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}
.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}
.btn-primary:hover {
  background-color: #e2c863;
}
.btn-secondary {
  background-color: transparent;
  color: var(--color-text-body);
  border: 1.5px solid var(--color-text-body);
}
.theme-dark .btn-secondary {
  color: var(--color-text-on-dark);
  border-color: var(--color-text-on-dark);
}
.btn-secondary:hover {
  background-color: rgba(0,0,0,0.05);
}
.theme-dark .btn-secondary:hover {
  background-color: rgba(255,255,255,0.05);
}

/* === Typography Helpers === */
.section-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding: 4px 12px;
  border-radius: 6px;
  background-color: var(--color-badge);
  color: var(--color-bg-dark);
}
.theme-dark .section-badge {
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
}
.h1-hero {
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  font-weight: var(--font-weight-title);
  line-height: var(--line-height-title);
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: var(--color-text);
}
.h2-section {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: var(--font-weight-title);
  line-height: 1.25;
  margin-bottom: 32px;
  color: var(--color-text);
}
.h3-sub {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 16px;
  color: var(--color-text);
}
.text-body {
  font-size: 1.05rem;
  line-height: var(--line-height-body);
  max-width: 38em;
  color: var(--color-text);
}
.hl {
  color: var(--color-hl);
  font-weight: 600;
}

/* === Section Layouts === */
section {
  padding: var(--section-y) 0;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr));
  gap: var(--gap);
  align-items: start;
}

/* === Hero Specific === */
.hero-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
  min-height: 80vh;
}
.hero-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.hero-visual {
  position: relative;
  background-color: var(--color-bg-dark);
  border-radius: 24px;
  padding: 32px;
  aspect-ratio: 4/3;
  overflow: hidden;
}
.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.hero-facts {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 8px;
}

/* === Feature Tabs (No JS required for visibility) === */
.feature-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  padding-bottom: 16px;
}
.feature-nav a {
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  color: var(--color-text);
  background: transparent;
}
.feature-nav a:hover, .feature-nav a:focus-visible {
  background: rgba(0,0,0,0.05);
}
.feature-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  padding: 32px 0;
  border-top: 1px solid rgba(0,0,0,0.1);
}
.feature-visual {
  background: var(--color-bg-dark);
  border-radius: var(--radius-card);
  aspect-ratio: 16/10;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 768px) {
  .feature-panel { grid-template-columns: 1fr; }
  .hero-layout { grid-template-columns: 1fr; }
  .hero-visual { order: -1; }
}

/* === Comparison Table === */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: fixed;
}
.comparison-table th, .comparison-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  overflow-wrap: break-word;
}
.comparison-table th {
  font-weight: 600;
  color: var(--color-text);
}
.comparison-table td:first-child {
  font-weight: 500;
  color: var(--color-text);
  width: 20%;
}
.comparison-table tr:last-child td {
  border-bottom: none;
}

/* === Info Table (Download Page) === */
.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  table-layout: fixed;
}
.info-table th, .info-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  overflow-wrap: break-word;
}
.info-table th {
  font-weight: 600;
  width: 35%;
}

/* === Steps List === */
.steps-list {
  list-style: none;
  counter-reset: step;
}
.steps-list li {
  position: relative;
  padding-left: 60px;
  margin-bottom: 32px;
}
.steps-list li::before {
  counter-increment: step;
  content: "0" counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  background-color: var(--color-accent);
  color: var(--color-bg-dark);
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* === News Cards === */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--gap);
}
.news-card {
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
  border-radius: var(--radius-card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.news-card h4 {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text-on-dark);
}
.news-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  opacity: 0.9;
}
.news-card time {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-top: auto;
}

/* === FAQ === */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.faq-item details {
  background: var(--color-bg-dark);
  color: var(--color-text-on-dark);
  border-radius: var(--radius-card);
  padding: 20px 24px;
}
.faq-item summary {
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  opacity: 0.7;
}
.faq-item details[open] summary::after {
  content: "−";
}
.faq-item p {
  margin-top: 16px;
  font-size: 0.95rem;
  line-height: 1.65;
  opacity: 0.9;
}

/* === Footer === */
.site-footer {
  background-color: var(--color-bg-dark);
  color: var(--color-text-on-dark);
  padding: 64px 0 32px;
  margin-top: var(--section-y);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 48px;
  margin-bottom: 48px;
}
.footer-col h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-accent);
}
.footer-col ul {
  list-style: none;
}
.footer-col li {
  margin-bottom: 12px;
}
.footer-col a {
  color: var(--color-text-on-dark);
  font-size: 0.9rem;
  opacity: 0.8;
}
.footer-col a:hover { opacity: 1; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 32px;
  font-size: 0.85rem;
  opacity: 0.6;
  text-align: center;
}

/* =========================================
   SVG Animations (CSS Only)
   ========================================= */
/* Star twinkling */
@keyframes twinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.8; }
}
.anim-star { animation: twinkle 4s ease-in-out infinite; }
.anim-star-delay-1 { animation-delay: 1s; }
.anim-star-delay-2 { animation-delay: 2s; }

/* Line drawing */
@keyframes drawLine {
  0% { stroke-dashoffset: 1; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: 1; }
}
.anim-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  animation: drawLine 6s linear infinite;
}

/* Bubble float */
@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.anim-bubble { animation: floatBubble 5s ease-in-out infinite; }

/* Notification slide in */
@keyframes slideIn {
  0% { transform: translateX(20px); opacity: 0; }
  20% { transform: translateX(0); opacity: 1; }
  80% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(20px); opacity: 0; }
}
.anim-slide { animation: slideIn 8s ease-in-out infinite; }

/* Input dots breathing */
@keyframes breathe {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.anim-dot { animation: breathe 2s ease-in-out infinite; }
.anim-dot-1 { animation-delay: 0s; }
.anim-dot-2 { animation-delay: 0.2s; }
.anim-dot-3 { animation-delay: 0.4s; }

/* 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;
  }
}
