/* CSS Variables for new color scheme */
:root {
    --slate-dark: #2d3748;
    --slate-medium: #4a5568;
    --slate-light: #718096;
    --slate-lighter: #a0aec0;
    --slate-lightest: #e2e8f0;
    --forest-green: #2f855a;
    --forest-green-light: #38a169;
    --forest-green-dark: #22543d;
    --rusty-brown: #c05621;
    --rusty-brown-light: #dd6b20;
    --rusty-brown-dark: #9c4221;
    --white: #ffffff;
    --off-white: #f7fafc;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--slate-dark);
    background: var(--off-white);
    overflow-x: hidden;
}

/* Disable background scrolling when any modal is open */
body:has(.css-modal:target) {
    overflow: hidden;
}

/* Alternative approach for browsers that don't support :has() */
.css-modal:target ~ body,
.css-modal:target ~ html {
    overflow: hidden;
}

/* More reliable approach using :target on html */
html:has(.css-modal:target) {
    overflow: hidden;
}

/* Fallback for older browsers */
.css-modal:target {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    position: fixed;
    top: 0;
    width: 100%;
    height: 70px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(45, 55, 72, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    isolation: isolate;
    transition: all 0.3s ease;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
}

/* Mobile menu open state - expand navbar to full height */
.mobile-menu-toggle:checked ~ .navbar {
    height: 100vh;
}

/* Fallback for browsers that don't support backdrop-filter */
@supports not (backdrop-filter: blur(15px)) {
    .navbar {
        background: rgba(255, 255, 255, 0.95);
    }
    
    .mobile-menu-toggle:checked ~ .navbar {
        background: rgba(255, 255, 255, 0.95);
    }
    
    .mobile-menu {
        background: transparent;
    }
}

.nav-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 20px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    grid-row: 1;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0;
}

.logo {
    width: 32px;
    height: 32px;
    margin-right: -5px;
    fill: var(--slate-dark);
}

.logo svg {
    fill: var(--slate-dark);
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--slate-dark);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
}

.logo-t {
    margin-left: -2px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--slate-dark);
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-link:hover {
    color: var(--forest-green);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    transition: width 0.3s ease;
}

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

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    text-decoration: none;
    width: 30px;
    height: 30px;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1001;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--slate-dark);
    margin: 2px 0;
    transition: 0.3s ease;
    transform-origin: center;
}

/* Morph hamburger to X when menu is open */
.mobile-menu-toggle:checked ~ .navbar .hamburger .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle:checked ~ .navbar .hamburger .bar:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle:checked ~ .navbar .hamburger .bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Alternative selector for when hamburger is inside the navbar */
.navbar .mobile-menu-toggle:checked ~ .hamburger .bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.navbar .mobile-menu-toggle:checked ~ .hamburger .bar:nth-child(2) {
    opacity: 0;
}

.navbar .mobile-menu-toggle:checked ~ .hamburger .bar:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Change hamburger link target when menu is open */
.mobile-menu-toggle:checked ~ .navbar .hamburger {
    pointer-events: auto;
}

/* Make the hamburger work as a close button when menu is open */
.mobile-menu-toggle:checked ~ .navbar .hamburger::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1002;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 55, 72, 0.4);
    z-index: -1;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--white);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.gradient-text {
    color: #22c55e;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--white);
    margin-bottom: 2rem;
    line-height: 1.6;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(47, 133, 90, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(47, 133, 90, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.7);
    color: var(--forest-green);
    border: 2px solid var(--forest-green);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: var(--forest-green);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(47, 133, 90, 0.6);
}

.hero-visual {
    position: relative;
    height: 400px;
}

.floating-elements {
    position: relative;
    width: 100%;
    height: 100%;
}

.floating-card {
    position: absolute;
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(45, 55, 72, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    animation: float 6s ease-in-out infinite;
    transform: scale(1);
}

.floating-card.card-1 {
    top: 15%;
    left: 5%;
    animation-delay: 0s;
}

.floating-card.card-2 {
    top: 60%;
    right: 8%;
    animation-delay: 2s;
}

.floating-card.card-3 {
    bottom: 10%;
    left: 25%;
    animation-delay: 4s;
}

.floating-card i {
    font-size: 2rem;
    color: var(--forest-green);
}

.floating-card span {
    font-weight: 600;
    color: var(--slate-dark);
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

.scroll-arrow {
    width: 30px;
    height: 30px;
    border: 2px solid var(--forest-green);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* Section Styles */
.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--slate-medium);
    max-width: 600px;
    margin: 0 auto;
}

/* About Section */
.about {
    padding: 6rem 0;
    background: var(--white);
    position: relative;
}

.about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 4rem;
    margin: 3rem 0;
    align-items: start;
}

.about-left {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--slate-medium);
    font-size: 1.1rem;
    line-height: 1.8;
}

