/* === Kintamieji (Variables) === */
:root {
    --color-primary: #75dddd;
    --color-secondary: #508991;
    --color-dark: #172a3a;
    --color-darker: #004346;
    --color-accent: #09bc8a;
}

/* === Pagrindiniai stiliai (Base Styles) === */
body {
    font-family: 'Montserrat', sans-serif;
    color: var(--color-dark);
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* === Spalvų pagalbinės klasės (Color Utilities) === */
.bg-primary { background-color: var(--color-primary); }
.bg-secondary { background-color: var(--color-secondary); }
.bg-dark { background-color: var(--color-dark); }
.bg-darker { background-color: var(--color-darker); }
.bg-accent { background-color: var(--color-accent); }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-secondary); }
.text-dark { color: var(--color-dark); }
.text-darker { color: var(--color-darker); }
.text-accent { color: var(--color-accent); }

/* === Komponentai (Components) === */

/* Hero sekcija */
.hero-section {
    background-image: url('https://images.squarespace-cdn.com/content/v1/54d11035e4b05e3af80ed873/1517241333124-A2II22UW6ST7HN6FW27U/custom+home+building+exterior+design+Ann+Arbor+MI.jpg');
    background-size: cover;
    background-position: center;
    position: relative;
}
.hero-overlay {
    background: linear-gradient(to right, rgba(23, 42, 58, 0.4), rgba(0, 67, 70, 0.7));
}

/* Mygtukai */
.btn {
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
    border-radius: 0.375rem; /* rounded-md */
    font-weight: 500;
    padding: 0.75rem 2rem; /* py-3 px-8 (apytiksliai) */
    display: inline-block;
}
.btn-primary {
    background-color: var(--color-accent);
    color: white;
}
.btn-primary:hover {
    background-color: var(--color-darker);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.btn-secondary {
    background-color: var(--color-secondary);
    color: white;
}
.btn-secondary:hover {
    background-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.btn-outline {
    background-color: transparent;
    border: 2px solid white;
    color: white;
}
.btn-outline:hover {
    background-color: white;
    color: var(--color-dark);
}

/* Paveikslėlio konteineris (Image Wrapper) */
.image-wrapper {
    overflow: hidden;
    border-radius: 0.5rem; /* rounded-lg */
}
.image-wrapper img {
    transition: transform 0.5s ease;
    display: block;
    width: 100%; /* Ensure image covers wrapper */
    height: 100%; /* Ensure image covers wrapper */
    object-fit: cover; /* Maintain aspect ratio */
}
.group:hover .image-wrapper img,
.image-wrapper:hover img {
    transform: scale(1.05);
}

/* Paslaugų kortelė (Service Card) */
.service-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out, box-shadow 0.3s ease;
    will-change: opacity, transform;
    cursor: pointer;
    /* Added for initial state consistency */
    pointer-events: none;
}
.service-card.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto; /* Enable pointer events when visible */
}
.service-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); /* shadow-xl */
    transform: translateY(-4px);
}

/* Kategorijų mygtukai */
.category-btn.active {
    background-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(117, 221, 221, 0.5); /* Focus ring style */
    color: white;
}
.category-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(117, 221, 221, 0.5); /* Focus ring style */
}

/* Mobilus meniu */
#mobile-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out;
}
#mobile-menu.open {
    max-height: 500px; /* Adjust as needed */
}
#mobile-menu-button i {
    transition: transform 0.3s ease;
}
#mobile-menu-button.open i {
    transform: rotate(90deg);
}

/* === Modalinis langas (Modal) === */

/* Modal pagrindiniai stiliai */
#service-modal {
    transition: visibility 0s linear 0.3s, opacity 0.3s ease;
}
#service-modal.modal-hidden {
   opacity: 0;
   visibility: hidden;
   transition: visibility 0s linear 0.3s, opacity 0.3s ease;
}
#service-modal.modal-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

/* Modal fonas (Overlay) */
#modal-overlay {
    transition: opacity 0.3s ease;
    opacity: 0;
}
#service-modal.modal-visible #modal-overlay {
    opacity: 1;
}

/* Modal konteineris */
#modal-container {
    max-width: 1000px; /* Max width for the modal */
    width: 90%;        /* Responsive width */
    max-height: 85vh;  /* Max height */
    transform: scale(0.95) translateY(10px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    will-change: transform, opacity;
    margin-left: auto; /* Center horizontally */
    margin-right: auto; /* Center horizontally */
    display: flex; /* Needed for flex-col */
    flex-direction: column; /* Stack children vertically */
}
#service-modal.modal-visible #modal-container {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal galerija */
#modal-gallery .gallery-image {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    z-index: 1;
    will-change: opacity;
}
#modal-gallery .gallery-image.active {
    opacity: 1;
    z-index: 10; /* Ensure active image is on top */
}
#modal-gallery img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Changed from cover to contain */
}

