/*
 * GANITSUTRAM
 * A Living Knowledge Ecosystem for Mathematical Discovery
 *
 * "यथा शिखा मयूराणां नागानां मणयो यथा
 *  तद्वद् वेदाङ्गशास्त्राणां गणितं मूर्ध्नि वर्तते"
 *
 * As the crest of a peacock, as the gem on the hood
 * of a cobra — so stands mathematics at the crown
 * of all knowledge.
 *                                       — Brahmagupta
 *                                         628 CE · Brahmasphutasiddhanta
 *
 * Creator:   Jawahar R. Mallah
 * Email:     jawahar@aitdl.com
 * GitHub:    https://github.com/jawahar-mallah
 * Websites:  https://ganitsutram.com
 *            https://aitdl.com
 *
 * Then:  628 CE · Brahmasphutasiddhanta
 * Now:   8 March MMXXVI · Vikram Samvat 2082
 *
 * Copyright © 2026 Jawahar R. Mallah · AITDL | GANITSUTRAM
 *
 * Developer Note:
 * If you intend to reuse this code, please respect
 * the creator and the work behind it.
 */
/*
Project: GanitSūtram
Author: Jawahar R Mallah
Company: AITDL | aitdl.com
*/

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Cinzel+Decorative:wght@400;700;900&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&family=Noto+Serif+Devanagari:wght@300;400;700&family=Space+Grotesk:wght@300;400;500;700&display=swap');

:root {
    /* ─── TYPOGRAPHY (The Golden Manuscript Edition) ─── */
    --font-display: 'Cinzel Decorative', cursive;
    --font-heading: 'Cinzel', serif;
    --font-label: 'Cinzel', serif;
    --font-body: 'Cormorant Garamond', serif;
    --font-ancient: 'Noto Serif Devanagari', serif;
    --font-accent: 'Cinzel', serif; /* Consistent with branding */

    /* ─── COLOR PALETTE (Deep Navy & Gold) ─── */
    --bg-primary: #04080F;      /* Deep Navy Black */
    --bg-secondary: #081226;    /* Midnight Blue */
    --fg-main: #FFFFFF;
    --fg-muted: rgba(255, 255, 255, 0.7);
    
    --accent-primary: #D4AF37;   /* Radiant Gold */
    --accent-soft: #B8972E;      /* Antique Gold Adj */
    --accent-secondary: #1A3060; /* Royal Blue */
    --accent-glow: rgba(212, 175, 55, 0.3);

    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Mobile Tokens -> Highly Fit Scaling */
    --nav-height-mobile: 56px;
    --content-padding-mobile: clamp(1rem, 3vw, 2rem);
    --font-size-hero-mobile: clamp(1.8rem, 8vw, 2.8rem);
}

/* ─── LIGHT THEME (Gurukul White / AITDL) ─── */
[data-theme="light"] {
    --bg-primary: #F4F3F0;      /* AITDL Light Cream */
    --bg-secondary: #FFFFFF;    /* Pure White */
    --fg-main: #1A1A1A;         /* Dark Charcoal */
    --fg-muted: rgba(0, 0, 0, 0.6);
    
    --accent-primary: #FF6B35;  /* AITDL Sunset Orange */
    --accent-soft: #E05A2B;      /* Darker Orange Adjust */
    --accent-secondary: #D4AF37; /* Gold as secondary */
    --accent-glow: rgba(255, 107, 53, 0.15);

    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.1);
}

@keyframes stillnessPulse {
    0%, 100% {
        opacity: 0.8;
        text-shadow: 0 0 5px rgba(212, 175, 55, 0.1);
    }
    33% { /* 4s Inhale */
        opacity: 1;
        text-shadow: 0 0 20px rgba(212, 175, 55, 0.8);
    }
    50% { /* 2s Hold (4s to 6s) */
        opacity: 1;
        text-shadow: 0 0 20px rgba(212, 175, 55, 0.8);
    }
}

/* ─── GLOBAL RESET ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--fg-main);
    font-family: var(--font-body);
    font-size: 1.1rem; /* Slightly larger for Garamond readability */
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -webkit-overflow-scrolling: touch;
}

html {
    overflow-x: hidden;
    width: 100%;
}

