/* --- 1. Root Variables & Global Styles --- */
:root {
  --bg-color: #f8f9fa;
  --primary-text: #1b263b;
  --secondary-text: #5a6978;
  --brand-blue: #0d1b2a;
  /* Deep, trustworthy navy */
  --accent-cyan: #00bfff;
  /* Electric, modern cyan for CTAs */
  --card-bg: #ffffff;
  --success-color: #28a745;
  --error-color: #dc3545;
  --shadow-sm: 0 4px 6px rgba(27, 38, 59, 0.04);
  --shadow-md: 0 10px 20px rgba(27, 38, 59, 0.07);
  --shadow-lg: 0 20px 40px rgba(27, 38, 59, 0.1);
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-logo: "Poppins", var(--font-main);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--primary-text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- 2. Interactive Particle Background --- */
#particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: -1;
  background-color: var(--bg-color);
  background-image: radial-gradient(
    circle at 10% 20%,
    rgba(0, 191, 255, 0.05),
    var(--bg-color) 40%
  );
}

/* --- 3. Header & Navigation --- */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 5%;
  background: rgba(248, 249, 250, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(27, 38, 59, 0.05);
}

.main-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
  height: 70px;
}

.logo {
  font-family: var(--font-logo);
  font-size: 2.2rem; /* Increased font size */
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(45deg, var(--brand-blue), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 2.5rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--primary-text);
  font-weight: 500;
  transition: color 0.3s ease;
}

.main-nav a:hover {
  color: var(--accent-cyan);
}

/* --- 4. Hero Section --- */
.hero-section {
  min-height: calc(80vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 5%;
}

.hero-content {
  max-width: 800px;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  color: var(--brand-blue);
  line-height: 1.2;
  margin-bottom: 1.5rem; /* Increased margin */
}

.subtitle {
  font-size: 1.25rem;
  color: var(--secondary-text);
  max-width: 650px;
  margin: 0 auto 2.5rem auto; /* Increased margin */
}

.cta-button {
  display: inline-block;
  padding: 14px 28px;
  background-color: var(--accent-cyan);
  color: var(--card-bg);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

/* --- 5. Services Section --- */
.services-section {
  padding: 6rem 5%;
  text-align: center;
  max-width: 1400px;
  margin: 0 auto;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 3.5rem;
}

.service-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.service-card {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 12px;
  text-align: left;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.service-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(0, 191, 255, 0.1), transparent 40%);
  transform: scale(0);
  transition: transform 0.5s ease;
  z-index: 0;
}

.service-card:hover::before {
  transform: scale(2);
}

.service-card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-md);
  border-color: rgba(0, 191, 255, 0.5);
}

.service-icon,
.service-card h3,
.service-card p {
  position: relative;
  z-index: 1;
}

.service-icon {
  margin-bottom: 1.5rem;
  color: var(--accent-cyan);
  transition: transform 0.3s ease;
}

.service-card:hover .service-icon {
  transform: scale(1.1);
}

.service-icon svg {
  width: 40px;
  height: 40px;
}

.service-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--brand-blue);
}

.service-card p {
  color: var(--secondary-text);
  flex-grow: 1;
}

/* --- 6. NEW BLOG SECTION STYLES --- */
.blog-section {
  padding: 6rem 5%;
  max-width: 1400px;
  margin: 0 auto;
}

.blog-container {
  display: grid;
  /* Always have 3 columns on larger screens */
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
}

/* The main blog card styling (no changes needed here) */
.blog-card {
  background-color: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--primary-text);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-md);
}

/* Container for the image (top half) */
.blog-image-container {
  height: 200px; /* Fixed height for a consistent look */
  overflow: hidden;
}

.blog-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* This is the key: it covers the area, cropping as needed */
  transition: transform 0.4s ease;
}

.blog-card:hover .blog-image-container img {
  transform: scale(1.05); /* Subtle zoom effect on hover */
}