/* Modal galerijos valdymas */
.gallery-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 9999px; /* rounded-full */
    padding: 0.5rem; /* p-2 */
    z-index: 20;
    transition: background-color 0.3s ease;
    backdrop-filter: blur(2px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: none;
    cursor: pointer;
    display: flex; /* Ensure icon is centered */
    align-items: center; /* Ensure icon is centered */
    justify-content: center; /* Ensure icon is centered */
}
.gallery-control:hover {
    background-color: rgba(255, 255, 255, 0.9);
}
.gallery-control i {
    color: #1f2937; /* gray-800 */
    display: block;
    font-size: 0.875rem; /* text-sm */
}
#prev-img {
    left: 0.5rem; /* left-2 */
}
#next-img {
    right: 0.5rem; /* right-2 */
}

/* Modal galerijos taškai */
#gallery-dots {
    position: absolute;
    bottom: 1rem; /* bottom-4 */
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 0.5rem; /* space-x-2 approx */
    z-index: 20;
}
#gallery-dots button {
    width: 0.625rem; /* w-2.5 */
    height: 0.625rem; /* h-2.5 */
    border-radius: 9999px; /* rounded-full */
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    padding: 0;
}
#gallery-dots button.active {
    background-color: white;
    transform: scale(1.1);
}
#gallery-dots button:not(.active) {
    background-color: rgba(255, 255, 255, 0.5);
}

/* Modal turinio stiliai */
#modal-content h4 {
    font-size: 1.125rem; /* text-lg */
    font-weight: 600; /* font-semibold */
    color: var(--color-dark);
    margin-top: 1.5rem; /* mt-6 */
    margin-bottom: 0.5rem; /* mb-2 */
}
#modal-content ul,
#modal-content ol {
    list-style-position: inside;
    padding-left: 0.5rem; /* pl-2 */
    margin-bottom: 1rem; /* mb-4 */
    font-size: 0.875rem; /* text-sm */
    color: #4b5563; /* gray-600 */
}
#modal-content ul li,
#modal-content ol li {
    margin-bottom: 0.5rem; /* mb-2 */
}
#modal-content p {
    margin-bottom: 1rem; /* mb-4 */
    line-height: 1.6;
    color: #4b5563; /* gray-600 */
}
#modal-content strong {
    font-weight: 600; /* font-semibold */
    color: var(--color-dark);
}

/* Modal išdėstymo stiliai (Layout) */
.modal-layout-container {
    /* Using flex flex-col md:flex-row from HTML for basic layout */
}
.modal-image-wrapper {
    width: 100%; /* Full width on mobile */
    position: relative; /* For absolute positioning of gallery items */
    background-color: #e5e7eb; /* gray-200 */
    min-height: 200px; /* Minimum height on mobile */
    overflow: hidden; /* Clip gallery items */
    flex-shrink: 0; /* Prevent shrinking when text is long */
}
.modal-text-wrapper {
    width: 100%; /* Full width on mobile */
    padding: 1.5rem; /* p-6 */
    flex-grow: 1; /* Allow text area to grow */
    flex-shrink: 1; /* Allow text area to shrink */
    overflow: hidden; /* In case of extremely long unbreakable words */
}
.modal-scroll-container {
    overflow-y: auto; /* Enable vertical scroll */
    overflow-x: hidden; /* Disable horizontal scroll */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    height: 100%; /* Take up available vertical space */
}

/* === Fokusavimo stiliai (Focus Styles) === */
*:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 2px;
}
*:focus:not(:focus-visible) {
    outline: none; /* Remove default outline for non-keyboard focus */
}
input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(9, 188, 138, 0.3);
    outline: none;
}

/* === Medijos užklausos (Media Queries) === */
@media (min-width: 768px) { /* md breakpoint */
    /* Modal Layout on Medium Screens and up */
    .modal-image-wrapper {
        width: 45%; /* Image takes 45% width */
        max-height: 400px; /* Set max height for image area */
        height: 400px;     /* Set fixed height */
        min-height: 0;     /* Reset min-height */
    }
    #modal-gallery {
        height: 100%; /* Ensure gallery fills the wrapper */
    }
    .modal-text-wrapper {
        width: 55%; /* Text takes 55% width */
        padding: 2rem; /* p-8 */
    }
}