/* ========================================
   EDLJX MODERNIZATION V2.0 CSS
   Ultra-Premium Dark Mode, Bento Grid & Interaction
   ======================================== */

/* CSS Custom Properties for Modern Design */
:root {
    /* Light Mode Palette */
    --golden-orange: #f7a527;
    --terracotta: #d07d45;
    --deep-burgundy: #88263a;
    --deep-purple: #691f65;
    --soft-pink: #fdd4e4;
    --white: #fff;
    --bg-primary: #fff;
    --bg-secondary: #fdf6f9;
    --text-primary: #691f65;
    --text-secondary: rgba(105, 31, 101, 0.7);
    --border-color: rgba(105, 31, 101, 0.1);

    /* Modern gradient colors */
    --gradient-aurora-1: rgba(247, 165, 39, 0.15);
    --gradient-aurora-2: rgba(105, 31, 101, 0.12);
    --gradient-aurora-3: rgba(253, 212, 228, 0.2);
    --gradient-aurora-4: rgba(208, 125, 69, 0.1);
    --bg-gradient: linear-gradient(135deg, #fdf6f9 0%, #fff 50%, #fef7ee 100%);

    /* Glassmorphism variables */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px rgba(105, 31, 101, 0.08);
    --glass-blur: 20px;

    /* Glow variables */
    --glow-primary: 0 0 30px rgba(247, 165, 39, 0.4);
    --glow-secondary: 0 0 30px rgba(105, 31, 101, 0.3);

    /* Animation timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out-smooth: cubic-bezier(0.65, 0, 0.35, 1);
}

/* DARK MODE PALETTE (Rich Maroon) */
[data-theme="dark"] {
    --bg-primary: #2d0f15;
    --bg-secondary: #1f0a0e;
    --text-primary: #fceceb;
    --text-secondary: rgba(252, 236, 235, 0.7);
    --border-color: rgba(208, 125, 69, 0.2);
    --deep-purple: #fceceb;

    --gradient-aurora-1: rgba(136, 38, 58, 0.2);
    --gradient-aurora-2: rgba(247, 165, 39, 0.15);
    --gradient-aurora-3: rgba(105, 31, 101, 0.2);
    --gradient-aurora-4: rgba(208, 125, 69, 0.15);
    --bg-gradient: linear-gradient(135deg, #2d0f15 0%, #1a0509 100%);

    --glass-bg: rgba(45, 15, 21, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* NOISE OVERLAY */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.5'/%3E%3C/svg%3E");
}

[data-theme="dark"] .noise-overlay {
    opacity: 0.06;
}

/* Dark Mode Transitions */
body,
.glass-card,
h1,
h2,
h3,
p,
a {
    transition: background-color 0.5s ease, color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease !important;
}

/* ========================================
   CUSTOM CURSOR
   ======================================== */
.cursor-dot,
.cursor-outline {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    pointer-events: none;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background-color: var(--golden-orange);
}

.cursor-outline {
    width: 40px;
    height: 40px;
    border: 1px solid var(--golden-orange);
    transition: width 0.2s, height 0.2s, background-color 0.2s;
}

body:hover .cursor-dot {
    opacity: 1;
}

body:hover .cursor-outline {
    opacity: 1;
}

.cursor-hover {
    width: 60px;
    height: 60px;
    background-color: rgba(247, 165, 39, 0.1);
    border-color: transparent;
}

/* ========================================
   THEME TOGGLE
   ======================================== */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--glass-shadow);
}

.theme-toggle:hover {
    transform: scale(1.1);
    background: var(--bg-primary);
}

.theme-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--golden-orange);
    transition: transform 0.5s ease;
}

.theme-toggle:hover svg {
    transform: rotate(30deg);
}

/* ========================================
   BENTO GRID LAYOUT
   ======================================== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
    padding: 1rem 0;
}

@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(2, auto);
    }

    .bento-card-large {
        grid-column: span 2;
    }

    .bento-card-tall {
        grid-row: span 2;
    }
}

.bento-card {
    position: relative;
    overflow: hidden;
    padding: 2.5rem;
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    height: 100%;
}

.bento-card p {
    font-size: 1rem;
    opacity: 0.9;
    margin-top: auto;
    padding-top: 1rem;
}

.bento-decoration {
    position: absolute;
    top: -20px;
    right: -20px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.2;
    background: var(--golden-orange);
    z-index: 0;
}

.bento-content {
    position: relative;
    z-index: 2;
}

/* ========================================
   FLOATING NAVIGATION
   ======================================== */
