:root {
    --space-dark: #020208;
    --space-deep: #03030f;
    --nebula-purple: #6366f1;
    --nebula-pink: #ec4899;
    --star-white: #ffffff;
    --star-blue: #60a5fa;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-glow: rgba(99, 102, 241, 0.3);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(180deg, var(--space-dark) 0%, var(--space-deep) 50%, #050512 100%);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Stars Canvas Background (index pages: real sky drawn by sky/sky.js).
   Fixed to the visual viewport so the sky covers the whole window on resize,
   scroll and mobile browser chrome (dvh), with no black gaps at the edges. */
#stars-canvas,
#sky-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    width: 100vw;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    pointer-events: none;
    z-index: 0;
}

.sky-layer {
    width: 100%;
    width: 100vw;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 100%;
    min-height: 100dvh;
    opacity: 0;
    transition: opacity 1.6s ease;
}

.sky-layer.sky-on {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .sky-layer {
        transition: none;
    }
}

/* Language Selector */
.lang-selector {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    gap: 0.4rem;
    background: rgba(10, 10, 26, 0.8);
    backdrop-filter: blur(10px);
    padding: 0.35rem;
    border-radius: 8px;
    border: 1px solid transparent;
}

a.lang-option,
a.lang-option:visited,
a.lang-option:link {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

a.lang-option:hover {
    color: var(--star-white);
    background: rgba(99, 102, 241, 0.15);
    text-decoration: none;
}

a.lang-option.active,
a.lang-option.active:visited {
    color: var(--star-white);
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--border-glow);
}

.lang-flag {
    font-size: 1.1rem;
    line-height: 1;
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 2;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 60px;
}

.hero-content {
    text-align: center;
}

.glow-text {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--star-white) 0%, var(--star-blue) 50%, var(--nebula-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

.tagline {
    font-size: 1.4rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

/* CTA Buttons */
.cta-links {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

a.cta-btn,
a.cta-btn:visited,
a.cta-btn:link {
    color: var(--star-white);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 2rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    border: 1px solid var(--border-glow);
    font-size: 1.05rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.12);
}

a.cta-btn:hover {
    color: var(--star-white);
    text-decoration: none;
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.2);
}

/* Contact Links */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-links a {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-size: 1rem;
}

.contact-links a:hover {
    color: var(--star-white);
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--border-glow);
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .glow-text {
        font-size: 2.2rem;
    }

    .tagline {
        font-size: 1.1rem;
    }

    .cta-links {
        gap: 1rem;
    }

    .contact-links {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .glow-text {
        font-size: 1.8rem;
    }
}

/* Insights Section */
.insights-section {
    padding: 80px 0 120px;
    position: relative;
    z-index: 2;
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.claude-icon {
    width: 2.5rem;
    height: 2.5rem;
    filter: drop-shadow(0 0 12px rgba(217, 119, 87, 0.6));
    object-fit: contain;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(99, 102, 241, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.2);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--star-white) 0%, var(--nebula-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.insights-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.insight-card {
    background: rgba(13, 13, 43, 0.6);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
}

.insight-card.highlight {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(236, 72, 153, 0.1) 100%);
    border-color: rgba(99, 102, 241, 0.4);
    margin-bottom: 2rem;
}

.insight-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--star-white);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.insight-card h3 i {
    color: var(--nebula-purple);
}

.insight-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.insight-card p strong {
    color: var(--star-blue);
}

.insight-card ul {
    list-style: none;
    color: var(--text-secondary);
}

.insight-card ul li {
    padding: 0.4rem 0;
    padding-left: 1.2rem;
    position: relative;
}

.insight-card ul li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--nebula-purple);
}

.insight-card.narrative {
    grid-column: 1 / -1;
    margin-bottom: 2rem;
}

.insight-card.narrative p {
    margin-bottom: 1rem;
}

.highlight-text {
    color: var(--star-blue);
}

.key-pattern {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-top: 1.5rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.key-pattern strong {
    color: #10b981;
}

/* Impressive Section */
.impressive-section {
    margin-bottom: 2rem;
}

.subsection-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--star-white);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.subsection-title i {
    color: #fbbf24;
}

.impressive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.impressive-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
}

.impressive-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #10b981;
    margin-bottom: 0.75rem;
}

.impressive-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

.impressive-card p strong {
    color: var(--star-white);
}

/* Charts */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.insight-card.chart-card {
    padding: 1.5rem;
}

