/* === Design Tokens & Variables === */
:root {
    /* Colors */
    --color-bg-dark: #19102D;
    --color-bg-paper: #F4F3F7;
    --color-text-body: #191523;
    --color-brand: #5214EB;
    --color-accent: #D66EED;
    
    /* Derived Colors for Contrast */
    --color-text-on-dark: #F4F3F7;
    --color-border-subtle: rgba(25, 21, 35, 0.1);
    
    /* Structural Constraints */
    --radius-card: 0;
    --radius-btn: 0;
    --card-border: 2px solid var(--color-text-body);
    --card-shadow: 4px 4px 0 var(--color-text-body);
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --content-max: 1120px;
    
    /* Typography */
    --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--color-bg-paper);
    color: var(--color-text-body);
    line-height: 1.55;
    font-size: 16px;
    overflow-x: hidden;
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

ul, ol {
    list-style: none;
}

/* === Layout Containers === */
.container {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 0 var(--gap);
}

.section-wrapper {
    padding: var(--section-y) 0;
    position: relative;
}

/* Dividers */
.section-divider {
    width: 100%;
    height: 1px;
    background-color: var(--color-border-subtle);
    border: none;
}

/* === Typography === */
.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-brand);
    margin-bottom: 0.75rem;
}

.dark-surface .badge {
    color: var(--color-accent);
}

h1 {
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 1.5rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    max-width: 38em;
}

.highlight {
    color: var(--color-brand);
}

.dark-surface .highlight {
    color: var(--color-accent);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 24px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-bg-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-secondary {
    background-color: transparent;
    color: var(--color-text-body);
    border: 2px solid var(--color-text-body);
}

.dark-surface .btn-secondary {
    color: var(--color-text-on-dark);
    border-color: var(--color-text-on-dark);
}

.btn-secondary:hover {
    background-color: rgba(25, 21, 35, 0.05);
}

.dark-surface .btn-secondary:hover {
    background-color: rgba(244, 243, 247, 0.1);
}

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* === Cards & Panels === */
.card {
    background: var(--color-bg-paper);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    position: relative;
}

.dark-surface .card {
    background: var(--color-bg-paper);
    color: var(--color-text-body);
}

.panel {
    background-color: var(--color-bg-dark);
    color: var(--color-text-on-dark);
    padding: 2rem;
    border-radius: 0;
}

/* 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);
}

/* === Tables === */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    border: 2px solid var(--color-text-body);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border-subtle);
}

th {
    background-color: rgba(25, 21, 35, 0.05);
    font-weight: 700;
}

.dark-surface th {
    background-color: rgba(244, 243, 247, 0.1);
    color: var(--color-text-on-dark);
}

/* === FAQ Details === */
details {
    border: var(--card-border);
    margin-bottom: 1rem;
    background: var(--color-bg-paper);
}

summary {
    padding: 1rem;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 2.5rem;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    line-height: 1;
}

details[open] summary::after {
    content: "-";
}

details p {
    padding: 1rem;
    border-top: 1px solid var(--color-border-subtle);
    margin-bottom: 0;
}

/* === Header & Footer === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: var(--color-bg-paper);
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 1rem 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-img {
    height: 32px;
    width: auto;
}

nav ul {
    display: flex;
    gap: 1.5rem;
}

nav a {
    font-weight: 600;
    font-size: 0.95rem;
}

nav a[aria-current="page"] {
    color: var(--color-brand);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.dark-surface nav a[aria-current="page"] {
    color: var(--color-accent);
}

.site-footer {
    background-color: var(--color-bg-dark);
    color: var(--color-text-on-dark);
    padding: 3rem 0;
    margin-top: var(--section-y);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

/* === SVG Animation Classes === */
.svg-node {
    fill: rgba(214, 110, 237, 0.2);
    stroke: var(--color-accent);
    stroke-width: 1;
    animation: nodeGlow 4s infinite ease-in-out;
}

.svg-line {
    stroke: var(--color-text-on-dark);
    stroke-width: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: lineFlow 3s infinite linear;
}

@keyframes nodeGlow {
    0%, 100% { fill: rgba(214, 110, 237, 0.1); }
    50% { fill: rgba(214, 110, 237, 0.8); }
}

@keyframes lineFlow {
    0% { stroke-dashoffset: 1; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 0; }
}

/* Staggered Delays */
.delay-1 { animation-delay: 0s; }
.delay-2 { animation-delay: 0.5s; }
.delay-3 { animation-delay: 1s; }
.delay-4 { animation-delay: 1.5s; }
.delay-5 { animation-delay: 2s; }

/* 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-node { fill: var(--color-accent); }
    .svg-line { stroke-dashoffset: 0; }
}

/* Responsive Utilities */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 1rem;
    }
    h1 {
        text-wrap: balance;
    }
}
