/*
 * Main stylesheet for the freelance web‑design template.
 *
 * Defines a simple color palette using CSS custom properties and
 * provides base styles for the navigation bar, hero section, content
 * sections, cards, portfolio items and contact form. The layout
 * makes use of Flexbox and CSS Grid to create responsive designs
 * without any JavaScript. Media queries adjust the layout for
 * smaller screens to ensure that the site remains usable on
 * smartphones and tablets.
 */

/* Import Google Fonts. The display swap directive ensures that
   text remains visible during font loading. */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&family=Open+Sans:wght@400;600&display=swap');

/* Color palette and typography variables */
:root {
  --primary: #4f46e5;        /* Deep indigo */
  --secondary: #38bdf8;      /* Bright sky blue */
  --accent: #f472b6;         /* Warm pink used for highlights */
  --dark: #0f172a;           /* Dark blue‑gray for text and footer */
  --light: #f8fafc;          /* Very light gray for page backgrounds */
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Open Sans', sans-serif;
}

/* Reset margins and paddings to make layout predictable */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--dark);
  background-color: var(--light);
}

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

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo a {
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--dark);
  font-weight: 600;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--primary);
}

/* Hero section with background image */
.hero {
  position: relative;
  height: 60vh;
  min-height: 400px;
  background: url('img/hero.png') center/cover no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #ffffff;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: 0 2rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  background-color: var(--secondary);
  color: #ffffff;
  border-radius: 9999px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

.btn:hover {
  background-color: var(--primary);
}

/* Generic section styling */
.section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
}

.section-text {
  max-width: 800px;
  margin: 0 auto;
  font-size: 1rem;
  color: #475569;
  text-align: center;
}

/* Services grid and cards */
.services-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

.service-card {
  background-color: #ffffff;
  border-radius: 0.5rem;
  padding: 2rem;
  flex: 1 1 250px;
  max-width: 350px;
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.service-card h3 {
  font-family: var(--font-heading);
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

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

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

.portfolio-item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.portfolio-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.portfolio-item:hover img {
  transform: scale(1.1);
}

.portfolio-item .overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.portfolio-item:hover .overlay {
  opacity: 1;
}

/* Contact form */
.contact-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  justify-content: center;
}

.contact-info {
  flex: 1 1 300px;
  max-width: 400px;
  color: #475569;
}

.contact-info h3 {
  font-family: var(--font-heading);
  color: var(--primary);
  margin-bottom: 1rem;
}

.contact-form {
  flex: 1 1 300px;
  max-width: 500px;
  background-color: #ffffff;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.contact-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--dark);
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  background-color: #f1f5f9;
  color: var(--dark);
  outline: none;
  transition: border-color 0.2s ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--secondary);
}

.contact-form button {
  background-color: var(--secondary);
  color: #ffffff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s ease;
}

.contact-form button:hover {
  background-color: var(--primary);
}

/* Footer */
footer {
  background-color: var(--dark);
  color: #ffffff;
  text-align: center;
  padding: 2rem;
  margin-top: 4rem;
  font-size: 0.875rem;
}

/* Typography helpers */
h3 {
  font-family: var(--font-heading);
  font-weight: 600;
}

h4 {
  font-family: var(--font-heading);
  font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }
  .hero-subtitle {
    font-size: 1rem;
  }
  .navbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-links {
    margin-top: 1rem;
    flex-direction: column;
    gap: 1rem;
  }
  .services-grid {
    gap: 1.5rem;
  }
}