/* If Then - Plasticine & Retro Pop Art Styles */

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

/* CSS Variables for the color palette */
:root {
    --plasticine-yellow: #FFD93D;
    --plasticine-pink: #FF6B9D;
    --plasticine-blue: #4ECDC4;
    --plasticine-turquoise: #45B7D1;
    --plasticine-orange: #FF8E53;
    --plasticine-purple: #A8E6CF;
    --house-brown: #8B4513;
    --text-dark: #2C3E50;
    --shadow-color: rgba(0, 0, 0, 0.3);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Oswald', sans-serif;
    background: linear-gradient(135deg, var(--plasticine-purple) 0%, var(--plasticine-blue) 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    background-attachment: fixed;
}

/* Background Image Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/fon if.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.6;
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    background: var(--plasticine-yellow);
    padding: 25px;
    border-radius: 25px;
    box-shadow: 0 10px 0 var(--plasticine-orange), 0 20px 40px rgba(0,0,0,0.2);
    border: 5px solid var(--text-dark);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 15px 15px;
    opacity: 0.3;
    pointer-events: none;
}

.title {
    font-family: 'Anton', sans-serif;
    font-size: 2.5rem;
    color: var(--text-dark);
    text-shadow: 8px 8px 0 var(--plasticine-orange);
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.subtitle {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    color: var(--text-dark);
    font-weight: 700;
    position: relative;
    z-index: 2;
}

/* Main Scene */
.main-scene {
    position: relative;
    height: 600px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, var(--plasticine-blue) 0%, var(--plasticine-turquoise) 50%, var(--plasticine-purple) 100%);
    border-radius: 35px;
    border: 8px solid var(--text-dark);
    box-shadow: 0 20px 0 var(--plasticine-purple), 0 40px 80px rgba(0,0,0,0.3);
    overflow: hidden;
    position: relative;
}

.main-scene::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
}

/* The Algorithm's House */
.house {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    filter: drop-shadow(0 15px 30px rgba(0,0,0,0.4));
    animation: houseFloat 4s ease-in-out infinite;
}

.house-image {
    width: 600px;
    height: auto;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.3));
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
}

.house-image:hover {
    transform: scale(1.02);
}

@keyframes houseFloat {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0px);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-15px);
    }
}

/* Enhanced floating animations with smooth transitions */
.house {
    animation: houseFloat 4s ease-in-out infinite;
    transition: all 0.3s ease;
}

.house:hover {
    animation-play-state: paused;
}

.algorithm {
    animation: algorithmFloat 3s ease-in-out infinite;
    transition: all 0.3s ease;
}

.algorithm:hover {
    animation-play-state: paused;
}

/* Project Information Blocks - Left and Right */
.project-info-left, .project-info-right {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 200px;
    background: var(--plasticine-yellow);
    border: 5px solid var(--text-dark);
    border-radius: 20px;
    padding: 15px;
    box-shadow: 0 10px 0 var(--plasticine-orange), 0 20px 40px rgba(0,0,0,0.3);
    z-index: 20;
    overflow: hidden;
    animation: infoFloat 6s ease-in-out infinite;
    transition: all 0.5s ease;
    opacity: 1;
    transform: translateY(-50%);
}

/* Medium screen adjustments */
@media (max-width: 1200px) {
    .project-info-left, .project-info-right {
        width: 190px;
        padding: 16px;
    }
    
    .project-info-left h3, .project-info-right h3 {
        font-size: 1.1rem;
    }
    
    .project-info-left p, .project-info-right p {
        font-size: 0.75rem;
    }
}

@media (max-width: 1000px) {
    .project-info-left, .project-info-right {
        width: 160px;
        padding: 14px;
        top: 15px;
    }
    
    .project-info-left {
        left: 15px;
    }
    
    .project-info-right {
        right: 15px;
    }
}

.project-info-left {
    left: 20px;
    animation-delay: 0s;
}

.project-info-right {
    right: 20px;
    animation-delay: 3s;
}

.project-info-left::before, .project-info-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 12px 12px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

.project-info-left h3, .project-info-right h3 {
    font-family: 'Oswald', sans-serif;
    color: var(--text-dark);
    font-size: 1.1rem;
    margin-bottom: 12px;
    text-align: center;
    position: relative;
    z-index: 2;
    text-shadow: 3px 3px 0 var(--plasticine-orange);
}

.project-info-left p, .project-info-right p {
    font-family: 'Oswald', sans-serif;
    color: var(--text-dark);
    font-size: 0.75rem;
    line-height: 1.3;
    margin-bottom: 8px;
    position: relative;
    z-index: 2;
    text-align: justify;
}

@keyframes infoFloat {
    0%, 100% {
        transform: translateY(-50%);
    }
    50% {
        transform: translateY(-52%);
    }
}

