/* === styles.css (Final Version - Updated with SVG Toggle Button) === */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    background-color: #f4f4f4;
    color: #333;
    font-size: 16px;
}

header {
    background: #333;
    color: white;
    padding: 0.8rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0;
    flex-grow: 1;
}

.about-button {
    display: inline-block;
    padding: 6px 14px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #eee;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.about-button:hover,
.about-button:focus {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    outline: none;
}

.content {
    background: white;
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 2rem 2.5rem;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.content.visible {
    opacity: 1;
    transform: translateY(0);
}

.text-content {
    flex: 1 1 300px;
    min-width: 0;
}

.text-content h2 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    color: #222;
    line-height: 1.3;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
}

.text-content p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.text-content p:last-child {
    margin-bottom: 0;
}

.image-container {
    flex: 0 1 300px;
}

.image-container.left {
    order: -1;
}

.side-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
}

#section5 {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

#section5 .text-content {
    flex-basis: auto;
    flex-grow: 0;
    width: 100%;
    max-width: 650px;
    text-align: center;
}

#section5 .download-container {
    width: 100%;
    text-align: center;
}

.download-button {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #ff7b00, #ff3d00);
    border: none;
    border-radius: 8px;
    text-decoration: none;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    text-align: center;
}

.download-button:hover,
.download-button:focus {
    background: linear-gradient(135deg, #ff3d00, #c70000);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.download-button:focus-visible {
     box-shadow: 0 0 0 3px rgba(255, 100, 0, 0.5);
}

/* --- Стили для переключателя и аватара на странице "О проекте" --- */
.avatar-toggle-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    position: relative;
    top: -0.1em;
    width: 22px;
    height: 22px;
    cursor: pointer;
    border-radius: 50%;
    background-color: #f0f0f0;
    border: 1px solid #dcdcdc;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.avatar-toggle-container:hover {
    background-color: #e6e6e6;
    border-color: #c8c8c8;
}

.avatar-toggle-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.avatar-toggle-label {
   display: flex;
   align-items: center;
   justify-content: center;
   width: 100%;
   height: 100%;
   padding: 0;
   border: none;
   background-color: transparent;
   cursor: pointer;
   color: #888;
   transition: color 0.2s ease;
   user-select: none; /* Добавлено для предотвращения выделения */
   line-height: 1; /* Добавлено для консистентности */
}

.avatar-toggle-label svg.toggle-icon {
    width: 12px;
    height: 12px;
    display: block;
    fill: currentColor;
}

.avatar-toggle-checkbox:checked ~ .avatar-toggle-label { /* Изменено на ~ для гибкости, если изменятся дочерние элементы */
    color: #555;
}
/* Можно добавить стили для checked состояния контейнера, если нужно */
/* .avatar-toggle-checkbox:checked + .avatar-toggle-container {
    background-color: #d5e8ff;
    border-color: #a0c7f0;
} */

.avatar-image-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    max-width: 180px;
    opacity: 0;
    transform: translate(30px, 30px) scale(0.8);
    transition: opacity 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
    z-index: 999;
    pointer-events: none;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.about-avatar-image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: inherit;
}

.avatar-image-container.visible {
    opacity: 1;
    transform: translate(0, 0) scale(1);
    pointer-events: auto;
}

.content#about-content {
    position: static;
}


/* --- Mobile Optimization (Tablet and below) --- */
@media (max-width: 768px) {
    body {
        font-size: 15px;
    }

    header {
        padding: 0.7rem 1rem;
    }
    header h1 {
        font-size: 1.4rem;
    }
    .about-button {
        padding: 5px 10px;
        font-size: 0.85rem;
    }

    .content {
        flex-direction: column;
        padding: 1.5rem 1rem;
        gap: 1.5rem;
        margin: 1rem auto;
    }

    .text-content,
    .image-container {
        flex-basis: auto;
        width: 100%;
        max-width: 100%;
        flex-grow: 0;
        flex-shrink: 1;
    }

    .image-container.left {
        order: 0;
    }

    .image-container {
        max-width: 350px;
        margin-left: auto;
        margin-right: auto;
    }

    .text-content h2 {
        font-size: 1.4rem;
    }

    .text-content p {
        font-size: 0.95rem;
    }

    #section5 {
        gap: 1rem;
    }

     #section5 .text-content {
         max-width: 100%;
     }

    .download-button {
        padding: 0.6rem 1.25rem;
        font-size: 0.95rem;
    }

    /* Mobile Avatar Styles */
    .avatar-image-container {
        position: static;
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transform: none;
        margin: 2rem auto 1rem auto;
        max-width: 160px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        transition: opacity 0.5s ease-out, max-height 0.6s ease-out, margin-top 0.6s ease-out;
        pointer-events: none;
    }

    .avatar-image-container.visible {
        opacity: 1;
        max-height: 400px;
        pointer-events: auto;
        margin-top: 2rem;
    }

    /* Mobile Toggle Button Styles */
     .avatar-toggle-container {
        width: 20px;
        height: 20px;
        top: -0.05em;
    }
    .avatar-toggle-label svg.toggle-icon {
        width: 10px;
        height: 10px;
    }
}

/* --- Mobile Optimization (Small Phones) --- */
@media (max-width: 480px) {
    body {
        font-size: 14px;
        line-height: 1.55;
    }

    header {
        padding: 0.6rem 0.8rem;
        gap: 0.5rem;
    }
    header h1 {
        font-size: 1.2rem;
    }
     .about-button {
        padding: 4px 8px;
        font-size: 0.8rem;
    }

    .content {
        padding: 1rem 0.8rem;
        margin: 0.8rem auto;
        gap: 1rem;
    }

     .image-container {
        max-width: 95%;
    }

    .text-content h2 {
        font-size: 1.25rem;
    }

     .text-content p {
        font-size: 0.9rem;
    }

    .download-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        width: auto;
        max-width: 90%;
    }

    /* Further mobile adjustments for avatar */
    .avatar-image-container {
        max-width: 140px;
        margin-top: 1.5rem;
    }
     .avatar-image-container.visible {
         margin-top: 1.5rem;
     }
}