/* ==========================================
   CSS Custom Properties (Design Tokens)
   ========================================== */
:root {
    /* Colors */
    --primary: #1a365d;
    --primary-light: #2d4a7c;
    --primary-lighter: #e8edf4;
    --accent: #2b6cb0;
    --accent-light: #ebf4ff;

    --text-dark: #1a202c;
    --text-body: #2d3748;
    --text-muted: #718096;
    --text-light: #a0aec0;

    --bg-white: #ffffff;
    --bg-light: #f7fafc;
    --bg-alt: #f0f4f8;

    --border: #e2e8f0;
    --border-dark: #cbd5e0;

    --success: #38a169;
    --success-bg: #f0fff4;
    --warning: #dd6b20;
    --danger: #e53e3e;

    --barrier-green: #38a169;
    --barrier-blue: #3182ce;
    --line-color: #a0aec0;

    /* Component colors */
    --cause-bg: #fff5f5;
    --cause-border: #feb2b2;
    --consequence-bg: #fffaf0;
    --consequence-border: #fbd38d;
    --event-bg: #ebf4ff;
    --event-border: #2b6cb0;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.9rem;
    --font-size-base: 1.1rem;
    --font-size-lg: 1.2rem;
    --font-size-xl: 1.30rem;
    --font-size-2xl: 1.6rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;
    --font-size-5xl: 3.5rem;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;

    /* Borders & Shadows */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ==========================================
   Reset & Base
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-body);
    background-color: var(--bg-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary);
}

ul, ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input {
    font-family: inherit;
    font-size: inherit;
}

/* ==========================================
   Layout
   ========================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.section {
    padding: var(--space-4xl) 0;
}

.section-alt {
    background-color: var(--bg-alt);
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-3xl);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.section-tag {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background-color: var(--accent-light);
    color: var(--accent);
    font-size: var(--font-size-sm);
    font-weight: 600;
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.section-title {
    font-size: var(--font-size-4xl);
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

.section-description {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    line-height: 1.7;
}

/* ==========================================
   Header & Navigation
   ========================================== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--primary);
    font-weight: 700;
    font-size: var(--font-size-lg);
}

.logo-text {
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: var(--space-xl);
}

.nav-links a {
    color: var(--text-body);
    font-weight: 500;
    font-size: var(--font-size-sm);
    padding: var(--space-sm) 0;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}

.nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: var(--transition);
}

/* ==========================================
   Hero Section
   ========================================== */
.hero {
    padding: var(--space-4xl) 0;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--primary-lighter) 100%);
    overflow: hidden;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: center;
}

.hero-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-title {
    font-size: var(--font-size-5xl);
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.1;
    margin-bottom: var(--space-lg);
}

.text-gradient {
    background: linear-gradient(135deg, var(--accent), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: var(--space-xl);
    max-width: 540px;
}

.hero-actions {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.hero-stats {
    display: flex;
    gap: var(--space-2xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-bowtie {
    width: 100%;
    max-width: 580px;
    filter: drop-shadow(var(--shadow-lg));
}

/* ==========================================
   Buttons
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-base);
    transition: all var(--transition);
    border: 2px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg-white);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--bg-white);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--border-dark);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: var(--primary-lighter);
    color: var(--primary);
}

.btn-lg {
    padding: var(--space-lg) var(--space-2xl);
    font-size: var(--font-size-lg);
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
}

/* ==========================================
   Method Cards
   ========================================== */
.method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-xl);
    margin-bottom: var(--space-3xl);
}

.method-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition);
}

.method-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.method-icon {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-lg);
}

.method-card h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--space-sm);
}

.method-card p {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.6;
}

/* Advantages */
.method-advantages {
    background: var(--bg-light);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    margin-bottom: var(--space-3xl);
}

.method-advantages h3 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--space-xl);
    text-align: center;
}

.advantages-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.advantage {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.advantage svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.advantage span {
    font-size: var(--font-size-sm);
    color: var(--text-body);
    line-height: 1.5;
}

/* When to apply */
.method-when h3 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--space-xl);
    text-align: center;
}

.when-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.when-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.when-icon {
    font-size: var(--font-size-2xl);
    flex-shrink: 0;
}

.when-item p {
    font-size: var(--font-size-sm);
    color: var(--text-body);
    line-height: 1.5;
}

/* ==========================================
   Steps Timeline
   ========================================== */
.steps-timeline {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.steps-timeline::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.step {
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
    position: relative;
}

.step:last-child {
    margin-bottom: 0;
}

.step-number {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: var(--bg-white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    font-weight: 700;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-md);
}

.step-content {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    flex: 1;
}

.step-content h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: var(--space-sm);
}

