/* 
 * SafeW Global Styles
 * Design System: Indigo Dark Base + Sky Blue Accent
 */

/* --- Reset & Variables --- */
:root {
    /* Color Palette */
    --color-dark-base: #141838;
    --color-paper: #F7F5F3;
    --color-body-text: #151723;
    --color-brand: #142CEB;
    --color-accent: #6EAFED;
    
    /* Derived Colors for Borders/Subtle Elements */
    --color-border-subtle: rgba(21, 23, 35, 0.1);
    --color-border-dark: rgba(247, 245, 243, 0.15);

    /* Layout Tokens */
    --content-max: 1120px;
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    
    /* Radii */
    --radius-card: 8px;
    --radius-btn: 6px;

    /* Typography */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --line-height-tight: 1.25;
    --line-height-body: 1.55;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-paper);
    color: var(--color-body-text);
    line-height: var(--line-height-body);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* --- Utility Classes --- */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Header --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(247, 245, 243, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 0.75rem 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
}

.brand-logo img {
    height: 32px;
    width: auto;
}

.main-nav ul {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.main-nav a {
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
    color: var(--color-brand);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 1.5rem;
    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;
}

.btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark-base);
}

.btn-primary:hover {
    background-color: #5a9bd6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(110, 175, 237, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-body-text);
    border: 1px solid var(--color-body-text);
}

.btn-secondary:hover {
    background-color: rgba(21, 23, 35, 0.05);
    transform: translateY(-1px);
}

/* In Dark Sections */
.dark-section .btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark-base);
}

.dark-section .btn-secondary {
    color: var(--color-paper);
    border-color: var(--color-paper);
}

.dark-section .btn-secondary:hover {
    background-color: rgba(247, 245, 243, 0.1);
}

/* --- Typography --- */
.section-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.paper-section .section-label {
    color: var(--color-brand);
}

.dark-section .section-label {
    color: var(--color-accent);
}

h1, h2, h3, h4 {
    line-height: var(--line-height-tight);
    font-weight: 600;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(2rem, 4.6vw, 3.4rem);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.highlight {
    color: var(--color-brand);
}

.dark-section .highlight {
    color: var(--color-accent);
}

.text-intro {
    font-size: 1.125rem;
    max-width: 65ch;
    margin-bottom: 2rem;
    color: var(--color-body-text);
}

.dark-section .text-intro {
    color: var(--color-paper);
    opacity: 0.9;
}

/* --- Sections --- */
.paper-section {
    background-color: var(--color-paper);
    color: var(--color-body-text);
    padding: var(--section-y) 0;
}

.dark-section {
    background-color: var(--color-dark-base);
    color: var(--color-paper);
    padding: var(--section-y) 0;
}

/* --- Hero Layout --- */
.hero-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    min-height: 80vh;
}

.hero-visual {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-color: var(--color-dark-base);
    border-radius: 16px;
    padding: 2rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-visual svg {
    width: 100%;
    height: 100%;
    max-width: 600px;
}

/* --- Feature Cards (Compact Grid) --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--gap);
    margin-top: 2rem;
}

.feature-card {
    background-color: rgba(21, 23, 35, 0.03);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
}

.feature-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 1rem;
    stroke: var(--color-brand);
}

/* --- Deep Dive (Magazine Style) --- */
.deep-dive-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 3rem;
    margin-top: 2rem;
}

.dive-toc {
    position: sticky;
    top: 100px;
    padding-left: 0;
    border-left: 2px solid var(--color-border-subtle);
}

.dive-toc li {
    margin-bottom: 1rem;
}

.dive-toc a {
    font-size: 0.95rem;
    color: var(--color-body-text);
    opacity: 0.7;
    transition: opacity 0.2s;
}

.dive-toc a:hover,
.dive-toc a.active {
    opacity: 1;
    color: var(--color-brand);
}

.dive-content h3 {
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border-subtle);
}

.dive-content p {
    margin-bottom: 1.25rem;
    max-width: 70ch;
}

/* --- Use Cases (Comparison) --- */
.case-study {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    background-color: rgba(21, 23, 35, 0.02);
    border-radius: var(--radius-card);
    padding: 2rem;
    border: 1px solid var(--color-border-subtle);
}

