/* --- Base Rules & Smooth Scroll --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
}

body {
    background-color: #83ab64;
    line-height: 1.6;
    /* ФИКС 1: Спира хоризонталното клатене на целия сайт на мобилни устройства */
    overflow-x: hidden; 
    width: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.section-padding {
    padding: 100px 0;
}

.bg-light {
    background-color: #6f8f40;
}

.divider {
    display: block;
    width: 60px;
    height: 4px;
    background-color: #393939;
    margin: 15px 0 30px 0;
}

/* --- Fixed Header Navigation --- */
header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 50px;
    background-color: transparent;
    box-shadow: none;
    z-index: 1000;
}

/* --- Logo Layout --- */
.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-image {
    height: 110px; 
    width: auto;
    display: block;
    transition: transform 0.3s ease;
    margin-top: 10px;
    margin-bottom: -20px;
}

.logo-image:hover {
    transform: scale(1.05); 
}

/* --- Main Navigation Bar --- */
nav {
    display: flex;
    position: relative;        /* Gives the language switcher an anchor point */
    align-items: center;       
    justify-content: flex-end; 
    padding-top: 15px;         /* Adds a bit of room at the top for the floated switcher */
}

/* Container holding text links AND your social icons */
.nav-links {
    display: flex;
    align-items: center;
    gap: 15px;                 /* Adjust this to change the tightness of the row */
}

.nav-links a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: #6f8f40;
}

/* --- Language Switcher Floated on Top --- */
.lang-switcher {
    position: absolute;
    top: -10px;                /* Floats it right above the social icons */
    right: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333333;
    line-height: 1;
}

.lang-link {
    text-decoration: none;
    color: #333333;
    padding: 0 2px;
    transition: color 0.3s ease;
}

.lang-link:hover {
    color: #6f8f40;
}

.active-lang {
    padding: 0 2px;
    color: #333333;
    font-weight: 700;
}

/* Header Social Media Icons - styled to match line height */
.header-social {
    font-size: 1rem;
    color: #333333;
    text-decoration: none;
    transition: color 0.3s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    margin-left: 5px;          /* Extra little separation gap */
}

.header-social:hover {
    transform: scale(1.15);
}

