/**
 * KV Dřevostavby - Main Stylesheet
 * Version: 2.1.0
 *
 * Table of Contents:
 * 1. CSS Variables & Root
 * 2. Base Styles
 * 3. Typography
 * 4. Layout & Sections
 * 5. Navigation
 * 6. Hero Section
 * 7. Project Cards
 * 8. Project Modal & Carousel
 * 9. Contact Section
 * 10. UI Components
 * 11. Footer
 * 12. Utility Classes
 * 13. Animations
 * 14. Media Queries
 */

:root {
    --bs-primary: #63b32f; /* Green primary color */
    --bs-primary-dark: #367010; /* Darker green for hover states */
    --white: #ffffff;
    --light-gray: #d8d8d8;
    --gray: #6c757d;
    --dark-gray: #323232;
    --text-color: #4d4d4d;
    --text-muted: #666;
    --border-radius: 0.5rem;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.1);
    --transition-quick: all 0.2s ease;
    --transition-normal: all 0.3s ease;
}
/* ===== 1. CSS VARIABLES & ROOT ===== */

/* ===== 2. BASE STYLES ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 300;
    line-height: 1.6;
    color: var(--text-color);
    padding-top: 76px; /* Account for fixed navbar */
}

/* ===== 3. TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
}

strong {
    font-weight: 500;
}

a {
    color: var(--bs-primary);
    text-decoration: none;
    transition: var(--transition-quick);
}

a:hover, a:focus, a:active {
    color: var(--bs-primary-dark);
    text-decoration: none;
}

p {
    margin-bottom: 1rem;
}

/* ===== 4. LAYOUT & SECTIONS ===== */
section {
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
    scroll-margin-top: 80px; /* Adjust scroll position for fixed navbar */
}

section:first-of-type {
    padding-top: 6rem;
}

.section-title {
    background: transparent;
    position: relative;
    z-index: 1;
    margin-bottom: 2.5rem;
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--text-color);
    text-align: center;
}

.section-title:after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--bs-primary);
    margin: 0.75rem auto 0;
}

/* ===== 5. NAVIGATION ===== */
.navbar {
    background-color: var(--white);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal), backdrop-filter 0.3s ease;
}

.navbar-brand {
    font-weight: 500;
    color: var(--bs-primary);
}

.navbar-scrolled {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-link {
    position: relative;
    color: #555;
    font-weight: 400;
    padding: 0.5rem 1rem !important;
    transition: var(--transition-quick);
    line-height: 1.5;
    text-decoration: none;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--bs-primary);
}

.nav-link.active {
    color: var(--bs-primary) !important;
}

/* Underline animation for nav links */
.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--bs-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Fix for hamburger menu button border thickness */
.navbar-toggler:focus {
    box-shadow: 0 0 0 0.1rem rgba(108, 168, 11, 0.25); /* Thinner shadow using primary color */
    outline: none;
}

.navbar-toggler {
    border: 1px solid rgba(0,0,0,.1); /* Lighter border */
    padding: 0.25rem 0.5rem; /* Slightly smaller padding */
}

/* ===== 6. HERO SECTION ===== */
.hero {
    background-color: var(--light-gray);
    background-image: url('../../ui/images/hero-background.jpg');
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    padding: 5rem 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(255,255,255,0.1));
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    border-radius: var(--border-radius);
    padding: 2rem 3rem;
    margin: 0 auto;
    max-width: 90%;
    width: auto;
    box-shadow: var(--shadow-sm);
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.hero h1 span {
    color: var(--light-gray);
    text-transform: none;
}

.hero p {
    font-size: 1.7rem;
    color: var(--dark-gray);
    margin-bottom: 0;
}

.hero p a span {
    color: var(--bs-primary-dark) !important;
}

.hero p a:hover span {
    color: var(--dark-gray) !important;
}

/* ===== 7. PROJECT CARDS ===== */
.project-card {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    overflow: hidden;
    height: 100%;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

/* Project image height adjustment */
.project-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3/2;
    overflow: hidden;
}

.project-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-body {
    padding: 1.25rem;
}

.project-title {
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.project-text {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.project-detail-btn {
    transition: var(--transition-quick);
    font-size: 0.9rem;
    padding: 0.35rem 0.8rem;
    color: var(--bs-primary);
    border-color: var(--bs-primary);
    background-color: transparent;
}

.project-detail-btn:hover {
    background-color: var(--bs-primary);
    color: var(--white);
    border-color: var(--bs-primary);
}

/* ===== 8. PROJECT MODAL & CAROUSEL ===== */
/* Modal structure */
#projectModal .modal-content {
    border-radius: 8px;
    overflow: hidden;
    border: none;
}

#projectModal .modal-body {
    padding: 20px;
    overflow: visible; /* Allow content to determine height */
}

#projectModal .modal-header {
    border-bottom-color: #eee;
}

#projectModal .modal-footer {
    border-top-color: #eee;
}

/* Carousel structure */
#projectCarousel {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

#projectCarousel .carousel-item {
    aspect-ratio: 3/2;
    background-color: #333;
    border-radius: 0.5rem;
    overflow: hidden;
}

#projectCarousel .carousel-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: var(--light-gray);
}

/* Carousel controls styling */
#projectCarousel .carousel-control-next-icon,
#projectCarousel .carousel-control-prev-icon {
    background-color: rgba(0, 0, 0, 0.5);
    background-size: 50%;
    padding: 12px;
    border-radius: 50%;
}

