/* Глобальні скидання та базові стилі */
h1, h2, h3, h4, h5, h6, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
address { font-style: normal; }
a { text-decoration: none; color: inherit; }

body {
  font-family: "Roboto", sans-serif;
  color: #434455;
  background-color: #ffffff;
}

.social-link svg {
  fill: #F4F4FD;
}

.social-list {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  padding-top: 8px;
}

.social-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #4D5AE5;
  fill: #F4F4FD;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.social-link:hover,
.social-link:focus {
  background-color: #404BBF;
}

.icon {
  display: block;
}

.container {
  max-width: 1158px;
  padding: 0 15px;
  margin: 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  white-space: nowrap;
  clip-path: inset(100%);
  clip: rect(0 0 0 0);
  overflow: hidden;
}

/* Header */
.header {
  border-bottom: 1px solid #e7e9fc;
  box-shadow: 0px 1px 6px 0px #2E2F4214, 0px 1px 1px 0px #2E2F4229, 0px 2px 1px 0px #2E2F4214;
}

.header-container {
  display: flex;
  align-items: center;
}

.header-nav {
  display: flex;
  align-items: center;
}

.logo {
  font-family: "Raleway", sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.17;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #4d5ae5;
}

.header-logo {
  margin-right: 76px;
}

.logo-studio-header {
  color: #2e2f42;
}

.nav-list {
  display: flex;
  gap: 40px;
}

