:root {
  /* Define CSS variables for colors to improve maintainability */
  --main-red: rgb(121, 9, 9);
  --main-dark-red: rgb(36, 0, 0);
  --main-gray: gray;
  --main-black: black;
  --main-white: white;
  --project-bg-light: rgba(255, 255, 255, 0.08);
  --project-shadow: #000000e0;
  --code-color: rgba(255, 255, 255, 0.7);
  --code-hover-color: #ff7f50;
  --navbar-bg: rgba(0, 0, 0, 0.55);
  --navbar-text-color: rgba(255, 255, 255, 0.85);
  --navbar-hover-glow: #49ff18;

  /* NEW GLOW COLORS */
  --glow-primary: #ff5e00;
  --glow-secondary: #00eeff;
  --glow-strong: #fff;

  /* Blur / Backdrop Filter variables */
  --backdrop-blur-amount: 12px;
  --backdrop-invert-amount: 5%;
}

/* Universal box-sizing reset */
*,
*::before,
*::after {
  box-sizing: inherit;
}

/* Base HTML styles */
html {
  box-sizing: border-box;
  font-size: 62.5%;
  scroll-behavior: smooth;
}

/* Accessibility: Visually hide content but keep it available for screen readers */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/* Accessibility: Skip link visibility on focus */
.skip-link:focus {
  clip: auto;
  clip-path: none;
  height: auto;
  width: auto;
  display: block;
  font-size: 1.8rem;
  font-weight: bold;
  text-decoration: underline;
  color: var(--glow-strong);
  background-color: var(--main-dark-red);
  padding: 1rem 2rem;
  left: 0;
  top: 0;
  z-index: 1000;
  /* Ensure it's on top */
  text-align: center;
}


/*
  Animations for reduced motion preference:
  If a user has set a preference for reduced motion,
  we disable most non-essential animations.
*/
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Body styles */
body {
  font-family: "Poppins", sans-serif;
  font-size: 1.8rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--main-white);
  margin: 0;
  padding-top: 7rem;
  background: linear-gradient(45deg,
      rgba(15, 0, 0, 0.95) 0%,
      rgba(30, 0, 0, 0.95) 50%,
      rgba(15, 0, 0, 0.95) 100%);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite alternate;
  min-height: 100vh;
}

/* Keyframes for subtle background gradient shift */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}


/* Heading styles */
h1,
h2 {
  font-family: "Raleway", sans-serif;
  font-weight: 700;
  text-align: center;
  color: var(--main-white);
}

h1 {
  font-size: 6rem;
  text-shadow: 0 0 1rem rgba(255, 255, 255, 0.5), 0 0 2rem rgba(255, 255, 255, 0.3);
}

h2 {
  font-size: 4.2rem;
  text-shadow: 0 0 0.8rem rgba(255, 255, 255, 0.4);
}

/* List and link resets */
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

a {
  text-decoration: none;
  color: var(--main-white);
}

/* Image styles */
img {
  display: block;
  width: 100%;
  /* Max width for images */
  height: auto;
  /* Maintain aspect ratio */
}

/* Main content wrapper */
main {
  /* No display: block; needed as it's default for <main> */
  outline: none;
  /* Remove default outline for focused main content */
}

/* Navigation bar styles */
.nav {
  display: grid;
  place-items: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: var(--navbar-bg);
  -webkit-backdrop-filter: blur(var(--backdrop-blur-amount)) invert(var(--backdrop-invert-amount));
  backdrop-filter: blur(var(--backdrop-blur-amount)) invert(var(--backdrop-invert-amount));
  border-bottom-left-radius: 4rem;
  border-bottom-right-radius: 4rem;
  box-shadow: 0 0.5rem 3rem rgba(0, 0, 0, 0.7);
  z-index: 999;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.nav-list a {
  display: block;
  font-size: 2.2rem;
  padding: 2rem 2.5rem;
  color: var(--navbar-text-color);
  transition: all 0.4s ease-out;
  position: relative;
  overflow: hidden;
}

.nav-list a:hover,
.nav-list a:focus-visible {
  /* Added focus-visible for accessibility */
  color: var(--glow-strong);
  text-shadow: 0 0 0.5rem var(--glow-strong),
    0 0 1rem var(--glow-primary),
    0 0 2rem var(--glow-primary),
    0 0 4rem var(--glow-secondary),
    0 0 6rem var(--glow-secondary),
    0 0 8rem var(--glow-strong);
  outline: none;
  /* Remove default focus outline */
}

/* Media query for smaller navigation on small screens */
@media (max-width: 46rem) {

  /* Equivalent to 460px */
  .nav-list a {
    font-size: 1.8rem;
    padding: 1.5rem 1rem;
  }

  body {
    padding-top: 5.5rem;
  }
}

/* Welcome section styles */
.welcome-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(6deg,
      var(--main-dark-red) 0%,
      var(--main-red) 100%);
}