.header-social.facebook:hover { color: #1877f2; }
.header-social.instagram:hover { color: #e1306c; }

/* --- СКРИТИ ЕЛЕМЕНТИ ЗА ХАМБУРГЕР МЕНЮ (Скрити на Десктоп) --- */
.menu-toggle, .hamburger-icon {
    display: none;
}

/* --- Section 1: Hero/Landing Page --- */
.hero-section {
    height: 100vh;
    background: url('my-portfolio/images/heroBgNewCopy.webp') no-repeat center bottom/cover; 
    position: relative;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-text {
    text-align: center;
    color: #6f8f40;
    width: 100%;
    padding: 0 20px;
}

.hero-text h1 {
    font-size: 3.5rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-top: -180px;
    margin-bottom: 5px;
    text-shadow: 2px 2px 1px rgba(0, 0, 0, 0.3);
}

.hero-text p {
    font-size: 1.3rem;
    margin-bottom: 30px;
    text-shadow: 1px 1px 5px rgba(0,0,0,0.5);
}

/* Common Button Style */
.btn {
    display: inline-block;
    padding: 12px 35px;
    background-color: #6f8f40;
    color: #434242;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s ease;
    max-width: 100%; /* Предотвратява излизането на бутона извън контейнера на телефон */
}

.btn:hover {
    background-color: #83ab64;
}

/* --- Section 2: About Me --- */
.about-container {
    display: flex;
    align-items: center;
    gap: 50px;
}

.about-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.about-image img {
    width: 100%;
    height: auto;          /* Allows the image to preserve its original aspect ratio */
    max-height: none;      /* Removes the desktop height cap causing the crop */
    object-fit: contain;   /* Ensures the entire image remains visible without zooming */
}

.about-text {
    flex: 1.2;
    text-align: center; /* Centers the heading text, divider, and paragraph lines */
}

.about-text h2 {
    font-size: 2.3rem;
}

/* Forces the line layout marker to look at container bounds and sit in the middle */
.about-text .divider {
    margin: 15px auto 30px auto; 
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #555;
}

/* --- Section 3: Gallery Grid (TRUE CROSS-BROWSER MASONRY) --- */
.gallery-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 0 10px;
}

.gallery-header h2 {
    font-size: 2.5rem;
}

.gallery-header .divider {
    margin: 15px auto;
}

/* Using CSS Columns layout creates perfect, fluid multi-browser masonry */
.gallery-grid {
    columns: 4; /* Forces up to 4 columns, auto-calculates if screen is tight */
    column-gap: 20px;
    width: 100%;
    max-width: 1200px; 
    margin: 0 auto;
    box-sizing: border-box;
}

.gallery-item {
    display: block; /* Crucial for masonry flow behavior */
    width: 100%; 
    margin-bottom: 20px;
    break-inside: avoid; /* Prevents cards from splitting awkwardly across columns */
    position: relative;
    background-color: transparent;
    border-radius: 8px;
    border: 2px solid #607363;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-sizing: border-box;
    overflow: hidden;
}

/* Restored fluid vertical sizes so portraits stay tall and landscapes stay wide */
.gallery-item img {
    width: 100%;
    height: auto; 
    display: block;
    object-fit: cover;
}

/* Responsive Overrides via Column Control */
@media (max-width: 1024px) {
    .gallery-grid {
        columns: 3; /* Smoothly drops column tracks on smaller viewports */
    }
}

@media (max-width: 768px) {
    .gallery-grid {
        columns: 2;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        columns: 1;
    }
}

/* Hover effect */
.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.gallery-item img:hover {
    opacity: 0.9;
}

.item-info {
    padding: 15px 20px;
}

.item-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* --- Section 4: Contact Me --- */
.contact-container {
    max-width: 750px;
    text-align: center;
    margin: 0 auto; /* Keeps form centered nicely */
    width: 100%;
}

.contact-container h2 {
    font-size: 2.5rem;
}

.contact-container .divider {
    margin: 15px auto 40px auto;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #646464;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, background-color 0.3s;
    background-color: #83ab64; /* CHANGED FROM WHITE TO GRAY */
    color: #2b2a2a;               /* Ensures input text is clean and highly visible */
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: #202020;
}

/* --- Footer --- */
footer {
    background-color: #6f8f40;
    color: #3d3b3b;
    text-align: center;
    padding: 30px 0;
    font-size: 0.9rem;
    font-weight: 600;
}

/* --- Custom Inline Gallery Hover Video Assets --- */
.video-wrapper {
    position: relative;
    width: 100%;
    height: auto; 
    cursor: pointer;
    overflow: hidden;
    border-radius: 6px; 
    display: flex;
}

.video-wrapper video {
    width: 100%;
    height: auto;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.play-overlay i {
    color: #ffffff;
    font-size: 2.5rem;
    filter: drop-shadow(0px 4px 10px rgba(0,0,0,0.3));
    transition: all 0.3s ease;
}

.video-wrapper:hover .play-overlay {
    opacity: 0;
    background-color: rgba(0, 0, 0, 0);
}

.video-wrapper:hover video {
    transform: scale(1.02);
}

/* --- ADVANCED INTERACTIVE LIGHTBOX THEATER PANEL --- */
.modal {
    display: none; 
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.95);
    overflow: hidden;
}

.modal-theater-layout {
    display: flex; 
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #111111;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

/* Left Canvas Area */
.main-viewer-area {
    flex: 4;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #050505;
    padding: 40px;
}

/* Обединен контейнер в модала, подреждащ елементите вертикално */
#mediaContainer {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; /* Центрира бутона хоризонтално над видеото */
    justify-content: center;
}

#mediaContainer img, 
#mediaContainer video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: 1px solid #222222;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

/* Тънък, фин стил за музикалния бутон точно над видеото */
.video-music-credit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px; /* Дистанция между бутона и горния ръб на видеото */
    padding: 4px 12px;
    background-color: rgba(255, 255, 255, 0.08); /* Дискретен полупрозрачен фон */
    color: rgba(255, 255, 255, 0.85);          /* Леко прозрачен фин текст */
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.8rem;                          /* Намален размер на буквите */
    font-weight: 300;                           /* Изключително тънък профил */
    letter-spacing: 0.3px;
    font-family: inherit;                       /* Следва основния Segoe UI шрифт */
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.video-music-credit:hover {
    background-color: rgba(255, 255, 255, 0.18);
    color: #ffffff; /* Текстът светва напълно при hover */
}

.video-music-credit i {
    font-size: 0.75rem; /* Деликатна икона */
    opacity: 0.9;
}

/* Right Side Miniature Grid Selection Panel */
.thumbnail-side-panel {
    flex: 0 0 160px;          /* Hard-locks the panel width so it doesn't expand too wide */
    background-color: #161616;
    border-left: 1px solid #252525;
    display: grid;            /* Switched from Flex to Grid for clean column alignment */
    grid-template-columns: repeat(2, 1fr); /* Creates two columns of smaller preview squares */
    gap: 10px;
    padding: 15px;
    align-content: start;      /* Aligns thumbnails at the very top of the panel */
    overflow-y: auto;
}

.thumb-square {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.4;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.thumb-square:hover,
.thumb-square.active-thumb {
    opacity: 1;
    border-color: #ff5a5f;
}

/* Slider Stepping Navigation Handles */
.slider-arrow {
    position: absolute;
    background: rgba(30, 30, 30, 0.6);
    color: #ffffff;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.3s, transform 0.2s;
    z-index: 10;
    user-select: none;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slider-arrow:hover { 
    background: #ff5a5f; 
    transform: scale(1.1); 
}

.prev-arr { left: 20px; }
.next-arr { right: 20px; }

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #ffffff;
    font-size: 40px;
    font-weight: 300;
    cursor: pointer;
    z-index: 2100;
    transition: color 0.2s;
}

.close-modal:hover { color: #ff5a5f; }

/* Fullscreen Video Overrides */
video:fullscreen {
    object-fit: contain !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

video:-webkit-full-screen {
    object-fit: contain !important;
    width: 100vw !important;
    height: 100vh !important;
}

/* --- Responsive Adjustments (Mobile/Tablets) --- */
@media (max-width: 768px) {
    header {
        padding: 15px 25px;
        flex-direction: row; /* Връща логото и хамбургера на един ред */
        justify-content: space-between;
        align-items: center;
        background-color: rgba(131, 171, 100, 0.98); /* Лека фонова плашка при отворено меню */
        position: fixed; /* Заключва го горе за по-лесна навигация */
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .logo-image {
        height: 70px; /* Малко по-малко лого за мобилни устройства */
        margin-top: 0;
        margin-bottom: 0;
    }

    nav {
        padding-top: 0;
    }

    /* ФИКС НА НАВИГАЦИЯТА: Скрива се извън десния край на екрана по подразбиране */
    .nav-links {
        position: fixed;
        top: 85px; /* Веднага под хедъра */
        right: -100%;
        width: 260px;
        height: calc(100vh - 85px);
        background-color: #6f8f40;
        flex-direction: column;
        align-items: flex-start;
        padding: 40px 30px;
        gap: 25px;
        transition: right 0.4s ease-in-out;
        box-shadow: -5px 5px 15px rgba(0,0,0,0.15);
        z-index: 999;
    }

    .nav-links a {
        font-size: 1.1rem;
        width: 100%;
        padding: 5px 0;
    }

    /* Позициониране на суичъра за език в мобилното меню */
    .lang-switcher {
        position: static;
        margin-top: 15px;
        font-size: 1.1rem;
        padding-left: 0;
    }

    /* АКТИВИРАНЕ НА ХАМБУРГЕР ИКОНАТА */
    .hamburger-icon {
        display: block;
        font-size: 1.8rem;
        color: #333;
        cursor: pointer;
        z-index: 1001;
        user-select: none;
        transition: transform 0.3s ease;
    }

    /* МАГИЯТА: Когато чекбоксът се маркира (кликне), менюто изскача отдясно */
    .menu-toggle:checked ~ nav .nav-links {
        right: 0;
    }

    /* Лека анимация на завъртане на хамбургера при отваряне */
    .menu-toggle:checked ~ .hamburger-icon {
        transform: rotate(90deg);
    }
    
    /* Оправяне на Hero секцията на мобилен */
    .hero-text h1 {
        font-size: 2.2rem;
        margin-top: 0; /* Махаме тежкия десктоп негативен марж */
    }
    
    .hero-text p {
        font-size: 1.1rem;
    }
    
    .about-container {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }
    
    .about-container .divider {
        margin: 15px auto;
    }
    
    .section-padding {
        padding: 60px 0;
    }

    /* Flip theater elements to bottom toolbar layout on narrow smartphone displays */
    .modal-theater-layout { 
        flex-direction: column; 
        height: 85vh; 
    }
    .thumbnail-side-panel { 
        flex-direction: row; 
        height: 90px; 
        width: 100%; 
        border-left: none; 
        border-top: 1px solid #252525; 
    }
    .thumb-square { 
        width: 55px; 
        height: 55px; 
    }
}

/* --- Floating Back to Top Button --- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background-color: #333333;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1500; /* Sits safely above sections but below the lightbox modal */
    
    /* Starts semi-transparent and hidden */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease, background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Appended via JavaScript when page scrolls down past 400px */
.back-to-top.show-btn {
    opacity: 0.5; /* Keeps it beautifully transparent while reading layout blocks */
    visibility: visible;
}

/* Interactive Hover States */
.back-to-top:hover {
    opacity: 0.9; /* Brightens up intentionally when hovered */
    background-color: #6f8f40; /* Switches to your branding green theme */
    transform: translateY(-3px); /* Subtle physical bump up */
}

/* --- Финална стилизация на линка към имейла в параграфа --- */
.contact-container p a.contact-link {
    color: #333333 !important;      /* Напълно същия цвят като горния текст */
    font-weight: 700;                /* Една идея по-плътен, за да личи, че е линк */
    text-decoration: underline !important; /* Класическо подчертаване */
    display: inline;
    transition: color 0.3s ease;
}

.contact-container p a.contact-link:hover {
    color: #83ab64 !important;      /* Дискретна промяна при посочване */
}