/**
 * Mood-Based Design System (v2.0)
 * 
 * Now powered by Semantic CSS Variables (Theme Tokens).
 * This allows dynamic theming without hardcoding colors.
 */

/* ========================================== */
/* Semantic Theme Tokens (The Contract)       */
/* ========================================== */

:root {
    /* Baseline Defaults (DigiSeva Green) */
    --theme-primary: #16a34a;
    /* green-600 */
    --theme-secondary: #2563eb;
    /* blue-600 */

    --theme-surface: #ffffff;
    --theme-surface-alt: #f8fafc;
    /* slate-50 */

    --theme-text: #0f172a;
    /* slate-900 */
    --theme-text-muted: #64748b;
    /* slate-500 */

    --theme-border: #e2e8f0;
    /* slate-200 */

    --theme-success: #16a34a;
    --theme-danger: #dc2626;
}

/* Utility Class Mappings (The API) */
/* Usage: class="bg-theme-primary" instead of "bg-brand-primary" */

.bg-theme-primary {
    background-color: var(--theme-primary);
}

.text-theme-primary {
    color: var(--theme-primary);
}

.border-theme-primary {
    border-color: var(--theme-primary);
}

.bg-theme-surface {
    background-color: var(--theme-surface);
}

.bg-theme-surface-alt {
    background-color: var(--theme-surface-alt);
}

.text-theme-text {
    color: var(--theme-text);
}

.text-theme-muted {
    color: var(--theme-text-muted);
}

.border-theme-border {
    border-color: var(--theme-border);
}

/* Legacy Motion Settings */

/* ========================================== */
/* Surface Card Utility                       */
/* ========================================== */