.welcome-section>p {
  font-size: 3.2rem;
  font-weight: 300;
  font-style: italic;
  color: var(--glow-primary);
  text-shadow: 0 0 0.8rem var(--glow-primary), 0 0 1.5rem rgba(255, 94, 0, 0.5);
}

/* Projects section styles */
.projects-section {
  text-align: center;
  padding: 10rem 2rem;
  background-color: rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 1rem 2rem rgba(0, 0, 0, 0.5), inset 0 -1rem 2rem rgba(0, 0, 0, 0.5);
}

.projects-section-header {
  max-width: 70vw;
  margin: 0 auto 6rem auto;
  border-bottom: 0.2rem solid var(--glow-primary);
  color: var(--main-white);
  padding-bottom: 1rem;
  text-shadow: 0 0 0.5rem var(--glow-secondary);
  transition: all 0.3s ease;
}

.projects-section-header:hover {
  text-shadow: 0 0 1rem var(--glow-strong), 0 0 2rem var(--glow-secondary);
  border-color: var(--glow-strong);
}

/* Media query for smaller project section header on small screens */
@media (max-width: 46rem) {
  .projects-section-header {
    font-size: 3.6rem;
  }
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(32rem, 1fr));
  grid-gap: 3rem;
  width: 100%;
  max-width: 128rem;
  margin: 0 auto;
  margin-bottom: 6rem;
}

/* Media query for single column layout on very small screens */
@media (max-width: 49rem) {
  .projects-section {
    padding: 6rem 1rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    grid-gap: 2.5rem;
  }
}

/* Individual project tile styles */
.project {
  background: var(--project-bg-light);
  box-shadow: 0 0.5rem 1.5rem var(--project-shadow);
  border-radius: 2.5rem;
  overflow: hidden;
  position: relative;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  border: 0.1rem solid rgba(255, 255, 255, 0.1);
}

.project::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 2.5rem;
  box-shadow: 0 0 0rem var(--glow-strong);
  transition: box-shadow 0.4s ease-out;
  z-index: 1;
  pointer-events: none;
}

.project:hover,
.project:focus-visible {
  /* Added focus-visible for accessibility */
  transform: translateY(-0.8rem) scale(1.02);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.9), 0 0 3rem var(--glow-primary);
  outline: none;
  /* Remove default focus outline */
}

.project:hover::before,
.project:focus-visible::before {
  /* Added focus-visible for accessibility */
  box-shadow: 0 0 2rem var(--glow-strong),
    0 0 4rem var(--glow-primary),
    0 0 8rem var(--glow-secondary);
}

.code {
  color: var(--code-color);
  transition: color 0.3s ease-out, text-shadow 0.3s ease-out;
}

.project:hover .code,
.project:focus-visible .code {
  /* Added focus-visible for accessibility */
  color: var(--code-hover-color);
  text-shadow: 0 0 0.5rem var(--code-hover-color), 0 0 1rem rgba(255, 127, 80, 0.5);
}

.project-image {
  height: calc(100% - 6.8rem);
  width: 100%;
  object-fit: cover;
  border-top-left-radius: 2.5rem;
  border-top-right-radius: 2.5rem;
  opacity: 0.8;
  transition: opacity 0.3s ease-out;
}

.project:hover .project-image,
.project:focus-visible .project-image {
  /* Added focus-visible for accessibility */
  opacity: 1;
}

.project-title {
  font-size: 2rem;
  padding: 2rem 0.5rem;
  color: var(--main-white);
  transition: color 0.3s ease;
}

.project:hover .project-title,
.project:focus-visible .project-title {
  /* Added focus-visible for accessibility */
  color: var(--glow-strong);
}

/* Button styles */
.btn {
  display: inline-block;
  padding: 1.2rem 2.5rem;
  border-radius: 0.4rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  z-index: 0;
}

/* Keyframes for subtle button glow pulse */
@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 1rem var(--glow-primary), 0 0 2rem rgba(255, 94, 0, 0.2);
  }

  50% {
    box-shadow: 0 0 2rem var(--glow-primary), 0 0 4rem rgba(255, 94, 0, 0.6);
  }

  100% {
    box-shadow: 0 0 1rem var(--glow-primary), 0 0 2rem rgba(255, 94, 0, 0.2);
  }
}

.btn-show-all {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  font-size: 2rem;
  background: var(--main-dark-red);
  border: 0.1rem solid var(--main-red);
  color: var(--main-white);
  box-shadow: 0 0.2rem 1rem rgba(0, 0, 0, 0.5);
}

.btn-show-all:hover,
.btn-show-all:focus-visible {
  /* Added focus-visible for accessibility */
  background: var(--main-red);
  color: var(--glow-strong);
  text-shadow: 0 0 0.5rem var(--glow-strong);
  border-color: var(--glow-strong);
  animation: pulseGlow 1.5s infinite alternate ease-in-out;
  outline: none;
  /* Remove default focus outline */
}

