/* YGGDRASIL Forest Index - Main Styles */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #11131a;
    --bg-card: #161820;
    --border-color: #2a2d3a;
    --text-primary: #e8eaf0;
    --text-secondary: #9aa0aa;
    --text-muted: #6b7280;
    --accent-primary: #4fd1c5;
    --accent-secondary: #e05a3c;
    --accent-tertiary: #7aa2f7;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --radius: 8px;
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    color: var(--accent-tertiary);
}

a:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 2px;
}

.nav-link:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.control-btn:focus-visible,
.control-select:focus-visible,
.detail-close:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.domain-card:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

code {
    background: var(--bg-secondary);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

/* Header */
.forest-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.forest-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-tertiary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-size: 1rem;
}

.forest-nav {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius);
    transition: all var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

/* Main */
main {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

section {
    margin-bottom: 3rem;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

/* Overview Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.overview-text {
    color: var(--text-secondary);
    max-width: 800px;
}

/* Domain Cards */
.domain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.domain-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.domain-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--domain-color, var(--accent-primary));
}

.domain-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--domain-color, var(--accent-primary));
}

.domain-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.domain-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.domain-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Forest Section */
.forest-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.control-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    min-width: 300px;
}

.control-select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.control-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
}

.control-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.node-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: auto;
}

.forest-canvas {
    width: 100%;
    height: 600px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}

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

/* Node Details Panel */
.node-details {
    position: absolute;
    top: 1rem;
    right: 1rem;
    bottom: 1rem;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-y: auto;
    z-index: 10;
    box-shadow: var(--shadow);
}

.node-details.hidden {
    display: none;
}

.node-details h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

#detail-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-close {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all var(--transition);
}

.detail-close:hover {
    border-color: var(--accent-primary);
}

/* Footer */
.forest-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.forest-footer a {
    color: var(--text-secondary);
}

.forest-footer a:hover {
    color: var(--accent-primary);
}

.license {
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    
    .forest-header {
        padding: 1rem;
    }
    
    .forest-canvas {
        height: 400px;
    }
    
    .node-details {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 50%;
        max-height: 50vh;
        border-radius: var(--radius) var(--radius) 0 0;
    }
    
    .control-select {
        min-width: 100%;
    }
    
    .forest-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .node-info {
        margin-left: 0;
    }
}