/* --- 1. UNIVERSAL CURSOR SETTINGS --- */

/* Force a single custom cursor for every element on the page */
html, body, a, button, img, .clickable-text, .x-pic, .ref-sheet, .avatar, [onclick], .modal-content {
    cursor: url('../images/my-cursor.png') 0 0, auto !important;
}

/* --- 2. BASE STYLES --- */

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    font-family: 'Quicksand', sans-serif;
    color: #2c3e50;
}

/* Fixed background layer with blur and slight scale to hide edges */
body::before {
    content: "";
    position: fixed;
    z-index: -1;
    top: -20px; 
    left: -20px;
    right: -20px;
    bottom: -20px;
    background-color: #6b8454;
    background-image: 
        url('../images/bg.jpg'),
        linear-gradient(135deg, #b2c99b 0%, #6b8454 100%);
    background-size: cover;
    background-position: center;
    filter: blur(10px);
    transform: scale(1.05);
}

/* --- 3. PROFILE CARD --- */

.profile-card {
    position: relative;
    z-index: 5;
    width: 40%;
    margin: 40px 0;
    padding: 2.5rem;
    border-radius: 20px;
    text-align: center;
    font-size: 1.8rem;
    line-height: 1.5;
    color: #222222;
    background: rgba(255, 255, 255, 0.6); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.profile-card:hover {
    transform: translateY(-10px);
}

/* --- 4. CONTENT & SOCIALS --- */

.avatar {
    width: 400px;
    height: 400px;
    background: linear-gradient(45deg, #6e8efb, #a777e3);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: block;
    object-fit: cover;
}

.socials {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    margin: 25px 0;
}

.socials a img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.socials a:hover img { 
    transform: scale(1.2); 
}

hr.rounded {
    border: 0;
    border-top: 3px solid #2c3e50;
    border-radius: 5px;
    width: 70%;
    margin: 30px auto;
}

.bio {
    line-height: 1.6;
    color: #333333;
    margin: 25px 0;
    font-weight: bold;
}

.clickable-text {
    display: inline-block;
    transition: transform 0.2s ease;
    margin: 0%;
}

.clickable-text:hover { 
    transform: scale(1.1); 
}

/* --- 5. GALLERIES & NSFW --- */

.ref_sheet {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

#refs-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: hidden;
    transition: max-height 0.6s ease-in-out, opacity 0.5s ease;
}

#refs-gallery.collapsed {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.ref-sheet {
    width: 90%;
    max-width: 1000px;
    border-radius: 12px;
    margin: 15px 0;
    transition: transform 0.3s ease, filter 0.5s ease;
    /* Keeps the blur edges clean and contained */
    backface-visibility: hidden;
}

/* Hover effect for the reference sheets */
.ref-sheet:hover {
    transform: scale(1.03);
}

/* NSFW Blur logic with clean edges */
.blurred-ref {
    clip-path: inset(0 round 12px);
    
    /* Grayscale + Blur + Darken */
    filter: grayscale(100%) blur(15px) brightness(0.7);
    
    /* We scale it slightly up to ensure the blur covers 100% of the area */
    
}

.unblurred {
    filter: blur(0) grayscale(0) brightness(1);
    transform: scale(1);
}

.tg-timeline-container {
    width: 100%;
    margin: 40px auto 20px;
    display: flex;
    justify-content: center;
}

.pics-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.x-pic {
    width: 250px;
    height: 250px;
    object-fit: cover; 
    border-radius: 40px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

/* Scatter rotation effect */
.x-pic:nth-child(1) { transform: rotate(-4deg); }
.x-pic:nth-child(2) { transform: rotate(5deg); }
.x-pic:nth-child(3) { transform: rotate(3deg); }
.x-pic:nth-child(4) { transform: rotate(-5deg); }

.x-pic:hover {
    transform: scale(1.1) rotate(0deg);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    z-index: 10;
}

/* --- 6. MODAL & LEAVES --- */

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
}

.modal-content {
    max-width: 95%;
    max-height: 95vh;
}

#leaves-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

.falling-leaf {
    position: absolute;
    top: -10vh;
    animation: fallAndSpin linear;
}

@keyframes fallAndSpin {
    0% { transform: translateY(0) rotate(0deg); }
    100% { transform: translateY(110vh) rotate(360deg); }
}

/* --- 7. MOBILE ADAPTIVITY --- */

@media (max-width: 1300px) {
    .profile-card { 
        width: 85%; 
    }
    .avatar { 
        width: 280px; 
        height: 280px; 
    }
    .pics-gallery { 
        grid-template-columns: 1fr; 
    }
}

/* --- 8. SUPER-TINY MOBILE OPTIMIZER (Anti-Scroll) --- */

@media (max-width: 600px) {
    /* 1. Блокируем горизонтальный скролл на корню */
    html, body {
        overflow-x: hidden;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    /* 2. Карточка профиля: делаем максимально плоской и узкой */
    .profile-card {
        width: 90% !important; /* Больше места по бокам */
        max-width: 320px; /* Чтобы не растягивалась на лопатах */
        margin: 15px auto !important;
        padding: 12px !important; /* Минимум внутреннего отступа */
        font-size: 0.85rem !important; /* Мелкий, но читаемый текст */
        line-height: 1.2;
        border-radius: 12px;
        box-sizing: border-box; /* Важно: padding не увеличивает ширину */
    }

    /* 3. Аватарка: крошечная */
    .avatar {
        width: 80px !important;
        height: 80px !important;
        margin: 0 auto 10px !important;
    }

    /* 4. Соцсети: в один ряд, очень плотно */
    .socials {
        gap: 12px !important;
        margin: 8px 0 !important;
    }

    .socials a img {
        width: 22px !important;
        height: 22px !important;
    }

    /* 5. Текст био и кликабельные элементы */
    .bio {
        margin: 8px 0 !important;
        font-size: 0.8rem !important;
        word-wrap: break-word; /* Чтобы длинные слова не ломали верстку */
    }

    .clickable-text {
        margin: -10px 0 !important; /* Убираем отрицательные маргины, они ломают позицию */
        font-size: 0.75rem !important;
    }

    /* 6. Галерея: 2 колонки, чтобы не скроллить вечно вниз */
    .pics-gallery {
        grid-template-columns: 1fr; 
        gap: 20px !important;
        width: 70%;
        margin: 0px 15% !important;
    }

    .x-pic {
        width: 100% !important;
        height: 90px !important; /* Совсем маленькие превью */
        border-radius: 8px !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    }

    /* 7. Референсы (те, что на весь экран) */
    .ref-sheet {
        width: 100% !important;
        margin: 5px 0 !important;
    }

    /* 8. Декорации (листья и разделители) */
    hr.rounded {
        margin: 5px auto !important;
        width: 60% !important;
    }

    .falling-leaf {
        display: none; /* На совсем маленьких экранах лучше скрыть для плавности */
    }

    /* Фикс фона, чтобы не «плыл» при скролле */
    body::before {
        transform: scale(1); 
        filter: blur(5px);
    }
    .tg-timeline-container {
        margin: 20px auto 10px !important;
    }
}