.case-context strong {
    display: block;
    color: var(--color-brand);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.case-steps ol {
    counter-reset: step;
    list-style: none;
}

.case-steps li {
    counter-increment: step;
    position: relative;
    padding-left: 2rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.case-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    width: 1.5rem;
    height: 1.5rem;
    background-color: var(--color-brand);
    color: #fff;
    border-radius: 4px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* --- Quick Start --- */
.quick-start-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.step-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.step-num {
    background-color: var(--color-accent);
    color: var(--color-dark-base);
    font-weight: 800;
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* --- Table --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid var(--color-border-subtle);
    overflow-wrap: break-word;
}

.data-table th {
    font-weight: 700;
    color: var(--color-brand);
    width: 40%;
}

.dark-section .data-table th {
    color: var(--color-accent);
}

.dark-section .data-table td {
    border-bottom-color: var(--color-border-dark);
}

/* --- News Cards --- */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.news-card {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--color-border-dark);
    border-radius: var(--radius-card);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-card time {
    font-size: 0.8rem;
    color: var(--color-accent);
    margin-bottom: 0.75rem;
    display: block;
}

.news-card h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--color-paper);
}

.news-card p {
    font-size: 0.9rem;
    color: rgba(247, 245, 243, 0.8);
    line-height: 1.6;
    flex-grow: 1;
}

/* --- FAQ --- */
.faq-list {
    max-width: 800px;
    margin: 2rem auto 0;
}

.faq-item {
    border-bottom: 1px solid var(--color-border-subtle);
}

.faq-item summary {
    padding: 1.25rem 0;
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    position: relative;
    padding-right: 2rem;
    transition: color 0.2s;
}

.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.25rem;
    font-weight: 400;
    color: var(--color-brand);
}

.faq-item[open] summary::after {
    content: "-";
    color: var(--color-brand);
}

.faq-item p {
    padding-bottom: 1.25rem;
    color: var(--color-body-text);
    opacity: 0.9;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* --- Footer --- */
.site-footer {
    background-color: var(--color-dark-base);
    color: var(--color-paper);
    padding: 3rem 0;
    border-top: 1px solid var(--color-border-dark);
    margin-top: 0;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
}

.footer-brand p {
    opacity: 0.7;
    margin-top: 1rem;
    font-size: 0.9rem;
    max-width: 300px;
}

.footer-links h5 {
    color: var(--color-accent);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-links ul li {
    margin-bottom: 0.75rem;
}

.footer-links a {
    opacity: 0.8;
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.footer-links a:hover {
    opacity: 1;
    color: var(--color-accent);
}

/* --- SVG Animations --- */

/* Hero Grid Nodes */
@keyframes gridPulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

.grid-node {
    fill: var(--color-accent);
    animation: gridPulse 3s infinite ease-in-out;
}

.grid-node:nth-child(1) { animation-delay: 0.0s; }
.grid-node:nth-child(2) { animation-delay: 0.4s; }
.grid-node:nth-child(3) { animation-delay: 0.8s; }
.grid-node:nth-child(4) { animation-delay: 1.2s; }
.grid-node:nth-child(5) { animation-delay: 1.6s; }
.grid-node:nth-child(6) { animation-delay: 2.0s; }

/* Flowing Lines */
@keyframes flowDash {
    to { stroke-dashoffset: -20; }
}

.flow-line {
    stroke-dasharray: 6 14;
    animation: flowDash 1s linear infinite;
}

/* Floating Bubbles */
@keyframes floatBubble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.bubble-anim {
    animation: floatBubble 4s ease-in-out infinite;
}

/* 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 --- */
@media (max-width: 900px) {
    .hero-layout {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-visual {
        order: -1;
        aspect-ratio: 16/9;
    }

    .deep-dive-layout {
        grid-template-columns: 1fr;
    }

    .dive-toc {
        position: static;
        display: flex;
        gap: 1rem;
        border-left: none;
        border-bottom: 1px solid var(--color-border-subtle);
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        overflow-x: auto;
    }
    
    .dive-toc a {
        white-space: nowrap;
    }

    .case-study {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 600px) {
    .main-nav ul {
        gap: 1rem;
    }
    
    .brand-logo span {
        display: none; /* Hide text on very small screens if needed, but keep logo */
    }
    
    .brand-logo img {
        height: 28px;
    }
}
