/* =========================================
   SafeW Global Styles & Design System
   ========================================= */

:root {
    /* Color Palette */
    --color-dark: #13102D;
    --color-paper: #D6D4ED;
    --color-body: #171523;
    --color-brand: #2714EB;
    --color-accent: #89ED6E;
    
    /* Derived Colors for Text/Backgrounds */
    --text-on-dark: var(--color-paper);
    --text-on-paper: var(--color-body);
    
    /* Structural Tokens */
    --radius-card: 24px;
    --radius-btn: 999px;
    --card-border: 0;
    --card-shadow: 0 10px 28px -14px rgba(23, 21, 35, 0.3);
    --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, "Noto Sans SC", sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    color: var(--text-on-paper);
    background-color: var(--color-paper);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text-on-paper);
}

h1 {
    font-size: clamp(2.4rem, 6vw, 4.5rem);
    margin-bottom: var(--gap);
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-bottom: calc(var(--gap) * 1.5);
}

h3 {
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-bottom: var(--gap);
}

p {
    margin-bottom: var(--gap);
    max-width: 38em;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Utilities */
.text-accent { color: var(--color-accent); }
.text-brand { color: var(--color-brand); }
.bg-dark { background-color: var(--color-dark); color: var(--text-on-dark); }
.bg-paper { background-color: var(--color-paper); color: var(--text-on-paper); }

.section-padding {
    padding-top: var(--section-y);
    padding-bottom: var(--section-y);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    height: 48px;
    padding: 0 24px;
    border-radius: var(--radius-btn);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
    border: none;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(137, 237, 110, 0.4);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-on-paper);
    border: 2px solid currentColor;
}

.bg-dark .btn-secondary {
    color: var(--text-on-dark);
    border-color: var(--text-on-dark);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 4px;
}

/* 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 rgba(23, 21, 35, 0.05);
    padding: 16px 0;
}

.bg-dark ~ .site-header {
    background-color: rgba(19, 16, 45, 0.9);
    border-bottom-color: rgba(214, 212, 237, 0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text-on-paper);
}

.bg-dark .logo {
    color: var(--text-on-dark);
}

.logo img {
    height: 32px;
    width: auto;
}

nav ul {
    display: flex;
    list-style: none;
    gap: var(--gap);
}

nav a {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

nav a:hover {
    background-color: rgba(23, 21, 35, 0.05);
}

.bg-dark nav a:hover {
    background-color: rgba(214, 212, 237, 0.1);
}

nav a[aria-current="page"] {
    color: var(--color-brand);
    background-color: rgba(39, 20, 235, 0.1);
}

.bg-dark nav a[aria-current="page"] {
    color: var(--color-accent);
    background-color: rgba(137, 237, 110, 0.1);
}

/* Cards */
.card {
    background-color: #fff; /* Default card bg, can be overridden */
    border-radius: var(--radius-card);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    padding: var(--gap);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px -14px rgba(23, 21, 35, 0.4);
}

.card-header {
    margin-bottom: var(--gap);
}

/* Grid Layouts */
.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);
}

/* FAQ Details/Summary */
details {
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    margin-bottom: var(--gap);
    padding: 16px 24px;
    border: 1px solid rgba(23, 21, 35, 0.08);
    transition: background-color 0.2s;
}

details[open] {
    background-color: #fff;
    border-color: var(--color-brand);
}

summary {
    font-weight: 700;
    font-size: 1.1rem;
    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: 400;
    transition: transform 0.2s;
}

details[open] summary::after {
    transform: rotate(45deg);
}

details p {
    margin-top: var(--gap);
    color: var(--text-on-paper);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-card);
    box-shadow: var(--card-shadow);
    background-color: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 16px 24px;
    text-align: left;
    border-bottom: 1px solid rgba(23, 21, 35, 0.08);
}

th {
    background-color: rgba(39, 20, 235, 0.05);
    font-weight: 800;
    color: var(--color-brand);
}

tr:last-child td {
    border-bottom: none;
}

td a {
    color: var(--color-brand);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

td a:hover {
    color: var(--color-dark);
}

/* SVG Animations */
svg {
    width: 100%;
    height: auto;
    display: block;
}

.animate-draw {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: drawStroke 6s ease-in-out infinite alternate;
}

.animate-float {
    animation: floatY 4s ease-in-out infinite alternate;
}

.animate-breathe {
    animation: breathe 5s ease-in-out infinite alternate;
}

@keyframes drawStroke {
    0% { stroke-dashoffset: 1; }
    20% { stroke-dashoffset: 0; }
    80% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 1; }
}

@keyframes floatY {
    0% { transform: translateY(0); }
    100% { transform: translateY(-10px); }
}

@keyframes breathe {
    0% { opacity: 0.6; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1.02); }
}

/* 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 adjustments */
@media (max-width: 768px) {
    nav {
        display: none; /* Simplified for this output, ideally hamburger menu */
    }
    
    /* Add simple mobile nav for accessibility/completeness */
    nav.mobile-only {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--color-paper);
        padding: 16px;
        justify-content: space-around;
        border-top: 1px solid rgba(0,0,0,0.1);
        z-index: 100;
    }
    
    .bg-dark ~ nav.mobile-only {
        background: var(--color-dark);
        border-top-color: rgba(255,255,255,0.1);
    }
    
    h1 {
        font-size: 2.2rem;
    }
}

/* Specific Component Styles */
.hero-section {
    background-color: var(--color-dark);
    color: var(--text-on-dark);
    padding: calc(var(--section-y) * 1.5) 0;
    position: relative;
    overflow: hidden;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    align-items: center;
}

.hero-svg-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.feature-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
    align-items: center;
    margin-bottom: calc(var(--section-y) * 2);
}

.feature-row.reverse {
    direction: rtl;
}

.feature-row.reverse > * {
    direction: ltr;
}

.feature-panel {
    background-color: var(--color-dark);
    border-radius: var(--radius-card);
    padding: var(--gap);
    box-shadow: var(--card-shadow);
}

.news-card article {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.news-card time {
    font-size: 0.85rem;
    color: var(--color-brand);
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
}

.cta-section {
    background-color: var(--color-dark);
    color: var(--text-on-dark);
    text-align: center;
    padding: calc(var(--section-y) * 1.5) 0;
}

.footer {
    background-color: #0f0c26; /* Slightly darker than hero for depth */
    color: rgba(214, 212, 237, 0.6);
    padding: var(--section-y) 0;
    font-size: 0.9rem;
}

.footer a {
    color: var(--text-on-dark);
    margin-right: 16px;
}

.footer a:hover {
    color: var(--color-accent);
}

/* Highlight span */
.hl {
    color: var(--color-brand);
}

.bg-dark .hl {
    color: var(--color-accent);
}

/* Badge/Micro-label */
.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 16px;
    color: var(--color-brand);
}

.bg-dark .badge {
    color: var(--color-accent);
}

/* Step List */
.step-list {
    counter-reset: step;
    list-style: none;
}

.step-list li {
    position: relative;
    padding-left: 3rem;
    margin-bottom: var(--gap);
}

.step-list li::before {
    counter-increment: step;
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background-color: var(--color-accent);
    color: var(--color-dark);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.bg-dark .step-list li::before {
    background-color: var(--color-accent);
    color: var(--color-dark);
}

/* Scenario Box */
.scenario-box {
    border-left: 4px solid var(--color-brand);
    padding-left: var(--gap);
    margin-bottom: var(--gap);
}

.bg-dark .scenario-box {
    border-left-color: var(--color-accent);
}
