/**
 * Caravan Custom Styles - Enhanced Version 2.0.0
 * 
 * This file combines the original custom styles with world-class enhancements
 * including animations, accessibility features, and performance optimizations.
 * 
 * @package    Caravan
 * @version    2.0.0
 * @since      2026-01-02
 */

/* =====================================================
   CSS VARIABLES & DESIGN TOKENS
   ===================================================== */
:root {
    /* Original Colors - Preserved */
    --color-primary: #1f2933;
    --color-secondary: #4b5563;
    --color-accent: #0f766e;
    --color-accent-dark: #115e59;
    --color-surface: #f9fafb;
    
    /* Additional Semantic Colors */
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;
    
    /* Typography */
    --font-sans: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
    --font-serif: Merriweather, Georgia, serif;
    
    /* Shadows - Enhanced */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   Tailwind base compatibility patch (CDN mode)
   Replaces @tailwind base + preflight
   ===================================================== */
*,
::before,
::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    background-color: #ffffff;
    color: var(--color-primary);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

/* =====================================================
   ACCESSIBILITY - Focus Styles
   ===================================================== */
/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Remove focus outline for mouse users */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* =====================================================
   Typography (formerly @layer base)
   ===================================================== */
h1,
h2,
h3,
h4 {
    font-family: var(--font-serif);
    color: var(--color-primary);
    line-height: 1.2;
}

p {
    color: var(--color-secondary);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-accent);
}

/* =====================================================
   Container (matches previous Tailwind config)
   ===================================================== */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }
}

/* =====================================================
   Sections (formerly @layer components)
   ===================================================== */
.section {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

@media (min-width: 768px) {
    .section {
        padding-top: 6rem;
        padding-bottom: 6rem;
    }
}

@media (min-width: 1024px) {
    .section {
        padding-top: 8rem;
        padding-bottom: 8rem;
    }
}

.section-muted {
    background-color: var(--color-surface);
    padding-top: 4rem;
    padding-bottom: 4rem;
}

@media (min-width: 768px) {
    .section-muted {
        padding-top: 6rem;
        padding-bottom: 6rem;
    }
}

@media (min-width: 1024px) {
    .section-muted {
        padding-top: 8rem;
        padding-bottom: 8rem;
    }
}

.section-title {
    font-size: 1.875rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

@media (min-width: 768px) {
    .section-title {
        font-size: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .section-title {
        font-size: 3rem;
    }
}

.section-lead {
    max-width: 48rem;
    font-size: 1.125rem;
    color: var(--color-secondary);
    line-height: 1.75;
}

@media (min-width: 768px) {
    .section-lead {
        font-size: 1.25rem;
    }
}

/* =====================================================
   Buttons
   ===================================================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    background-color: var(--color-accent);
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-base), 
                box-shadow var(--transition-base),
                transform var(--transition-base);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--color-accent-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

.btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.4);
}

/* =====================================================
   Utility Classes
   ===================================================== */
.shadow-soft {
    box-shadow: var(--shadow-soft);
}

.bg-surface {
    background-color: var(--color-surface);
}

.text-primary {
    color: var(--color-primary);
}

.text-secondary {
    color: var(--color-secondary);
}

.text-accent {
    color: var(--color-accent);
}

.text-accent-dark {
    color: var(--color-accent-dark);
}

/* =====================================================
   ANIMATIONS - New World-Class Features
   ===================================================== */

/* Zoom animation for hero images */
@keyframes zoom-soft {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.05);
    }
}

.animate-zoom-soft {
    animation: zoom-soft 20s ease-in-out infinite alternate;
}

/* Fade in animations */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fade-in 0.8s ease-out;
}

.animate-fade-in-delay {
    animation: fade-in 0.8s ease-out 0.2s backwards;
}

.animate-fade-in-delay-2 {
    animation: fade-in 0.8s ease-out 0.4s backwards;
}