.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bar-label {
    width: 80px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #14b8a6 0%, #06b6d4 100%);
    border-radius: 4px;
}

.bar-chart-blue .bar-fill {
    background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 100%);
}

.bar-chart-purple .bar-fill {
    background: linear-gradient(90deg, #8b5cf6 0%, #a78bfa 100%);
}

.bar-value {
    width: 70px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    font-family: monospace;
}

.insight-card.quote-card {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.25);
}

.insight-card blockquote {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    text-align: center;
    padding: 0.5rem 1rem;
}

/* VPS Section */
.vps-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-glow);
}

.vps-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.vps-stats {
    grid-template-columns: repeat(4, 1fr);
}

.vps-stats .stat-card {
    background: rgba(236, 72, 153, 0.1);
    border-color: rgba(236, 72, 153, 0.3);
}

.vps-stats .stat-card:hover {
    background: rgba(236, 72, 153, 0.2);
    box-shadow: 0 8px 32px rgba(236, 72, 153, 0.2);
}

.vps-stats .stat-value {
    background: linear-gradient(135deg, var(--star-white) 0%, var(--nebula-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .vps-stats {
        grid-template-columns: repeat(2, 1fr);
    }

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

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

    .charts-row {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* About Section */
.about-section {
    padding: 0 0 80px;
    position: relative;
    z-index: 2;
}

.about-card {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(13, 13, 43, 0.6);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 2rem 2.5rem;
    backdrop-filter: blur(10px);
}

.about-text {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.about-text:last-child {
    margin-bottom: 0;
}

.about-text strong {
    color: var(--star-blue);
}

.about-text em {
    color: var(--text-primary);
    font-style: italic;
}

/* Projects Section */
.projects-section {
    padding: 80px 0;
    position: relative;
    z-index: 2;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.project-category {
    background: rgba(13, 13, 43, 0.6);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.project-category:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background: rgba(13, 13, 43, 0.8);
}

.category-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--star-white);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-title i {
    color: var(--nebula-purple);
    font-size: 0.9rem;
}

.category-projects {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

a.project-item:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.2);
}

.project-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--nebula-purple);
    white-space: nowrap;
}

.project-stars {
    font-size: 0.7rem;
    color: #fbbf24;
    white-space: nowrap;
}

.project-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    width: 100%;
    line-height: 1.4;
}

/* Languages Section */
.languages-section {
    padding: 80px 0;
    position: relative;
    z-index: 2;
}

.languages-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    max-width: 700px;
    margin: 0 auto;
}

.lang-tag {
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid;
}

.lang-tag:hover {
    transform: translateY(-2px);
}

.lang-tag.primary {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    color: var(--star-white);
    font-size: 1rem;
    padding: 0.6rem 1.5rem;
}

.lang-tag.secondary {
    background: rgba(96, 165, 250, 0.15);
    border-color: rgba(96, 165, 250, 0.35);
    color: var(--star-blue);
}

.lang-tag.tertiary {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Interests Section */
.interests-section {
    padding: 80px 0;
    position: relative;
    z-index: 2;
}

.interests-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.interest-card {
    background: rgba(13, 13, 43, 0.6);
    border: 1px solid var(--border-glow);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.interest-card:hover {
    background: rgba(13, 13, 43, 0.8);
    border-color: rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.interest-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--star-white);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.interest-card h3 i {
    color: var(--nebula-purple);
}

.interest-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

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

    .about-card {
        padding: 1.5rem;
    }
}

/* Open Source Contributions Section */
.oss-section {
    padding: 80px 0 120px;
    position: relative;
    z-index: 2;
}

.oss-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.oss-item {
    display: grid;
    grid-template-columns: 240px 1fr 80px;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: rgba(13, 13, 43, 0.6);
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.oss-item:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--border-glow);
    transform: translateX(4px);
}

.oss-repo {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--nebula-purple);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oss-repo i {
    margin-right: 0.4rem;
    font-size: 0.75rem;
}

.oss-title {
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oss-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
    font-family: monospace;
}

@media (max-width: 768px) {
    .oss-item {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 0.25rem 1rem;
    }

    .oss-repo {
        grid-column: 1;
        grid-row: 1;
    }

    .oss-date {
        grid-column: 2;
        grid-row: 1;
    }

    .oss-title {
        grid-column: 1 / -1;
        grid-row: 2;
        white-space: normal;
    }
}
