/* =====================
   Общие стили
===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Montserrat", sans-serif;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    color: var(--text);
    transition: background 0.3s ease, color 0.3s ease;
}

/* Цветовые переменные */
:root {
    --bg: #ffffff;
    --text: #111111;
    --primary: #111111;
    --secondary: #f5f5f5;
    --accent: linear-gradient(45deg, #f77737, #e1306c, #c13584, #5851db);
}

body.dark {
    --bg: #0e0e0e;
    --text: #f8f8f8;
    --primary: #f8f8f8;
    --secondary: #1e1e1e;
}

/* =====================
   Прелоадер
===================== */
#preloader {
    position: fixed;
    background: var(--bg);
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loader {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 6px solid transparent;
    border-top: 6px solid #f77737;
    border-right: 6px solid #e1306c;
    border-bottom: 6px solid #c13584;
    border-left: 6px solid #5851db;
    animation: spin 1.2s linear infinite;
}

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

/* =====================
   Хедер
===================== */
header {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    background: var(--bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    z-index: 99;
}

.logo {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text);
}

.logo span {
    background: var(--accent);
    -webkit-background-clip: text;
    color: transparent;
}

h2 {
    font-size: 2.2rem;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 30px;
}

nav ul li a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 18px;
    transition: color 0.2s ease;
}

nav ul li a:hover {
    color: #e1306c;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-toggle {
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    user-select: none;
}

.lang {
    /*font-weight: 600;*/
    padding: 5px 10px;
    color: var(--btn-color, #333);
    background: var(--btn-bg, #f1f1f1);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.lang.active {
    color: var(--btn-bg, #f1f1f1);
    font-weight: 800;
    background: #009ce6;
    /*background: #e1306c;*/
}

.lang:hover {
    transform: scale(1.05);
}

body.dark .lang-toggle {
    --btn-bg: #2a2a2a;
    --btn-color: #fff;
    --btn-hover-bg: #3a3a3a;
}

/* Переключатель темы */
.theme-toggle:hover {
    transform: rotate(20deg);
}

/* Контейнер переключателя */
.theme-toggle {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    /* background: #f1f1f1; */
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); */
    transition: background 0.4s ease, transform 0.3s ease;
}

/* Эффект при наведении */
.theme-toggle:hover {
    transform: scale(1.1);
}

/* Иконки */
.toggle-icon {
    position: relative;
    top: -2px;
    left: -2px;
    width: 24px;
    height: 24px;
}

/* Солнце */
.toggle-icon .sun {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 24px;
    opacity: 1;
    transform: rotate(0deg);
    transition: opacity 0.4s ease, transform 0.5s ease;
}

/* Луна */
.toggle-icon .moon {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 24px;
    opacity: 0;
    transform: rotate(-90deg);
    transition: opacity 0.4s ease, transform 0.5s ease;
}

/* Когда включена тёмная тема */
body.dark .theme-toggle {
    background: #2b2b2b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Анимация для иконок при переключении темы */
body.dark .toggle-icon .sun {
    opacity: 0;
    transform: rotate(90deg);
}
body.dark .toggle-icon .moon {
    opacity: 1;
    transform: rotate(0deg);
}


/* =====================
   Аватар и блок "Обо мне"
===================== */
#about {
    padding-top: 120px;
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.about-contact-btn {
    display: inline-block;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    padding: 12px 25px;
    margin-top: 20px;
    border-radius: 10px;
    background-color: #00a1e5;
    transition: all 0.3s ease
}

.about-contact-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.about-contact-btn img {
    width: 25px;
    margin-right: 4px;
    vertical-align: middle;
}

#about .about-contact-btn span {
    color: #fff;
    vertical-align: middle;
}

#avatar {
    width: 140px;
    height: 140px;
    margin: 0 auto 20px;
    border-radius: 50%;
    padding: 5px;

    /* Двойной фон: фото + градиент */
    background:
        url("../img/me1.png") center/cover no-repeat,
        linear-gradient(45deg, #f77737, #e1306c, #c13584, #5851db);
    
    /* Градиент идёт по бордеру, фото внутри */
    background-origin: padding-box, border-box;
    background-clip: content-box, border-box;

    /*border: 1px solid transparent;*/
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}


#about h1 {
    font-size: 2.2rem;
    margin-bottom: 15px;
}

#about span {
    background: var(--accent);
    -webkit-background-clip: text;
    color: transparent;
}

#about p {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--text);
}

/* =====================
   Навыки
===================== */
#skills {
    padding: 80px 10%;
    text-align: center;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.skill {
    display: flex;
    flex-direction: column;
    color: var(--text);
    text-decoration: none;
    background: var(--secondary);
    padding: 15px;
    border-radius: 12px;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skill img {
    width: 40px;
    margin-bottom: 10px;
}

.skill:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* =====================
   Портфолио
===================== */
#portfolio {
    padding: 40px 10% 60px;
    text-align: center;
}

/* Табы */
.portfolio-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0 30px;
}

.tab-btn {
    background: #f2f2f2;
    border: none;
    padding: 10px 35px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    /* font-weight: 600; */
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: #e1306c;
    color: white;
}

.tab-btn.active {
    background: #e1306c;
    color: #fff;
    box-shadow: 0 4px 12px rgba(225, 48, 108, 0.3);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.project {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.project img {
    width: 100%;
    display: block;
}

.project:hover {
    transform: scale(1.03);
}

.overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.project:hover .overlay {
    opacity: 1;
}

.overlay a {
    margin-top: 10px;
    background: #e1306c;
    padding: 8px 15px 10px;
    border-radius: 10px;
    color: white;
    text-decoration: none;
    transition: background 0.3s;
}

.overlay p {
    padding: 10px;
    line-height: 1.3;
}

.overlay a:hover {
    background: #c13584;
}

/* Скрытие неактивных проектов */
.project {
    display: none;
}
.project.active {
    display: block;
}

/* =====================
   Telegram-боты
===================== */
#bots {
    padding: 80px 10%;
    text-align: center;
}

.bots-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.bots-grid a {
    padding: 10px 20px;
    background: var(--secondary);
    border-radius: 10px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.bots-grid a:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* =====================
   Контакты
===================== */
#contacts {
    padding: 80px 10%;
    text-align: center;
}

.contacts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.contact-btn {
    max-width: 100px;
    margin: 10px 12px;
    border-radius: 25px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    text-align: center;
    transition: transform 0.3s ease;
}

.contact-btn img {
    display: inline-block;
    width: 75px;
    margin-bottom: 10px;
}

/*.telegram { background: #0088cc; }
.whatsapp { background: #25d366; }
.email { background: #ff5f5f; }
.github { background: #333333; }
.insta { background: #e1306c; }*/

.contact-btn:hover {
    transform: scale(1.05);
}

/* =====================
   Footer
===================== */
footer {
    font-size: 14px;
    padding: 6px;
    text-align: center;
    background: var(--secondary);
    margin-top: 40px;
    color: var(--text);
}

/* =====================
   Reveal-анимации
===================== */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* =====================
   Адаптивность
===================== */
@media (max-width: 768px) {
    nav ul { display: none; }
    header { padding: 15px 5%; }
    #about h1 { font-size: 1.8rem; }
    h2 { font-size: 1.8rem;}
    #about p { padding: 0 20px; }
    #skills { padding: 40px 10% 30px; }
    #portfolio { padding: 20px 10% 30px; }
    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 15px;
        margin-top: 15px;
    }
    .skill { font-size: 12px; }
}