.nav-floating {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    box-shadow:
        0 10px 20px -5px rgba(0, 0, 0, 0.1),
        var(--glass-shadow);
    transition: all 0.3s var(--ease-out-expo);
    width: auto;
    min-width: 320px;
    justify-content: space-between;
}

.nav-floating.scrolled {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem 1.5rem;
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .nav-floating.scrolled {
    background: rgba(20, 10, 20, 0.9);
}

.nav-logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo img {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
    padding: 0.25rem 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--golden-orange);
    transition: width 0.3s ease;
}

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

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

/* Move theme toggle to fit in nav or separate */
/* We will keep theme toggle separate or integrate it. 
   For this design, let's keep nav centered and toggle top-right or inside nav. 
   Inside nav is cleaner. */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* TYPING EFFECT CURSOR */
.typing-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background-color: var(--golden-orange);
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* ========================================
   V6: SPOTLIGHT EFFECT
   ======================================== */
.spotlight-card {
    position: relative;
    overflow: hidden;
    --mouse-x: 0px;
    --mouse-y: 0px;
    --spotlight-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .spotlight-card {
    --spotlight-color: rgba(255, 255, 255, 0.08);
}

.spotlight-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(800px circle at var(--mouse-x) var(--mouse-y),
            var(--spotlight-color),
            transparent 40%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 2;
}

.spotlight-card:hover::before {
    opacity: 1;
}

/* ========================================
   V6: MAGNETIC BUTTONS
   ======================================== */
.magnetic-wrap {
    display: inline-block;
    position: relative;
    z-index: 10;
}

.magnetic-area {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    z-index: -1;
    /* Debug: background: rgba(255,0,0,0.1); */
}

/* ========================================
   V6: MODERN HEADING GLOW
   ======================================== */
h2,
.hero-title,
.nav-logo span {
    transition: all 0.3s ease;
    cursor: default;
    position: relative;
    display: inline-block;
    /* Required for transform */
}

h2:hover,
.hero-title:hover,
.nav-logo span:hover {
    background: linear-gradient(90deg, var(--golden-orange), var(--terracotta), var(--deep-purple));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
    transform: scale(1.02);
}


/* ========================================
   SCROLL PROGRESS BAR
   ======================================== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--golden-orange), var(--deep-purple));
    z-index: 10001;
    /* Above nav loader */
    transition: width 0.1s linear;
    box-shadow: 0 0 10px rgba(247, 165, 39, 0.5);
}

/* ========================================
   ANIMATED AURORA BACKGROUND
   ======================================== */
.aurora-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-gradient);
    transition: background 0.5s ease;
}

.aurora-bg::before,
.aurora-bg::after {
    content: '';
    position: absolute;
    width: 120%;
    height: 120%;
    border-radius: 50%;
    filter: blur(30px);
    opacity: 0.5;
    animation: aurora-float 20s ease-in-out infinite;
    animation-play-state: running;
}

/* v2.0.1 perf: pause aurora when user is idle (no scroll/mousemove for 3s) */
body.is-idle .aurora-bg::before,
body.is-idle .aurora-bg::after {
    animation-play-state: paused;
}

/* Respect user preference */
@media (prefers-reduced-motion: reduce) {
    .aurora-bg::before,
    .aurora-bg::after {
        animation: none;
    }
}

.aurora-bg::before {
    top: -20%;
    left: -20%;
    background: radial-gradient(ellipse at center, var(--gradient-aurora-1), transparent 70%);
    animation-delay: -5s;
}

.aurora-bg::after {
    bottom: -20%;
    right: -20%;
    background: radial-gradient(ellipse at center, var(--gradient-aurora-2), transparent 70%);
    animation-delay: -10s;
}

@keyframes aurora-float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    50% {
        transform: translate(-3%, 8%) rotate(-3deg) scale(0.95);
    }
}

/* ========================================
   GLASSMORPHISM CARDS
   ======================================== */
.glass-card,
.bento-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    transition: all 0.4s var(--ease-out-expo);
    color: var(--text-primary);
}

.glass-card:hover,
.bento-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--golden-orange);
    box-shadow:
        0 20px 60px -10px rgba(247, 165, 39, 0.15),
        0 10px 30px -10px rgba(0, 0, 0, 0.1);
    transform: translateY(-8px) scale(1.01);
}

[data-theme="dark"] .glass-card:hover {
    background: rgba(255, 255, 255, 0.05);
    box-shadow:
        0 20px 60px -10px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(247, 165, 39, 0.05);
}

/* ========================================
   3D CARD TRANSFORMS
   ======================================== */