.about-text p:last-child {
    margin-bottom: 0;
}

.skills {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.skill-category {
    margin-bottom: 0;
}

.skill-category h3 {
    font-size: 1.2rem;
    color: var(--slate-dark);
    margin-bottom: 1rem;
    font-weight: 600;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skill-tag {
    background: linear-gradient(135deg, var(--forest-green-light) 0%, var(--forest-green) 100%);
    color: var(--white);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.3s ease;
}

.about-stats {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: 100%;
    justify-content: space-between;
}

.stat-item {
    background: linear-gradient(135deg, var(--slate-lightest) 0%, var(--off-white) 100%);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--slate-lightest);
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--forest-green);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    color: var(--slate-medium);
    font-size: 1rem;
    font-weight: 500;
}

/* Projects Section - Masonry Grid */
.projects {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--off-white) 0%, var(--slate-lightest) 100%);
    position: relative;
}

.projects::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(45, 55, 72, 0.4));
    pointer-events: none;
    z-index: 1;
}

.projects::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    background: linear-gradient(to left, transparent, rgba(45, 55, 72, 0.4));
    pointer-events: none;
    z-index: 1;
}

.projects-container {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px; /* Minimal space for scrollbar */
    position: relative;
    width: 100vw; /* Full viewport width */
    margin-left: calc(-50vw + 50%); /* Center the container */
    padding-left: 2rem; /* Add some padding from the left edge */
    padding-right: 2rem; /* Add some padding from the right edge */
}

/* Custom scrollbar for projects container */
.projects-container::-webkit-scrollbar {
    height: 8px;
}

.projects-container::-webkit-scrollbar-track {
    background: rgba(45, 55, 72, 0.1);
    border-radius: 4px;
}

.projects-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    border-radius: 4px;
}

.projects-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--forest-green-light) 0%, var(--forest-green) 100%);
}

.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 300px); /* Auto-fit columns based on content */
    grid-auto-rows: 175px; /* Smaller base row height for more flexibility */
    gap: 2rem;
    height: auto; /* Dynamic height based on content */
    padding: 10px 0; /* Add padding to prevent hover clipping */
    justify-content: center; /* Center the grid when not full width */
}

.masonry-item {
    break-inside: avoid;
    cursor: pointer;
    transition: transform 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

/* Desktop masonry sizing for different items */
.masonry-item:nth-child(3n+1) {
    grid-row: span 2; /* Every 3rd item starting from 1st gets 2 rows */
}

.masonry-item:nth-child(5n+2) {
    grid-row: span 3; /* Every 5th item starting from 2nd gets 3 rows */
}

.masonry-item:nth-child(7n+3) {
    grid-row: span 2; /* Every 7th item starting from 3rd gets 2 rows */
}

.masonry-item:nth-child(11n+4) {
    grid-row: span 4; /* Every 11th item starting from 4th gets 4 rows */
}

.masonry-item:nth-child(13n+5) {
    grid-row: span 2; /* Every 13th item starting from 5th gets 2 rows */
}

.masonry-item:nth-child(17n+6) {
    grid-row: span 3; /* Every 17th item starting from 6th gets 3 rows */
}

.masonry-item:nth-child(19n+7) {
    grid-row: span 2; /* Every 19th item starting from 7th gets 2 rows */
}

.masonry-item:nth-child(23n+8) {
    grid-row: span 3; /* Every 23rd item starting from 8th gets 3 rows */
}

.masonry-item:hover {
    transform: translateY(-5px);
}

.project-tile {
    position: relative;
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(45, 55, 72, 0.08);
    transition: all 0.3s ease;
    height: 100%;
}

.project-tile:hover {
    box-shadow: 0 8px 20px rgba(45, 55, 72, 0.12);
}

.project-image {
    height: 100%; /* Changed from 250px to 100% to fill entire tile */
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.project-tile:hover .project-image img {
    transform: scale(1.05);
}

.project-placeholder {
    color: var(--white);
    font-size: 3rem;
    opacity: 0.8;
}

.project-placeholder.small {
    font-size: 1.5rem;
}

.project-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(45, 55, 72, 0.8));
    color: var(--white);
    padding: 2rem 1.5rem 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.project-tile:hover .project-overlay {
    transform: translateY(0);
}

.project-overlay h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-overlay p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* CSS-Only Modal Styles */
.css-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 55, 72, 0.9);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    place-items: center;
    padding: 20px;
}