.nav-link {
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #2e2f42;
  padding: 24px 0;
  display: block;
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-link:hover,
.nav-link:focus {
  color: #404bbf;
}

.nav-link.active::after {
  content: '';
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background-color: #404bbf;
  position: absolute;
  left: 0;
  bottom: -1px;
}

.contacts {
  margin-left: auto;
}

.contacts-list {
  display: flex;
  gap: 40px;
}

.contacts-link {
  display: inline-block;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #434455;
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.contacts-link:hover,
.contacts-link:focus,
.active {
  color: #404bbf;
}

/* Hero Section */
.hero {
  max-width: 1440px;
  background-image: linear-gradient(rgba(46, 47, 66, 0.7), rgba(46, 47, 66, 0.7)), url(../images/hero-bg.jpg);
  padding: 188px 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  margin: 0 auto;
}

.hero-title {
  font-size: 56px;
  line-height: 1.07;
  text-align: center;
  letter-spacing: 0.02em;
  color: #ffffff;
  max-width: 496px;
  margin: 0 auto 48px auto;
}

.hero-btn {
  padding: 16px 32px;
  background-color: #4d5ae5;
  color: #ffffff;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  display: block;
  min-width: 169px;
  height: 56px;
  border: none;
  border-radius: 4px;
  margin: 0 auto;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  box-shadow: 0px 4px 4px 0px #00000026;
}

.hero-btn:hover,
.hero-btn:focus {
  background-color: #404bbf;
  box-shadow: 0px 4px 4px 0px #00000026;
}

/* Features */
.features {
  padding: 120px 0;
}

.features-ico {
  width: 264px;
  height: 112px;
  background-color: #F4F4FD;
  border: #8E8F99 1px solid;
  border-radius: 4px;
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.icon-antenna-1,
.icon-astronaut-1,
.icon-diagram-1,
.icon-clock-1 {
  width: 64px;
  height: 64px;
}

.features-list {
  display: flex;
  gap: 24px;
}

.features-item {
  width: calc((100% - 72px) / 4);
}

.features-subtitle {
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #2e2f42;
  margin-bottom: 8px;
}

.features-text {
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* Team */
.team {
  background-color: #f4f4fd;
  padding: 120px 0;
}

.section-title {
  font-size: 36px;
  line-height: 1.11;
  text-align: center;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  color: #2e2f42;
  margin-bottom: 72px;
}

.team-list {
  display: flex;
  gap: 24px;
}

.team-item {
  background-color: #ffffff;
  width: calc((100% - 72px) / 4);
  border-radius: 0px 0px 4px 4px;
  box-shadow: 0px 1px 6px rgba(46, 47, 66, 0.08), 0px 1px 1px rgba(46, 47, 66, 0.16), 0px 2px 1px rgba(46, 47, 66, 0.08);
}

.team-card-content {
  padding: 32px 16px;
  text-align: center;
}

.team-subtitle {
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #2e2f42;
  margin-bottom: 8px;
}

.team-text,
.portfolio-text {
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #434455;
}

/* Portfolio */
.portfolio {
  padding: 120px 0;
}

.portfolio-list {
  display: flex;
  flex-wrap: wrap;
  column-gap: 24px;
  row-gap: 48px;
}

.portfolio-item {
  width: calc((100% - 48px) / 3);
  transition: box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
}

.img-box {
  position: relative;
  width: 360px;
  height: 300px;
  overflow: hidden;
}

.card-back {
  padding: 40px 32px;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  width: 100%;
  height: 100%;
  background-color: #4D5AE5;
  position: absolute;
  top: 0;
  left: 0;
  color: #F4F4FD;
  transform: translateY(300px);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-item:hover .card-back,
.portfolio-item:focus .card-back {
  transform: translateY(0px);
  top: 0px;
}

.portfolio-item:hover,
.portfolio-item:focus {
  box-shadow: 0px 2px 1px 0px #2E2F4214, 0px 1px 1px 0px #2E2F4229, 0px 1px 6px 0px #2E2F4214;
}

.portfolio-card-content {
  padding: 32px 16px;
  border-bottom: solid 1px #E7E9FC;
  border-left: solid 1px #E7E9FC;
  border-right: solid 1px #E7E9FC;
}

.portfolio-subtitle {
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #2e2f42;
  margin-bottom: 8px;
}

/* Footer */
.footer {
  background-color: #2e2f42;
  padding: 100px 0;
}

.footer-social-title {
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  color: #FFFFFF;
  letter-spacing: 0.02em;
}

.social-footer {
  justify-content: flex-start;
  column-gap: 16px;
}

.social.social-footer .social-list {
  display: flex;
  gap: 16px;
  padding-top: 16px;
}

.social-footer .social-link:hover,
.social-footer .social-link:focus {
  background-color: #31D0AA;
}

.footer-content {
  display: flex;
  align-items: baseline;
  /* Виправляємо gap та вирівнювання підписки */
}

/* Виправлення блоку підписки: вирівнювання по правому краю */
.subscribe {
  margin-left: auto; /* Відштовхує третій блок до правого краю */
}

.logo-studio-footer {
  color: #f4f4fd;
}

.footer-text {
  color: #f4f4fd;
  line-height: 1.5;
  letter-spacing: 0.02em;
  max-width: 264px;
  margin-top: 16px;
}

.footer-logo-wrap {
  margin-right: 120px; /* Чіткий відступ між 1 та 2 блоком */
}

.sub-form {
  color: #f4f4fd;
}

.email-subscribe {
  display: inline-block;
  margin-bottom: 16px;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #fff;
}

.sub-input-wrap {
  display: flex;
  column-gap: 24px;
}

.sub-input {
  background-color: #2E2F42;
  border: solid 1px #fff;
  width: 264px;
  border-radius: 4px;
  padding: 8px 16px;
  font-weight: 400;
  font-size: 12px;
  line-height: 2;
  letter-spacing: 0.04em;
  color: #F4F4FD;
  outline: none;
  transition: border-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sub-input:focus {
  border-color: #31D0AA;
}

.sub-input::placeholder {
  color: #F4F4FD;
}

.subscribe-btn {
  color: #FFFFFF;
  background-color: #4D5AE5;
  border: none;
  padding: 8px 24px;
  min-width: 165px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
  column-gap: 16px;
  outline: none;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.subscribe-btn:hover,
.subscribe-btn:focus {
  background-color: #31D0AA;
}

.icon-send {
  fill: #fff;
}

/* POPUP */
.popup-wrapper {
  width: 100%;
  height: 100%;
  position: fixed;
  background-color: rgba(46, 47, 66, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  top: 0;
  left: 0;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1), visibility 250ms cubic-bezier(0.4, 0, 0.2, 1);
  /* Виправлення одиниць виміру line-height */
  font-weight: 400;
  font-size: 12px;
  line-height: 1.17;
  letter-spacing: 0.04em;
}

.popup {
  width: 408px;
  min-height: 584px;
  background-color: #FCFCFC;
  padding: 72px 24px 24px 24px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 2px 1px 0 rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-wrapper.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.popup-close {
  border-radius: 50%;
  background-color: #E7E9FC;
  width: 24px;
  height: 24px;
  position: absolute;
  top: 24px;
  right: 24px;
  border: solid 1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1), border 250ms cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  padding: 0;
}

.icon-close {
  fill: currentColor;
  transition: fill 250ms cubic-bezier(0.4, 0, 0.2, 1);

}
.popup-close:hover .icon-close,
.popup-close:focus .icon-close {
    fill: #ffffff;
}
.popup-close:hover,
.popup-close:focus {
  background-color: #404bbf;
  border: none;
}

.popup-txt {
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-align: center;
  color: #2E2F42;
  margin-bottom: 16px;
}

.popup-form {
  display: flex;
  flex-direction: column;
}

.input-wrapper {
  margin-bottom: 8px;
}

/* Окремий відступ для Comment */
.comment-wrapper {
  margin-bottom: 16px;
}

.inner-icon-wrapper {
  position: relative;
}

.icon-popup {
  position: absolute;
  top: 50%;
  left: 19px;
  transform: translateY(-50%);
  fill: #2E2F42;
  transition: fill 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-label {
  display: block;
  font-size: 12px;
  line-height: 1.17;
  letter-spacing: 0.04em;
  color: #8e8f99;
  margin-bottom: 4px;
}

.popup-input {
  width: 100%;
  height: 40px;
  padding: 11px 10px 11px 38px;
  border: solid 1px rgba(46, 47, 66, 0.4);
  border-radius: 4px;
  outline: transparent;
  background-color: transparent;
  /* Об'єднуємо транзішени для виправлення перезапису */
  transition: border-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-input:focus {
  border-color: #4D5AE5;
}

.popup-input:focus+.icon-popup {
  fill: #4D5AE5;
}

.input-wrapper-checkbox {
  margin-bottom: 24px;
}

.textarea {
  width: 100%;
  height: 120px;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.17;
  letter-spacing: 0.04em;
  color: rgba(46, 47, 66, 0.4);
  border: solid 1px rgba(46, 47, 66, 0.4);
  resize: none;
  outline: transparent;
  background-color: transparent;
  /* Виправлення перезапису транзішена */
  transition: border-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.textarea:focus {
  border-color: #4D5AE5;
}

.textarea::placeholder {
  color: rgba(46, 47, 66, 0.4);
}

.custom-checkbox {
  width: 16px;
  height: 16px;
  border: solid 1px rgba(46, 47, 66, 0.4);
  border-radius: 2px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  fill: transparent;
  cursor: pointer;
  margin-right: 8px;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1), border 250ms cubic-bezier(0.4, 0, 0.2, 1), fill 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Приховуємо галочку за замовчуванням */
.icon-check {
  opacity: 0;
  transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox:checked + .popup-label .custom-checkbox {
  background-color: #404BBF; /* Використовуємо акцентний колір #404bbf */
  border: none;
  fill: #F4F4FD;
}

/* Показуємо галочку тільки коли checked */
.checkbox:checked + .popup-label .icon-check {
  opacity: 1;
}

.terms-link {
  color: #4D5AE5;
  text-decoration: underline;
}

.popup-submit {
  display: block;
  font-family: "Roboto", sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0.04em;
  background-color: #4D5AE5;
  color: #FFFFFF;
  border-radius: 4px;
  padding: 16px 32px;
  min-width: 169px;
  height: 56px;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.15);
  border: none;
  margin: 0 auto;
  cursor: pointer;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.popup-submit:hover,
.popup-submit:focus {
  background-color: #404BBF;
}

