:root {
  --primary-brand-color: #4d5ae5; /*IRIS (CTAs, Focused, Active states, Links*/
  --pressed-state-color: #404bbf; /*OCEAN (CTAs)*/
  --dark-color: #2e2f42; /*NAVY BLUE(Overlays, Shadows, Headings)*/
  --success-color: #31d0aa; /*GREEN(Valid fields, Success messages)*/
  --text-color: #434455; /*SLATE(Body text)*/
  --subtle-text-color: #8e8f99; /*LIGHT SLATE(Helper text, Deemphasized text)*/
  --accent-color: #e7e9fc; /*CORNFLOWER (Accent color, Heirlines, Subtle bgs)*/
  --light-color: #f4f4fd; /*CLOUD (L-mode bgs, L-mode dialogs/alerts)*/
  --overlay-color: #2e2f4266; /*NAVY BLUE MODAL (Overlay)*/
  --hero-bg-color: #2e2f42b2; /*GREY (Hero image bg)*/
  --white-color: #ffffff; /*WHITE (Header, Team card, bg)*/
  --modal-bg-color: #fcfcfc; /*DAIRY (Modal bg)*/
  --card-shadow: #2e2f4214;
  --card-shadow-2: #2e2f4229;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--white-color);
  color: var(--text-color);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

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

p {
  margin: 0;
}

a {
  text-decoration: none;
}

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

img {
  display: block;
  max-width: 100%;
  height: 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;
}

.container {
  max-width: 320px;
  margin: 0 auto;
  padding: 0 16px;
}

.header {
  border-bottom: 1px solid var(--accent-color);
  box-shadow: 0px 2px 1px rgba(46, 47, 66, 0.08),
    0px 1px 1px rgba(46, 47, 66, 0.16), 0px 1px 6px rgba(46, 47, 66, 0.08);
}

.header .container {
  width: auto;
  max-width: unset;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

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

.nav-list,
.address {
  display: none;
}

.nav-logo {
  text-align: center;
  vertical-align: middle;
}

.nav-logo,
.footer-logo {
  font-family: 'Raleway', sans-serif;
  font-weight: 700;
  font-size: 18px;
  line-height: 1.17;
  letter-spacing: 0.03em;
  vertical-align: middle;
  text-transform: uppercase;
  padding: 16px 0;
  color: var(--primary-brand-color);
}

.nav-logo .nav-logo-span {
  color: var(--dark-color);
}

.footer-logo .footer-logo-span {
  color: var(--light-color);
}

.nav-link {
  display: block;
  color: var(--dark-color);
  font-weight: 500;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  transition: color 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover,
.nav-link:focus {
  color: var(--pressed-state-color);
}

.active {
  position: relative;
  color: var(--pressed-state-color);
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  display: block;
  background: var(--pressed-state-color);
  width: 100%;
  height: 4px;
  border-radius: 2px;
}

.address {
  font-style: normal;
}

.address-link {
  color: var(--text-color);
  letter-spacing: 0.02em;
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.address-link:hover,
.address-link:focus {
  color: var(--pressed-state-color);
}

.hero-section {
  background-color: var(--dark-color);
  background-image: linear-gradient(
      rgba(46, 47, 66, 0.7),
      rgba(46, 47, 66, 0.7)
    ),
    url('../images/hero-bg.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  max-width: 1440px;
  padding: 72px 0;
  margin: 0 auto;
}

@media screen and (min-resolution: 2dppx), (min-resolution: 192dpi) {
  .hero-section {
    background-image: linear-gradient(
        rgba(46, 47, 66, 0.7),
        rgba(46, 47, 66, 0.7)
      ),
      url(../images/hero-bg-2x.jpg);
  }
}

.hero-section .container {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
}

.hero-header {
  color: var(--white-color);
  max-width: 216px;
  margin: 0 auto 72px;
  text-align: center;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.11;
  letter-spacing: 0.02em;
}

.hero-button,
.modal-form-submit-button {
  display: block;
  min-width: 169px;
  padding: 16px 32px;
  background: var(--primary-brand-color);
  color: var(--white-color);
  font-size: 16px;
  font-weight: 500;
  text-transform: capitalize;
  line-height: 1.5;
  letter-spacing: 0.04em;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
  margin: 0 auto;
}

.hero-button:hover,
.hero-button:focus {
  background-color: var(--pressed-state-color);
}

.modal-form-submit-button:hover,
.modal-form-submit-button:focus {
  background-color: var(--pressed-state-color);
}

.values-section {
  padding: 96px 0;
}

.values-list {
  display: flex;
  flex-direction: column;
  gap: 72px;
}

.values-item {
  width: 100%;
}

.values-icon-wrapper {
  display: none;
}

.values-header {
  color: var(--dark-color);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.11;
  letter-spacing: 0.02em;
  text-align: center;
  margin-bottom: 8px;
}

.values-text {
  font-weight: 500;
}

.team-item-header,
.portfolio-item-header {
  color: var(--dark-color);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: capitalize;
  margin-bottom: 8px;
}

.team-header,
.portfolio-header {
  color: var(--dark-color);
  font-size: 36px;
  line-height: 1.11;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: capitalize;
  margin-bottom: 72px;
}

.team-section {
  background-color: var(--light-color);
  padding: 96px 0;
}

.team-list {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 72px;
}

.team-list-item {
  background-color: var(--white-color);
  border-radius: 0 0 4px 4px;
  box-shadow: 0px 2px 1px 0px var(--card-shadow),
    0px 1px 1px 0px var(--card-shadow-2), 0px 1px 6px 0px var(--card-shadow);
  overflow: hidden;
}

.team-item-image {
  object-fit: cover;
}

.team-item-description {
  padding: 32px 0;
  text-align: center;
}

.team-item-text {
  margin-bottom: 8px;
}

.team-item-socials {
  display: flex;
  justify-content: center;
  align-items: center;
  list-style: none;
  gap: 24px;
}

.team-item-social,
.footer-social {
  width: 40px;
  height: 40px;
  fill: var(--light-color);
}

.team-item-link,
.footer-social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: var(--primary-brand-color);
  border-radius: 50%;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}
.team-item-link:hover,
.team-item-link:focus {
  background-color: var(--pressed-state-color);
}

.footer-social-link:hover,
.footer-social-link:focus {
  background-color: var(--success-color);
}

.portfolio-section {
  padding: 96px 0;
}

.portfolio-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
}

.portfolio-item {
  transition: box-shadow 250ms cubic-bezier(0.4, 0, 0.2, 1);
  width: calc(100% - 32px);
}

.portfolio-item:hover,
.portfolio-item:focus {
  box-shadow: 0px 1px 6px var(--card-shadow), 0px 1px 1px var(--card-shadow-2),
    0px 2px 1px var(--card-shadow);
}

.portfolio-item-description {
  padding: 32px 16px;
  border: 1px solid var(--accent-color);
  border-top: none;
}

.portfolio-item-image-wrapper {
  overflow: hidden;
  position: relative;
}

.portfolio-item-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 40px 32px;
  transform: translateY(100%);
  background-color: var(--primary-brand-color);
  color: var(--light-color);
  line-height: 1.5;
  letter-spacing: 0.02em;
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.portfolio-item:hover .portfolio-item-image-overlay,
.portfolio-item:focus .portfolio-item-image-overlay {
  transform: translateY(0%);
}

.footer {
  padding: 96px 0;
  background-color: var(--dark-color);
}

.footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 72px;
}

.footer-text-wrapper,
.footer-socials-wrapper {
  text-align: center;
}

.footer-logo {
  display: inline-block;
  margin-bottom: 16px;
}

.footer-text {
  color: var(--light-color);
  max-width: 264px;
  text-align: left;
}

.footer-socials-text {
  color: var(--white-color);
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

.footer-socials {
  display: flex;
  gap: 16px;
}

.footer-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.footer-form-input {
  background-color: transparent;
  padding-left: 16px;
  border: 1px solid var(--white-color);
  border-radius: 4px;
  box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.15);
  width: 288px;
  height: 40px;
  color: var(--white-color);
  font-size: 12px;
  line-height: 2;
  letter-spacing: 0.04em;
  outline: none;
}

.footer-form-text {
  color: var(--white-color);
  margin-bottom: 16px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-align: center;
}

.footer-form-input::placeholder {
  color: var(--white-color);
}

.footer-form-button {
  min-width: 165px;
  height: 40px;
  background-color: var(--primary-brand-color);
  padding: 8px 24px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.04em;
  color: var(--white-color);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-form-button:hover,
.footer-form-button:focus {
  background-color: var(--success-color);
}

.footer-form-button-icon {
  margin-left: 16px;
}

/* ===== Modal ===== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(46, 47, 66, 0.4);
  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);
}

.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90%;
  max-width: 392px;
  min-height: 584px;
  padding: 72px 16px 24px 16px;
  border-radius: 4px;
  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);
  background-color: var(--modal-bg-color);
  transform: translate(-50%, -50%);
  transition: transform 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay:not(.is-open) .modal {
  transform: translate(-50%, -100%);
}

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

.modal-close-button:hover,
.modal-close-button:focus {
  background-color: var(--pressed-state-color);
  border: none;
}

.modal-close-button:hover .modal-close-icon,
.modal-close-button:focus .modal-close-icon {
  fill: white;
}

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

.modal-form-description {
  color: var(--dark-color);
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
}

.modal-form-item {
  margin-bottom: 8px;
}

.modal-form-label {
  display: block;
  color: var(--subtle-text-color);
  font-size: 12px;
  line-height: 1.17;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.modal-form-input-wrapper {
  position: relative;
}

.modal-form-input {
  width: 100%;
  height: 40px;
  padding-left: 38px;
  font-size: 12px;
  background-color: transparent;
  border: 1px solid rgba(46, 47, 66, 0.4);
  border-radius: 4px;
  outline: transparent;
  transition: border-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-form-input:focus {
  border-color: var(--primary-brand-color);
}

.modal-form-input-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  fill: var(--dark-color);
  transition: fill 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-form-input:focus + .modal-form-input-icon {
  fill: var(--primary-brand-color);
}

.modal-form-textarea {
  height: 120px;
  width: 100%;
  font-size: 12px;
  line-height: 1.17;
  letter-spacing: 0.04em;
  color: rgba(46, 47, 66, 0.4);
  border: 1px solid rgba(46, 47, 66, 0.4);
  border-radius: 4px;
  background-color: transparent;
  padding: 8px 16px;
  outline: transparent;
  transition: border-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
  resize: none;
}

.modal-form-textarea:focus {
  border-color: var(--primary-brand-color);
}

.form-terms {
  margin-bottom: 24px;
}

.modal-form-item-comment {
  margin-bottom: 16px;
}

.modal-form-checkmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  fill: transparent;
  border: 1px solid rgba(46, 47, 66, 0.4);
  border-radius: 2px;
  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);
}

.modal-form-checkbox:checked
  + .modal-form-terms-description
  > .modal-form-checkmark {
  background-color: var(--pressed-state-color);
  border: none;
  fill: var(--light-color);
}

.modal-form-terms-description {
  display: flex;
  align-items: center;
  color: var(--subtle-text-color);
  font-size: 12px;
  line-height: 1.17;
  letter-spacing: 0.04em;
}

.modal-form-terms-link {
  color: var(--primary-brand-color);
  text-decoration: underline;
}

.modal-form-terms-text {
  line-height: 16px;
}

/* ===== Mobile Menu ===== */
.mobile-menu-button-open {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 0;
  background-color: transparent;
  border: none;
  cursor: pointer;
}

.mobile-menu-button-icon {
  transition: fill 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-button-open:hover .mobile-menu-button-icon,
.mobile-menu-button-open:focus .mobile-menu-button-icon {
  fill: var(--primary-brand-color);
}

.mobile-menu-button-icon {
  fill: var(--dark-color);
}

.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--white-color);
  visibility: hidden;
  opacity: 0;
  transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1),
    visibility 250ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 999;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-menu-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 72px 16px 40px 16px;
}

.mobile-menu-button {
  display: flex;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 24px;
  right: 24px;
  width: 24px;
  height: 24px;
  background-color: transparent;
  border-radius: 50%;
  border: 1px solid var(--accent-color);
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

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

.mobile-menu-button:hover,
.mobile-menu-button:focus {
  background-color: var(--pressed-state-color);
}

.mobile-menu-button:hover .mobile-menu-button-icon-close,
.mobile-menu-button:focus .mobile-menu-button-icon-close {
  fill: var(--white-color);
}

.mobile-menu-list {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 40px;
  padding: 72px 0 40px 0;
}

.mobile-menu-nav-link {
  font-weight: 700;
  font-size: 36px;
  line-height: 1.11;
  letter-spacing: 0.02em;
  color: var(--dark-color);
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-nav-link:hover,
.mobile-menu-nav-link:focus {
  color: var(--pressed-state-color);
}

.active-mobile {
  color: var(--pressed-state-color);
}

.mobile-menu-address-wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mobile-menu-address-link {
  font-weight: 500;
  font-size: 20px;
  line-height: 1.2;
  font-style: normal;
  font-size: 20px;
  color: var(--text-color);
  transition: color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-address-link:hover,
.mobile-menu-address-link:focus {
  color: var(--primary-brand-color);
}

.mobile-menu-socials {
  display: flex;
  gap: 40px;
}

.mobile-menu-social-item {
  width: 40px;
  height: 40px;
}

.mobile-menu-social-link {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--primary-brand-color);
  border-radius: 50%;
  transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-social-link:hover,
.mobile-menu-social-link:focus {
  background-color: var(--pressed-state-color);
}

.mobile-menu-social-icon {
  fill: var(--light-color);
}

/* ===== TABLET STYLES ===== */
@media screen and (min-width: 768px) {
  .container {
    max-width: 768px;
  }

  .header .container {
    width: 768px;
    margin: auto;
  }

  .mobile-menu-button-open {
    display: none;
  }

  .nav-list,
  .address {
    display: flex;
  }

  .address {
    margin-left: auto;
  }

  .nav-list {
    gap: 40px;
  }

  .nav-logo {
    margin-right: 120px;
  }

  .address-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .address-link {
    font-size: 12px;
    line-height: 1.17;
    letter-spacing: 0.04em;
    padding: 0;
  }

  .nav-link {
    padding: 24px 0;
  }

  .hero-section {
    padding: 112px 0;
  }

  .hero-header {
    max-width: 496px;
    font-size: 56px;
    line-height: 1.07;
    margin-bottom: 36px;
  }

  .values-section {
    padding: 96px 0;
  }

  .values-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 72px 24px;
  }

  .values-item {
    width: calc((100% - 24px) / 2);
  }

  .values-header {
    text-align: left;
  }

  .team-section {
    padding: 96px 0;
  }

  .team-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 64px 24px;
  }

  .portfolio-section {
    padding: 96px 0;
  }

  .portfolio-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 72px 24px;
  }

  .portfolio-item {
    width: calc((100% - 24px) / 2);
  }

  .footer .container {
    max-width: 768px;
    padding-left: 92px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 72px 24px;
  }

  .footer-text-wrapper,
  .footer-socials-wrapper {
    text-align: left;
  }

  .footer-form {
    flex-direction: row;
    gap: 24px;
  }

  .footer-form-text {
    text-align: left;
  }

  .modal {
    width: 408px;
    padding: 72px 24px 24px 24px;
  }
  .footer-form-input {
    width: 264px;
  }
}

/* ===== DESKTOP STYLES ===== */
@media screen and (min-width: 1158px) {
  .container {
    max-width: 1158px;
    padding: 0 15px;
  }

  .header .container {
    width: 1158px;
    height: 72px;
  }

  .address {
    margin-left: 0;
  }

  .address-list {
    flex-direction: row;
    gap: 40px;
  }

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

  .hero-section {
    padding: 188px 0;
  }

  .hero-header {
    margin-bottom: 48px;
  }

  .values-section {
    padding: 120px 0;
  }

  .values-list {
    flex-wrap: nowrap;
    gap: 24px;
  }

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

  .values-icon-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 112px;
    margin-bottom: 8px;
    background-color: var(--light-color);
    border: 1px var(--subtle-text-color) solid;
    border-radius: 4px;
  }

  .values-header {
    font-weight: 500;
    font-size: 20px;
    line-height: 1.2;
  }

  .values-text {
    font-weight: 400;
  }

  .team-section {
    padding: 120px 0;
  }

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

  .portfolio-section {
    padding: 120px 0;
  }

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

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

  .footer {
    padding: 100px 0;
  }

  .footer .container {
    max-width: 1158px;
    flex-wrap: nowrap;
    justify-content: center;
    padding: 0 8px;
  }

  .footer-text-wrapper {
    margin-right: 90px;
  }

  .footer-form-wrapper {
    margin-left: 80px;
  }
}
