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

body {
  font-family: 'Roboto', sans-serif;
  background-color: #fafafa;
}

body:has(.overlay.open) {
  overflow: hidden;
}

h1 {
  font-size: 50px;
  text-align: center;
  padding: 40px;
  font-weight: 700;
  margin-bottom: 20px;
}

img {
  max-width: 100%;
}

.countries {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 1.5rem;
}

.country:hover {
  cursor: pointer;
}

.country {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1px solid #d9d9d9;
  border-radius: 5px;
  padding: 20px;
  box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.1);
  background-color: #f5f5f5;
}

.country-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
}

.country-flag {
  width: 100%;
  max-width: 300px;
  margin-bottom: 10px;
}

.content {
  margin-top: auto;
  width: 100%;
}

.content h3 {
  font-size: 1.5rem;
  font-weight: 700;
}

.content p {
  font-size: 1.125rem;
  line-height: 1.5;
}

.content p:not(:last-of-type) {
  margin-bottom: 1rem;
}

/* ADDED THIS SINCE LAST PRACTICE */

.overlay {
  display: none;
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
}

.overlay.open {
  display: flex;
}

.modal {
  background-color: #d9d9d9;
  border-radius: 6px;
  padding: 2.5rem;
  box-shadow: 5px 5px 8px rgba(0, 0, 0, 0.1);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  margin-left: auto;
  font-size: 2rem;
  cursor: pointer;
  background-color: transparent;
  border: none;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.content {
  margin-top: auto;
  width: 100%;
}

.content h3 {
  font-size: 1.5rem;
  font-weight: 700;
}

.content p {
  font-size: 1.125rem;
  line-height: 1.5;
}

.content p:not(:last-of-type) {
  margin-bottom: 1rem;
}

.modal .flag {
  width: 100%;
  max-width: 300px;
  border-radius: 4px;
  overflow: hidden;
}