.css-modal:target {
    opacity: 1;
    visibility: visible;
}

.css-modal .modal-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(45, 55, 72, 0.3);
    transition: transform 0.3s ease;
    max-height: 90vh;
    min-height: 500px;
    overflow: hidden;
    transform: scale(0.9);
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr;
}

.css-modal:target .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 0;
    color: var(--slate-medium);
    text-decoration: none;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0;
    transform: translateZ(0);
    text-align: center;
    vertical-align: middle;
    grid-row: 1;
    grid-column: 1;
    justify-self: end;
}

.close-modal::before,
.close-modal::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 2px;
    background-color: currentColor;
    transition: all 0.3s ease;
}

.close-modal::before {
    transform: rotate(45deg);
}

.close-modal::after {
    transform: rotate(-45deg);
}

.close-modal:hover {
    background: var(--slate-lightest);
    color: var(--slate-dark);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    position: relative;
    height: 100%;
    min-height: 400px;
    padding: 1rem;
    grid-row: 2;
    overflow: hidden;
}

.modal-image {
    position: relative;
    height: 100%;
    min-height: 400px;
    max-height: none;
    background: linear-gradient(135deg, var(--slate-lightest) 0%, var(--off-white) 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex: 1;
}

.modal-image .main-image,
.modal-image .gallery-image {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 10px;
}

.modal-image .project-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--slate-medium);
    background: transparent;
    transition: all 0.3s ease;
    max-width: 80%;
    max-height: 80%;
    margin: auto;
}

.modal-image .project-placeholder.main-image {
    display: flex;
}

.modal-image .project-placeholder.gallery-image {
    display: none;
}

.modal-image {
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.modal-image.gallery-image {
    display: none;
}

.modal-image.main-image {
    display: block;
}

.modal-image .main-image {
    display: block;
}

.modal-image .gallery-image {
    display: none;
}

.modal-info {
    padding: 1rem;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--slate-dark);
    flex-shrink: 0;
}

.modal-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--slate-medium);
    margin-bottom: 1.5rem;
}

.modal-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.modal-content-scrollable {
    overflow-y: auto;
    flex: 1;
    padding-right: 0.5rem;
}

.modal-gallery {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

/* Custom scrollbar for modal content */
.css-modal .modal-content::-webkit-scrollbar {
    width: 8px;
}

.css-modal .modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.css-modal .modal-content::-webkit-scrollbar-thumb {
    background: var(--slate-light);
    border-radius: 4px;
}

.css-modal .modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--slate-medium);
}

/* Custom scrollbar for modal info section */
.modal-info::-webkit-scrollbar {
    width: 6px;
}

.modal-info::-webkit-scrollbar-track {
    background: transparent;
}

.modal-info::-webkit-scrollbar-thumb {
    background: var(--slate-light);
    border-radius: 3px;
}

.modal-info::-webkit-scrollbar-thumb:hover {
    background: var(--slate-medium);
}



.detail-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--slate-lightest);
    font-size: 1rem;
    color: var(--slate-medium);
}

.detail-item:last-child {
    border-bottom: none;
}