.surface-card {
    /* Base styles (Corporate Mood - Default) */
    background-color: white;
    border: 1px solid rgb(229 231 235);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    border-radius: 1rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Vibrant Mood - Glassmorphism */
[data-mood="vibrant"] .surface-card {
    background-color: rgb(255 255 255 / 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgb(255 255 255 / 0.5);
    box-shadow: 0 10px 40px -10px rgb(0 0 0 / 0.15);
}

/* Minimal Mood - Ultra Clean */
[data-mood="minimal"] .surface-card {
    background-color: transparent;
    border: none;
    border-bottom: 1px solid rgb(229 231 235);
    box-shadow: none;
    border-radius: 0;
}

/* ========================================== */
/* Mood-Based Typography & Button Styles      */
/* ========================================== */

/* Corporate: Sharp, Professional */
[data-mood="corporate"] h1,
[data-mood="corporate"] h2 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

[data-mood="corporate"] .rounded-full {
    border-radius: 0.5rem;
}

/* Vibrant: Rounded, Playful */
[data-mood="vibrant"] h1,
[data-mood="vibrant"] h2 {
    font-weight: 800;
    letter-spacing: -0.03em;
}

[data-mood="vibrant"] .rounded-full {
    border-radius: 9999px;
}

/* Add gradient text effect for vibrant mood */
[data-mood="vibrant"] h1 {
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Minimal: Light, Airy */
[data-mood="minimal"] h1,
[data-mood="minimal"] h2 {
    font-weight: 300;
    letter-spacing: 0.05em;
}

[data-mood="minimal"] .rounded-full {
    border-radius: 0.25rem;
}

/* Organic: Natural, Warm */
[data-mood="organic"] {
    background-color: #fefaf0;
    /* Creamy background */
}

[data-mood="organic"] h1,
[data-mood="organic"] h2 {
    font-weight: 600;
    font-family: serif;
    /* Use a serif font for organic feel if possible */
    color: #166534;
    /* Soft forest green */
}

[data-mood="organic"] .surface-card {
    background-color: #ffffff;
    border: 2px solid #ecfccb;
    /* Soft lime border */
    border-radius: 1.5rem;
    box-shadow: 0 4px 20px -5px rgb(22 101 52 / 0.1);
}

[data-mood="organic"] .rounded-full {
    border-radius: 1rem;
    /* Softer, but not quite pill-shaped */
}

/* ========================================== */
/* Surface Card Variants                      */
/* ========================================== */

/* Elevated Surface (for CTAs, Sidebars) */
.surface-elevated {
    background-color: white;
    border: 1px solid rgb(229 231 235);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    border-radius: 1rem;
}

[data-mood="vibrant"] .surface-elevated {
    background-color: rgb(255 255 255 / 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgb(255 255 255 / 0.6);
    box-shadow: 0 20px 50px -12px rgb(0 0 0 / 0.25);
}

[data-mood="minimal"] .surface-elevated {
    background-color: rgb(249 250 251);
    border: 1px solid rgb(229 231 235);
    box-shadow: none;
    border-radius: 0.5rem;
}

/* ========================================== */
/* Motion Utilities                           */
/* ========================================== */

/* Safe Hover Effects - Single Axis Only (Shadow OR Transform, not both) */
.hover-lift {
    transition: transform 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

/* Disable motion for reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .hover-lift:hover {
        transform: none;
    }

    .surface-card,
    .surface-elevated {
        transition: none;
    }
}

/* Disable motion via data attribute */
[data-motion-safe="false"] .hover-lift:hover {
    transform: none;
}

/* ========================================== */
/* Shimmer Effect (Hover-Only, Non-Looping)   */
/* ========================================== */

.shimmer-button {
    position: relative;
    overflow: hidden;
}

.shimmer-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgb(255 255 255 / 0.2),
            transparent);
    transition: left 0.5s ease;
}

.shimmer-button:hover::before {
    left: 100%;
}

/* Disable shimmer for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .shimmer-button::before {
        display: none;
    }
}

[data-motion-safe="false"] .shimmer-button::before {
    display: none;
}

/* ========================================== */
/* Button States (Tactile Feedback)           */
/* ========================================== */

.btn-tactile {
    transition: transform 0.1s ease;
}

.btn-tactile:hover {
    transform: scale(1.02);
}

.btn-tactile:active {
    transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {

    .btn-tactile:hover,
    .btn-tactile:active {
        transform: none;
    }
}

/* ========================================== */
/* Semantic Markdown Callouts                 */
/* ========================================== */

.callout {
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    margin: 1.5rem 0;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.callout-icon {
    flex-shrink: 0;
    font-size: 1.25rem;
}

.callout-content {
    flex: 1;
}

.callout-note {
    background-color: rgb(239 246 255);
    border-left: 4px solid rgb(59 130 246);
}

.callout-warning {
    background-color: rgb(254 252 232);
    border-left: 4px solid rgb(234 179 8);
}

.callout-tip {
    background-color: rgb(240 253 244);
    border-left: 4px solid rgb(34 197 94);
}

.callout-caution {
    background-color: rgb(254 242 242);
    border-left: 4px solid rgb(239 68 68);
}

/* ========================================== */
/* Mobile Carousel for Feature Grid           */
/* ========================================== */

@media (max-width: 767px) {
    .feature-carousel {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 1rem;
        gap: 1rem;
    }

    .feature-carousel::-webkit-scrollbar {
        display: none;
    }

    .feature-carousel-item {
        flex-shrink: 0;
        width: 85vw;
        scroll-snap-align: center;
    }
}

@media (min-width: 768px) {
    .feature-carousel {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        overflow: visible;
    }

    .feature-carousel-item {
        width: auto;
    }
}

/* --- HYDRATION & SKELETON STATES --- */

/* Premium shimmer animation (Instagram/LinkedIn style) */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes skeleton-pulse {
    0% {
        background-color: rgba(0, 0, 0, 0.05);
    }

    50% {
        background-color: rgba(0, 0, 0, 0.1);
    }

    100% {
        background-color: rgba(0, 0, 0, 0.05);
    }
}

/* --- Base Skeleton Primitives --- */

.skeleton-text {
    height: 0.8em;
    margin: 0.3em 0;
    border-radius: 4px;
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.06) 25%,
            rgba(0, 0, 0, 0.10) 50%,
            rgba(0, 0, 0, 0.06) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-box {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.06) 25%,
            rgba(0, 0, 0, 0.10) 50%,
            rgba(0, 0, 0, 0.06) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-circle {
    border-radius: 50%;
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.06) 25%,
            rgba(0, 0, 0, 0.10) 50%,
            rgba(0, 0, 0, 0.06) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* While hydrating, any element with .skeleton-on-load will pulse */
body.is-hydrating .skeleton-on-load {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}

body.is-hydrating .skeleton-on-load img,
body.is-hydrating .skeleton-on-load svg {
    opacity: 0 !important;
}

/* --- Product Card Skeleton (Alpine.js pre-hydration) --- */

.skeleton-product-card {
    background: white;
    border-radius: 0.75rem;
    border: 1px solid rgb(241 245 249);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}

.skeleton-product-card .skeleton-img {
    aspect-ratio: 1 / 1;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(90deg,
            rgb(241 245 249) 25%,
            rgb(226 232 240) 50%,
            rgb(241 245 249) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-product-card .skeleton-title {
    height: 0.875rem;
    width: 80%;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    background: linear-gradient(90deg,
            rgb(241 245 249) 25%,
            rgb(226 232 240) 50%,
            rgb(241 245 249) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-product-card .skeleton-category {
    height: 0.625rem;
    width: 40%;
    border-radius: 3px;
    margin-bottom: 0.5rem;
    background: linear-gradient(90deg,
            rgb(241 245 249) 25%,
            rgb(226 232 240) 50%,
            rgb(241 245 249) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    animation-delay: 0.1s;
}

.skeleton-product-card .skeleton-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.skeleton-product-card .skeleton-price {
    height: 0.875rem;
    width: 3rem;
    border-radius: 4px;
    background: linear-gradient(90deg,
            rgb(241 245 249) 25%,
            rgb(226 232 240) 50%,
            rgb(241 245 249) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    animation-delay: 0.2s;
}

.skeleton-product-card .skeleton-btn {
    height: 1.75rem;
    width: 3rem;
    border-radius: 0.5rem;
    background: linear-gradient(90deg,
            rgb(241 245 249) 25%,
            rgb(226 232 240) 50%,
            rgb(241 245 249) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    animation-delay: 0.3s;
}

/* --- Hero Section Skeleton --- */

.skeleton-hero {
    width: 100%;
    aspect-ratio: 21 / 9;
    border-radius: 0;
    background: linear-gradient(90deg,
            rgb(241 245 249) 25%,
            rgb(226 232 240) 50%,
            rgb(241 245 249) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.skeleton-hero .skeleton-hero-text {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skeleton-hero .skeleton-hero-text .skeleton-h2 {
    height: 2rem;
    width: 16rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.3);
}

.skeleton-hero .skeleton-hero-text .skeleton-p {
    height: 1rem;
    width: 10rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
}

@media (min-width: 640px) {
    .skeleton-hero {
        aspect-ratio: 21 / 7;
    }
}

@media (min-width: 1024px) {
    .skeleton-hero {
        aspect-ratio: 21 / 6;
    }
}

/* --- Image Lazy-Load Fade-In Transition --- */

img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.4s ease-in;
}

img[loading="lazy"].loaded,
img[loading="lazy"]:not([data-src]) {
    opacity: 1;
}

/* Immediately show eager images */
img[loading="eager"],
img:not([loading]) {
    opacity: 1;
}

/* --- Mood Compatibility --- */

body[data-mood="minimal"] .skeleton-text,
body[data-mood="minimal"] .skeleton-box,
body[data-mood="minimal"] .skeleton-product-card .skeleton-img {
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0.02) 25%,
            rgba(0, 0, 0, 0.05) 50%,
            rgba(0, 0, 0, 0.02) 75%);
    background-size: 200% 100%;
}

body[data-mood="corporate"] .skeleton-text,
body[data-mood="corporate"] .skeleton-box {
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {

    .skeleton-text,
    .skeleton-box,
    .skeleton-circle,
    .skeleton-product-card .skeleton-img,
    .skeleton-product-card .skeleton-title,
    .skeleton-product-card .skeleton-category,
    .skeleton-product-card .skeleton-price,
    .skeleton-product-card .skeleton-btn,
    .skeleton-hero {
        animation: none;
        background: rgba(0, 0, 0, 0.06);
    }

    img[loading="lazy"] {
        opacity: 1;
        transition: none;
    }
}

/* --- SHELL THEMES (Navbar & Footer) --- */

/* Navbar Styles */
.nav-light {
    background-color: rgba(255, 255, 255, 0.8) !important;
    color: #1f2937 !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-dark {
    background-color: #1f2937 !important;
    color: #ffffff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.nav-accent {
    background-color: var(--theme-primary) !important;
    color: var(--theme-primary-content, #ffffff) !important;
    border-bottom: none !important;
}

.nav-dark nav,
.nav-accent nav,
.nav-dark [data-bind="businessName"],
.nav-accent [data-bind="businessName"],
.nav-dark .text-brand-primary,
.nav-accent .text-brand-primary,
.nav-dark .text-brand-secondary,
.nav-accent .text-brand-secondary {
    color: inherit !important;
}

.nav-dark a,
.nav-accent a,
.nav-dark .text-brand-secondary,
.nav-accent .text-brand-secondary {
    opacity: 0.85;
}

.nav-dark a,
.nav-accent a {
    color: inherit !important;
}

.nav-dark a:hover,
.nav-accent a:hover {
    opacity: 1;
    color: inherit !important;
}

/* Language Switcher Contrast Fix */
.nav-dark [aria-label="Select language"],
.nav-accent [aria-label="Select language"] {
    color: currentColor !important;
    border-color: currentColor !important;
    opacity: 0.8;
}

.nav-dark [aria-label="Select language"] svg,
.nav-accent [aria-label="Select language"] svg {
    color: currentColor !important;
}

.nav-dark [aria-label="Select language"]:hover,
.nav-accent [aria-label="Select language"]:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    opacity: 1;
}

/* Footer Styles */
.footer-light {
    background-color: #f1f5f9 !important;
    /* Soft Slate 100 for better separation from white content */
    color: #1f2937 !important;
    border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.footer-dark {
    background-color: #111827 !important;
    color: #ffffff !important;
}

.footer-dark h2,
.footer-dark [data-bind="businessName"] {
    color: #ffffff !important;
}

.footer-accent {
    background-color: var(--theme-primary) !important;
    color: var(--theme-primary-content, #ffffff) !important;
}

.footer-accent h2,
.footer-accent [data-bind="businessName"] {
    color: inherit !important;
}

.footer-light .text-white\/70 {
    color: #6b7280 !important;
}

.footer-light .text-white\/80 {
    color: #374151 !important;
}

.footer-light .text-white {
    color: #111827 !important;
}

.footer-light .border-white\/30 {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

.footer-light .border-white\/10 {
    border-color: rgba(0, 0, 0, 0.05) !important;
}

.footer-accent .text-brand-accent,
.footer-accent a:hover {
    color: inherit !important;
    opacity: 0.9;
    text-decoration: underline;
}

.footer-accent .text-white\/60,
.footer-accent .text-white\/70,
.footer-accent .text-white\/80,
.footer-accent .text-white {
    color: inherit !important;
}

.footer-accent .border-white\/30,
.footer-accent .border-white\/10 {
    border-color: currentColor !important;
    opacity: 0.2;
}

/* Light yellow for accent contrast */