/* --- Variables & Reset --- */
:root {
  --black: #0f0f0f;
  --blue: #1f4fd8;
  --grey: #f4f4f4;
  --white: #ffffff;
  --success-green: #e6ffed;
  --border-color: #cccccc;
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body {
  font-family: 'Montserrat', Arial, sans-serif;
  background: var(--white);
  color: var(--black);
  line-height: 1.6;
}

/* --- Header & Nav --- */
header { 
  background: var(--black); 
  padding: 10px 40px; 
  height: 80px;       
  position: relative; 
  z-index: 1000;
}

nav { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  height: 100%;
}

/* Logo Link Wrapper for Clickability */
.logo-link {
  display: inline-block;
  text-decoration: none;
  z-index: 1001;
  position: absolute; /* Keeps the clickable area matched to the image */
  top: 10px;
  left: 40px;
}

nav img { 
  height: 200px;      
  width: auto;
  display: block;
  transition: transform 0.3s ease;
}

nav img:hover {
  transform: scale(1.02); /* Subtle hover effect for desktop */
}

/* Push the links to the right */
nav div {
  margin-left: auto; 
}

nav a { 
  color: var(--white); 
  margin-left: 25px; 
  text-decoration: none; 
  font-weight: 600; 
  transition: color 0.3s ease;
}

nav a:hover { 
  color: var(--blue) !important; 
}

/* --- Hero Section --- */
.hero {
  position: relative;
  text-align: center;
  color: var(--white);
  background: url('../images/hero-bg.jpg') center/cover no-repeat;
  padding: 120px 20px;
}

.hero::after { 
  content: ''; 
  position: absolute; 
  top: 0; left: 0; right: 0; bottom: 0; 
  background: rgba(0,0,0,0.5); 
}

.hero h1, .hero p { 
  position: relative; 
  z-index: 1; 
  font-family: 'Lora', serif; 
}

.hero h1 { font-size: 3rem; margin-bottom: 15px; }
.hero p { font-size: 1.2rem; }

/* --- Layout --- */
section { 
  max-width: 1100px; 
  margin: auto; 
  padding: 80px 20px; 
}

h2 { 
  font-family: 'Lora', serif; 
  font-size: 2rem; 
  margin-bottom: 30px; 
  border-left: 6px solid var(--blue); 
  padding-left: 18px; 
}

/* --- Grid System --- */
/* Update your grid to be smarter */
.grid { 
  display: grid; 
  /* This tells the grid: "Fill the row with as many 280px items as fit, 
     and if there's extra space, grow them to fill it." */
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
  gap: 30px; 
}

/* Ensure images handle missing slots gracefully */
#gallery img, #homepage-portfolio img {
  display: block;
  width: 100%;
}
/* --- Cards --- */
.card { 
  background: var(--grey); 
  border-radius: 12px; 
  padding: 30px; 
  box-shadow: 0 8px 25px rgba(0,0,0,0.1); 
  transition: transform 0.3s ease, box-shadow 0.3s ease; 
}

.card:hover { 
  transform: translateY(-5px); 
  box-shadow: 0 15px 35px rgba(0,0,0,0.2); 
}

/* --- Portfolio & Gallery Images --- */
#homepage-portfolio img,
#gallery img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#homepage-portfolio img:hover,
#gallery img:hover { 
  transform: translateY(-5px); 
}

/* --- Quote Form Styles --- */
#quote-form {
  max-width: 700px;
  margin: 0 auto;
  background: var(--grey);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.form-group { margin-bottom: 25px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; }

input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  background-color: var(--white);
  color: var(--black);
  display: block;
}

select {
  height: 50px;
  cursor: pointer;
  appearance: menulist !important;
  -webkit-appearance: menulist !important;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 8px rgba(31, 79, 216, 0.3);
}

.file-upload-wrapper {
  border: 2px dashed #bbb;
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  background: var(--white);
  cursor: pointer;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 15px;
}

.preview-item {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
}

/* UI Elements */
#success-msg {
  display: none;
  background-color: var(--success-green);
  border: 1px solid var(--blue);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
  font-weight: 600;
}

.button { 
  display: inline-block; 
  background: var(--blue); 
  color: var(--white); 
  padding: 16px 40px; 
  border-radius: 8px; 
  font-weight: bold; 
  text-decoration: none; 
  border: none;
  cursor: pointer;
}

/* --- Lightbox --- */
#lightbox { 
  position: fixed; 
  top: 0; left: 0; right: 0; bottom: 0; 
  background: rgba(0,0,0,0.9); 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  opacity: 0; 
  pointer-events: none; 
  transition: opacity 0.3s ease; 
  z-index: 2000;
  cursor: default;
}

#lightbox.active { 
  opacity: 1; 
  pointer-events: all; 
}

#lightbox img { 
  max-width: 90%; 
  max-height: 85%; 
  border-radius: 12px; 
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  cursor: default;
}

#close-lightbox {
  position: absolute;
  top: 20px;
  right: 30px;
  color: var(--white);
  font-size: 60px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2001;
  line-height: 1;
}

#close-lightbox:hover {
  color: var(--blue);
}

/* Footer */
footer { background: var(--black); color: #aaa; text-align: center; padding: 40px; font-size: 0.9rem; }

/* --- RESPONSIVE / MOBILE LAYOUT --- */
@media (max-width: 768px) {
  header {
    height: auto;
    padding: 15px 10px !important;
  }

  nav {
    flex-direction: column !important;
    align-items: center;
  }

  .logo-link {
    position: relative; /* Reset absolute positioning for mobile flow */
    top: 0;
    left: 0;
    margin-bottom: 15px;
  }

  nav img { 
    height: 120px;      
    position: relative;
    top: 0;
    left: 0;
  }

  nav div {
    display: flex;
    justify-content: center;
    gap: 15px;
    width: 100%;
    margin-left: 0; 
  }

  nav a {
    margin-left: 0 !important;
    font-size: 0.9rem;
  }

  .hero, section:first-of-type {
    padding-top: 40px !important; 
  }

  #homepage-portfolio.grid, #gallery.grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
    padding: 10px;
  }

  /* Target images with the class used in your JS */
  .gallery-thumb, #homepage-portfolio img, #gallery img {
    width: 100%;
    height: 280px;
  }
}