.btn-show-all:hover>i,
.btn-show-all:focus-visible>i {
  /* Added focus-visible for accessibility */
  transform: translateX(0.5rem) scale(1.1);
}

.btn-show-all>i {
  transform: translateX(0);
  transition: transform 0.3s ease-out, color 0.3s ease;
}

/* Contact section styles */
.contact-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  min-height: 85vh;
  padding-top: 2rem;
  background: rgba(10, 0, 0, 0.8);
  box-shadow: inset 0 1rem 2rem rgba(0, 0, 0, 0.6), inset 0 -1rem 2rem rgba(0, 0, 0, 0.6);
  border-top: 0.1rem solid rgba(255, 255, 255, 0.1);
}

.contact-section-header>h2 {
  font-size: 6rem;
  text-shadow: 0 0 1rem var(--glow-secondary);
  margin-bottom: 1rem;
}

/* Media query for smaller contact section header on small screens */
@media (max-width: 46rem) {
  .contact-section-header>h2 {
    font-size: 4rem;
  }
}

.contact-section-header>p {
  font-style: italic;
  font-size: 2.2rem;
  margin-top: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

.contact-links {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 90vw;
  flex-wrap: wrap;
  margin-top: 5rem;
  gap: 3rem;
}

/* Keyframes for subtle icon bounce */
@keyframes subtleBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-0.3rem);
  }
}

.contact-details {
  font-size: 2.8rem;
  text-shadow: 0.2rem 0.2rem 0.5rem var(--main-black);
  transition: transform 0.3s ease-out, color 0.3s ease, text-shadow 0.3s ease;
  color: var(--main-white);
}

.contact-details:hover,
.contact-details:focus-visible {
  /* Added focus-visible for accessibility */
  transform: translateY(-1rem) scale(1.1);
  color: var(--glow-strong);
  text-shadow: 0 0 1rem var(--glow-strong),
    0 0 2rem var(--glow-primary),
    0 0 4rem var(--glow-secondary);
  outline: none;
  /* Remove default focus outline */
}

.contact-details:hover i,
.contact-details:focus-visible i {
  /* Added focus-visible for accessibility */
  animation: subtleBounce 0.5s ease-out;
}

/* NEW MEDIA QUERIES FOR VERY SMALL SCREENS - Specifically for contact buttons */
@media (max-width: 60rem) {
  .contact-links {
    gap: 2rem;
  }

  .contact-details {
    font-size: 2.4rem;
    padding: 1rem 2rem;
  }
}

@media (max-width: 38rem) {
  .contact-links {
    gap: 1.5rem;
    max-width: 95vw;
  }

  .contact-details {
    font-size: 2rem;
    padding: 0.8rem 1.5rem;
  }
}

/* Footer styles */
footer {
  font-weight: 300;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 2rem;
  background: var(--main-black);
  border-top: 0.4rem solid var(--glow-primary);
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  position: relative;
  box-shadow: inset 0 0.5rem 1.5rem rgba(0, 0, 0, 0.7);
}

footer>p {
  margin: 0.8rem 0;
  font-size: 1.6rem;
  line-height: 1.5;
}

footer a {
  color: var(--glow-secondary);
  transition: color 0.3s ease, text-shadow 0.3s ease;
}

footer a:hover,
footer a:focus-visible {
  /* Added focus-visible for accessibility */
  color: var(--glow-strong);
  text-shadow: 0 0 0.5rem var(--glow-strong), 0 0 1rem var(--glow-secondary);
  outline: none;
  /* Remove default focus outline */
}

/* Icon Styling - New and refined */
i.fas,
i.fab {
  margin-right: 0.7rem;
  transition: transform 0.2s ease-out, color 0.3s ease, text-shadow 0.3s ease;
  vertical-align: middle;
}

/* Specific adjustments for navbar icons */
.nav-list a i {
  font-size: 1.8rem;
  margin-right: 0.5rem;
}

/* Specific adjustments for welcome section icon */
.welcome-section>p i {
  font-size: 2.8rem;
  margin-right: 1rem;
  color: inherit;
  text-shadow: inherit;
}

/* Specific adjustments for project code icons */
.project-title .code i {
  font-size: 1.6rem;
  margin: 0 0.4rem;
  color: var(--code-color);
}

.project:hover .project-title .code i,
.project:focus-visible .project-title .code i {
  /* Added focus-visible for accessibility */
  color: var(--code-hover-color);
  text-shadow: inherit;
}

/* Specific adjustments for contact header icon */
.contact-section-header>p i {
  font-size: 2rem;
  margin-right: 0.8rem;
  color: inherit;
}

/* Specific adjustments for footer icons */
footer p i {
  font-size: 1.4rem;
  color: inherit;
  margin-right: 0.5rem;
}

footer a i {
  margin-right: 0;
  margin-left: 0.5rem;
}

/* Media query for footer layout on larger screens (reversing the column stack for wider views) */
@media (min-width: 46.1rem) {
  footer {
    flex-direction: row;
    justify-content: space-evenly;
  }
}