/* =========================================
   SafeW - Global Styles (style.css)
   ========================================= */

/* --- Design Tokens & Reset --- */
:root {
    /* Colors */
    --color-bg-dark: #21163C;
    --color-bg-paper: #F4F3F7;
    --color-text-main: #191523;
    --color-brand: #5214EB;
    --color-accent: #ED926E;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "SF Mono", "Roboto Mono", monospace;
    
    /* Spacing & Layout */
    --content-max: 1280px;
    --section-y: clamp(3.5rem, 7vw, 6rem);
    --gap: clamp(1rem, 2vw, 1.75rem);
    --header-h: 72px;
    
    /* UI Elements */
    --radius-card: 20px;
    --radius-btn: 12px;
    --card-border: 1px solid rgba(25, 21, 35, 0.16);
    --card-shadow: none;
    
    /* Transitions */
    --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.65;
    color: var(--color-text-main);
    background-color: var(--color-bg-paper);
    overflow-x: hidden;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* --- Layout Containers --- */
.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;
}

.section-divider {
    height: 1px;
    background-color: rgba(25, 21, 35, 0.1);
    margin: 0;
    border: none;
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0;
    color: var(--color-text-main);
}

.hero-title {
    font-size: clamp(2rem, 4.6vw, 3.4rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
    color: #F4F3F7; /* Paper color on dark bg */
}

.section-title {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-bottom: 1rem;
}

.subtitle {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    line-height: 1.6;
    color: var(--color-text-main);
    opacity: 0.85;
    margin-bottom: 2rem;
    max-width: 60ch;
}

.dark-mode-text {
    color: #F4F3F7;
}

.dark-mode-subtitle {
    color: #F4F3F7;
    opacity: 0.9;
}

.highlight {
    color: var(--color-brand);
}

.dark-highlight {
    color: var(--color-accent);
}

/* --- Components: Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s var(--ease-out), background-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: none;
    min-height: 48px;
}

.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--color-text-main);
    color: var(--color-text-main);
}

.dark-section .btn-secondary {
    border-color: #F4F3F7;
    color: #F4F3F7;
}

.btn-secondary:hover {
    background-color: rgba(25, 21, 35, 0.05);
}

.dark-section .btn-secondary:hover {
    background-color: rgba(244, 243, 247, 0.1);
}

/* --- Components: Cards --- */
.card {
    background-color: #fff;
    border: var(--card-border);
    border-radius: var(--radius-card);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s var(--ease-out);
}

.card:hover {
    transform: translateY(-4px);
}

.dark-card {
    background-color: var(--color-bg-dark);
    color: #F4F3F7;
}

.light-card-on-dark {
    background-color: #F4F3F7;
    color: var(--color-text-main);
    border-color: rgba(25, 21, 35, 0.08);
}

/* --- Components: Tables --- */
.platform-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}

.platform-table th, 
.platform-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(25, 21, 35, 0.1);
}

.platform-table th {
    font-weight: 600;
    color: var(--color-text-main);
    background-color: rgba(82, 20, 235, 0.05);
}

.platform-table tr:last-child td {
    border-bottom: none;
}

/* --- Components: FAQ --- */
details.faq-item {
    border: var(--card-border);
    border-radius: var(--radius-card);
    margin-bottom: 1rem;
    background-color: #fff;
    overflow: hidden;
}

details.faq-item summary {
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 3rem;
    transition: background-color 0.2s;
}

details.faq-item summary::-webkit-details-marker {
    display: none;
}

details.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--color-brand);
    transition: transform 0.3s var(--ease-out);
}

details.faq-item[open] summary::after {
    transform: translateY(-50%) rotate(45deg);
}

details.faq-item p {
    padding: 0 1.5rem 1.5rem 1.5rem;
    color: var(--color-text-main);
    opacity: 0.9;
    line-height: 1.7;
}

/* --- Components: Timeline --- */
.timeline {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid rgba(82, 20, 235, 0.2);
}

.timeline-item {
    position: relative;
    margin-bottom: 2.5rem;
    padding-left: 1.5rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2.55rem;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    background-color: var(--color-brand);
    border-radius: 50%;
    border: 3px solid var(--color-bg-paper);
}

.dark-section .timeline-dot {
    border-color: var(--color-bg-dark);
}

.timeline-time {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-brand);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    display: block;
}

.dark-section .timeline-time {
    color: var(--color-accent);
}

/* --- Components: News Grid --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--gap);
}

.news-date {
    font-size: 0.85rem;
    color: var(--color-text-main);
    opacity: 0.6;
    margin-bottom: 0.75rem;
    display: block;
}

/* --- Header & Navigation --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-h);
    z-index: 100;
    transition: background-color 0.3s, box-shadow 0.3s;
    background-color: rgba(244, 243, 247, 0.85);
    backdrop-filter: blur(12px);
}

.site-header.scrolled {
    background-color: rgba(244, 243, 247, 0.95);
    box-shadow: 0 1px 0 rgba(25, 21, 35, 0.1);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--color-text-main);
    transition: color 0.2s;
}

.nav-link:hover, .nav-link[aria-current="page"] {
    color: var(--color-brand);
}

.logo-img {
    height: 32px;
    width: auto;
}

/* --- Footer --- */
.site-footer {
    background-color: var(--color-bg-dark);
    color: #F4F3F7;
    padding: 4rem 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    color: #F4F3F7;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.footer-links li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: rgba(244, 243, 247, 0.7);
    font-size: 0.95rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--color-accent);
}

.footer-bottom {
    border-top: 1px solid rgba(244, 243, 247, 0.1);
    padding-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(244, 243, 247, 0.5);
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .hero-title {
        font-size: clamp(1.8rem, 6vw, 2.5rem);
    }
    
    .nav-links {
        display: none; /* Simplified for this output, normally hamburger */
    }
    
    .section {
        padding-top: calc(var(--section-y) * 0.75);
    }
}

/* =========================================
   SVG Animation System
   ========================================= */

/* Base SVG styles */
.svg-icon {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Animation Keyframes */

/* 1. Line Drawing Effect */
@keyframes draw-line {
    0% {
        stroke-dashoffset: 1;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

.anim-draw {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: draw-line 2s ease-in-out infinite alternate;
}

/* 2. Breathing Opacity (for elements after draw) */
@keyframes breathe-opacity {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.anim-breathe {
    animation: breathe-opacity 4s ease-in-out infinite;
}

/* 3. Floating / Gentle Movement */
@keyframes float-y {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.anim-float {
    animation: float-y 6s ease-in-out infinite;
}

/* 4. Slide In (Staggered) */
@keyframes slide-up {
    0% {
        opacity: 0.4;
        transform: translateY(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.anim-slide {
    animation: slide-up 1.5s var(--ease-out) infinite alternate;
}

/* Stagger delays handled via inline styles or utility classes if needed, 
   but here we keep it simple with global classes */

/* Reduced Motion Support */
@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;
    }
    
    .anim-draw, .anim-breathe, .anim-float, .anim-slide {
        animation: none;
    }
}

/* Specific SVG container adjustments */
.svg-container {
    width: 100%;
    height: auto;
    overflow: visible;
}

/* Transform origin for rotation/scaling within SVGs */
svg [class^="anim-"] {
    transform-box: fill-box;
    transform-origin: center;
}
