/* === Design System & Tokens === */
:root {
    /* Colors */
    --color-dark: #240F29;
    --color-paper: #F6F3F7;
    --color-text: #201523;
    --color-brand: #A711CF;
    --color-accent: #ED6E73;
    
    /* Structural Tokens */
    --radius-card: 0;
    --radius-btn: 0;
    --card-border: 0;
    --card-shadow: none;
    --section-y: clamp(2.5rem, 5vw, 4rem);
    --gap: clamp(0.75rem, 1.5vw, 1.25rem);
    --content-max: 1280px;
    
    /* Typography */
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.55;
    color: var(--color-text);
    background-color: var(--color-paper);
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === Layout Utilities === */
.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 {
    border: none;
    border-top: 1px solid rgba(32, 21, 35, 0.1);
    margin: 0;
}

/* === Typography === */
h1, h2, h3, h4 {
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

h1 {
    font-size: clamp(2.6rem, 6.4vw, 5rem);
    margin-bottom: 1.5rem;
}

h2 {
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.dark-theme h2 {
    color: var(--color-paper);
}

.dark-theme .hl {
    color: var(--color-accent);
}

.paper-theme h2 .hl {
    color: var(--color-brand);
}

h3 {
    font-size: clamp(1.3rem, 2vw, 1.6rem);
    margin-bottom: 1rem;
    color: var(--color-text);
}

p {
    margin-bottom: 1rem;
    max-width: 38em;
}

.masthead {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    display: block;
}

.paper-theme .masthead {
    color: var(--color-brand);
}

.dark-theme .masthead {
    color: var(--color-accent);
}

/* === Components === */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 24px;
    font-weight: 600;
    font-size: 1rem;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-dark);
    border: none;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--color-text);
    color: var(--color-text);
}

.dark-theme .btn-secondary {
    border-color: var(--color-paper);
    color: var(--color-paper);
}

.btn-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Cards & Panels */
.card {
    background-color: rgba(255, 255, 255, 0.05);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    border-radius: var(--radius-card);
    transition: background-color 0.3s ease;
}

.paper-theme .card {
    background-color: #fff;
    border: 1px solid rgba(32, 21, 35, 0.08);
}

.dark-theme .card {
    background-color: rgba(246, 243, 247, 0.05);
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(32, 21, 35, 0.1);
}

th {
    font-weight: 600;
    color: var(--color-text);
}

.dark-theme th {
    color: var(--color-paper);
    border-bottom-color: rgba(246, 243, 247, 0.2);
}

td {
    color: var(--color-text);
}

.dark-theme td {
    color: var(--color-paper);
    border-bottom-color: rgba(246, 243, 247, 0.1);
}

tr:last-child td {
    border-bottom: none;
}

/* FAQ */
details {
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(32, 21, 35, 0.1);
    padding-bottom: 1rem;
}

.dark-theme details {
    border-bottom-color: rgba(246, 243, 247, 0.15);
}

summary {
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    padding: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "+";
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.2s ease;
}

details[open] summary::after {
    transform: rotate(45deg);
}

details p {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: var(--color-text);
}

.dark-theme details p {
    color: var(--color-paper);
}

/* News Cards */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--gap);
}

.news-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.news-date {
    font-size: 0.85rem;
    color: var(--color-brand);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.dark-theme .news-date {
    color: var(--color-accent);
}

.news-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.dark-theme .news-title {
    color: var(--color-paper);
}

.news-excerpt {
    font-size: 0.95rem;
    color: var(--color-text);
    flex-grow: 1;
}

.dark-theme .news-excerpt {
    color: rgba(246, 243, 247, 0.8);
}

/* === Header & Footer === */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(246, 243, 247, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(32, 21, 35, 0.05);
    padding: 1rem 0;
}

.dark-theme.site-header {
    background-color: rgba(36, 15, 41, 0.95);
    border-bottom-color: rgba(246, 243, 247, 0.1);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-text);
}

.dark-theme .logo {
    color: var(--color-paper);
}

.logo img {
    width: 32px;
    height: 32px;
}

nav ul {
    display: flex;
    gap: 2rem;
    align-items: center;
}

nav a {
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

nav a:hover {
    color: var(--color-brand);
}

.dark-theme nav a:hover {
    color: var(--color-accent);
}

nav a[aria-current="page"] {
    color: var(--color-brand);
    font-weight: 700;
}

.dark-theme nav a[aria-current="page"] {
    color: var(--color-accent);
}

.site-footer {
    background-color: var(--color-dark);
    color: var(--color-paper);
    padding: 3rem 0;
    margin-top: auto;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: rgba(246, 243, 247, 0.7);
    font-size: 0.9rem;
}

.footer-links a:hover {
    color: var(--color-accent);
}

/* === SVG Animations === */
.svg-container {
    width: 100%;
    height: auto;
    max-width: 600px;
    margin: 0 auto;
}

/* Grid Node Animation */
.grid-node {
    fill: rgba(246, 243, 247, 0.1);
    animation: nodeLightUp 4s infinite ease-in-out;
}

@keyframes nodeLightUp {
    0%, 100% { fill: rgba(246, 243, 247, 0.1); }
    50% { fill: var(--color-accent); }
}

/* Bubble Float */
.chat-bubble {
    animation: bubbleFloat 6s infinite ease-in-out;
}

@keyframes bubbleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Input Dots Breathing */
.input-dot {
    animation: dotBreathe 2s infinite ease-in-out;
}

@keyframes dotBreathe {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* Draw Line Animation */
.draw-line {
    pathLength: 1;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    animation: drawLine 8s infinite ease-in-out;
}

@keyframes drawLine {
    0% { stroke-dashoffset: 1; }
    20% { stroke-dashoffset: 0; }
    80% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 1; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .grid-node { fill: var(--color-accent); }
    .chat-bubble { transform: none; }
    .input-dot { opacity: 1; }
    .draw-line { stroke-dashoffset: 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        gap: 1rem;
    }
    nav ul {
        gap: 1rem;
    }
    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
    .two-col-grid {
        grid-template-columns: 1fr;
    }
}

.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--gap);
}

@media (max-width: 768px) {
    .two-col-grid {
        grid-template-columns: 1fr;
    }
}

.step-list {
    counter-reset: step-counter;
}

.step-item {
    position: relative;
    padding-left: 4rem;
    margin-bottom: 2rem;
}

.step-number {
    position: absolute;
    left: 0;
    top: 0;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-brand);
    line-height: 1;
}

.dark-theme .step-number {
    color: var(--color-accent);
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--gap);
}

.feature-item {
    padding: 1.5rem;
}

.feature-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.dark-theme .feature-title {
    color: var(--color-paper);
}

.tip-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tip-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.tip-number {
    background-color: var(--color-brand);
    color: #fff;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.dark-theme .tip-number {
    background-color: var(--color-accent);
    color: var(--color-dark);
}
