/*
 * Global Stylesheet for Blackline Motors Website
 *
 * This stylesheet defines the look and feel of the Blackline Motors
 * dealership website. The design takes inspiration from the provided
 * branding: refined serif typefaces, crisp lines and a neutral,
 * cream‑coloured backdrop offset with deep blacks and warm accent
 * tones. Care has been taken to ensure that colours meet contrast
 * requirements for accessibility and that the layout responds
 * gracefully to different device sizes. Utility classes and variables
 * make it easy to adjust the design consistently across pages.
 */

/* CSS Custom Properties (Theme Variables) */
:root {
  --font-heading: 'Merriweather', serif;
  --font-body: 'Poppins', sans-serif;
  --color-background: #f7f1e4; /* soft cream background */
  --color-foreground: #121212; /* near black for high contrast */
  --color-accent: #b89a72; /* warm neutral accent colour */
  --color-primary: #000000;
  --color-secondary: #4a4a4a;
  --color-light: #ffffff;
  --nav-height: 70px;
  --transition-duration: 0.3s;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  line-height: 1.6;
  background-color: var(--color-background);
  color: var(--color-secondary);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-duration);
}

a:focus,
a:hover {
  color: var(--color-accent);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-primary);
}

h1 { font-size: 2.5rem; line-height: 1.2; }
h2 { font-size: 2rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.5rem; margin-bottom: 0.3rem; }

p {
  margin-bottom: 1rem;
}

/* Navigation */
header {
  width: 100%;
  background-color: var(--color-light);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

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

.logo img {
  height: 50px;
  width: auto;
}

nav {
  display: flex;
  align-items: center;
}

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

nav a {
  font-weight: 500;
  padding: 0.25rem 0;
}

nav a.active {
  color: var(--color-accent);
}

/* Mobile navigation toggle */
#nav-toggle {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--color-primary);
}

/* Hero Section */
.hero {
  position: relative;
  width: 100%;
  height: 70vh;
  /* The hero section serves as a container for the hero image and overlay. */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: var(--color-light);
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* Apply a subtle dark overlay to the hero image. This helps the
     white text stand out against the photograph while still allowing
     the car’s details to be seen. */
  background: rgba(0, 0, 0, 0.25);
  z-index: 0;
}

/* Hero background image inserted via an <img> element in the markup.
   Position it absolutely so it fills the hero section and sits beneath
   the overlay and content. object-fit: cover maintains aspect ratio
   while cropping to fill the available space. */
.hero .hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 700px;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  color: var(--color-light);
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  color: var(--color-light);
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  background-color: var(--color-accent);
  color: var(--color-light);
  font-weight: 600;
  transition: background-color var(--transition-duration);
  border: none;
}

.btn:hover,
.btn:focus {
  /* Slightly darken the button on hover by decreasing brightness */
  filter: brightness(0.9);
}

/* Utility classes */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1rem;
}

.section {
  padding: 4rem 0;
}

.grid {
  display: grid;
  gap: 2rem;
}

/* Features section */
.features {
  text-align: center;
}

.features-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 2rem;
}

.feature {
  background-color: var(--color-light);
  padding: 2rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: transform var(--transition-duration), box-shadow var(--transition-duration);
}

.feature:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feature i {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--color-accent);
}

/* Vehicle cards */
.cards {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.card {
  background-color: var(--color-light);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-duration), box-shadow var(--transition-duration);
  /* Establish a positioning context so badges or overlays can be
     absolutely positioned relative to each card */
  position: relative;
}

/* Sold badge styling */
.sold-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background-color: var(--color-accent);
  color: var(--color-light);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 3px;
  z-index: 1;
  text-transform: uppercase;
}

/* When a card represents a sold vehicle, reduce button visibility and disable pointer */
.card.sold .btn {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

/* Brand highlight section */
.logo-highlight {
  background-color: var(--color-light);
  padding: 2rem 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

/* Increase the size of the brand logo displayed in the highlight section
   on the home page. A larger width helps the logo stand out as a key
   visual element while still maintaining responsive behavior. */
.logo-highlight .brand-large {
  width: 320px;
  height: auto;
  margin: 0 auto;
  display: block;
}

/* Page-specific logo used on content pages like the contact page. It
   centres the logo and sets a larger width than the default logo in the
   navigation bar. Using a dedicated class avoids inline styling in
   individual HTML files and keeps styling consistent. */
.page-logo {
  width: 180px;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card-body {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-body h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.card-body .price {
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 0.5rem;
}

.card-body p {
  font-size: 0.9rem;
  flex-grow: 1;
  margin-bottom: 1rem;
}

.card-body button {
  align-self: flex-start;
}

/* Footer */
footer {
  background-color: var(--color-primary);
  color: var(--color-light);
  padding: 2rem 0;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  padding: 0 1rem;
}

.footer-logo img {
  height: 40px;
  width: auto;
  margin-bottom: 1rem;
}

.footer-section h3 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.social-icons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.social-icons a {
  color: var(--color-light);
  font-size: 1.25rem;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: var(--color-secondary);
  transition: background-color var(--transition-duration);
}

.social-icons a:hover,
.social-icons a:focus {
  background-color: var(--color-accent);
}

/* Inventory page specific styles */
.inventory-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.inventory-controls input[type="text"],
.inventory-controls select {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--transition-duration), visibility var(--transition-duration);
  z-index: 10000;
}

.modal.active {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  background-color: var(--color-light);
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 2rem;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-primary);
}

/* Contact page */
.contact-info {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 3rem;
}

.contact-item h4 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.contact-form {
  background-color: var(--color-light);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.contact-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-family: var(--font-body);
}

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

.contact-form button {
  cursor: pointer;
}

/* About page */
.about-section {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  align-items: center;
  margin-top: 2rem;
}

.about-image {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.about-text h2 {
  margin-bottom: 1rem;
}

.about-text p {
  margin-bottom: 1rem;
}

/* Responsive behaviour */
@media (max-width: 768px) {
  nav ul {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background-color: var(--color-light);
    flex-direction: column;
    gap: 0;
    display: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }
  nav ul.open {
    display: flex;
  }
  nav li {
    padding: 1rem;
    border-bottom: 1px solid #eee;
  }
  #nav-toggle {
    display: block;
  }
  .hero {
    height: 60vh;
  }
  .hero h1 {
    font-size: 2.25rem;
  }
  .hero p {
    font-size: 1rem;
  }
}