@import url("https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap");
*,
::before,
::after {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

ul {
  list-style: none;
}

button {
  border: none;
}
button:hover {
  cursor: pointer;
}
button:focus {
  outline: 2px solid hsl(3, 71%, 56%);
  outline-offset: 2px;
}

body {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
  min-height: 100vh;
  font-family: "Noto Sans";
  color: hsl(227, 75%, 14%);
  background-image: linear-gradient(180deg, #ebf2fc 0%, #eef8f9 100%);
}
body.dark-theme {
  background-image: linear-gradient(180deg, #040918 0%, #091540 100%);
  color: hsl(0, 0%, 93%);
}
body.dark-theme header {
  border: 2px solid hsl(225, 23%, 24%);
  background-color: hsl(226, 25%, 17%);
}
body.dark-theme header button {
  background-color: hsl(225, 23%, 24%);
}
body.dark-theme header button:hover, body.dark-theme header button:focus {
  background-color: hsl(226, 11%, 37%);
}
body.dark-theme nav ul input:checked + label {
  color: hsl(226, 25%, 17%);
  background-color: hsl(3, 71%, 56%);
}
body.dark-theme nav label {
  background-color: hsl(226, 25%, 17%);
  outline: 2px solid hsl(225, 23%, 24%);
}
body.dark-theme nav label:hover {
  background-color: hsl(226, 11%, 37%);
}
body.dark-theme .card {
  background-color: hsl(226, 25%, 17%);
  border-color: hsl(225, 23%, 24%);
}
body.dark-theme .card > div:last-of-type .remove-button {
  color: inherit;
  outline: 1px solid hsl(226, 11%, 37%);
}
body.dark-theme .card > div:last-of-type .remove-button:hover {
  color: hsl(226, 25%, 17%);
  outline: none;
}
body.dark-theme .card > div:last-of-type .remove-button:focus {
  background-color: hsl(226, 11%, 37%);
  outline: 2px solid hsl(3, 71%, 56%);
}
body.dark-theme .switch {
  background-color: hsl(226, 11%, 37%);
}
body.dark-theme ul label:focus,
body.dark-theme span:focus {
  outline: 2px solid hsl(3, 71%, 56%);
  outline-offset: 2px;
  background-color: hsl(226, 11%, 37%);
}

main {
  width: 100%;
  max-width: 1080px;
  margin-inline: 1rem;
}

article {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 2px solid hsl(217, 61%, 90%);
  background-color: hsl(200, 60%, 99%);
}
header button {
  padding: 0.5rem;
  border-radius: 0.5rem;
}
header button:hover {
  background-color: hsl(0, 0%, 78%);
  color: hsl(226, 25%, 17%);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-block-start: 2rem;
}
nav h1 {
  font-size: 1.8rem;
}
nav ul {
  display: flex;
  gap: 0.5rem;
}
nav ul input {
  opacity: 0;
  width: 0;
  height: 0;
}
nav ul input:checked + label {
  color: hsl(200, 60%, 99%);
  background-color: hsl(3, 71%, 56%);
  outline: 2px solid hsl(3, 71%, 56%);
}
nav ul label {
  background-color: hsl(200, 60%, 99%);
  outline: 2px solid hsl(217, 61%, 90%);
  padding: 0.5rem 1rem;
  border-radius: 1.5rem;
}
nav ul label:hover {
  background-color: hsl(0, 0%, 78%);
  cursor: pointer;
}

.ext-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-auto-rows: 175px;
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.75rem;
  border-radius: 1rem;
  border: 2px solid hsl(217, 61%, 90%);
  background-color: hsl(200, 60%, 99%);
  transition: opacity 0.3s;
}
.card.fade-out {
  opacity: 0;
}
.card > div:first-of-type {
  display: flex;
  align-items: start;
  gap: 1rem;
}
.card > div:first-of-type p {
  font-size: 14px;
  padding-top: 0.5rem;
}
.card > div:last-of-type {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card > div:last-of-type .remove-button {
  background-color: inherit;
  outline: 1px solid hsl(0, 0%, 78%);
  padding: 0.5rem 1rem;
  border-radius: 1rem;
}
.card > div:last-of-type .remove-button:hover {
  background-color: hsl(3, 71%, 56%);
  color: hsl(200, 60%, 99%);
  outline: none;
}
.card > div:last-of-type .remove-button:focus {
  background-color: hsl(0, 0%, 93%);
  outline: 2px solid hsl(3, 71%, 56%);
}
.card .switch-label {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}
.card .switch-input {
  opacity: 0;
  width: 0;
  height: 0;
}
.card .switch {
  position: absolute;
  cursor: pointer;
  background-color: hsl(0, 0%, 78%);
  border-radius: 24px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  transition: 0.25s;
}
.card .switch::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.25s;
}
.card .switch-input:checked + .switch {
  background-color: hsl(3, 71%, 56%);
}
.card .switch-input:checked + .switch::before {
  transform: translateX(26px);
}

ul label:focus,
span:focus {
  outline: 2px solid hsl(3, 71%, 56%);
  outline-offset: 2px;
}

.hidden {
  display: none;
}

@media (width <= 650px) {
  nav {
    flex-direction: column;
    gap: 1rem;
    padding-block: 1rem;
  }
}