/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  scroll-behavior: smooth;
  background-color: #FCFAFA;
  color: #333;
}

body {
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header and Navigation */
header {
  background-color: #500000; /* TAMU maroon */
  color: #fff;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 1px;
  color: #F2D5D5;
  text-decoration: none;
}

nav {
  position: relative;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

nav ul li a {
  color: #F2D5D5;
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 0;
  transition: color 0.3s ease;
}

nav ul li a:hover,
nav ul li a:focus,
nav ul li a.active {
  color: #FFF5F5;
  border-bottom: 2px solid #FFF5F5;
}

/* Responsive Navigation Toggle Button */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: #F2D5D5;
  font-size: 1.5rem;
}

.nav-toggle:focus {
  outline: 2px solid #FFF5F5;
  outline-offset: 2px;
}

/* Main Content */
main {
  flex-grow: 1;
  padding: 2rem 0;
}

/* Footer */
footer {
  background-color: #500000;
  color: #F2D5D5;
  text-align: center;
  padding: 1rem 0;
  font-size: 0.9rem;
}

/* Headings */
h1, h2, h3 {
  color: #500000;
  margin-bottom: 1rem;
  font-weight: 700;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.25rem;
}

/* Paragraphs */
p {
  margin-bottom: 1rem;
  color: #444;
}

/* Buttons */
button, .btn {
  background-color: #500000;
  color: #FFF5F5;
  border: none;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  user-select: none;
}

button:hover, .btn:hover,
button:focus, .btn:focus {
  background-color: #700000;
  outline: none;
}

/* Services Filter Section */
.services-filter {
  margin-bottom: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.services-filter button {
  background-color: #F4E8E8;
  color: #500000;
  font-weight: 600;
  border-radius: 20px;
  padding: 0.5rem 1rem;
  border: 2px solid transparent;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.services-filter button.active,
.services-filter button:hover,
.services-filter button:focus {
  background-color: #500000;
  color: #FFF5F5;
  border-color: #F2D5D5;
  outline: none;
}

/* Services List */
.services-list {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 1.5rem;
}

.service-card {
  background-color: #fff;
  border: 1px solid #E4D4D4;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 2px 6px rgba(26,42,108,0.1);
  transition: box-shadow 0.3s ease;
}

.service-card:hover,
.service-card:focus-within {
  box-shadow: 0 4px 12px rgba(26,42,108,0.2);
}

.service-card h3 {
  margin-bottom: 0.75rem;
  color: #500000;
}

.service-card p {
  color: #555;
  font-size: 0.95rem;
}

/* Projects Section */
.projects-list {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(280px,1fr));
  gap: 1.5rem;
}

.project-card {
  background-color: #fff;
  border: 1px solid #E4D4D4;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(26,42,108,0.1);
  transition: box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover,
.project-card:focus-within {
  box-shadow: 0 4px 12px rgba(26,42,108,0.2);
}

.project-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background-color: #F4E8E8;
}

.project-content {
  padding: 1rem;
  flex-grow: 1;
}

.project-content h3 {
  margin-bottom: 0.5rem;
  color: #500000;
}

.project-content p {
  color: #555;
  font-size: 0.95rem;
  flex-grow: 1;
}

/* Contact Form */
.contact-form {
  max-width: 600px;
  background-color: #fff;
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid #E4D4D4;
  box-shadow: 0 2px 6px rgba(26,42,108,0.1);
}

.contact-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #500000;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-bottom: 1.25rem;
  border: 1px solid #C9A3A3;
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
  border-color: #500000;
  outline: none;
}

.contact-form textarea {
  min-height: 120px;
}

.contact-form button[type="submit"] {
  width: 100%;
}

/* 404 Page */
.error-container {
  text-align: center;
  padding: 4rem 1rem;
}

.error-container h1 {
  font-size: 6rem;
  color: #500000;
  margin-bottom: 1rem;
}

.error-container p {
  font-size: 1.25rem;
  color: #555;
  margin-bottom: 2rem;
}

.error-container a.btn {
  max-width: 200px;
  margin: 0 auto;
  display: inline-block;
}

/* Responsive Styles */
@media (max-width: 768px) {
  nav ul {
    flex-direction: column;
    background-color: #500000;
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 8px rgba(26,42,108,0.3);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  nav ul.open {
    max-height: 500px;
  }

  nav ul li {
    margin: 0;
  }

  nav ul li a {
    display: block;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #650000;
  }

  .nav-toggle {
    display: block;
  }
}

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

  h2 {
    font-size: 1.5rem;
  }

  .service-card, .project-card {
    padding: 1rem;
  }

  .contact-form {
    padding: 1rem;
  }
}

/* Desktop navigation */
@media (min-width: 769px) {
  #nav-toggle {
    display: none;
  }

  #nav-menu {
    display: block;
  }

  #nav-menu ul {
    display: flex;
    align-items: center;
    gap: 24px;
    list-style: none;
    margin: 0;
    padding: 0;
  }

  #nav-menu a {
    text-decoration: none;
  }
}

/* Mobile navigation */
@media (max-width: 768px) {
  #nav-toggle {
    display: block;
    cursor: pointer;
  }

  #nav-menu {
    display: none;
  }

  #nav-menu.nav-menu_visible {
    display: block;
  }

  #nav-menu ul {
    display: flex;
    flex-direction: column;
    gap: 12px;
    list-style: none;
    padding: 16px 0;
  }
}


/* Homepage hero layout */
.hero {
  padding: 3rem 0;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  align-items: center;
  gap: 2.5rem;
}

.hero-content h1 {
  margin-top: 0;
}

.hero-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
}

/* Stack hero content on smaller screens */
@media (max-width: 768px) {
  .hero-layout {
    grid-template-columns: 1fr;
  }

  .hero-image {
    max-width: 550px;
    margin: 0 auto;
  }
}