#projectCarousel .carousel-control-next:hover .carousel-control-next-icon,
#projectCarousel .carousel-control-prev:hover .carousel-control-prev-icon {
    background-color: rgba(0, 0, 0, 0.7);
}

/* Project thumbnails - using CSS Grid for multi-row layout */
#projectThumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 2px;  /* Space between thumbnails */
    overflow: hidden;  /* Prevent overflow issues */
    height: auto;
    margin-bottom: 10px;
    clear: both;
    /* Match padding with the modal body */
    padding: 0 0.5rem;
}

/* Our custom thumbnail item styling */
.thumbnail-item {
    /* No additional styling needed - grid handles positioning */
}

#projectThumbnails img {
    height: 38px;
    width: 56px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

#projectThumbnails img:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

#projectThumbnails img.active {
    border-color: var(--bs-primary);
}

/* Project details section */
.project-details {
    margin-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
    padding-top: 20px;
    position: relative;
    clear: both;
}

.project-metadata {
    margin-top: 20px;
    font-size: 0.95rem;
}

.project-metadata dt {
    color: var(--text-muted);
    font-weight: 500;
}

.project-metadata dd {
    margin-bottom: 0.75rem;
}

/* ===== 9. CONTACT SECTION ===== */
.contact-info {
    margin-bottom: 2rem;
}

.contact-info p {
    margin-bottom: 0.3rem; /* Reduce paragraph margin from 1rem to 0.5rem */
}

.contact-person {
    margin-bottom: 1rem; /* Reduce from 1.5rem to 1rem */
}

.contact-info h5 {
    margin-bottom: 0.5rem; /* Reduce spacing after person names */
}

.contact-info i {
    color: var(--bs-primary);
    font-size: 1.25rem;
    margin-right: 0.5rem;
    width: 25px;
    text-align: center;
}

.contact-person {
    margin-bottom: 1.5rem;
}

/* Map container styling */
.ratio-map {
    --bs-aspect-ratio: 50%;
}

.ratio {
    position: relative;
    width: 100%;
}

.ratio::before {
    display: block;
    padding-top: var(--bs-aspect-ratio);
    content: "";
}

.ratio > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0,0,0,0.1);
}

/* ===== 10. UI COMPONENTS ===== */
/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background-color: var(--bs-primary);
    color: var(--white);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-quick);
}

.back-to-top:hover {
    background-color: var(--bs-primary-dark);
}

/* Show more button - centered with animation */
#show-more-projects {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: var(--white);
    font-weight: 500;
    padding: 0.5rem 1.75rem;
    border-radius: var(--border-radius);
    transition: var(--transition-normal);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    display: inline-block;
}

#show-more-projects:hover,
#show-more-projects:focus {
    background-color: var(--bs-primary-dark);
    border-color: var(--bs-primary-dark);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

#show-more-projects:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#show-more-projects::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: -100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.7s ease;
}

#show-more-projects:hover::after {
    left: 100%;
}

/* Quick links styling */
.quick-links-card {
    background-color: white;
    border-radius: 0.75rem;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    padding: 1.25rem;
    margin: 0 auto;
    max-width: 800px;
}

.quick-links-title {
    text-align: center;
    margin-bottom: 1rem;
    color: #333;
    font-weight: 500;
}

.quick-links-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.btn-quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    transition: background-color 0.2s, color 0.2s;
    color: #333;
}

.btn-quick-link:hover {
    background-color: var(--bs-primary);
    color: white;
}

.btn-quick-link i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ===== 11. FOOTER ===== */
footer {
    background-color: var(--dark-gray);
    color: var(--white);
    padding: 2rem 0;
}

/* ===== 12. UTILITY CLASSES ===== */
.bg-light {
    background-color: #f9f9f9 !important;
}

/* Hidden project class */
.hidden-project {
    display: none;
}

/* Animation for revealing hidden projects */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* ===== 13. ANIMATIONS ===== */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 14. MEDIA QUERIES ===== */
@media (max-width: 768px) {
    /* Typography adjustments */
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* Modal adjustments for mobile */
    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        border-radius: 0;
        min-height: 100%;
    }

    /* Remove rounded corners and shadows on mobile carousel */
    #projectCarousel,
    #projectCarousel .carousel-item {
        border-radius: 0;
        box-shadow: none !important;
    }

    /* Thumbnail grid adjustment for small screens */
    #projectThumbnails {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 5px;  /* Wider gap for mobile as requested */
    }

    #projectThumbnails .col-auto {
        margin: 0 3px 3px 0; /* Slightly larger spacing on mobile */
    }

    #projectThumbnails img {
        width: 50px;
    }

    .ratio-map {
        --bs-aspect-ratio: 75%;
    }
}

@media (min-width: 576px) {
    .quick-links-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .ratio-map {
        --bs-aspect-ratio: 90%;
    }
}

@media (min-width: 768px) {
    .ratio-map {
        --bs-aspect-ratio: 65%;
    }
}

@media (min-width: 992px) {
    .quick-links-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .ratio-map {
        --bs-aspect-ratio: 75%;
    }
}

@media (min-width: 1200px) {
    .quick-links-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .ratio-map {
        --bs-aspect-ratio: 50%;
    }
}