/* ─── PREMIUM UTILITIES ─── */
.gs-gold-foil {
    background: linear-gradient(135deg, #FFF8E7 0%, #D4AF37 50%, #A07820 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 15px rgba(212, 175, 55, 0.2);

}

/* ════════════════════════════
   TOUCH & MOBILE OPTIMIZATIONS
════════════════════════════ */
/* Touch targets minimum 44px */
button,
.gs-button,
input,
select,
textarea,
.persona-card,
.discovery-card,
nav a {
    min-height: 44px;
}

/* Remove tap highlight on iOS */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent zoom on input focus (iOS) */
input,
select,
textarea {
    font-size: max(16px, 1rem);
}

/* ════════════════════════════
   ACCESSIBILITY & UTILITIES
════════════════════════════ */
.gs-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 8px 16px;
    z-index: 9999;
    font-family: var(--font-heading);
    font-weight: bold;
    text-transform: uppercase;
    transition: top 0.2s ease;
}

.gs-skip-link:focus {
    top: 0;
}

/* ════════════════════════════
   SHARED UI COMPONENTS
════════════════════════════ */

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

.gs-title {
    font-family: var(--font-display);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.gs-ancient-text {
    font-family: var(--font-ancient);
    color: var(--accent-soft);
    letter-spacing: 0.5rem;
}

.gs-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: transparent;
    color: var(--fg-main);
    border: 1px solid var(--accent-soft);
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none;
}

.gs-button:hover {
    background: rgba(255, 85, 0, 0.1);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 85, 0, 0.2);
}

.gs-footer {
    text-align: center;
    padding: 4rem 2rem;
    font-family: var(--font-main);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    line-height: 1.8;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: var(--bg-primary);
}

[data-theme="light"] .gs-footer {
    background: var(--bg-secondary) !important;
    color: var(--fg-muted) !important;
    border-top-color: rgba(0, 0, 0, 0.08) !important;
}

/* ════════════════════════════
   GLOBAL NAVIGATION & HEADER
════════════════════════════ */

.gs-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: var(--bg-primary); /* Use theme variable */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0; /* Edge to edge */
    transition: all 0.4s ease;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.gs-nav.scrolled {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--accent-glow);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}


.gs-nav-inner {
    height: 64px; /* Sleeker profile */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

/* ─── THEME TOGGLE ─── */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    border-radius: 20px !important;
    transition: all 0.3s ease;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--accent-glow);
    color: var(--fg-main);
    margin-left: 1rem;
}

.theme-toggle-btn:hover {
    background: var(--accent-glow) !important;
    transform: translateY(-1px);
}

.theme-toggle-btn .theme-icon {
    font-size: 1rem;
}

/* ─── LIGHT THEME COMPONENT OVERRIDES ─── */
[data-theme="light"] .gs-nav {
    background: rgba(255, 255, 255, 0.7) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05) !important;
}

.gs-hero-quote {
    font-family: var(--font-ancient);
    font-size: 1.1rem;
    color: var(--accent-secondary);
    opacity: 0.8;
    letter-spacing: 0.05em;
}

.gs-hero-invocation-meaning {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.5rem;
}


[data-theme="light"] .gs-nav.scrolled {
    background: rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] .gs-nav-logo {
    color: var(--fg-main) !important;
}

[data-theme="light"] .theme-toggle-btn:hover {
    background: rgba(255, 107, 53, 0.1) !important;
}

[data-theme="light"] .gs-hero-title {
    text-shadow: none !important;
}

[data-theme="light"] .gs-button-ghost {
    border-color: rgba(0, 0, 0, 0.2) !important;
    color: var(--fg-main) !important;
}