/* Smooth animation transitions */
.house, .algorithm {
    will-change: transform;
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* Animation performance optimizations */
@media (prefers-reduced-motion: reduce) {
    .house, .algorithm {
        animation: none;
    }
}

/* The Tired Algorithm */
.algorithm {
    position: absolute;
    bottom: -10%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    text-align: center;
    animation: algorithmFloat 3s ease-in-out infinite;
    /* Добавляем fallback позиционирование для надежности */
    margin-left: -90px; /* Половина ширины изображения (180px / 2) */
}

.algorithm-image {
    width: 180px;
    height: auto;
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    border-radius: 15px;
    /* Обеспечиваем правильное отображение при загрузке */
    display: block;
    max-width: 100%;
    height: auto;
}

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

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







/* On Work Section */
.on-work-section {
    margin-bottom: 30px;
    position: relative;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0) scale(1);
}

.on-work-content {
    background: linear-gradient(135deg, #2E5A88 0%, #1E3A5F 100%);
    border: 8px solid var(--text-dark);
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 15px 0 #1a365d, 0 30px 60px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

.on-work-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 15px 15px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

.on-work-title {
    font-family: 'Oswald', sans-serif;
    color: white;
    font-size: 2.2rem;
    margin-bottom: 20px;
    text-align: center;
    position: relative;
    z-index: 2;
    text-shadow: 6px 6px 0 #1a365d;
}

/* Work Image */
.work-image-container {
    text-align: center;
    margin-bottom: 25px;
    position: relative;
    z-index: 2;
}

.work-image {
    width: 300px;
    height: auto;
    border-radius: 20px;
    border: 6px solid var(--text-dark);
    box-shadow: 0 12px 0 #1a365d, 0 25px 50px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    cursor: pointer;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
    animation: workFloat 4s ease-in-out infinite;
}

.work-image:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 15px 0 #1a365d, 0 30px 60px rgba(0,0,0,0.4);
    animation-play-state: paused;
}

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

.on-work-text {
    position: relative;
    z-index: 2;
}

.on-work-text p {
    font-family: 'Oswald', sans-serif;
    color: white;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: justify;
    font-weight: 500;
}

.on-work-text p:last-child {
    margin-bottom: 0;
}

/* Control Panel */
.control-panel {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
    position: relative;
}

.control-btn {
    background: var(--plasticine-pink);
    border: 5px solid var(--text-dark);
    border-radius: 20px;
    padding: 15px 25px;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 10px 0 var(--plasticine-orange), 0 20px 40px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
}

.control-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 12px 12px;
    opacity: 0.3;
    pointer-events: none;
}

.control-btn:hover {
    background: var(--plasticine-orange);
    transform: translateY(-2px);
    box-shadow: 0 8px 0 var(--plasticine-pink);
}

.control-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 0 var(--plasticine-pink);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--plasticine-yellow);
    margin: 5% auto;
    padding: 0;
    border: 8px solid var(--text-dark);
    border-radius: 25px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 0 var(--plasticine-orange), 0 40px 80px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 15px 15px;
    opacity: 0.3;
    pointer-events: none;
    z-index: 1;
}

.modal-header {
    background: var(--plasticine-pink);
    padding: 25px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 5px solid var(--text-dark);
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.1) 1px, transparent 1px);
    background-size: 12px 12px;
    opacity: 0.3;
    pointer-events: none;
}

.modal-header h3 {
    font-family: 'Oswald', sans-serif;
    color: var(--text-dark);
    font-size: 24px;
    font-weight: 700;
}

.close-modal {
    font-family: 'Oswald', sans-serif;
    color: var(--text-dark);
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-modal:hover {
    color: var(--plasticine-orange);
    transform: scale(1.2);
}

.modal-body {
    padding: 30px;
}

.rules-container {
    position: relative;
    height: 300px;
    overflow: hidden;
}

.rule {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 25px;
    background: white;
    border-radius: 20px;
    border: 4px solid var(--text-dark);
    box-shadow: 0 10px 0 var(--plasticine-blue), 0 20px 40px rgba(0,0,0,0.2);
    overflow: hidden;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.rule.active {
    opacity: 1;
    transform: translateX(0);
}

.rule.prev {
    transform: translateX(-100%);
}

.rule::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, rgba(0,0,0,0.05) 1px, transparent 1px);
    background-size: 10px 10px;
    opacity: 0.3;
    pointer-events: none;
}

.rule h4 {
    font-family: 'Oswald', sans-serif;
    color: var(--plasticine-pink);
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 700;
}

.rule p {
    font-family: 'Oswald', sans-serif;
    color: var(--text-dark);
    margin-bottom: 10px;
    line-height: 1.5;
}

