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

body {
  max-width: 1300px;
  margin: 0 auto;
  padding: 50px 30px;
  font-family: sans-serif;
  min-width: 400px;
}

button {
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.25s;
}

.visually-hidden { 
  border: 0;
  padding: 0;
  margin: 0;
  position: absolute !important;
  height: 1px; 
  width: 1px;
  overflow: hidden;
  clip: rect(1px 1px 1px 1px); /* IE6, IE7 - a 0 height clip, off to the bottom right of the visible 1px box */
  clip: rect(1px, 1px, 1px, 1px); /* maybe deprecated but we need to support legacy browsers */
  clip-path: inset(50%); /* modern browsers, clip-path works inwards from each corner */
  white-space: nowrap; /* added line to stop words getting smushed together (as they go onto seperate lines and some screen readers do not understand line feeds as a space */
}

.main-title {
  margin-bottom: 30px;
  font-family: monospace;
}

.open-modal-btn {
  padding: 15px;
  cursor: pointer;
  margin-bottom: 50px;
  border: none;
  background-color: hotpink;
  color: #fff;
  border-radius: 3px;
  transition: opacity 0.15s;
}

.first-modal,
.second-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  justify-content: center;
  align-items: center;
  padding: 20px;
  display: none;
}

.second-modal {
  z-index: 30;
}

.first-modal__overlay,
.second-modal__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 140, 0, 0.4), rgba(138, 43, 226, 0.4));
  opacity: 0;
  transition: opacity 0.25s;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.second-modal__overlay {
  backdrop-filter: blur(6px);
  background: linear-gradient(160deg, rgba(255, 140, 0, 0.4), rgba(138, 43, 226, 0.4));
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

.first-modal__content,
.second-modal__content {
  background-color: white;
  max-width: 350px;
  width: 100%;
  scrollbar-width: thin;
  max-height: 95vh;
  overflow-y: auto;
  position: relative;
  border-radius: 5px;
  text-align: center;
  padding: 50px;
  font-size: 1.25rem;
  transform: scale(0);
  transition: transform 0.25s, opacity 0.25s;
  z-index: 25;
  text-align: center;
}

.first-modal__close-btn,
.second-modal__close-btn {
  line-height: 0;
  border: none;
  background-color: transparent;
  position: absolute;
  right: 10px;
  top: 10px;
  transition: color 0.25s;
}

.first-modal__image {
  width: 125px;
  display: block;
  margin: 0 auto;
  margin-bottom: 20px;
}

.first-modal__text,
.second-modal__text {
  margin-bottom: 30px;
}

.second-modal__text {
  margin-top: 20px;
}

.first-modal__close-btn svg,
.second-modal__close-btn svg {
  width: 30px;
  cursor: pointer;
}

.modal-btn {
  padding: 12px;
  border-radius: 3px;
  cursor: pointer;
  border: none;
  background-color: rgb(90, 185, 157);
  color: white;
  transition: background-color 0.15s;
}

.first-modal__toggle-btn-container {
  display: flex;
  margin-top: 10px;
}

.second-modal__accept-btn {
  display: block;
  width: 30%;
  margin: 0 auto;
}

.first-modal__disabled-btn:disabled {
  background-color: rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

.first-modal__toggle-btn,
.first-modal__disabled-btn {
  flex: 1;
}

.first-modal__toggle-btn {
  border-radius: 3px 0px 0px 3px;
}

.first-modal__disabled-btn {
  border-radius: 0px 3px 3px 0px;
}

.popup__content {
  display: flex;
  align-items: center;
  gap: 5px;
}

.popup__close-btn  {
  line-height: 0;
  border: none;
  background-color: transparent;
  display: inline-block;
}

.popup__close-btn svg {
  width: 1.7rem;
}

.popup {
  position: fixed;
  bottom: 40px;
  border-radius: 12px;
  box-shadow: 0px 0px 30px -6px rgba(0, 0, 0, 0.08);  padding: 10px 10px;
  right: -500px;
  transition: right 0.25s;
}

.popup.active {
  right: 30px;
}

.popup__text {
  font-size: 1.1rem;
}

.open-popup-btn {
  padding: 15px;
  cursor: pointer;
  margin-bottom: 50px;
  margin-left: 5px;
  border: none;
  background-color: seagreen;
  color: #fff;
  border-radius: 3px;
  transition: opacity 0.15s;
}

@media screen and (pointer: fine) and (hover: hover) { 
  .first-modal__close-btn:is(:hover, :focus-visible),
  .second-modal__close-btn:is(:hover, :focus-visible) {
    color: red;
  }
  
  .modal-btn:is(:hover, :focus-visible),
  .modal-btn:is(:hover, :focus-visible) {
    background-color: rgb(60, 187, 149);
  }

  .open-modal-btn:is(:hover, :focus-visible),
  .open-popup-btn:is(:hover, :focus-visible) {
    opacity: 0.8;
  }
}

.modal-btn:active,
.modal-btn:active {
  transition: none;
  background-color: rgb(27, 179, 133);
}

.first-modal__close-btn:active,
.second-modal__close-btn:active {
  opacity: 0.7;
}