/* Root Variables & Reset */
:root {
    --color-dark: #0a0a0f;
    --color-dark-secondary: #1a1a2e;
    --color-light: #f5f5f5;
    --color-accent-1: #ff6b6b;
    --color-accent-2: #4ecdc4;
    --color-accent-3: #f7b731;
    --color-accent-4: #5f27cd;
    --color-text: #e0e0e0;
    --color-text-muted: #a0a0a0;
    --font-serif: 'Crimson Text', serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-sanskrit: 'Noto Sans Devanagari', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-serif);
    background: var(--color-dark);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Loader */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--color-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s, visibility 0.5s;
}

.loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.mandala-loader {
    filter: drop-shadow(0 0 20px rgba(255, 107, 107, 0.5));
}

.rotate-slow {
    animation: rotate 20s linear infinite;
}

.rotate-reverse {
    animation: rotate-reverse 15s linear infinite;
}

.rotate-fast {
    animation: rotate 10s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotate-reverse {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

/* Navigation */
.nav-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.nav-container.visible {
    transform: translateY(0);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sanskrit {
    font-family: var(--font-sanskrit);
    color: var(--color-accent-1);
}

.code {
    font-family: var(--font-mono);
    color: var(--color-accent-2);
}

.english {
    font-family: var(--font-serif);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu li {
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem 0;
}

.nav-menu li::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-accent-1), var(--color-accent-2));
    transition: width 0.3s ease;
}

.nav-menu li:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
}

.nav-toggle span {
    width: 25px;
    height: 2px;
    background: var(--color-text);
    transition: var(--transition);
}

/* Hero Section */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#particleCanvas {
    width: 100%;
    height: 100%;
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
}

.hero-title {
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.word {
    position: relative;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.word:nth-child(2) {
    animation-delay: 0.2s;
}

.word:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.word::before {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--color-accent-1), var(--color-accent-2), var(--color-accent-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    animation: glitch 2s ease-in-out infinite;
}

@keyframes glitch {
    0%, 90%, 100% { opacity: 0; }
    95% { opacity: 1; }
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    font-family: var(--font-mono);
}

.typing-effect {
    overflow: hidden;
    border-right: 2px solid var(--color-accent-2);
    white-space: nowrap;
    animation: typing 3s steps(30, end), blink 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink {
    from, to { border-color: transparent; }
    50% { border-color: var(--color-accent-2); }
}

.hero-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    color: var(--color-text-muted);
}

.meta-separator {
    color: var(--color-accent-3);
}

.cta-button {
    background: linear-gradient(135deg, var(--color-accent-1), var(--color-accent-4));
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.cta-button:hover::before {
    width: 300px;
    height: 300px;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(95, 39, 205, 0.3);
}

.infinity-icon {
    fill: currentColor;
    animation: rotate 4s linear infinite;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

.mouse {
    width: 25px;
    height: 40px;
    border: 2px solid var(--color-text-muted);
    border-radius: 15px;
    display: block;
    position: relative;
}

.wheel {
    width: 3px;
    height: 8px;
    background: var(--color-text-muted);
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(10px); }
}

@keyframes scroll {
    0% { opacity: 1; top: 8px; }
    100% { opacity: 0; top: 20px; }
}

/* Sections */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 5rem 0;
    position: relative;
}

.section-title {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
    width: 100%;
}

.glitch {
    position: relative;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitch-1 0.5s infinite;
    color: var(--color-accent-1);
    z-index: -1;
}

.glitch::after {
    animation: glitch-2 0.5s infinite;
    color: var(--color-accent-2);
    z-index: -2;
}

@keyframes glitch-1 {
    0%, 100% { clip-path: inset(0 0 0 0); }
    20% { clip-path: inset(20% 0 30% 0); transform: translate(-2px, 2px); }
    40% { clip-path: inset(50% 0 20% 0); transform: translate(2px, -2px); }
    60% { clip-path: inset(10% 0 60% 0); transform: translate(-2px, 0); }
    80% { clip-path: inset(70% 0 10% 0); transform: translate(2px, 2px); }
}

@keyframes glitch-2 {
    0%, 100% { clip-path: inset(0 0 0 0); }
    20% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -2px); }
    40% { clip-path: inset(20% 0 50% 0); transform: translate(-2px, 2px); }
    60% { clip-path: inset(30% 0 40% 0); transform: translate(2px, 0); }
    80% { clip-path: inset(10% 0 70% 0); transform: translate(-2px, -2px); }
}

/* Chapters Grid */
.chapters {
    background: var(--color-dark-secondary);
}

.chapters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.chapter-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 2rem;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.chapter-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--color-accent-1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s;
}

.chapter-card:hover::before {
    opacity: 0.1;
}

.chapter-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-accent-1);
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.2);
}

.card-number {
    font-size: 3rem;
    font-weight: 300;
    color: var(--color-accent-2);
    font-family: var(--font-mono);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.card-excerpt {
    color: var(--color-text-muted);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-family: var(--font-mono);
    color: var(--color-accent-3);
}

/* Themes Section */
.themes-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
    margin-top: 3rem;
}

.theme-item {
    text-align: center;
    padding: 2rem;
    border-radius: 10px;
    transition: var(--transition);
    cursor: pointer;
}

.theme-item:hover {
    transform: scale(1.05);
}

.theme-icon {
    margin-bottom: 1rem;
    display: inline-block;
    filter: drop-shadow(0 0 20px currentColor);
}

.theme-item[data-theme="blade"] .theme-icon {
    color: var(--color-accent-1);
    animation: rotate 3s linear infinite;
}

.theme-item[data-theme="eastwest"] .theme-icon {
    color: var(--color-accent-2);
}

.theme-item[data-theme="loop"] .theme-icon {
    color: var(--color-accent-3);
}

.theme-item[data-theme="error"] .theme-icon {
    color: var(--color-accent-4);
}

.theme-item h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.theme-item p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Gallery */
.gallery {
    background: var(--color-dark-secondary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.gallery-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1rem;
    transition: var(--transition);
    cursor: pointer;
    overflow: hidden;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-item:hover {
    transform: scale(1.02);
    border-color: var(--color-accent-2);
    box-shadow: 0 10px 30px rgba(78, 205, 196, 0.2);
}

.gallery-item svg {
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
}

.gallery-item:hover svg {
    transform: scale(1.1);
}

/* About Section */
.about-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-text p {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    color: var(--color-text);
}

.quote {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(95, 39, 205, 0.1));
    padding: 2rem;
    border-radius: 10px;
    margin: 3rem 0;
    border-left: 4px solid var(--color-accent-1);
    font-style: italic;
    font-size: 1.3rem;
}

.quote cite {
    display: block;
    margin-top: 1rem;
    font-style: normal;
    color: var(--color-accent-3);
    font-family: var(--font-mono);
}

/* Footer */
.footer {
    background: var(--color-dark);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem 0;
    text-align: center;
}

.footer-text {
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.footer-meta {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu.active {
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--color-dark-secondary);
        flex-direction: column;
        padding: 2rem;
        gap: 1rem;
    }
    
    .hero-title {
        font-size: clamp(2rem, 8vw, 4rem);
    }
    
    .chapters-grid {
        grid-template-columns: 1fr;
    }
    
    .themes-container {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .nav-container,
    .loader,
    .hero-bg,
    .scroll-indicator,
    .cta-button {
        display: none;
    }
    
    section {
        page-break-inside: avoid;
    }
}