/* Container for the content (bottom half) */
.blog-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* Allows content to fill space if cards have varying heights */
}

.blog-date {
  font-size: 0.875rem;
  color: var(--secondary-text);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.blog-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--brand-blue);
  line-height: 1.4;
}

/* --- 7. Contact Section --- */
.contact-section {
  padding: 6rem 5%;
  background-color: var(--card-bg);
}

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

.contact-info h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 1rem;
  line-height: 1.3;
}

.contact-info p {
  font-size: 1.1rem;
  color: var(--secondary-text);
}

#contact-form {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr 1fr;
}

.form-group {
  position: relative;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

#contact-form input,
#contact-form textarea {
  width: 100%;
  padding: 1rem;
  font-family: var(--font-main);
  font-size: 1rem;
  border: 1px solid #dde2e7;
  border-radius: 8px;
  background-color: var(--bg-color);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Default state for all labels */
#contact-form label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: var(--secondary-text);
  pointer-events: none;
  transition: all 0.3s ease;
  background-color: var(--bg-color);
  padding: 0 0.25rem;
}

/* General rule for floating labels on standard inputs */
#contact-form input:not(#phone):focus + label,
#contact-form input:not(#phone):not(:placeholder-shown) + label,
#contact-form textarea:focus + label,
#contact-form textarea:not(:placeholder-shown) + label {
  top: 0;
  left: 0.75rem;
  font-size: 0.875rem;
  color: var(--accent-cyan);
}

#contact-form input:focus,
#contact-form textarea:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.2);
}

#contact-form textarea {
  resize: vertical;
  min-height: 140px;
}

/* The intl-tel-input plugin wrapper needs this for the label to position correctly */
#contact-form .iti {
  position: static;
}

/* 1. Add padding to the INPUT FIELD to prevent text from overlapping the flag dropdown. */
#contact-form input#phone {
  padding-left: 58px !important;
}

/* 2. Position the LABEL correctly in its default state, accounting for the new padding. */
#contact-form label[for="phone"] {
  left: 58px;
}

/* 3. Position the LABEL correctly in its floated state (when typing or focused).
   We use the general sibling selector (~) because the JS moves the label. */
#contact-form input#phone:focus ~ label[for="phone"],
#contact-form input#phone:not(:placeholder-shown) ~ label[for="phone"] {
  top: 0;
  left: 52px; /* Adjust slightly for better aesthetics in floated state */
  font-size: 0.875rem;
  color: var(--accent-cyan);
}

#contact-form button {
  padding: 1rem;
  background-color: var(--brand-blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 600;
  transition: background-color 0.3s ease, transform 0.2s ease;
  grid-column: 1 / -1;
}

#contact-form button:hover {
  background-color: #1a3a5a;
  transform: translateY(-2px);
}

#form-message {
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  margin-top: -0.5rem;
  display: none;
}

#form-message.success {
  display: block;
  background-color: #e9f7ef;
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

#form-message.error {
  display: block;
  background-color: #fce8e6;
  color: var(--error-color);
  border: 1px solid var(--error-color);
}
/* --- 8. Footer --- */
.main-footer {
  padding: 2rem 5%;
  text-align: center;
  border-top: 1px solid rgba(27, 38, 59, 0.05);
}

.main-footer p {
  color: var(--secondary-text);
  font-size: 0.9rem;
}

/* --- 9. Animation & Responsiveness --- */
.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease forwards;
}

.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .contact-container {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: 60vh;
  }
}

@media (max-width: 600px) {
  .main-nav {
    flex-direction: column;
    gap: 1rem;
    height: auto;
    padding: 1rem 0;
  }

  .service-container,
  #contact-form {
    grid-template-columns: 1fr;
  }
}

/* Add media queries to stack on smaller screens */
@media (max-width: 1024px) {
  .blog-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .blog-container {
    grid-template-columns: 1fr;
  }
}