.gallery-item {
    flex: 1;
    min-width: 80px;
    height: 80px;
    background: var(--off-white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border: 2px solid transparent;
}

.gallery-item:hover {
    background: var(--slate-lightest);
    transform: scale(1.05);
    z-index: 10;
    border-color: var(--forest-green);
}

.gallery-item.active {
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    color: var(--white);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(47, 133, 90, 0.4);
    border-color: var(--forest-green);
}

.gallery-item.active .project-placeholder {
    color: var(--white);
}

/* Gallery hover effect using CSS sibling selector */
.modal-gallery:hover ~ .modal-image {
    transform: scale(1.02);
}

/* When any gallery item is hovered, scale the modal image */
.modal-gallery:has(.gallery-item:hover) ~ .modal-image {
    transform: scale(1.05);
}

/* Modal Image Switching - Generic for all modals */
.modal-image .gallery-image {
    display: none;
}

/* Show main image by default, hide others */
.modal-image .main-image {
    display: flex;
}

/* Generic selectors for any modal with radio groups */
input[type="radio"][id^="modal-"][id$="-main"]:checked ~ .css-modal .modal-image .main-image {
    display: flex;
}

input[type="radio"][id^="modal-"][id$="-main"]:checked ~ .css-modal .modal-image .gallery-image {
    display: none;
}

/* Show gallery images when their radio is checked */
input[type="radio"][id^="modal-"][id$="-1"]:checked ~ .css-modal .modal-image .main-image {
    display: none;
}

input[type="radio"][id^="modal-"][id$="-1"]:checked ~ .css-modal .modal-image .gallery-image[data-image="gallery1"] {
    display: block;
}

input[type="radio"][id^="modal-"][id$="-2"]:checked ~ .css-modal .modal-image .main-image {
    display: none;
}

input[type="radio"][id^="modal-"][id$="-2"]:checked ~ .css-modal .modal-image .gallery-image[data-image="gallery2"] {
    display: block;
}

input[type="radio"][id^="modal-"][id$="-3"]:checked ~ .css-modal .modal-image .main-image {
    display: none;
}

input[type="radio"][id^="modal-"][id$="-3"]:checked ~ .css-modal .modal-image .gallery-image[data-image="gallery3"] {
    display: block;
}

/* Global modal image switching (for radio buttons inside modal containers) */
.css-modal input[type="radio"][id$="-main"]:checked ~ .modal-content .modal-image .main-image {
    display: block;
}

.css-modal input[type="radio"][id$="-main"]:checked ~ .modal-content .modal-image .gallery-image {
    display: none;
}

.css-modal input[type="radio"][id$="-1"]:checked ~ .modal-content .modal-image .main-image {
    display: none;
}

.css-modal input[type="radio"][id$="-1"]:checked ~ .modal-content .modal-image .gallery-image[data-image="gallery1"] {
    display: block;
}

.css-modal input[type="radio"][id$="-2"]:checked ~ .modal-content .modal-image .main-image {
    display: none;
}

.css-modal input[type="radio"][id$="-2"]:checked ~ .modal-content .modal-image .gallery-image[data-image="gallery2"] {
    display: block;
}

.css-modal input[type="radio"][id$="-3"]:checked ~ .modal-content .modal-image .main-image {
    display: none;
}

.css-modal input[type="radio"][id$="-3"]:checked ~ .modal-content .modal-image .gallery-image[data-image="gallery3"] {
    display: block;
}

/* Generic selectors for when radio buttons are inside modal container */
.css-modal input[type="radio"][id$="-main"]:checked ~ .modal-content .modal-image.main-image {
    display: block;
}

.css-modal input[type="radio"][id$="-main"]:checked ~ .modal-content .modal-image.gallery-image {
    display: none;
}

.css-modal input[type="radio"][id$="-1"]:checked ~ .modal-content .modal-image.main-image {
    display: none;
}

.css-modal input[type="radio"][id$="-1"]:checked ~ .modal-content .modal-image.gallery-image[data-image="gallery1"] {
    display: block;
}

.css-modal input[type="radio"][id$="-2"]:checked ~ .modal-content .modal-image.main-image {
    display: none;
}

.css-modal input[type="radio"][id$="-2"]:checked ~ .modal-content .modal-image.gallery-image[data-image="gallery2"] {
    display: block;
}

.css-modal input[type="radio"][id$="-3"]:checked ~ .modal-content .modal-image.main-image {
    display: none;
}

.css-modal input[type="radio"][id$="-3"]:checked ~ .modal-content .modal-image.gallery-image[data-image="gallery3"] {
    display: block;
}

/* Generic thumbnail highlighting for selected image */
.css-modal input[type="radio"][id$="-main"]:checked ~ .modal-content .modal-gallery label[for$="-main"] {
    border: 2px solid var(--forest-green);
    background: var(--forest-green-light);
}

.css-modal input[type="radio"][id$="-1"]:checked ~ .modal-content .modal-gallery label[for$="-1"] {
    border: 2px solid var(--forest-green);
    background: var(--forest-green-light);
}

.css-modal input[type="radio"][id$="-2"]:checked ~ .modal-content .modal-gallery label[for$="-2"] {
    border: 2px solid var(--forest-green);
    background: var(--forest-green-light);
}

.css-modal input[type="radio"][id$="-3"]:checked ~ .modal-content .modal-gallery label[for$="-3"] {
    border: 2px solid var(--forest-green);
    background: var(--forest-green-light);
}

/* Gallery item styling for labels */
.modal-gallery .gallery-item {
    cursor: pointer;
    display: inline-block;
    margin: 0 0.5rem 0.5rem 0;
    transition: transform 0.2s ease;
    text-align: center;
    height: 80px;
    background: var(--off-white);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.modal-gallery .gallery-item .project-placeholder.small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin: 0;
    font-size: 1.5rem;
}

.modal-gallery .gallery-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    object-position: center;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.modal-gallery .gallery-item:hover img {
    transform: scale(1.05);
}

.modal-gallery .gallery-item:hover {
    transform: scale(1.05);
    background: var(--slate-lightest);
}

/* Active state for selected image - Generic */
input[type="radio"][id^="modal-"]:checked ~ .css-modal .modal-gallery label[for]:hover {
    transform: scale(1.05);
}

/* Specific active state styling */
input[type="radio"][id^="modal-"]:checked ~ .css-modal .modal-gallery label[for] {
    border: 2px solid transparent;
    border-radius: 8px;
}

input[type="radio"][id^="modal-"]:checked ~ .css-modal .modal-gallery label[for]:hover {
    border-color: var(--forest-green);
}

/* Contact Section */
.contact {
    padding: 100px 0;
    background: var(--white);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
}

.contact-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
}

