/* ========================================
   JAIN JINVANI - BASE STYLES
   Core variables, reset, and typography
   ======================================== */

/* ===== CSS Custom Properties ===== */
:root {
    /* Golden Ratio */
    --phi: 1.618;
    --phi-inverse: 0.618;

    /* Spacing Scale (Base 4px -> 8px -> 12px...)
       Using a more consistent linear/geometric hybrid for UI
    */
    --space-2xs: 4px;
    --space-xs: 8px;
    --space-sm: 12px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    --space-4xl: 96px;

    /* Colors - Bharat (Indian) Aesthetic */
    --kumkum-red: #B22222;
    --kumkum-red-dark: #8B1A1A;
    --kumkum-red-light: #CD5C5C;
    --gold: #D4AF37;
    --gold-light: #FFD700;
    --gold-dark: #B8860B;
    --primary-saffron: #FF5722;
    --turmeric-yellow: #FFC107;
    --peacock-blue: #006B7D;
    --cream-bg: #FDF5E6;
    --deep-maroon: #5C1010;
    --lotus-pink: #E91E63;
    --warm-cream: #FFF8F0;
    --warm-white: #FFFEFA;

    /* Background Colors */
    --bg-primary: #FAFAF8;
    --bg-secondary: #FFFFFF;
    --bg-accent: #F5F3F0;
    --bg-dark: #1a1a2e;

    /* Text Colors */
    --text-title: #2D2D2D;
    --text-body: #4A4A4A;
    --text-muted: #6B6B6B;
    --text-light: #888888;
    --text-dark: #1a1a1a;

    /* Gradients */
    --gradient-sacred: linear-gradient(135deg, var(--kumkum-red-dark) 0%, var(--kumkum-red) 50%, var(--kumkum-red-light) 100%);
    --gradient-divine: linear-gradient(135deg, var(--peacock-blue) 0%, #7E3794 100%);
    --gradient-gold: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-light) 100%);

    /* Typography */
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Poppins', 'Inter', sans-serif;
    --font-devanagari: 'Noto Sans Devanagari', 'Noto Serif Devanagari', sans-serif;
    --font-serif: 'Crimson Text', Georgia, serif;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.25);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* macOS Core Animation (Physics) */
    --ease-apple: cubic-bezier(0.25, 0.1, 0.25, 1.0);
    --ease-out-apple: cubic-bezier(0.2, 0, 0, 1);
    --spring-apple: cubic-bezier(0.175, 0.885, 0.32, 1.275);

    --duration-fast: 200ms;
    --duration-normal: 350ms;
    --duration-slow: 500ms;

    /* Layout */
    --sidebar-width: 280px;
    --container-max: 1200px;
    --mobile-nav-height: 70px;

    /* Interaction (Fitts's Law) */
    --touch-target-min: 44px;

    /* Apple Liquid Glass (Vision Pro) */
    /* High blur + Saturation + Inner Glow for thickness */
    --liquid-glass-bg: rgba(255, 255, 255, 0.6);
    --liquid-glass-border: rgba(255, 255, 255, 0.4);
    --liquid-glass-blur: blur(40px) saturate(180%);
    --liquid-glass-shadow:
        0 8px 32px 0 rgba(31, 38, 135, 0.15),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2),
        /* Subtle inner border */
        inset 0 1px 0 0 rgba(255, 255, 255, 0.5);
    /* Top specular highlight */

    /* PERMANENT DARK MODE - Apply dark mode by default */
    /* Backgrounds */
    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-accent: #2D2D2D;
    --bg-dark: #000000;
    --cream-bg: #1A1A1A;

    /* Text */
    --text-title: #E0E0E0;
    --text-body: #B0B0B0;
    --text-muted: #888888;
    --text-light: #666666;
    --text-dark: #FFFFFF;

    /* Colors for dark mode */
    --deep-maroon: #FF8A80;
    --kumkum-red: #FF5252;
    --kumkum-red-dark: #FF1744;

    /* Shadows */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

    /* Border colors */
    --border-light: #333333;

    /* Liquid Glass Dark Mode */
    --liquid-glass-bg: rgba(30, 30, 30, 0.65);
    --liquid-glass-border: rgba(255, 255, 255, 0.1);
    --liquid-glass-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
}

/* ===== Dark Mode Overrides ===== */
[data-theme="dark"] {
    /* Backgrounds */
    --bg-primary: #121212;
    --bg-secondary: #1E1E1E;
    --bg-accent: #2D2D2D;
    --bg-dark: #000000;
    --cream-bg: #1A1A1A;
    /* Inverted cream */

    /* Text */
    --text-title: #E0E0E0;
    --text-body: #B0B0B0;
    --text-muted: #888888;
    --text-light: #666666;
    --text-dark: #FFFFFF;

    /* Colors */
    --deep-maroon: #FF8A80;
    /* Lighter red for dark mode contrast */
    --kumkum-red: #FF5252;
    --kumkum-red-dark: #FF1744;
    --gold: #FFD700;

    /* Shadows - more subtle/glowy */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-elevated: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

    /* Border colors */
    --border-light: #333333;

    /* Liquid Glass Dark Mode */
    --liquid-glass-bg: rgba(30, 30, 30, 0.65);
    --liquid-glass-border: rgba(255, 255, 255, 0.1);
    --liquid-glass-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 0 rgba(255, 255, 255, 0.15);
}

/* ===== Reset ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-body);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--text-title);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: var(--space-md);
}

h1 {
    font-size: clamp(2.5rem, 5vw + 1rem, 3.5rem);
    /* Extra Large */
    margin-bottom: var(--space-xl);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(2rem, 3vw + 1rem, 2.5rem);
    /* Large */
    margin-bottom: var(--space-lg);
    letter-spacing: -0.01em;
}

h3 {
    font-size: clamp(1.5rem, 2vw + 1rem, 1.75rem);
    /* Medium-Large */
    margin-bottom: var(--space-md);
}

h4 {
    font-size: clamp(1.125rem, 1.5vw + 0.5rem, 1.35rem);
    /* Medium */
    margin-bottom: var(--space-sm);
}

h5 {
    font-size: 1.1rem;
    margin-bottom: var(--space-xs);
    font-weight: 600;
}

h6 {
    font-size: 0.95rem;
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

p {
    margin-bottom: var(--space-md);
    color: var(--text-body);
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.7;
    max-width: 70ch;
}

/* Devanagari Text */
.hindi-text,
.sanskrit-text,
[lang="hi"],
[lang="sa"] {
    font-family: var(--font-devanagari);
}

.sanskrit-verse {
    font-family: 'Noto Serif Devanagari', serif;
    font-size: 1.3rem;
    color: var(--deep-maroon);
    line-height: 1.8;
    text-align: center;
    font-weight: 600;
}

.sanskrit-subtext {
    font-family: var(--font-devanagari);
    font-size: 1.5rem;
    opacity: 0.9;
    margin-bottom: var(--space-md);
}

/* ===== Links ===== */
a {
    color: var(--kumkum-red);
    text-decoration: none;
    transition: var(--transition-smooth);
}

a:hover {
    color: var(--kumkum-red-dark);
}

a:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ===== Lists ===== */
ul,
ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* ===== Images ===== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== Selection ===== */
::selection {
    background: var(--gold);
    color: var(--kumkum-red-dark);
}

/* ===== Accessibility ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--kumkum-red);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    z-index: 10000;
    font-weight: 600;
}

.skip-link:focus {
    top: 10px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Focus Styles ===== */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}