/* Custom CSS for Diarynole Website */

/* CSS Variables for consistent theming */
:root {
    --primary-50: #f0f9ff;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-900: #1e3a8a;
    
    --secondary-500: #6366f1;
    --secondary-600: #4f46e5;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-900: #111827;
    
    --transition-default: all 0.3s ease;
    --shadow-default: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Base styles */
* {
    scroll-behavior: smooth;
}

body {
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Navigation styles */
.nav-link {
    @apply text-gray-700 hover:text-primary-600 transition-colors font-medium relative;
    padding: 0.5rem 0;
}

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

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

.nav-link.active {
    @apply text-primary-600;
}

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

/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Animation classes */
.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.6s ease-out;
}

.animate-pulse-slow {
    animation: pulse 2s infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Scroll animations */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: var(--transition-default);
}

.scroll-animate.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* Button styles */
.btn-primary {
    @apply bg-primary-600 hover:bg-primary-700 text-white font-semibold px-6 py-3 rounded-lg transition-colors transform hover:scale-105;
    box-shadow: var(--shadow-default);
}

.btn-secondary {
    @apply bg-secondary-600 hover:bg-secondary-700 text-white font-semibold px-6 py-3 rounded-lg transition-colors;
}

.btn-outline {
    @apply border-2 border-primary-600 text-primary-600 hover:bg-primary-600 hover:text-white font-semibold px-6 py-3 rounded-lg transition-colors;
}

/* Card styles */
.card {
    @apply bg-white rounded-lg shadow-lg overflow-hidden transition-shadow hover:shadow-xl;
}

.card-hover {
    @apply transform hover:scale-105 transition-transform;
}

/* Form styles */
.form-input {
    @apply w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 transition-colors;
}

.form-input:focus {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.form-error {
    @apply border-red-500 bg-red-50;
}

.form-error:focus {
    @apply ring-red-500 border-red-500;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

/* Three.js canvas styles */
#three-canvas {
    pointer-events: auto;
    cursor: grab;
}

#three-canvas:active {
    cursor: grabbing;
}

#fallback-bg {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--secondary-500) 50%, var(--primary-700) 100%);
}

/* Animation toggle button */
#animation-toggle {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#animation-toggle:hover {
    background: rgba(255, 255, 255, 1);
}

/* Loading states */
.loading {
    @apply animate-pulse;
}

.loading-spinner {
    @apply animate-spin;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-fade-in,
    .animate-slide-up,
    .animate-pulse-slow,
    .animate-float {
        animation: none;
    }
    
    .scroll-animate {
        opacity: 1;
        transform: none;
    }
}

/* Focus styles for better accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-link {
    @apply sr-only focus:not-sr-only focus:absolute focus:top-4 focus:left-4 bg-primary-600 text-white px-4 py-2 rounded-lg z-50;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    a {
        text-decoration: underline !important;
    }
    
    .bg-primary-600,
    .bg-secondary-600 {
        background: #000 !important;
        color: #fff !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nav-link {
        border-bottom: 1px solid transparent;
    }
    
    .nav-link:hover,
    .nav-link:focus {
        border-bottom-color: currentColor;
    }
    
    .card {
        border: 2px solid #000;
    }
}

/* Dark mode preferences (basic support) */
@media (prefers-color-scheme: dark) {
    /* This would be expanded for full dark mode support */
    ::selection {
        background: rgba(59, 130, 246, 0.3);
    }
}

/* Responsive design utilities */
@media (max-width: 640px) {
    .text-responsive-sm {
        font-size: 0.875rem;
        line-height: 1.25rem;
    }
    
    .px-responsive {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .py-responsive {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

@media (min-width: 768px) {
    .px-responsive {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    .py-responsive {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-500);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-600);
}

/* Selection styles */
::selection {
    background: rgba(59, 130, 246, 0.2);
    color: inherit;
}

::-moz-selection {
    background: rgba(59, 130, 246, 0.2);
    color: inherit;
}

/* Performance optimizations */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Image optimizations */
img {
    max-width: 100%;
    height: auto;
}

.lazy-load {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-load.loaded {
    opacity: 1;
}

/* Typography enhancements */
.text-balance {
    text-wrap: balance;
}

.text-pretty {
    text-wrap: pretty;
}

/* Container queries support (future-proofing) */
@container (min-width: 768px) {
    .container-md\:text-lg {
        font-size: 1.125rem;
        line-height: 1.75rem;
    }
}

/* Utility classes for common patterns */
.content-grid {
    display: grid;
    grid-template-columns: 1fr min(65ch, 100%) 1fr;
}

.content-grid > * {
    grid-column: 2;
}

.full-width {
    grid-column: 1 / -1;
}

/* Micro-interactions */
.hover-lift {
    transition: transform 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-2px);
}

.hover-glow {
    transition: box-shadow 0.2s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Error states */
.error-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Success states */
.success-bounce {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}
