body {
  margin: 0;
  font-family: 'Courier New', Courier, monospace;
  background-color: #53BD71;
}

h1 {
  text-align: center;
  margin: 20px 0;
  color: white;
  font-size: 50px;
  animation: glow 2s infinite alternate;
}

@keyframes glow {
  from {
    text-shadow: 0 0 5px white;
  }
  to {
    text-shadow: 0 0 20px #FA2929, 0 0 30px #FA2929;
  }
}

nav {
  padding: 10px 20px;
}

nav a {
  margin-right: 15px;
  color: yellow;
  font-size: 20px;
}

.header-image {
  width: 100%;
  height: auto;
  margin: 0 auto;

  opacity: 0.35;
  transition: opacity 1s ease;
}

.header-image:hover {
  opacity: 1;
}

footer {
  color: white;
  text-align: center;
  margin: 20px 0;
}

#gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  padding: 15px;
  justify-items: center;
}

figure {
  margin: 0;
  cursor: pointer;
}

figure img {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
  border-radius: 8px;
  transition: transform 0.3s ease, filter 0.3s ease;
}

figure img:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

figcaption {
  text-align: center;
  font-family: Georgia, Times, 'Times New Roman', serif;
  margin-top: 8px;
  font-size: 22px;
  color: white;
  word-wrap: break-word;
}

#preview {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color:#FA2929;
  padding: 40px;
  box-sizing: border-box;
  display: none;
  overflow: auto;
  text-align: center;
  z-index: 1000;
}

#preview img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

#preview p {
  color: white;
  font-size: 18px;
  margin-top: 15px;
  text-align: center;
  word-wrap: break-word;
}

body.preview-open #gallery {
  grid-template-columns: 1fr;
}

#close-preview {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 32px;
  cursor: pointer;
}

#close-preview:hover {
  color: yellow;
}

@media (min-width: 600px) {
  h1 {
    font-size: 80px;
  }

  nav a {
    font-size: 30px;
  }

  figcaption {
    font-size: 22px;
  }

  #preview p {
    font-size: 25px;
  }

  #gallery {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  }

  figure img {
    width: 400px;
  }
}

.top-section {
    width: 100%;
    background-color: #222;   
    padding: 30px 20px;       
    box-sizing: border-box;
}


.top-section h1,
.top-section a {
    color: white;
}


.top-section a {
    text-decoration: none;
    margin-right: 20px;
}

#car {
  animation-name: drivingAround;
  animation-duration: 6000ms;
   animation-fill-mode: forwards; 
  animation-iteration-count: 2;
}

@keyframes drivingAround {
  0% {
    transform: translateX(0px)
  }
  48% {
    transform: translateX(600px);
  }
  50% {
    transform: rotateY(180deg) translateX(-600px);
  }
  98% {
    transform: translateX(0px) rotateY(180deg);
  } 

  100% {
    transform: translateX(600px);
  }
}

/* solution */
article {
  position: relative;
}
article section {
  position: absolute;
  top: 2.44em;
  width: 700px;
  left: -700px;
  padding: 0 1em 0.5em 0.5em;
  background-color: rgba(16, 16, 16, 0.95);
  transition: transform 0.5s;
}
article section nav {
  width: 110%;
  text-align: right;
  background-color: rgba(16, 16, 16, 0.95);
  padding: 0.5em;
}

.visible {
  transform: translateX(690px);
}

#prev-btn,
#next-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.5);
  border: none;
  color: white;
  font-size: 40px;
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 5px;
}

#prev-btn {
  left: 20px;
}

#next-btn {
  right: 20px;
}

#prev-btn:hover,
#next-btn:hover {
  background: rgba(0,0,0,0.8);
}







