/* 
   Non-Critical CSS
   Deferred via media="print" onload trick for fastest rendering of above-the-fold content 
*/

.section {
    padding: 5rem 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.bg-light {
    background-color: var(--bg-light);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--primary-dark);
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background-color: var(--primary);
    margin: 1rem auto 0;
    border-radius: 2px;
}

/* RECENT PROJECTS GRID */
.grid-gallery {
    display: grid;
    gap: 1.5rem;
    /* Mobile: 2 columns, Desktop: up to 4 columns */
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .grid-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid-gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    background: #fff;
    /* Isolate paint/layout so lazy image loads don't reflow neighbours */
    contain: layout paint;
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    /* Reserve aspect ratio explicitly so the box never resizes when the
       lazy-loaded image swaps in. height:250px wins because it's set,
       but aspect-ratio makes the intrinsic size knowable up-front. */
    aspect-ratio: 3 / 2;
}

.gallery-item figcaption {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
    background: #fff;
    border-top: 1px solid #eee;
}

/* SERVICES */
.services-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.service-card {
    background: #fff;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    text-align: center;
    border-bottom: 4px solid transparent;
    /* Service cards form a 3-column grid on desktop with nested lists,
       icons, and varying heights. Containment prevents intra-card
       changes (hover transitions, focus rings) from invalidating the
       grid's layout. */
    contain: layout paint;
}

.service-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1;
}

.service-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
}

.service-list {
    list-style: none;
    text-align: left;
}

.service-list li {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
    color: #333;
}

.service-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.65em; /* Position perfectly centered with the first line of text */
    width: 7px;
    height: 7px;
    background-color: var(--primary);
    border-radius: 50%;
}

/* CONTACT */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: center;
    background: #fff;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

@media (min-width: 768px) {
    .contact-wrapper {
        grid-template-columns: 1fr 1fr;
    }
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-desc {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 1rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-dark);
    text-decoration: none;
    padding: 1rem;
    border-radius: 8px;
    background: var(--bg-light);
    transition: var(--transition);
}

.contact-link:hover {
    background: var(--primary);
    color: var(--text-light);
}

.contact-map img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* FOOTER */
footer {
    background: var(--primary-dark);
    color: var(--text-light);
    padding: 3rem 1rem;
    text-align: center;
}

.footer-content p {
    /* opacity: 0.8 removed — semi-transparent white on dark green failed
       Lighthouse contrast audit. Using an explicit off-white instead:
       #cccccc on #1e3f1a gives ~9:1 contrast, well above the 4.5:1 requirement. */
    color: #cccccc;
}

/* BACK TO TOP BUTTON */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    color: #111111;
    font-size: 1.6rem;
    font-weight: 900;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 10001;
    /* Isolate so visibility/opacity/transform changes during scroll don't
       invalidate layout for the rest of the page. */
    contain: layout paint;
    will-change: opacity, transform;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #a04000;
    color: #ffffff;
}

/* REVIEWS CAROUSEL */
.reviews-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 1.5rem;
    padding: 1rem 0 2rem 0;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    /* The carousel scrolls horizontally and runs an auto-scroll interval.
       Containment prevents its scrolling from invalidating page layout. */
    contain: layout paint;
}
.reviews-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}
.reviews-carousel:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
    border-radius: 8px;
}
.review-card {
    flex: 0 0 85%;
    max-width: 400px;
    background: #fff;
    padding: 2.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 6px 15px rgba(0,0,0,0.06);
    scroll-snap-align: center;
    border: 1px solid rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
}
@media (min-width: 768px) {
    .review-card {
        flex: 0 0 calc(50% - 1rem);
        scroll-snap-align: start;
    }
}
@media (min-width: 1024px) {
    .review-card {
        flex: 0 0 calc(33.333% - 1rem);
    }
}
.review-stars {
    color: #f59e0b; /* Golden Yellow */
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
    letter-spacing: 3px;
}
.review-text {
    font-style: italic;
    color: #333;
    flex-grow: 1;
    margin-bottom: 1.5rem;
    line-height: 1.7;
    position: relative;
    padding-left: 1.2rem;
    border-left: 3px solid var(--primary);
}
.review-author {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1.1rem;
}

/* CAROUSEL NAVIGATION CONTROLS */
.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--accent);
    color: #111111;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s, color 0.2s;
}
.carousel-nav-btn:hover {
    background: #a04000;
    color: #ffffff;
    transform: translateY(-50%) scale(1.05); /* Slight pop effect */
}
.prev-btn {
    left: -15px;
}
.next-btn {
    right: -15px;
}

/* ------------------------------------ */
/* COOKIE BANNER                        */
/* ------------------------------------ */
.cookie-banner {
    /* Darkened from #2389da — white text on #2389da was only ~4.0:1 contrast,
       just below the 4.5:1 WCAG AA requirement. #135a9e gives ~6.2:1 with white. */
    background-color: #135a9e;
    color: #ffffff;
    padding: 1.5rem;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
    transition: transform 0.5s ease-in-out, visibility 0.5s;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.cookie-buttons {
    display: flex;
    gap: 1rem;
}

.btn-accept, .btn-decline {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.btn-accept {
    background-color: var(--accent);
    color: #111111;
    animation: attentionPulse 2s infinite ease-in-out;
}

@keyframes attentionPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); filter: brightness(1.1); }
    100% { transform: scale(1); }
}

.btn-accept:hover {
    background-color: #a04000;
    color: #ffffff;
}

.btn-decline {
    background-color: transparent;
    color: #ffffff;
    border: 1px solid #ffffff;
}

.btn-decline:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

@media (min-width: 768px) {
    .cookie-content {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}
@media (max-width: 768px) {
    .prev-btn { left: 5px; } /* Pull in slightly on mobile so it doesn't clip */
    .next-btn { right: 5px; }
}