[data-theme="light"] .gs-button-ghost:hover {
    background: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .btn-ghost,
[data-theme="light"] .nav-link.btn-ghost {
    color: var(--fg-main) !important;
}

[data-theme="light"] .gs-lang-btn {
    color: var(--fg-muted) !important;
}

[data-theme="light"] .gs-lang-btn.active {
    color: var(--accent-primary) !important;
    background: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .gs-hero-quote {
    color: #5C4033 !important; /* Deep Burnt Orange for light mode */
    opacity: 1 !important;
}

[data-theme="light"] .gs-hero-invocation-meaning {
    color: var(--fg-muted) !important;
    opacity: 1 !important;
}

[data-theme="light"] .gs-stats-bar {

    background: rgba(255, 255, 255, 0.8) !important;
    border-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .gs-archival-bg,
[data-theme="light"] #nebula-overlay,
[data-theme="light"] .nebula-bloom,
[data-theme="light"] #vignette,
[data-theme="light"] #ring-overlay {
    opacity: 0 !important;
    visibility: hidden !important;
}

[data-theme="light"] .gs-hero-label .gs-label-text {
    color: var(--accent-primary) !important;
}

[data-theme="light"] .gs-hero-description {
    color: var(--fg-muted) !important;
}

[data-theme="light"] .gs-hero-inner {
    z-index: 10;
}



/* ════════════════════════════
   MOBILE SLEEK NAVBAR
════════════════════════════ */

.gs-nav-logo {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--fg-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    letter-spacing: -0.05em;
    text-transform: uppercase;
    animation: stillnessPulse 12s infinite; /* The 4-2-6 Amygdala sequence */
}

.gs-nav-logo-dev {
    color: var(--accent-primary);
    font-family: var(--font-ancient);
    font-size: 1.8rem;
    font-weight: 400;
}

.gs-nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.gs-nav-hamburger {
    display: none;
    background: transparent;
    border: none;
    color: var(--accent-primary);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: transform 0.3s ease;
}

.gs-nav-hamburger:active {
    transform: scale(0.9);
}

.nav-link {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s ease;
    background: transparent;
    border: none;
    cursor: pointer;
}

.nav-link:hover {
    color: var(--accent-primary);
}

/* Ghost Button Styling */
.btn-ghost {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 0.5rem 1.2rem !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    color: #fff !important;
    min-height: auto !important;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Primary CTA Styling */
.gs-nav-cta {
    background: var(--accent-primary) !important;
    color: #fff !important;
    padding: 0.6rem 1.4rem !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    min-height: auto !important;
}

.gs-nav-cta:hover {
    background: #ff6622 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 85, 0, 0.3);
}

/* Language Switcher Styling */
.gs-lang-switcher {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.gs-lang-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gs-lang-btn:hover {
    color: #fff;
}

.gs-lang-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-primary);
}

/* Accessibility Focus Styles */
:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ════════════════════════════
   GOLD PULSE VERIFICATION
════════════════════════════ */
@keyframes gsGoldPulseFX {
    0%   { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.7); border-color: var(--accent-primary); }
    70%  { box-shadow: 0 0 0 25px rgba(212, 175, 55, 0); border-color: #fff; }
    100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); border-color: var(--accent-primary); }
}

.gs-gold-pulse {
    animation: gsGoldPulseFX 0.8s ease-out forwards;
}

/* ════════════════════════════
   ZERO-SCROLL MOBILE (Stack Cards)
════════════════════════════ */
@media (max-width: 768px) {
    /* Convert arithmetic tables into vertical stack cards */
    table:not(.gs-ignore-stack) {
        display: block;
        width: 100%;
        overflow-x: hidden;
    }
    table:not(.gs-ignore-stack) thead {
        display: none;
    }
    table:not(.gs-ignore-stack) tbody, 
    table:not(.gs-ignore-stack) tr, 
    table:not(.gs-ignore-stack) td, 
    table:not(.gs-ignore-stack) th {
        display: block;
        width: 100%;
    }
    table:not(.gs-ignore-stack) tr {
        margin-bottom: 1.5rem;
        background: var(--glass-bg);
        border: 1px solid var(--accent-primary);
        border-radius: 12px;
        padding: 1rem;
    }
    table:not(.gs-ignore-stack) td, 
    table:not(.gs-ignore-stack) th {
        text-align: right;
        padding: 0.8rem 0;
        border-bottom: 1px dashed rgba(255,255,255,0.1);
        position: relative;
    }
    table:not(.gs-ignore-stack) td:last-child {
        border-bottom: none;
    }
    table:not(.gs-ignore-stack) td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 0.8rem;
        font-family: var(--font-heading);
        color: var(--accent-soft);
        font-size: 0.8rem;
        text-transform: uppercase;
    }

    /* --- MOBILE NAVBAR OVERRIDE (Moved to end for specificity) --- */
    .gs-nav {
        top: 10px;
        width: calc(100% - 20px);
        border-radius: 40px;
    }
    .gs-nav.scrolled {
        top: 10px;
        width: calc(100% - 20px);
    }
    .gs-nav-inner {
        height: 56px;
        padding: 0 1rem;
    }
    .gs-nav-logo {
        font-size: 1.1rem;
    }
    
    .gs-nav-hamburger {
        display: block;
        order: 3; /* Ensure it stays on the far right */
    }

    .gs-nav-links {
        display: none !important; /* Force hide unless active */
        position: absolute;
        top: 70px;
        right: 10px;
        width: calc(100vw - 40px);
        max-width: 300px;
        background: rgba(4, 1, 16, 0.98);
        backdrop-filter: blur(25px);
        border: 1px solid var(--accent-primary);
        border-radius: 24px;
        padding: 2rem;
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
        box-shadow: 0 25px 60px rgba(0,0,0,0.9);
        z-index: 1001;
    }

    .gs-nav-links.active {
        display: flex !important;
        animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    .nav-right {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 1rem;
    }
    .gs-connectivity-toast {
        bottom: 5rem; /* Above mobile nav if any */
        width: 90%;
        max-width:320px;
    }
}