/* Bounce animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-bounce {
    animation: bounce 2s ease-in-out infinite;
}

/* Slide in animations */
@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-left {
    animation: slide-in-left 0.6s ease-out;
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-right {
    animation: slide-in-right 0.6s ease-out;
}

/* Pulse animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* =====================================================
   RESPONSIVE IMAGES
   ===================================================== */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy loading transition */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity var(--transition-base);
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* =====================================================
   PROSE STYLING (for content areas)
   ===================================================== */
.prose {
    color: var(--color-primary);
    max-width: 65ch;
}

.prose p {
    margin-bottom: 1.25em;
}

.prose strong {
    color: var(--color-primary);
    font-weight: 600;
}

.prose a {
    color: var(--color-accent);
    text-decoration: underline;
    font-weight: 500;
}

.prose a:hover {
    color: var(--color-accent-dark);
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    color: var(--color-primary);
    font-weight: 700;
    line-height: 1.25;
    margin-top: 2em;
    margin-bottom: 1em;
}

.prose h1 { font-size: 2.25em; }
.prose h2 { font-size: 1.875em; }
.prose h3 { font-size: 1.5em; }

.prose ul,
.prose ol {
    padding-left: 1.625em;
    margin-bottom: 1.25em;
}

.prose li {
    margin-bottom: 0.5em;
}

/* =====================================================
   HOVER EFFECTS
   ===================================================== */
.hover-scale {
    transition: transform var(--transition-base);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-lift {
    transition: transform var(--transition-base), 
                box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* =====================================================
   BACKDROP EFFECTS
   ===================================================== */
.backdrop-blur-sm {
    backdrop-filter: blur(4px);
}

.backdrop-blur-md {
    backdrop-filter: blur(12px);
}

.backdrop-blur-lg {
    backdrop-filter: blur(16px);
}

/* =====================================================
   LOADING STATES
   ===================================================== */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background-color: #e2e8f0;
    background-image: linear-gradient(
        90deg,
        #e2e8f0 0px,
        #cbd5e0 40px,
        #e2e8f0 80px
    );
    background-size: 200px 100%;
    background-repeat: no-repeat;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

/* =====================================================
   GRADIENT TEXT
   ===================================================== */
.text-gradient {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* =====================================================
   SELECTION STYLING
   ===================================================== */
::selection {
    background-color: var(--color-accent);
    color: white;
}

::-moz-selection {
    background-color: var(--color-accent);
    color: white;
}

/* =====================================================
   CUSTOM SCROLLBAR (WebKit browsers)
   ===================================================== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--color-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--color-secondary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* =====================================================
   REDUCED MOTION SUPPORT
   ===================================================== */
@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;
    }
}

/* =====================================================
   HIGH CONTRAST MODE
   ===================================================== */
@media (prefers-contrast: high) {
    :root {
        --color-accent: #0000ff;
        --color-accent-dark: #000080;
    }
    
    .btn-primary {
        border: 2px solid currentColor;
    }
}

/* =====================================================
   DARK MODE SUPPORT (Future Enhancement)
   ===================================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --color-primary: #f7fafc;
        --color-secondary: #cbd5e0;
        --color-surface: #1a202c;
    }
    
    body {
        background-color: #0f1419;
        color: var(--color-primary);
    }
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    .no-print,
    header,
    footer,
    nav,
    .btn-primary {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    img {
        max-width: 100% !important;
    }
    
    @page {
        margin: 2cm;
    }
}

/* =====================================================
   PERFORMANCE OPTIMIZATIONS
   ===================================================== */
/* Use GPU acceleration for animations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Contain layout for better performance */
.contain-layout {
    contain: layout;
}

.contain-paint {
    contain: paint;
}

/* =====================================================
   NAVIGATION STYLES
   ===================================================== */

/* Desktop Navigation Links */
.nav-link {
    position: relative;
    display: inline-block;
    color: var(--color-secondary);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-base);
}

.nav-link:hover {
    color: var(--color-accent);
}

.nav-link.active {
    color: var(--color-accent);
}

/* Mobile Navigation Links */
.mobile-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--color-secondary);
    font-weight: 500;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all var(--transition-base);
}

.mobile-link:hover {
    background-color: var(--color-surface);
    color: var(--color-accent);
}

.mobile-link.active {
    background-color: rgba(15, 118, 110, 0.1);
    color: var(--color-accent);
}

/* Mobile menu slide animation */
#mobileMenu {
    transition: all 0.3s ease-in-out;
}

/* Prevent body scroll when mobile menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* =====================================================
   Safety footer
   ===================================================== */
/*
  NOTES:
  - Original styles preserved and enhanced
  - Tailwind utilities handle layout, grid, spacing
  - Do NOT recreate utilities here
  - This file is only for base + components + animations
  - All original color values maintained
  - Enhanced with CSS variables for consistency
  - Added world-class animations and accessibility features
  - Backward compatible with existing markup
  
  Version: 2.0.0
  Date: 2026-01-02
  Status: Production Ready
*/