.card-3d {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.card-3d-inner {
    transition: transform 0.6s var(--ease-out-expo);
    transform-style: preserve-3d;
}

.card-3d:hover .card-3d-inner {
    transform: rotateX(5deg) rotateY(-5deg) translateZ(20px);
}

/* ========================================
   FLOATING ANIMATIONS
   ======================================== */
.float {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(2deg);
    }
}

/* ========================================
   GRADIENT TEXT
   ======================================== */
.gradient-text {
    background: linear-gradient(135deg, var(--terracotta) 0%, var(--golden-orange) 50%, var(--deep-burgundy) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* ========================================
   SCROLL REVEAL
   ======================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.4s var(--ease-out-expo), transform 0.4s var(--ease-out-expo);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-modern {
    position: relative;
    overflow: hidden;
    transition: all 0.4s var(--ease-out-expo);
    z-index: 1;
}

.btn-modern:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(247, 165, 39, 0.3);
}

/* ========================================
   LOADING ANIMATION
   ======================================== */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.loader-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0 6px;
    animation: loader-bounce 1.4s ease-in-out infinite both;
}

.loader-dot:nth-child(1) {
    background: var(--golden-orange);
    animation-delay: -0.32s;
}

.loader-dot:nth-child(2) {
    background: var(--terracotta);
    animation-delay: -0.16s;
}

.loader-dot:nth-child(3) {
    background: var(--deep-burgundy);
}

@keyframes loader-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Hide default cursor only on desktops */
@media (min-width: 1024px) {
    body {
        cursor: none;
    }
}

/* ========================================
   V6: FOOTER BLEND
   ======================================== */
:root {
    --footer-bg: #1a0b18;
}

/* Ensure footer uses the variable and connects smoothly */
.footer {
    background: var(--footer-bg) !important;
    margin-top: -2px;
    /* Prevent sub-pixel gaps */
    position: relative;
    z-index: 2;
}

/* Gradient fade from body color to wine at the top of the footer.
   Uses var(--bg-primary) so it works in both light and dark mode:
   - Dark mode: maroon (#2d0f15) -> wine (#1a0b18)
   - Light mode: white (#fdf6f9) -> wine (#1a0b18) */
.footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, var(--bg-primary) 0%, #1a0b18 100%);
    pointer-events: none;
    z-index: 1;
}

/* Nuclear light/dark mode handling - bypasses pagespeed CSS variable conflicts.
   These rules use !important and high specificity to win against the
   pagespeed-optimized CSS that sets --bg-primary via [data-theme="dark"]. */
body.dark-mode {
    background-color: #2d0f15 !important;
    background-image: none !important;
}
body.light-mode {
    background-color: #fdf6f9 !important;
    background-image: none !important;
}
body.dark-mode .aurora-bg {
    background: transparent !important;
    background-image: linear-gradient(135deg, #2d0f15 0%, #1a0509 100%) !important;
}
body.light-mode .aurora-bg {
    background: transparent !important;
    background-image: none !important;
}

/* Ensure the body has maroon and html has wine for below-footer color */
html {
    background: #1a0b18;
}

body {
    background-color: var(--bg-primary);
}

/* Hide aurora-bg's gradient so the body color shows through */
body>.aurora-bg {
    background: transparent !important;
    background-image: none !important;
}

.aurora-bg::before,
.aurora-bg::after {
    background: transparent !important;
    background-image: none !important;
}

/* Quick Links in 2 columns */
.footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem 2rem;
}


/* Ensure footer uses the variable and connects smoothly */
.footer {
    background: var(--footer-bg) !important;
    margin-top: -2px;
    /* Prevent sub-pixel gaps */
    position: relative;
    z-index: 2;
}

/* Add gradient fade to the contact section */
#contact {
    position: relative;
    /* We don't change padding here to avoid layout shifts, 
       but the gradient will sit at the bottom */
}

#contact::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 12rem;
    /* Substantial fade height */
    background: linear-gradient(to bottom, transparent 0%, var(--footer-bg) 100%);
    pointer-events: none;
    z-index: 1;
}

/* Ensure content stays clickable and visible above fading gradient */
.contact-card,
.container {
    position: relative;
    z-index: 2;
}


/* ============================================
 * v2026-06-12: Hero "Get the weekly digest" link
 * ============================================ */
.hero-newsletter-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: var(--text-secondary, #ccc);
    text-decoration: none;
    padding: .4rem .65rem;
    border-radius: 4px;
    transition: color .12s ease, background .12s ease;
    opacity: .9;
}
.hero-newsletter-link:hover,
.hero-newsletter-link:focus-visible {
    color: #ff8c42;
    background: rgba(255,255,255,.06);
    outline: 0;
}
.hero-newsletter-link svg {
    flex: 0 0 14px;
    color: currentColor;
}
