/* --------------------------------
   CSS Variables with fallback
   -------------------------------- */
:root {
  --primary-color: #3c78d8;
  --accent-color: #c05050;
  --bg-color: #fafafa;
  --font-primary: "Montserrat", Arial, sans-serif;
  /* Use color-mix for a gradient effect if supported */
  --gradient-color: color-mix(in srgb, #3c78d8 50%, #c05050 50%);
}

/* --------------------------------
   Base Styles
   -------------------------------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-color);
  color: #333;
  line-height: 1.6;
}

/* --------------------------------
   Header & Navigation (common to all pages)
   -------------------------------- */
header {
  background-color: var(--primary-color);
  padding: 1rem;
}

header nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

header nav ul li a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s ease;
}

header nav ul li a.active,
header nav ul li a:hover {
  color: var(--accent-color);
}

/* Social icon styling */
.social-link .nav-icon {
  width: 24px;
  height: auto;
  vertical-align: middle;
}

/* Desktop navigation styling */
.nav-menu {
  list-style: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.nav-toggle-button {
  display: none;
}

/* Hide the close button by default */
.nav-close {
  display: none;
}

/* --------------------------------
   Responsive Navigation for Small Screens
   -------------------------------- */
@media (max-width: 768px) {
  /* Ensure header stays consistent */
  header {
    background-color: var(--primary-color);
    min-height: 60px;
    position: relative;
  }

  /* Hamburger menu button: vertically centered */
  .nav-toggle-button {
    display: block;
    font-size: 2rem;
    color: #fff;
    text-decoration: none;
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    z-index: 200;
  }

  /* Mobile nav menu: hidden by default, shown via :target */
  .nav-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-color);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
  }

  .nav-menu:target {
    display: flex;
  }

  .nav-menu ul {
    list-style: none;
    text-align: center;
    padding: 0;
  }

  .nav-menu li {
    margin: 1rem 0;
  }

  /* Mobile close button */
  .nav-close {
    display: block;
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 2rem;
    color: #fff;
    text-decoration: none;
    z-index: 300;
  }
}

/* --------------------------------
   Hero Section
   -------------------------------- */
.hero {
  background: url("assets/person.webp") no-repeat center center;
  background-size: cover;
  width: 100%;
  height: 100vh; /* Full viewport height */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
}

.hero::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5); /* Dark overlay for readability */
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-content h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero-content h2 {
  font-size: 2rem;
}

/* --------------------------------
   Featured Project Section
   -------------------------------- */
.featured-project {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 2rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.featured-project h2 {
  margin-bottom: 1rem;
  font-size: 2rem;
  color: var(--primary-color);
}

.featured-project figure {
  margin: 0 auto 1rem;
  max-width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

.featured-project figure img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  object-position: center;
}

.featured-project figcaption {
  margin-top: 0.5rem;
  font-style: italic;
  color: #666;
}

.featured-project p {
  font-size: 1rem;
  margin: 1rem 0;
}

.featured-project .btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--primary-color);
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.featured-project .btn:hover {
  background: color-mix(
    in srgb,
    var(--accent-color) 50%,
    var(--primary-color) 50%
  );
}

/* Remove rounding for featured project on small screens */
@media (max-width: 600px) {
  .featured-project {
    border-radius: 0;
  }
  .featured-project figure {
    border-radius: 0;
  }
}

/* --------------------------------
   Projects Section (Index Page) - Grid Layout
   -------------------------------- */
.projects-grid {
  padding: 2rem;
  background-color: var(--bg-color);
  text-align: center;
}

.projects-grid h2 {
  margin-bottom: 1.5rem;
  font-size: 2rem;
  color: var(--primary-color);
  text-align: center;
  padding: 1rem;
}

main {
  padding: 2dvh 2dvw; /* using dynamic viewport height and width */
}

.projects-section h1 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  color: var(--primary-color);
}

/* Adding padding to grid container so tiles don’t stretch edge-to-edge */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.project-tile {
  text-decoration: none;
  color: #333;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.project-tile img {
  width: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.project-tile p {
  padding: 1rem;
  font-size: 1rem;
}

.project-tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* --------------------------------
   Projects Page Specific Styles (Article Layout)
   -------------------------------- */
.project {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 3rem;
  padding: 1rem;
  border: 1px solid #ddd;
  /* Reserve left border space */
  border-left: 5px solid transparent;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  animation: slideIn 0.8s ease-out;
}

.project:hover {
  border-left-color: var(--primary-color);
}

.project:has(.github-link:hover) {
  border-left-color: purple;
}

.project-description {
  flex: 1 1 300px;
  padding: 1rem;
}

.project-description h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.project-description p {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.github-link {
  display: inline-block;
  background: var(--gradient-color, #3c78d8);
  color: #fff;
  padding: 0.5rem 1rem;
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.github-link:hover {
  background: color-mix(in srgb, #c05050 50%, #3c78d8 50%);
}

.project-image {
  flex: 1 1 300px;
  padding: 1rem;
  text-align: center;
}

.project-image img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.project-image img:hover {
  transform: scale(1.05);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* --------------------------------
   CSS Animation using @keyframes
   -------------------------------- */
@keyframes slideIn {
  from {
    transform: translateX(20%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive adjustments for Projects Page article layout */
@media (max-width: 768px) {
  .project {
    flex-direction: column;
  }
  .project-description,
  .project-image {
    flex: 1 1 100%;
  }
}

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

footer address {
  font-style: normal;
  margin-bottom: 0.5rem;
}

/* --------------------------------
   Global Media Queries for Typography Adjustments
   -------------------------------- */
/* For Phones */
@media (max-width: 600px) {
  header nav ul {
    flex-direction: column;
  }
  .hero-content h1 {
    font-size: 2.5rem;
  }
  .hero-content h2 {
    font-size: 1.5rem;
  }
}

/* For Tablets & Small Laptops */
@media (min-width: 601px) and (max-width: 992px) {
  .hero-content h1 {
    font-size: 3rem;
  }
  .hero-content h2 {
    font-size: 2rem;
  }
}

/* For Desktops */
@media (min-width: 993px) {
  .hero-content h1 {
    font-size: 3.5rem;
  }
  .hero-content h2 {
    font-size: 2.5rem;
  }
}
