* {
  box-sizing: border-box;
}

body {
  margin: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #fafafa;
  color: #212121;
  line-height: 1.5;
}

p {
  margin-top: 0;
}

a {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 16px;
  color: #4e75ff;
  text-decoration: none;
}

a:hover,
a:focus {
  text-decoration: underline;
}

/* ===================== Task 1 ===================== */

#categories {
  width: 392px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.item {
  padding: 16px;
  background-color: #f6f6fe;
  border-radius: 8px;
}

.item:not(:last-child) {
  margin-bottom: 24px;
}

.item h2 {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.33;
  letter-spacing: 0.04em;
  color: #2e2f42;
}

.item ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.item ul li {
  padding: 8px 16px;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #2e2f42;
  background-color: #ffffff;
  border: 1px solid #808080;
  border-radius: 8px;
}

.item ul li:not(:last-child) {
  margin-bottom: 8px;
}

/* ===================== Task 2 ===================== */

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  max-width: 1128px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.gallery-item {
  width: calc((100% - 48px) / 3);
}

.gallery-image {
  display: block;
  width: 100%;
  height: 300px;
  object-fit: cover;
}

/* ===================== Task 3 ===================== */

#name-input {
  display: block;
  width: 360px;
  height: 40px;
  margin-bottom: 16px;
  padding: 8px 16px;

  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #2e2f42;

  border: 1px solid #808080;
  border-radius: 4px;
  outline: none;

  transition: border-color 250ms ease, box-shadow 250ms ease;
}

#name-input::placeholder {
  color: #2e2f42;
}

#name-input:hover {
  border-color: #000000;
}

#name-input:focus {
  border-color: #4e75ff;
  box-shadow: 0 0 0 3px rgba(78, 117, 255, 0.15);
}

h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.04em;
  color: #2e2f42;
}

#name-output {
  display: inline-block;
  transition: opacity 250ms ease, transform 250ms ease;
}

/* ===================== Task 4 ===================== */

.login-form {
  width: 360px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;

  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #2e2f42;
}

.login-form input {
  width: 100%;
  height: 40px;
  padding: 8px 16px;

  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #2e2f42;

  border: 1px solid #808080;
  border-radius: 4px;
  outline: none;

  transition: border-color 250ms ease, box-shadow 250ms ease;
}

.login-form input:hover {
  border-color: #000000;
}

.login-form input:focus {
  border-color: #4e75ff;
  box-shadow: 0 0 0 3px rgba(78, 117, 255, 0.15);
}

.login-form button {
  min-width: 86px;
  height: 40px;
  padding: 8px 16px;

  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #ffffff;

  background-color: #4e75ff;
  border: none;
  border-radius: 8px;
  cursor: pointer;

  transition: background-color 250ms ease, transform 200ms ease;
}

.login-form button:hover,
.login-form button:focus {
  background-color: #6c8cff;
}

.login-form button:active {
  transform: scale(0.98);
}

/* ===================== Task 5 ===================== */

.widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;

  width: 345px;
  height: 280px;
  padding: 88px 100px;

  background-color: #f6f6fe;
  border-radius: 8px;
}

.widget p {
  margin: 0;
  font-size: 24px;
  line-height: 1.33;
  letter-spacing: 0.04em;
  text-align: center;
}

.color {
  font-weight: 600;
}

.change-color {
  width: 148px;
  height: 40px;

  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #ffffff;

  background-color: #4e75ff;
  border: none;
  border-radius: 8px;
  cursor: pointer;

  transition: background-color 250ms ease, transform 150ms ease;
}

.change-color:hover,
.change-color:focus {
  background-color: #6c8cff;
}

.change-color:active {
  transform: scale(0.96);
}