* {
  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;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
}

ul,
ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

a {
  display: inline-block;
  text-decoration: none;
  background-color: #f9fafbbd;
  color: #2e2f42;
  font-weight: 600;
  padding: 8px 24px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12), 0 6px 12px rgba(0, 0, 0, 0.08);
  transition: box-shadow 250ms ease-in-out;
}

a:hover,
a:focus {
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.15);
  outline: none;
}

p > a {
  margin-bottom: 16px;
}

li a {
  padding: 12px 48px;
  margin-bottom: 16px;
}

body:has(> ul:only-child) {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

body > ul:only-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  max-width: 320px;
  width: 100%;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

body > ul li a {
  display: block;
  padding: 12px 16px;
  margin-bottom: 0;
  text-align: center;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

body > ul li a:hover,
body > ul li a:focus {
  background: rgba(0, 0, 0, 0.04);
  box-shadow: none;
}

body > ul li a:active {
  background: rgba(0, 0, 0, 0.08);
}

button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  border: none;
  padding: 8px 16px;
  margin: 0;
  outline: none;
  border-radius: 8px;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #fff;
  background-color: #4e75ff;
  transition: background-color 250ms ease-in-out, box-shadow 250ms ease-in-out;
}

button:hover,
button:focus {
  background-color: #4667dc;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Task 1: Categories */
#categories {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 440px;
  padding: 24px;
  margin: 0 auto;
}

.item {
  width: 100%;
  max-width: 392px;
  padding: 16px;
  background-color: #f6f6fe;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  border-radius: 8px;
}

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

.item ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

/* Task 2: Gallery — flexbox через CSS-класи */
.gallery {
  max-width: 1200px;
  padding: 100px 36px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 48px 24px;
  flex-wrap: wrap;
}

.gallery__item {
  width: 360px;
  height: 300px;
  border-radius: 8px;
  overflow: hidden;
}

.gallery__image {
  display: block;
  max-width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Task 3: Name input */
#name-input {
  display: block;
  min-width: 280px;
  max-width: 360px;
  width: 100%;
  height: 40px;
  padding: 8px 16px;
  margin: 60px auto;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #2e2f42;
  border: 1px solid #808080;
  border-radius: 4px;
  box-shadow: 6px 6px 8px #e0dff8, -6px -6px 12px #cfcdf5;
  background-color: #fff;
}

#name-input::placeholder {
  color: #808080;
}

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

#name-input:focus {
  outline: 1px solid #4e75ff;
  border-color: #4e75ff;
}

h1 {
  font-weight: 600;
  font-size: 24px;
  line-height: 1.33333;
  letter-spacing: 0.04em;
  text-align: center;
  color: #2e2f42;
}

/* Task 4: Login form */
.login-form {
  display: flex;
  flex-direction: column;
  max-width: 408px;
  padding: 48px 24px;
  margin: 0 auto;
  background-color: #fff;
  border-radius: 8px;
}

.login-form label {
  display: block;
  margin-bottom: 16px;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #2e2f42;
}

.login-form input {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: 4px;
  padding: 8px 16px;
  font-size: 16px;
  color: #2e2f42;
  border: 1px solid #808080;
  border-radius: 4px;
  background-color: #fff;
}

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

.login-form input:focus {
  outline: 1px solid #4e75ff;
  border-color: #4e75ff;
}

.login-form button {
  margin-top: 8px;
}

/* Task 5: Widget */
.widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: fit-content;
  margin: 0 auto;
  padding: 24px;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: #2e2f42;
  background-color: #fff;
  border-radius: 8px;
}

.widget p {
  margin: 0;
}

.widget .color {
  font-weight: 600;
}