.contact-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.2rem;
}

.contact-details h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--slate-dark);
}

.contact-details p {
    color: var(--slate-medium);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.social-link {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--forest-green-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    text-decoration: none;
    transition: transform 0.3s ease;
}

.social-link:hover {
    transform: translateY(-3px);
}

.contact-form {
    background: var(--off-white);
    padding: 2rem;
    border-radius: 20px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--slate-lightest);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    font-family: inherit;
    background: var(--white);
    color: var(--slate-dark);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--forest-green);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

/* Footer */
.footer {
    background: var(--slate-dark);
    color: var(--white);
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-areas: 
        "logo"
        "text"
        "links";
    gap: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

.footer-logo {
    grid-area: logo;
    display: grid;
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 0;
}

.footer-logo .logo {
    width: 45px;
    height: 45px;
    filter: brightness(0) invert(1);
}

.footer-logo .logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    -webkit-text-fill-color: white;
}

.footer-text {
    grid-area: text;
    color: var(--slate-lighter);
    margin-bottom: 0;
}

.footer-links {
    grid-area: links;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2rem;
    justify-content: center;
    margin-bottom: 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.footer-links a {
    color: var(--slate-lighter);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--slate-medium);
    color: var(--slate-lighter);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
}

/* Mobile Menu */
.mobile-menu {
    grid-row: 2;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.mobile-menu-toggle:checked ~ .navbar .mobile-menu {
    display: flex;
}

/* Fallback for browsers that don't support backdrop-filter */
@supports not (backdrop-filter: blur(15px)) {
    .mobile-menu {
        background: transparent;
    }
}

.close-menu {
    grid-area: close;
    justify-self: end;
    align-self: start;
    font-size: 2rem;
    color: var(--slate-dark);
    text-decoration: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
    cursor: pointer;
    margin: 20px 20px 0 0;
}

.close-menu:hover {
    background: var(--slate-lightest);
}

.mobile-nav-menu {
    list-style: none;
    text-align: center;
    padding: 0;
    margin: 0;
}

.mobile-nav-menu li {
    margin: 1.5rem 0;
}

.mobile-nav-link {
    text-decoration: none;
    color: var(--slate-dark);
    font-size: 1.5rem;
    font-weight: 500;
    transition: color 0.3s ease;
    display: block;
    padding: 1rem;
}

.mobile-nav-link:hover {
    color: var(--forest-green);
}

/* Responsive Design */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
        text-decoration: none;
    }

    .nav-menu {
        display: none;
    }

    .hero {
        min-height: calc(100vh - 70px); /* Account for fixed header */
        padding-top: 90px; /* Increased padding to prevent content from going under header */
        align-items: center;
    }
    
    .hero-background-video {
        object-position: center;
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
        padding-top: 2rem; /* Additional top padding for better centering */
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-visual {
        height: 300px;
    }

    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .about-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-around;
    }

    .stat-item {
        flex: 0 1 calc(33.333% - 2rem);
        min-width: 200px;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .masonry-grid {
        grid-template-columns: repeat(auto-fit, 187px); /* Auto-fit columns based on content */
        grid-auto-rows: 93px; /* 2/3 of 140px = ~93px */
        height: auto; /* Dynamic height based on content */
        gap: 0.75rem; /* Smaller gap on mobile */
        justify-content: center; /* Center the grid when not full width */
    }

    .projects-container {
        padding-bottom: 10px; /* Less padding on mobile */
        padding-left: 1rem; /* Less padding on mobile */
        padding-right: 1rem; /* Less padding on mobile */
    }

    .hero-buttons {
        justify-content: center;
    }

    .floating-card {
        transform: scale(0.7);
        padding: 14px;
    }

    .floating-card.card-1 {
        top: 10%;
        left: 2%;
    }

    .floating-card.card-2 {
        top: 65%;
        right: 5%;
    }

    .floating-card.card-3 {
        bottom: 8%;
        left: 10%;
    }

    .css-modal .modal-content {
        width: 95%;
        margin: 10px auto;
        max-height: 90vh;
        display: grid;
        grid-template-rows: auto 1fr;
        grid-template-columns: 1fr;
        overflow: auto;
        padding: 0;
    }

    .modal-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: 100%;
        min-height: auto;
        display: grid;
        overflow: auto;
        padding: 0;
        grid-row: 2;
    }
    
    .modal-image {
        position: relative;
        height: 250px;
        min-height: 250px;
        max-height: 250px;
        background: linear-gradient(135deg, var(--slate-lightest) 0%, var(--off-white) 100%);
        border-radius: 20px 20px 0 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(45, 55, 72, 0.15);
        z-index: 2;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        margin: 0 -1rem;
        width: calc(100% + 2rem);
    }
    
    .modal-info {
        padding: 1.5rem;
        overflow-y: visible;
        max-height: none;
        flex: 1;
        height: auto;
    }

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

    .modal-description {
        font-size: 1rem;
    }

    .modal-gallery {
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        display: flex;
    }
    
    .modal-gallery::-webkit-scrollbar {
        height: 4px;
    }
    
    .modal-gallery::-webkit-scrollbar-track {
        background: var(--slate-lightest);
        border-radius: 2px;
    }
    
    .modal-gallery::-webkit-scrollbar-thumb {
        background: var(--slate-medium);
        border-radius: 2px;
    }
    
    .modal-gallery::-webkit-scrollbar-thumb:hover {
        background: var(--slate-dark);
    }
    
    .modal-gallery .gallery-item {
        flex-shrink: 0;
        min-width: 60px;
        width: 60px;
    }

    .gallery-item {
        min-width: 60px;
        height: 60px;
    }

    .modal-gallery .gallery-item .project-placeholder.small {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .social-links {
        justify-content: center;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Specific fix for transition points between 769px and 990px */
@media (max-width: 990px) and (min-width: 769px) {
    .hero {
        padding-top: 100px; /* Extra padding for this specific breakpoint */
    }
    
    .hero-container {
        padding-top: 3rem; /* Additional container padding */
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }

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

    .container {
        padding: 0 15px;
    }

    .css-modal .modal-content {
        width: 95%;
        margin: 20px;
    }

    .modal-info {
        padding: 1.5rem;
    }
    
    .modal-image {
        height: 250px;
        min-height: 250px;
        max-height: 250px;
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }
}

@media (min-width: 1200px) {
    .hero-title {
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
    }
    
    .hero-subtitle {
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
    }
}

/* Modal Toggle Radio Buttons */
.modal-toggle,
.modal-img-radio {
    display: none;
}

/* FAQ Section */
.faq {
    padding: 5rem 0;
    background: var(--off-white);
}

.faq-content {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    gap: 2rem;
}

.faq-item {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(45, 55, 72, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.faq-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(45, 55, 72, 0.15);
}

.faq-item h3 {
    color: var(--slate-dark);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.faq-item p {
    color: var(--slate-medium);
    line-height: 1.6;
    margin: 0;
}

/* Contact Section Updates */
.contact-item {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(45, 55, 72, 0.1);
    transition: transform 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-2px);
}