.rule code {
    background: var(--text-dark);
    color: var(--plasticine-yellow);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    display: block;
    white-space: nowrap;
    overflow-x: auto;
}

/* Rules Navigation */
.rules-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px 0;
    border-top: 3px solid var(--plasticine-blue);
}

.nav-btn {
    background: var(--plasticine-pink);
    border: 3px solid var(--text-dark);
    border-radius: 15px;
    padding: 10px 15px;
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 5px 0 var(--plasticine-orange), 0 10px 20px rgba(0,0,0,0.2);
}

.nav-btn:hover {
    background: var(--plasticine-orange);
    transform: translateY(-2px);
    box-shadow: 0 3px 0 var(--plasticine-pink);
}

.nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 0 var(--plasticine-pink);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.rule-indicators {
    display: flex;
    gap: 10px;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--plasticine-blue);
    border: 2px solid var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
}

.indicator.active {
    background: var(--plasticine-orange);
    transform: scale(1.2);
}

.indicator:hover {
    background: var(--plasticine-orange);
    transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 1.8rem;
    }
    
    .main-scene {
        height: 500px;
    }
    
    .house-image {
        width: 450px;
    }
    
    .control-panel {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 300px;
    }
    
    /* On Work section for mobile */
    .on-work-content {
        padding: 25px;
        margin: 0 15px;
        border-width: 6px;
    }
    
    .on-work-title {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    /* Work image for mobile */
    .work-image {
        width: 250px;
        border-width: 5px;
        animation: workFloat 3s ease-in-out infinite;
    }
    
    @keyframes workFloat {
        0%, 100% {
            transform: translateY(0px);
        }
        50% {
            transform: translateY(-10px);
        }
    }
    
    .work-image-container {
        margin-bottom: 20px;
    }
    
    .on-work-text p {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 12px;
    }
    
    /* Project info blocks for mobile */
    .project-info-left, .project-info-right {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        transform: none;
        width: 100%;
        margin: 15px 0;
        animation: none;
    }
    
    .project-info-left h3, .project-info-right h3 {
        font-family: 'Oswald', sans-serif;
        font-size: 1.2rem;
    }
    
    .project-info-left p, .project-info-right p {
        font-family: 'Oswald', sans-serif;
        font-size: 0.9rem;
    }
    
    /* Adjust animations for mobile */
    .house {
        animation: houseFloat 3s ease-in-out infinite;
    }
    
    .algorithm {
        animation: algorithmFloat 2.5s ease-in-out infinite;
    }
    
    @keyframes houseFloat {
        0%, 100% {
            transform: translate(-50%, -50%) translateY(0px);
        }
        50% {
            transform: translate(-50%, -50%) translateY(-10px);
        }
    }
    
    @keyframes algorithmFloat {
        0%, 100% {
            transform: translateX(-50%) translateY(0px);
        }
        50% {
            transform: translateX(-50%) translateY(-0.3px);
        }
    }
}

@media (max-width: 480px) {
    /* On Work section for very small screens */
    .on-work-content {
        padding: 20px;
        margin: 0 10px;
        border-width: 5px;
    }
    
    .on-work-title {
        font-size: 1.6rem;
        margin-bottom: 12px;
    }
    
    /* Work image for very small screens */
    .work-image {
        width: 200px;
        border-width: 4px;
        animation: workFloat 2.5s ease-in-out infinite;
    }
    
    @keyframes workFloat {
        0%, 100% {
            transform: translateY(0px);
        }
        50% {
            transform: translateY(-8px);
        }
    }
    
    .work-image-container {
        margin-bottom: 15px;
    }
    
    .on-work-text p {
        font-size: 0.9rem;
        line-height: 1.4;
        margin-bottom: 10px;
    }
    
    /* Project info blocks for very small screens */
    .project-info-left, .project-info-right {
        padding: 15px;
        margin: 10px 0;
        transform: none;
    }
    
    .project-info-left h3, .project-info-right h3 {
        font-family: 'Oswald', sans-serif;
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .project-info-left p, .project-info-right p {
        font-family: 'Oswald', sans-serif;
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
    
    /* Further reduce animations for very small screens */
    .house {
        animation: houseFloat 2.5s ease-in-out infinite;
    }
    
    .algorithm {
        animation: algorithmFloat 2s ease-in-out infinite;
    }
    
    @keyframes houseFloat {
        0%, 100% {
            transform: translate(-50%, -50%) translateY(0px);
        }
        50% {
            transform: translate(-50%, -50%) translateY(-6px);
        }
    }
    
    @keyframes algorithmFloat {
        0%, 100% {
            transform: translateX(-50%) translateY(0px);
        }
        50% {
            transform: translateX(-50%) translateY(-0.3px);
        }
    }
}








