/* Custom CSS for Alyx Babysitter Portfolio */

/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
    --bg-primary: #000000;
    --bg-secondary: rgba(0, 0, 0, 0.4);
    --bg-card: rgba(0, 0, 0, 0.4);
    --border-primary: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.7);
    --accent-primary: #9ca3af;
    --accent-primary-hover: #6b7280;
    --accent-silver: #c0c0c0;
    --accent-dark-silver: #808080;
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    cursor: none !important;
}

/* Custom cursor styles */
.cursor-trail {
    position: fixed;
    top: -5px;
    left: -5px;
    width: 10px;
    height: 10px;
    background-color: white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    will-change: transform;
}

body.cursor-hover-active .cursor-trail:first-child {
    transform-origin: center;
    transform: scale(3) !important;
    background-color: #ec4899;
}

/* Interactive elements should show pointer cursor */
button, a, summary, [onclick], .cursor-pointer {
    cursor: pointer !important;
}

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

@keyframes fadeInFast {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

.animate-fade-in-fast {
    animation: fadeInFast 0.3s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.5s ease-out;
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Button transitions */
button {
    transition: all 0.2s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

/* Image hover effects */
.group:hover .group-hover\:scale-105 {
    transform: scale(1.05);
}

/* Video styling */
video {
    object-fit: cover;
}

video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

/* Form styles */
input, textarea {
    background: rgba(39, 39, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    transition: border-color 0.2s ease;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-silver);
}

input::placeholder, textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Details/Summary styling */
details summary {
    list-style: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s ease;
}

details summary::-webkit-details-marker {
    display: none;
}

details summary::before {
    content: "▶";
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
    color: var(--accent-silver);
}

details[open] summary::before {
    transform: rotate(90deg);
}

details summary:hover {
    color: var(--text-primary);
}

/* Navigation active states */
.nav-link {
    transition: all 0.2s ease;
    position: relative;
}

.nav-link.active::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--accent-silver);
    border-radius: 1px;
}

/* Mobile menu animation */
#mobile-menu {
    transition: all 0.3s ease;
}

#mobile-menu.hidden {
    opacity: 0;
    transform: translateY(-10px);
}

/* Backdrop blur support */
@supports (backdrop-filter: blur(12px)) {
    .backdrop-blur-sm {
        backdrop-filter: blur(12px);
    }
    
    .backdrop-blur-md {
        backdrop-filter: blur(16px);
    }
}

/* Grid animations */
.grid > * {
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
}

.grid > *:nth-child(1) { animation-delay: 0.1s; }
.grid > *:nth-child(2) { animation-delay: 0.2s; }
.grid > *:nth-child(3) { animation-delay: 0.3s; }
.grid > *:nth-child(4) { animation-delay: 0.4s; }
.grid > *:nth-child(5) { animation-delay: 0.5s; }
.grid > *:nth-child(6) { animation-delay: 0.6s; }

/* Modal animations */
.modal-enter {
    animation: fadeInFast 0.3s ease-out;
}

.modal-content-enter {
    animation: slideIn 0.4s ease-out;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Text shadows for better readability */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.text-shadow-sm {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Responsive design helpers */
@media (max-width: 640px) {
    .cursor-trail {
        display: none; /* Hide custom cursor on mobile */
    }
    
    body {
        cursor: auto !important;
    }
    
    button, a, summary, [onclick], .cursor-pointer {
        cursor: pointer !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-primary: rgba(255, 255, 255, 0.3);
        --text-secondary: rgba(255, 255, 255, 0.9);
        --text-muted: rgba(255, 255, 255, 0.8);
    }
}

/* 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;
    }
    
    .cursor-trail {
        transition: none !important;
    }
}



/* Background videos full screen coverage */
#background-video video {
    /* Обеспечиваем полное покрытие экрана */
    width: 100vw;
    height: 100vh;
    min-width: 100vw;
    min-height: 100vh;
    object-fit: cover;
}

/* Print styles */
@media print {
    .cursor-trail,
    #background-video,
    nav,
    button,
    .modal {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .page {
        display: block !important;
    }
}

/* Focus styles for accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Selection styles */
::selection {
    background-color: var(--accent-blue);
    color: white;
}

::-moz-selection {
    background-color: var(--accent-blue);
    color: white;
}

/* Telegram Web App specific styles */
.telegram-web-app {
    /* Убираем лишние отступы для Telegram */
    padding-top: 0 !important;
}

.telegram-web-app .cursor-trail {
    /* Отключаем кастомный курсор в Telegram */
    display: none !important;
}

.telegram-web-app body {
    cursor: auto !important;
}

.telegram-web-app #background-video {
    /* Уменьшаем высоту видео в Telegram для экономии трафика */
    opacity: 0.3;
}

/* Telegram theme variables */
:root {
    --tg-theme-bg-color: #000000;
    --tg-theme-text-color: #ffffff;
    --tg-theme-hint-color: #708499;
    --tg-theme-link-color: #6ab7ff;
    --tg-theme-button-color: #5288c1;
    --tg-theme-button-text-color: #ffffff;
}

/* Utility classes */
.font-inter {
    font-family: 'Inter', sans-serif;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-portrait {
    aspect-ratio: 3 / 4;
}

/* Component-specific styles */
.portfolio-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.service-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-primary);
    transition: all 0.3s ease;
}

.service-card:hover {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.faq-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-primary);
    transition: all 0.2s ease;
}

.faq-item:hover {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Button variants */
.btn-primary {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(156, 163, 175, 0.3);
}

.btn-secondary {
    background: rgba(107, 114, 128, 0.8);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(75, 85, 99, 0.9);
    transform: translateY(-1px);
}

/* Error and success states */
.error {
    color: #ef4444;
}

.success {
    color: #10b981;
}

.warning {
    color: #f59e0b;
}

/* Loading spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Progressive image loading */
.progressive-image {
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.progressive-image.loading {
    opacity: 0.7;
    filter: blur(5px);
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

.progressive-image.loaded {
    opacity: 1;
    filter: none;
}

.progressive-image.error {
    opacity: 0.5;
    filter: grayscale(1);
}

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

/* Video loading states */
video.loading {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
    animation: loading-shimmer 1.5s infinite;
}

video.loaded {
    background: none;
}

/* Video cover specific styles */
.portfolio-item video {
    background-color: #1f2937;
    object-fit: cover;
    width: 100%;
    height: 100%;
    opacity: 0.9;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 12px;
}

.portfolio-item video:hover {
    opacity: 1;
}

.portfolio-item:hover video {
    transform: scale(1.05);
}

/* Убираем любые возможные рамки с изображений */
.portfolio-item img {
    border: none !important;
    outline: none !important;
    border-radius: 12px;
}

/* Fallback for failed video loads */
.video-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-fallback.show {
    opacity: 1;
}

/* Performance optimizations */
.portfolio-item {
    contain: layout style paint;
    will-change: transform;
}

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

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .progressive-image,
    video,
    .portfolio-item {
        transition: none !important;
        animation: none !important;
    }
    
    .loading-shimmer {
        animation: none !important;
    }
}

/* Connection-based optimizations */
@media (max-width: 768px) {
    .cursor-trail {
        display: none; /* Hide custom cursor on mobile to save resources */
    }
    
    .portfolio-item {
        will-change: auto; /* Reduce GPU usage on mobile */
    }
}