.step-content p {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.6;
}

.step-tip {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--text-body);
    border-left: 3px solid var(--accent);
}

/* ==========================================
   Constructor
   ========================================== */
.constructor-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: var(--space-xl);
    align-items: start;
}

.constructor-controls {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    position: sticky;
    top: 90px;
}

.control-group {
    margin-bottom: var(--space-xl);
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: var(--space-sm);
}

.control-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.control-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--text-body);
    transition: border-color var(--transition);
    background: var(--bg-light);
}

.control-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.1);
}

.control-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.control-item {
    display: flex;
    gap: var(--space-sm);
}

.control-item .control-input {
    flex: 1;
}

.control-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
}

.btn-add {
    width: 28px;
    height: 28px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    font-weight: 700;
    transition: all var(--transition);
}

.btn-add:hover {
    background: var(--accent);
    color: var(--bg-white);
}

.btn-remove {
    width: 28px;
    height: 28px;
    background: #fee2e2;
    color: var(--danger);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
    font-weight: 700;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-remove:hover {
    background: var(--danger);
    color: var(--bg-white);
}

/* Preview */
.constructor-preview {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border);
    background: var(--bg-light);
}

.preview-header h3 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-dark);
}

.preview-actions {
    display: flex;
    gap: var(--space-sm);
}

.preview-canvas {
    padding: var(--space-xl);
    background: var(--bg-white);
    min-height: 500px;
}

.preview-canvas svg {
    width: 100%;
    height: auto;
}

/* ==========================================
   FAQ
   ========================================== */
.faq-list {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.faq-item {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.faq-item:hover {
    border-color: var(--accent);
}

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-dark);
    text-align: left;
    transition: all var(--transition);
}

.faq-question:hover {
    color: var(--accent);
}

.faq-icon {
    flex-shrink: 0;
    transition: transform var(--transition);
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-slow);
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer > div {
    padding: 0 var(--space-xl) var(--space-xl);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.7;
}

/* ==========================================
   CTA Section
   ========================================== */
.cta-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    text-align: center;
}

.cta-content h2 {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--bg-white);
    margin-bottom: var(--space-md);
}

.cta-content p {
    font-size: var(--font-size-lg);
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: var(--space-xl);
}

.cta-section .btn-primary {
    background: var(--bg-white);
    color: var(--primary);
    border-color: var(--bg-white);
}

.cta-section .btn-primary:hover {
    background: var(--bg-light);
    border-color: var(--bg-light);
    color: var(--primary);
}

/* ==========================================
   Footer
   ========================================== */
.footer {
    background: var(--text-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: var(--space-3xl) 0 var(--space-xl);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: var(--space-3xl);
    margin-bottom: var(--space-2xl);
}

.footer-brand p {
    margin-top: var(--space-md);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.footer-brand .logo-text {
    color: var(--bg-white);
}

.footer-nav h4 {
    color: var(--bg-white);
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.footer-nav ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer-nav a, .footer-nav li {
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-sm);
}

.footer-nav a:hover {
    color: var(--bg-white);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--space-xl);
    text-align: center;
}

.footer-bottom p {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.4);
}

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 1024px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-subtitle {
        max-width: 100%;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-stats {
        justify-content: center;
    }

    .hero-visual {
        order: -1;
    }

    .hero-bowtie {
        max-width: 400px;
    }

    .constructor-wrapper {
        grid-template-columns: 1fr;
    }

    .constructor-controls {
        position: static;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
}

@media (max-width: 768px) {
    :root {
        --font-size-5xl: 2.5rem;
        --font-size-4xl: 2rem;
        --font-size-3xl: 1.75rem;
    }

    .section {
        padding: var(--space-3xl) 0;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--bg-white);
        flex-direction: column;
        padding: var(--space-lg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-toggle {
        display: flex;
    }

    .hero-actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-stats {
        flex-direction: column;
        align-items: center;
        gap: var(--space-md);
    }

    .control-columns {
        grid-template-columns: 1fr;
    }

    .preview-header {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }

    .preview-actions {
        flex-wrap: wrap;
    }

    .steps-timeline::before {
        left: 20px;
    }

    .step-number {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-base);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-md);
    }

    .hero-title {
        font-size: var(--font-size-3xl);
    }

    .method-grid {
        grid-template-columns: 1fr;
    }

    .advantages-list {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   Print Styles
   ========================================== */
@media print {
    .header, .nav-toggle, .hero-actions, .constructor-controls,
    .preview-actions, .footer-nav, .cta-section {
        display: none;
    }

    .section {
        padding: var(--space-xl) 0;
        page-break-inside: avoid;
    }
}
